:root {
  color-scheme: light;
  --bg: #f2eadc;
  --bg-wash: #ece0cb;
  --panel: rgba(252, 247, 239, 0.94);
  --surface: rgba(255, 250, 242, 0.98);
  --surface-strong: #fff7ec;
  --line: rgba(92, 74, 42, 0.14);
  --line-strong: rgba(92, 74, 42, 0.24);
  --text: #34271b;
  --muted: #5a4a39;
  --accent: #8b5a2b;
  --accent-strong: #5c4a2a;
  --accent-soft: #efe0c5;
  --gold: #ba8641;
  --gold-soft: #f1e0c2;
  --danger: #8f4a3d;
  --danger-soft: #f3dfda;
  --success: #7a5b34;
  --success-soft: #f4e7cf;
  --shadow: 0 12px 28px rgba(92, 74, 42, 0.06);
  --shadow-soft: 0 4px 14px rgba(92, 74, 42, 0.05);
  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --space-1: 0.35rem;
  --space-2: 0.6rem;
  --space-3: 0.95rem;
  --space-4: 1.2rem;
  --space-5: 1.6rem;
  --space-6: 2.2rem;
  --max-width: 50rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(241, 224, 194, 0.58), rgba(241, 224, 194, 0) 36%),
    linear-gradient(180deg, #faf6ef 0%, var(--bg) 52%, var(--bg-wash) 100%);
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.page-shell {
  width: min(calc(100% - 1.5rem), var(--max-width));
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  justify-items: center;
  gap: 0.7rem;
  padding: clamp(1.55rem, 4vw, 2.15rem) clamp(1.1rem, 3vw, 1.7rem);
  text-align: center;
}

.eyebrow,
.section-label,
.card-kicker,
.sidecard-label {
  margin: 0 0 var(--space-2);
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Newsreader", Georgia, serif;
  font-weight: 600;
  line-height: 1.08;
  color: var(--accent-strong);
}

h1 {
  font-size: clamp(1.28rem, 3.2vw, 1.72rem);
  max-width: 30ch;
}

h2 {
  font-size: clamp(1.08rem, 2.35vw, 1.34rem);
}

h3 {
  font-size: clamp(1rem, 2vw, 1.15rem);
}

.hero-text,
.section-note,
.card-copy,
.empty-state,
.timer-status,
.save-status,
.stat-label,
.sidecard-meta,
.detail-label,
.form-feedback,
.global-message {
  line-height: 1.6;
}

.hero-text {
  margin: 0;
  max-width: 39rem;
  color: var(--muted);
  font-size: 1rem;
}

.surface-card,
.notice-card,
.stats-item {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.stats-list {
  list-style: none;
  padding: 0;
  margin: 0.35rem 0 0;
  width: 100%;
  display: grid;
  gap: 0.75rem;
}

.stats-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.95rem 0.9rem;
  border-radius: var(--radius-md);
  min-height: 6.3rem;
  text-align: center;
}

.stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 18ch;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  white-space: nowrap;
  color: var(--accent-strong);
  line-height: 1;
}

.global-message {
  margin: var(--space-4) 0 0;
  padding: 0.95rem 1.15rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}

.global-message.info {
  background: rgba(139, 90, 43, 0.08);
  border-color: rgba(139, 90, 43, 0.16);
}

.global-message.success {
  background: var(--success-soft);
  border-color: rgba(122, 91, 52, 0.2);
}

.global-message.error {
  background: var(--danger-soft);
  border-color: rgba(143, 74, 61, 0.2);
}

.global-message.warning {
  background: rgba(241, 224, 194, 0.88);
  border-color: rgba(186, 134, 65, 0.2);
}

