:root {
  --bg: #f6f1e7;
  --ink: #1d1a16;
  --muted: #6f665a;
  --rule: #d9cfbd;
  --card: #fffdf8;
  --accent: #a8641b;
  --ok: #2f7a4f;
  --bad: #b23b2e;
  --wait: #8a6d1f;
  --t-S: #a8641b;
  --t-A: #9a4f8a;
  --t-B: #2f6f73;
  --t-C: #4b6a2e;
  --t-D: #6f665a;
  --t-E: #8a8175;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16130f;
    --ink: #efe8db;
    --muted: #a3998a;
    --rule: #3a342b;
    --card: #201c17;
    --accent: #e3b25c;
    --ok: #7cc69a;
    --bad: #ec8a7d;
    --wait: #d9bb6a;
    --t-S: #e3b25c;
    --t-A: #d79ac9;
    --t-B: #6fb7b9;
    --t-C: #a6c97f;
    --t-D: #a3998a;
    --t-E: #8f877b;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.top, main, .foot { width: 100%; max-width: 640px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.top { display: flex; align-items: baseline; gap: 10px; padding-top: 22px; padding-bottom: 6px; }
.mark { font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: 28px; letter-spacing: -.03em; color: inherit; text-decoration: none; }
.mark em { font-style: italic; font-weight: 400; color: var(--accent); }
.badge { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); border: 1px solid currentColor; border-radius: 999px; padding: 2px 8px; }
.day { margin-left: auto; font-size: 13px; color: var(--muted); }
main { flex: 1; padding-top: 18px; padding-bottom: 32px; }
h1, h2 { font-family: Fraunces, Georgia, serif; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 30px; margin: 8px 0 6px; }
h2 { font-size: 21px; margin: 0 0 10px; }
.lede, .muted, .resets { color: var(--muted); }
.lede { margin: 0 0 20px; }
.resets { font-size: 13px; margin: 14px 0 0; }

