:root {
  --bg-1: #f8efe1;
  --bg-2: #efd0a6;
  --panel: rgba(255, 250, 242, 0.95);
  --line: rgba(106, 73, 34, 0.12);
  --text: #2c2118;
  --muted: #6b5948;
  --accent: #c96b27;
  --accent-deep: #8c4720;
  --accent-soft: #efb266;
  --shadow: 0 24px 60px rgba(109, 70, 24, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.78), transparent 28%),
    linear-gradient(145deg, var(--bg-1), var(--bg-2));
}

.app-shell {
  width: min(1080px, calc(100% - 1rem));
  margin: 0 auto;
  padding: 1rem 0;
}

.app-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 1rem;
}

.app-shell.guest {
  min-height: 100vh;
  display: grid;
  align-items: center;
}

.app-shell.guest .app-grid {
  grid-template-columns: minmax(0, 31rem);
  justify-content: center;
}

.app-shell.guest .clicker-panel,
.app-shell.signed-in .account-panel {
  display: none;
}

.app-shell.signed-in .app-grid {
  grid-template-columns: minmax(0, 38rem);
  justify-content: center;
}

.clicker-panel,
.account-panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 1.6rem;
  padding: 1.1rem;
  box-shadow: var(--shadow);
}

.auth-toggle,
.inline-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.clicker-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 23rem;
  overflow: hidden;
}

.ring {
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(106, 73, 34, 0.14);
}

.ring-a {
  width: 18rem;
  height: 18rem;
}

.ring-b {
  width: 24rem;
  height: 24rem;
}

.clicker-button {
  width: 14rem;
  height: 14rem;
  border: none;
  cursor: pointer;
  color: #fffaf4;
  background:
    radial-gradient(circle at 30% 30%, #f6cf93, transparent 24%),
    linear-gradient(180deg, var(--accent-soft), var(--accent));
  border-radius: 50%;
  box-shadow:
    inset 0 -12px 24px rgba(117, 51, 18, 0.18),
    0 16px 30px rgba(128, 74, 22, 0.24);
  transform: translateY(0);
  transition: transform 160ms ease;
}

.clicker-button:active,
.clicker-button.is-active {
  transform: translateY(8px) scale(0.98);
}

.clicker-button.is-disabled,
.ghost-button:disabled,
.solid-button:disabled,
.mode-chip:disabled,
input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button-top {
  display: block;
  font-family: "Baloo 2", cursive;
  font-size: 3rem;
  line-height: 1;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.stat-box,
.mini-card {
  background: rgba(255, 249, 240, 0.92);
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  padding: 0.95rem 1rem;
}

.stat-box span,
.mini-card span,
label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-box strong,
.mini-card strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.08rem;
}

.mini-card p,
.message {
  margin: 0.35rem 0 0;
  color: var(--muted);
  line-height: 1.45;
  min-height: 1.2rem;
}

.account-panel {
  display: grid;
  gap: 0.9rem;
  align-content: start;
}

.pair-panel {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.identity-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 1rem;
  align-items: center;
}

.identity-card span,
.identity-card strong {
  grid-column: 1;
}

.identity-card p {
  grid-column: 1;
}

.auth-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: rgba(255, 249, 240, 0.85);
  border: 1px solid var(--line);
}

.auth-toggle .mode-chip {
  width: 100%;
  justify-content: center;
  text-align: center;
  padding: 0.8rem 1rem;
  background: transparent;
  border: none;
  border-radius: 999px;
  margin: 0;
}

.auth-toggle .mode-chip.active {
  background: var(--accent-deep);
  color: #fffaf4;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.stack-form {
  display: grid;
  gap: 0.65rem;
}

.compact-form {
  margin-top: -0.1rem;
}

.actions-row {
  justify-content: space-between;
}

.ghost-button,
.solid-button,
input {
  border-radius: 999px;
}

.mode-chip,
.ghost-button,
.solid-button {
  border: 1px solid var(--line);
  padding: 0.85rem 1rem;
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.1rem;
  text-decoration: none;
  outline: none;
  box-shadow: none;
}

.mode-chip {
  background: rgba(255, 249, 240, 0.85);
  color: var(--text);
  cursor: pointer;
}

.ghost-button {
  background: rgba(255, 249, 240, 0.85);
}

.solid-button {
  background: var(--accent-deep);
  color: #fffaf4;
  cursor: pointer;
}

.mode-chip::-moz-focus-inner,
.ghost-button::-moz-focus-inner,
.solid-button::-moz-focus-inner {
  border: 0;
  padding: 0;
}

.mode-chip:focus,
.mode-chip:focus-visible,
.ghost-button:focus,
.ghost-button:focus-visible,
.solid-button:focus,
.solid-button:focus-visible {
  outline: none;
  box-shadow: none;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  padding: 0.95rem 1rem;
  font: inherit;
  color: var(--text);
  background: rgba(255, 251, 245, 0.95);
}

.is-hidden,
[hidden] {
  display: none !important;
}

@media (max-width: 920px) {
  .app-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 0.75rem, 100%);
  }

  .clicker-panel,
  .account-panel {
    padding: 0.9rem;
    border-radius: 1.3rem;
  }

  .clicker-stage {
    min-height: 19rem;
  }

  .clicker-button {
    width: 11.5rem;
    height: 11.5rem;
  }

  .button-top {
    font-size: 2.5rem;
  }

  .stats-row,
  .inline-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .app-shell.guest {
    align-items: start;
    padding-top: 1rem;
  }

  .app-shell.signed-in .app-grid {
    grid-template-columns: 1fr;
  }
}