.main-grid {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.content-column {
  display: grid;
  gap: var(--space-4);
}

.section-panel {
  padding: clamp(1.05rem, 3vw, 1.4rem);
}

.section-header {
  display: grid;
  gap: 0.65rem;
  margin-bottom: var(--space-4);
  justify-items: center;
  text-align: center;
}

.section-note {
  margin: 0;
  color: var(--muted);
  max-width: 34rem;
  font-size: 0.98rem;
}

.entry-grid {
  display: grid;
  gap: 1rem;
  max-width: 42rem;
  margin: 0 auto;
}

.dashboard-top {
  display: grid;
  gap: var(--space-4);
  width: 100%;
}

.surface-card,
.notice-card {
  border-radius: var(--radius-md);
  padding: 1rem;
}

.notice-card h3 {
  margin-bottom: 0.6rem;
}

.notice-card p {
  margin: 0;
  color: var(--muted);
}

.notice-card.warning {
  background: rgba(241, 224, 194, 0.7);
  border-color: rgba(186, 134, 65, 0.18);
}

.notice-card.success {
  background: rgba(244, 231, 207, 0.82);
  border-color: rgba(122, 91, 52, 0.18);
}

.card-heading {
  margin-bottom: 0.8rem;
}

.card-copy {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.form-card {
  display: grid;
  gap: 0.9rem;
  align-content: start;
}

.field {
  display: grid;
  gap: 0.45rem;
  font-weight: 600;
}

.field-hint {
  margin: -0.15rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.field span {
  color: var(--text);
}

.field input,
.copy-input {
  width: 100%;
  padding: 0.82rem 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fffdf8;
  color: var(--text);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.field input:focus,
.copy-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(139, 90, 43, 0.12);
}

.field input:disabled,
.copy-input:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.form-feedback {
  margin: 0;
  color: var(--danger);
  font-size: 0.94rem;
}

.form-feedback:empty {
  display: none;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.button-row.compact {
  justify-content: center;
}

.primary-button,
.secondary-button,
.ghost-button,
.step-button {
  min-height: 2.85rem;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.72rem 1.15rem;
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease,
    border-color 180ms ease;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.step-button:hover {
  transform: translateY(-1px);
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.ghost-button:focus-visible,
.step-button:focus-visible {
  outline: 3px solid rgba(182, 133, 72, 0.44);
  outline-offset: 2px;
}

.primary-button {
  background: linear-gradient(135deg, #9a6734 0%, #5c4a2a 100%);
  color: #fff8ec;
  box-shadow: 0 8px 18px rgba(92, 74, 42, 0.12);
}

.secondary-button {
  background: rgba(239, 224, 197, 0.78);
  border-color: rgba(139, 90, 43, 0.18);
  color: var(--accent-strong);
}

.ghost-button {
  background: rgba(255, 250, 242, 0.86);
  border-color: var(--line-strong);
  color: var(--text);
}

.form-card .primary-button {
  justify-self: start;
  min-width: 12rem;
}

.identity-card,
.progress-card,
.timer-card {
  display: grid;
  gap: var(--space-3);
}

.progress-card,
.timer-card {
  align-content: start;
}

.progress-card-wide {
  width: 100%;
  justify-self: stretch;
  justify-items: center;
  text-align: center;
}

.progress-card-wide .card-copy,
.progress-card-wide .save-note {
  max-width: 34rem;
}

.progress-card-wide .hour-controls {
  width: 100%;
}

.identity-card {
  order: 3;
}

.identity-detail {
  display: grid;
  gap: 0.5rem;
}

.detail-label,
.detail-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.copy-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.link-row .copy-input {
  flex: 1 1 20rem;
  max-width: 20rem;
}

.word-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 3rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: rgba(239, 224, 197, 0.72);
  color: var(--accent-strong);
  font-family: "Manrope", "Segoe UI", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
}

.hours-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  text-align: center;
}

.hours-display strong {
  font-size: clamp(1.5rem, 7vw, 2.3rem);
  line-height: 0.95;
}

.hours-display span {
  color: var(--muted);
  font-size: 1rem;
}

.progress-meter {
  width: 100%;
  height: 0.95rem;
  background: rgba(139, 90, 43, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.progress-meter span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d4a260 0%, var(--accent) 58%, var(--accent-strong) 100%);
  transition: width 220ms ease;
}

.hour-controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-3);
}

.save-status,
.timer-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.save-note {
  margin: -0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.save-status.error,
.timer-status.error {
  color: var(--danger);
}

.save-status.success {
  color: var(--success);
}

.step-button {
  width: 3rem;
  height: 3rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-strong);
  border-color: var(--line-strong);
  color: var(--accent-strong);
  font-size: 2rem;
  line-height: 1;
}

.timer-display {
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(1.25rem, 6vw, 2.1rem);
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--accent-strong);
}

.leaderboard-panel {
  height: fit-content;
}

.site-footer {
  margin-top: calc(var(--space-6) + var(--space-2));
  padding-top: var(--space-3);
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer a {
  display: inline-block;
  background: linear-gradient(135deg, var(--gold) 0%, var(--accent) 55%, #c96f2d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
  text-decoration-color: rgba(139, 90, 43, 0.35);
  text-underline-offset: 0.16em;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  text-decoration-color: rgba(139, 90, 43, 0.7);
}

.empty-state {
  padding: 0.25rem 0.2rem 0;
  color: var(--muted);
  text-align: center;
}

.leaderboard-list {
  display: grid;
  gap: 0.85rem;
}

.leaderboard-row {
  display: grid;
  gap: 0.7rem;
  padding: 0.95rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.leaderboard-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0;
}

.leaderboard-name {
  font-weight: 700;
}

.leaderboard-hours {
  color: var(--accent-strong);
  font-weight: 700;
  white-space: nowrap;
}

.leaderboard-meter {
  height: 0.8rem;
  border-radius: 999px;
  background: rgba(139, 90, 43, 0.1);
  overflow: hidden;
}

.leaderboard-meter span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(212, 162, 96, 0.98), rgba(139, 90, 43, 0.98));
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 640px) {
  .page-shell {
    width: min(calc(100% - 2.4rem), var(--max-width));
    padding-top: 1.4rem;
  }

  .stats-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-top {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .progress-card-wide,
  .identity-card {
    grid-column: 1 / -1;
  }

  .copy-input {
    min-width: 0;
  }
}

@media (max-width: 479px) {
  .form-card .primary-button {
    width: 100%;
    justify-self: stretch;
  }

  .hour-controls {
    gap: var(--space-2);
  }

  .dashboard-top {
    gap: var(--space-4);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}