.rounds, .prev-rounds, .feed { list-style: none; margin: 0; padding: 0; }
.round {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  grid-template-areas: "slot word play" "slot state play";
  align-items: center;
  column-gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  margin-bottom: 10px;
}
.r-slot { grid-area: slot; font-family: Fraunces, Georgia, serif; font-size: 18px; color: var(--muted); }
.r-word { grid-area: word; }
.r-word b { font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: 19px; letter-spacing: .02em; text-transform: uppercase; }
.r-word i { color: var(--muted); font-size: 13px; }
.r-state { grid-area: state; font-size: 13px; color: var(--muted); }
.r-state:empty { display: none; }
.r-play { grid-area: play; }
.r-play, .primary, .guess-form button, .chip {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  border-radius: 999px;
  padding: 7px 16px;
  font-weight: 500;
  cursor: pointer;
}
.r-play[disabled] { display: none; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.previous { margin-top: 36px; }
.prev-rounds li { border-top: 1px solid var(--rule); padding: 10px 0; }
.prev-rounds summary { cursor: pointer; }
.prev-rounds summary b { font-family: Fraunces, Georgia, serif; text-transform: uppercase; letter-spacing: .02em; }
.reveal-tier { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.reveal-tier .t { font-weight: 600; font-size: 12px; width: 18px; }
.reveal-word { font-size: 14px; background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: 1px 7px; }

.prompt-card { background: var(--card); border: 1px solid var(--rule); border-radius: 14px; padding: 18px 20px 16px; }
.prompt-head { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); font-size: 13px; }
.timer { font-family: Fraunces, Georgia, serif; font-size: 28px; color: var(--ink); font-variant-numeric: tabular-nums; }
.timer.low { color: var(--bad); }
.prompt-word { margin-top: 2px; }
#play-word { font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: clamp(32px, 9vw, 44px); letter-spacing: .03em; text-transform: uppercase; }
.pos { color: var(--muted); font-style: italic; }
.gloss { margin: 4px 0 2px; }
.example { margin: 0 0 12px; color: var(--muted); font-style: italic; }
.example:empty { display: none; }
.bar { height: 4px; background: var(--rule); border-radius: 2px; overflow: hidden; }
.bar-fill { height: 100%; width: 100%; background: var(--accent); transform-origin: left; }

.guess-form { display: flex; gap: 8px; margin: 16px 0 8px; }
.guess-form input { flex: 1; min-width: 0; padding: 11px 14px; border: 1px solid var(--rule); border-radius: 10px; background: var(--card); font-size: 17px; }
.guess-form input:disabled { opacity: .55; }
.guess-form button[disabled] { opacity: .5; cursor: default; }
.score-line { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.score-line span { color: var(--ink); font-weight: 600; }

.feed li { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: start; padding: 9px 0; border-top: 1px solid var(--rule); }
.feed .icon { font-weight: 700; text-align: center; }
.feed .w { font-family: Fraunces, Georgia, serif; font-size: 19px; }
.feed .msg { display: block; font-size: 13px; color: var(--muted); }
.feed .pts { font-weight: 600; font-variant-numeric: tabular-nums; }
.feed .accepted .icon, .feed .accepted .pts { color: var(--ok); }
.feed .rejected .icon { color: var(--bad); }
.feed .pending .icon, .feed .unverifiable .icon, .feed .suggestion .icon { color: var(--wait); }
.feed .duplicate .icon { color: var(--muted); }
.tier { display: inline-block; font-size: 11px; font-weight: 600; border: 1px solid currentColor; border-radius: 999px; padding: 0 7px; margin-left: 6px; vertical-align: 2px; }
.tier-S { color: var(--t-S); } .tier-A { color: var(--t-A); } .tier-B { color: var(--t-B); }
.tier-C { color: var(--t-C); } .tier-D { color: var(--t-D); } .tier-E { color: var(--t-E); }
.actions { display: flex; gap: 6px; margin-top: 6px; }
.actions { flex-wrap: wrap; align-items: center; }
.word-star { margin-left: 6px; white-space: nowrap; }
#account-content > details { margin-top: 18px; border-top: 1px solid var(--rule); padding-top: 14px; }
#account-content > details > summary { font-family: Fraunces, Georgia, serif; font-size: 20px; cursor: pointer; }
summary { cursor: pointer; }
#account-content label { display: block; margin: 12px 0 6px; }
#account-content input:not([type=checkbox]), #account-content textarea { display: block; width: 100%; font: inherit; background: var(--card); color: var(--ink); padding: 8px; border: 1px solid var(--rule); border-radius: 8px; }
#account-content input[type=date] { width: auto; }
#google-button { margin-top: 12px; }
.library-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.progress-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 18px 0; }
.progress-metric { border: 1px solid var(--rule); border-radius: 10px; padding: 12px 10px; background: var(--card); }
.progress-metric strong { display: block; font-family: Fraunces,Georgia,serif; font-size: clamp(19px,4vw,25px); font-weight: 600; font-variant-numeric: tabular-nums; }
.progress-metric span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.history-toolbar { display: flex; align-items: center; gap: 6px; }
.history-nav { flex: 0 0 40px; min-height: 44px; border: 1px solid var(--rule); border-radius: 9px; background: var(--card); cursor: pointer; }
.history-nav:disabled { opacity: .35; cursor: default; }
#account-content .month-picker { min-width: 0; flex: 1; margin: 0; }
#account-content #history-end { width: 100%; min-width: 0; height: 44px; font-size: 14px; }
.history-toolbar .chip { min-height: 44px; white-space: nowrap; padding: 6px 10px; }
#calendar-range { margin: 10px 0 16px; }
.calendar-view { margin-bottom: 16px; }
.calendar-view > summary, .history-help > summary { font-size: 13px; color: var(--muted); padding: 8px 0; }
.history-calendar { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 5px; padding-top: 10px; }
.calendar-weekday { text-align: center; font-size: 11px; color: var(--muted); padding-bottom: 3px; }
.calendar-day { min-width: 0; min-height: 52px; border: 1px solid var(--rule); color: var(--ink); background: var(--card); padding: 6px 2px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.calendar-day small { display: block; color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar-day.completed { border-bottom: 3px solid var(--ok); }
.calendar-day.partial { border-bottom: 3px solid var(--accent); }
.calendar-day.legacy { border-bottom: 3px dotted var(--muted); }
.calendar-day[aria-pressed=true] { outline: 2px solid var(--ink); outline-offset: 1px; }
.calendar-day:disabled { opacity: .4; cursor: default; }
.calendar-key, .chart-key { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: 11px; }
.calendar-key span::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 5px; background: var(--muted); }
.calendar-key .completed::before { background: var(--ok); }
.calendar-key .partial::before { background: var(--accent); }
.history-workspace { display: grid; gap: 18px; align-items: start; }
.history-days { min-width: 0; }
.history-columns, .history-day { display: grid; grid-template-columns: minmax(0,1fr) 52px 40px 12px; align-items: center; gap: 6px; padding: 10px; }
.history-columns { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.history-columns span:nth-child(2), .history-columns span:nth-child(3) { text-align: right; }
.history-list { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto; scrollbar-width: thin; border: 1px solid var(--rule); border-radius: 10px; }
.history-list li + li { border-top: 1px solid var(--rule); }
.history-day { width: 100%; min-height: 64px; border: 0; text-align: left; background: transparent; cursor: pointer; }
.history-day:hover { background: var(--card); }
.history-day[aria-pressed=true] { background: color-mix(in srgb,var(--accent) 10%,var(--card)); box-shadow: inset 3px 0 var(--accent); }
.history-date { min-width: 0; }
.history-date strong { display: block; font-size: 12px; font-weight: 500; }
.day-state { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.day-state.completed { color: var(--ok); }
.day-state.partial { color: var(--accent); }
.history-points, .history-rank { font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.history-rank, .history-arrow { color: var(--muted); }
.history-arrow { font-size: 24px; }
.history-empty { padding: 20px 14px; font-size: 13px; color: var(--muted); }
.day-details { min-width: 0; background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 14px; scroll-margin-top: 16px; }
.day-details:empty { display: none; }
.day-heading { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin-bottom: 14px; }
.community .day-heading h3, .community .day-details > h3 { font-family: Fraunces,Georgia,serif; font-size: 19px; margin: 0; }
.day-total { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.history-round { border-top: 1px solid var(--rule); }
.history-round > summary { display: grid; grid-template-columns: minmax(0,1fr) auto 12px; align-items: center; gap: 8px; list-style: none; padding: 12px 0; min-height: 64px; }
.history-round > summary::-webkit-details-marker { display: none; }
.history-round > summary::after { content: '+'; color: var(--muted); }
.history-round[open] > summary::after { content: '−'; }
.round-title small, .round-result small { display: block; color: var(--muted); font-size: 10px; font-weight: 400; }
.round-title strong { display: block; font-family: Fraunces,Georgia,serif; font-size: 17px; overflow-wrap: anywhere; }
.round-result { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.history-guesses { list-style: none; padding: 0; margin: 0 0 12px; }
.history-guess { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 6px; align-items: center; padding: 9px 0; border-top: 1px dashed var(--rule); font-size: 12px; }
.guess-description { min-width: 0; overflow-wrap: anywhere; }
.guess-description strong { font-weight: 500; }
.guess-description small { display: block; color: var(--muted); font-size: 10px; }
.history-guess.accepted .guess-description small, .history-guess.accepted .guess-points { color: var(--ok); }
.history-guess .word-star { margin-left: 0; padding: 4px 8px; font-size: 11px; min-height: 32px; }
.guess-points { font-variant-numeric: tabular-nums; white-space: nowrap; }
.alternate-attempts { margin: 8px 0 12px; }
.alternate-attempts > summary { font-size: 12px; color: var(--muted); }
.history-footer { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.history-footer button { min-height: 36px; }
.history-help { margin-top: 8px; }
#history-error:empty { display: none; }
@media (min-width: 600px) { .history-workspace { grid-template-columns: minmax(0,1fr) minmax(0,1.12fr); gap: 14px; } }
@media (max-width: 599px) { .history-list { max-height: 260px; } }
@media (max-width: 400px) { .history-toolbar { display: grid; grid-template-columns: 40px minmax(0,1fr) 40px; } .history-toolbar .chip { grid-column: 1 / -1; justify-self: end; min-height: 36px; } }
#share-fallback { width: 100%; }
@media (max-width: 400px) { .library-filters { grid-template-columns: 1fr; } }
.chip { padding: 3px 12px; font-size: 13px; }
.chip.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }

.summary { margin-top: 22px; padding: 18px 20px; border: 1px solid var(--rule); border-radius: 14px; background: var(--card); }
.summary p { margin: 0 0 8px; }
.error { margin-top: 18px; color: var(--bad); }
.foot { padding-top: 12px; padding-bottom: 24px; font-size: 13px; color: var(--muted); }

.community { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--rule); }
.community h2 { font-family: Fraunces, Georgia, serif; font-size: 23px; margin: 0 0 12px; }
.community h3 { font-size: 16px; margin-top: 20px; }
select, textarea { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--rule); border-radius: 8px; padding: 8px; max-width: 100%; }
.muted { color: var(--muted); font-size: 13px; }
.distribution { margin: 20px 0 14px; padding: 16px; border: 1px solid var(--rule); border-radius: 14px; background: var(--card); }
.widget-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: center; }
.community .widget-heading h3 { margin: 0; font-family: Fraunces,Georgia,serif; font-size: 20px; }
.cohort-picker select { padding: 7px; font-size: 12px; }
#histogram-caption { margin: 8px 0 12px; }
.histogram svg { display: block; width: 100%; height: auto; overflow: visible; }
.histogram text { fill: var(--muted); font-family: Inter,system-ui,sans-serif; }
.histogram .axis-tick { font-size: 11px; font-variant-numeric: tabular-nums; }
.histogram .axis-title { font-size: 12px; font-weight: 500; }
.histogram .hist-grid { stroke: var(--rule); stroke-width: 1; }
.histogram .hist-column { fill: var(--muted); opacity: .65; }
.histogram .hist-column.mine { fill: var(--accent); opacity: 1; }
.histogram .bar-count { fill: var(--ink); font-size: 11px; font-weight: 600; }
.histogram .hist-marker { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 3 4; }
.chart-empty { min-height: 130px; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 13px; }
.chart-key { justify-content: center; margin: 4px 0 12px; }
.chart-swatch { display: inline-block; width: 9px; height: 9px; margin-right: 4px; border-radius: 2px; background: var(--muted); opacity: .65; }
.chart-swatch.mine { background: var(--accent); opacity: 1; }
.chart-data summary { font-size: 12px; color: var(--muted); }
.distribution:has(.chart-empty) .chart-key, .distribution:has(.chart-empty) .chart-data { display: none; }
.histogram-table { border-collapse: collapse; width: 100%; margin-top: 12px; font-size: 12px; font-variant-numeric: tabular-nums; }
.histogram-table th, .histogram-table td { padding: 7px 0; border-bottom: 1px solid var(--rule); text-align: left; }
.histogram-table th:last-child, .histogram-table td:last-child { text-align: right; }
.histogram-table .mine { color: var(--accent); font-weight: 600; }
.report-list { list-style: none; margin: 12px 0; padding: 0; }
.report-list li { border: 1px solid var(--rule); border-radius: 10px; padding: 12px; margin-bottom: 10px; overflow-wrap: anywhere; }
.report-list p { margin: 4px 0; }
.discovery { display: inline-block; border: 1px solid var(--accent); border-radius: 999px; padding: 3px 10px; font-size: 13px; }
.r-report { grid-column: 2 / -1; justify-self: start; margin-top: 5px; }
.own-history { grid-column: 2 / -1; margin-top: 8px; font-size: 13px; }
.own-history summary { cursor: pointer; }
dialog { width: min(460px, calc(100% - 32px)); border: 1px solid var(--rule); border-radius: 14px; background: var(--bg); color: var(--ink); padding: 20px; }
dialog::backdrop { background: #0008; }
#report-form label { display: block; margin: 12px 0 6px; }
#report-form select, #report-form textarea { width: 100%; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
