:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #16161a;
  --muted: #8a8a8f;
  --line: #e7e5e0;
  --accent: #16161a;
  --done: #2f9e62;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e10;
    --surface: #17171a;
    --text: #e8e6e1;
    --muted: #6f6f75;
    --line: #26262a;
    --accent: #e8e6e1;
    --done: #4cc38a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 "Geist", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 72px 16px 48px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 28px;
}
h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.03em; }
.date { color: var(--muted); margin-top: 2px; }

.progress { text-align: right; min-width: 96px; }
#count { font: 500 13px "Geist Mono", monospace; color: var(--muted); }
.bar { height: 3px; background: var(--line); border-radius: 2px; margin-top: 6px; overflow: hidden; }
#fill { height: 100%; width: 0; background: var(--done); transition: width .4s ease; }

.games { list-style: none; padding: 0; display: grid; gap: 8px; }

.game {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color .15s, opacity .2s;
}
.game:hover { border-color: color-mix(in srgb, var(--text) 25%, var(--line)); }

.check {
  flex: none;
  width: 22px; height: 22px;
  margin-left: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: none;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s, border-color .15s;
}
.check:hover { border-color: var(--muted); }
.game.done .check { background: var(--done); border-color: var(--done); }
.game.done .check::after {
  content: "";
  width: 9px; height: 5px;
  border: solid var(--surface);
  border-width: 0 0 2px 2px;
  transform: translateY(-1px) rotate(-45deg);
}

.open {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 16px 16px 14px;
  color: inherit;
  text-decoration: none;
}
.key {
  font: 500 12px "Geist Mono", monospace;
  color: var(--muted);
  width: 10px;
}
.text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.name { font-weight: 500; }
.blurb { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game.done .name { color: var(--muted); }

.streak { font: 500 12px "Geist Mono", monospace; color: var(--muted); white-space: nowrap; }
.streak:empty { display: none; }

.score-pill {
  font: 500 11px "Geist Mono", monospace;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px dashed var(--line);
  color: var(--muted);
  background: none;
  cursor: pointer;
  white-space: nowrap;
  flex: none;
  transition: all .15s;
  user-select: none;
}
.score-pill:hover, .score-pill:focus-visible {
  border-color: var(--muted);
  color: var(--text);
  outline: none;
}
.game.done .score-pill:not(.has-score) {
  border-color: color-mix(in srgb, var(--done) 50%, var(--line));
  color: var(--done);
}
.score-pill.has-score {
  font-weight: 600;
  font-size: 12px;
  background: color-mix(in srgb, var(--done) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--done) 45%, var(--line));
  color: var(--text);
}
.score-pill.has-score:hover, .score-pill.has-score:focus-visible {
  border-color: var(--done);
  background: color-mix(in srgb, var(--done) 22%, var(--surface));
}

.arrow { width: 16px; height: 16px; color: var(--muted); flex: none; transition: transform .15s, color .15s; }
.open:hover .arrow { color: var(--text); transform: translate(1px, -1px); }

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.ghost {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
}
.ghost:hover { border-color: var(--muted); }
.ghost:disabled { opacity: .4; cursor: default; }
.hint { color: var(--muted); font-size: 12px; }
kbd {
  font: 500 11px "Geist Mono", monospace;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 4px;
  color: var(--muted);
}

@media (max-width: 480px) {
  main { padding-top: 40px; }
  .key, .hint { display: none; }
}

/* installed app: keep clear of the notch / home bar */
main {
  padding-top: calc(72px + env(safe-area-inset-top));
  padding-bottom: calc(48px + env(safe-area-inset-bottom));
}
@media (max-width: 480px) {
  main { padding-top: calc(40px + env(safe-area-inset-top)); }
}

/* history: year grid */
:root {
  --l0: var(--line);
  --l1: color-mix(in srgb, var(--done) 22%, var(--surface));
  --l2: color-mix(in srgb, var(--done) 42%, var(--surface));
  --l3: color-mix(in srgb, var(--done) 62%, var(--surface));
  --l4: color-mix(in srgb, var(--done) 82%, var(--surface));
  --l5: var(--done);
  --cell: 12px;
  --gap: 3px;
}
.cal {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.cal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.cal-head h2 { font-size: 15px; font-weight: 500; }
.stats { color: var(--muted); font-size: 12px; font-family: "Geist Mono", monospace; }

.cal-filter {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 12px;
  scrollbar-width: none;
}
.cal-filter::-webkit-scrollbar { display: none; }
.cal-pill {
  font: inherit;
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: none;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.cal-pill:hover { border-color: var(--muted); color: var(--text); }
.cal-pill.active { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 500; }

.cal-body { display: flex; gap: 6px; }
.daynames {
  display: grid;
  grid-template-rows: repeat(7, var(--cell));
  gap: var(--gap);
  margin-top: 20px;
  font-size: 10px;
  color: var(--muted);
  line-height: var(--cell);
}
.scroller {
  overflow-x: auto;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 20px);
  mask-image: linear-gradient(to right, transparent, #000 20px);
  scrollbar-width: none;
  padding-bottom: 2px;
  min-width: 0;
}
.scroller::-webkit-scrollbar { display: none; }
.months, .grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--cell);
  gap: var(--gap);
}
.months {
  height: 20px;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.months span { overflow: visible; }
.grid { grid-template-rows: repeat(7, var(--cell)); }

:where(.cell, .legend i) {
  width: var(--cell);
  height: var(--cell);
  border-radius: 3px;
  background: var(--l0);
  border: 0;
  padding: 0;
  outline-offset: 1px;
}
.cell { cursor: pointer; }
[data-l="1"] { background: var(--l1); }
[data-l="2"] { background: var(--l2); }
[data-l="3"] { background: var(--l3); }
[data-l="4"] { background: var(--l4); }
[data-l="5"] { background: var(--l5); }
.cell.future { visibility: hidden; }
.cell.today { outline: 1px solid var(--muted); }
.cell.sel { outline: 1.5px solid var(--text); }
.cell:hover { outline: 1px solid var(--text); }

.legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
}
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.legend span:first-child { margin-right: 4px; }
.legend span:last-child { margin-left: 4px; }

.tip {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 6px 20px rgb(0 0 0 / .18);
}
.tip-head { font-weight: 500; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 8px; opacity: .45; }
.tip-row::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
}
.tip-row.on { opacity: 1; }
.tip-row.on::before { background: var(--done); border-color: var(--done); }
.tip-score {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  margin-left: auto;
  padding-left: 8px;
  opacity: 0.9;
}

.detail {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
#dayLabel { font-size: 13px; color: var(--muted); min-width: 72px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.chip:hover { border-color: var(--muted); }
.chip.on { background: var(--done); border-color: var(--done); color: var(--surface); }

.day-chip-group {
  display: inline-flex;
  align-items: center;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: none;
  overflow: hidden;
}
.day-chip-group.on {
  background: var(--done);
  border-color: var(--done);
}
.day-chip-group .chip-toggle {
  font: inherit;
  font-size: 12px;
  padding: 4px 8px 4px 10px;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.day-chip-group.on .chip-toggle {
  color: var(--surface);
}
.day-chip-group .chip-score {
  font: 500 11px "Geist Mono", monospace;
  padding: 2px 7px;
  margin-right: 4px;
  border-radius: 99px;
  border: 0;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--muted);
  cursor: pointer;
  transition: background .15s;
}
.day-chip-group.on .chip-score {
  background: color-mix(in srgb, var(--surface) 25%, transparent);
  color: var(--surface);
}
.day-chip-group .chip-score:hover {
  background: color-mix(in srgb, var(--text) 16%, transparent);
}
.day-chip-group.on .chip-score:hover {
  background: color-mix(in srgb, var(--surface) 40%, transparent);
}

/* ---------- statistics & trends section ---------- */
.stats-section {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.stats-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.stats-head-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.stats-head h2 { font-size: 15px; font-weight: 500; }
.stats-hint { color: var(--muted); font-size: 12px; font-family: "Geist Mono", monospace; }
.stats-game-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.stats-game-pills::-webkit-scrollbar { display: none; }
.stats-pill {
  font: inherit;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: none;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.stats-pill:hover { border-color: var(--muted); color: var(--text); }
.stats-pill.active { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 500; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kpi-label { font-size: 11px; color: var(--muted); }
.kpi-val { font: 600 16px "Geist Mono", monospace; color: var(--text); }
.kpi-sub { font-size: 11px; color: var(--muted); }

.chart-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.chart-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.chart-title { font-size: 13px; font-weight: 500; }
.chart-range { display: flex; gap: 4px; }
.range-btn {
  font: 500 11px "Geist Mono", monospace;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.range-btn:hover { border-color: var(--muted); color: var(--text); }
.range-btn.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.svg-chart-wrap {
  width: 100%;
  position: relative;
  min-height: 140px;
}
.svg-chart-wrap svg {
  width: 100%;
  height: auto;
  display: block;
}
.chart-point {
  cursor: pointer;
  transition: r .15s ease;
}
.chart-point:hover {
  r: 5.5;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  border-radius: 6px;
  padding: 4px 8px;
  font: 500 11px "Geist Mono", monospace;
  transform: translate(-50%, -100%);
  margin-top: -8px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgb(0 0 0 / .15);
  z-index: 5;
  transition: opacity .1s;
}

/* guess distribution horizontal histogram */
.dist-chart {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}
.dist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 500 12px "Geist Mono", monospace;
}
.dist-label {
  width: 14px;
  color: var(--muted);
  text-align: right;
  flex: none;
}
.dist-bar-track {
  flex: 1;
  background: color-mix(in srgb, var(--line) 60%, transparent);
  border-radius: 4px;
  height: 20px;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.dist-bar {
  height: 100%;
  background: color-mix(in srgb, var(--done) 50%, var(--surface));
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 8px;
  min-width: 24px;
  color: var(--text);
  font-size: 11px;
  transition: width .3s ease;
}
.dist-bar.highlight {
  background: var(--done);
  color: var(--surface);
  font-weight: 600;
}
.dist-row:hover .dist-bar:not(.highlight) {
  background: color-mix(in srgb, var(--done) 70%, var(--surface));
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--text);
  color: var(--bg);
  padding: 10px 10px 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgb(0 0 0 / .18);
}
.toast[hidden] { display: none; }
#toastPaste {
  font: inherit;
  font-weight: 500;
  color: var(--surface);
  background: color-mix(in srgb, var(--surface) 22%, transparent);
  border: 0;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}
#toastPaste:hover {
  background: color-mix(in srgb, var(--surface) 35%, transparent);
}
#toastScore {
  font: inherit;
  font-weight: 500;
  color: var(--surface);
  background: color-mix(in srgb, var(--surface) 18%, transparent);
  border: 0;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}
#toastScore:hover {
  background: color-mix(in srgb, var(--surface) 28%, transparent);
}
#undo {
  font: inherit;
  font-weight: 500;
  color: var(--done);
  background: none;
  border: 0;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}
#undo:hover { background: color-mix(in srgb, var(--bg) 12%, transparent); }

a.ghost { text-decoration: none; }
a.ghost[hidden] { display: none; }
.native .hint { display: none; }

/* footer actions, empty state */
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.empty {
  text-align: center;
  padding: 36px 16px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
}
.empty[hidden] { display: none; }
.empty p { margin-bottom: 12px; }

/* game editor */
.editor {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  margin: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 60px rgb(0 0 0 / .3);
}
.editor::backdrop { background: rgb(0 0 0 / .45); backdrop-filter: blur(2px); }
.editor-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.editor-head h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }

.edit-list { list-style: none; padding: 0; margin-bottom: 20px; }
.edit-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.edit-list li:last-child { border-bottom: 0; }
.edit-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.remove {
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
}
.remove:hover { color: var(--text); border-color: var(--muted); }
.remove.armed { color: #e5484d; border-color: #e5484d; }

.add-form { display: grid; gap: 8px; }
.add-form h3 { font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 2px; }
.add-form input {
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  outline: none;
}
.add-form input:focus { border-color: var(--muted); }
.add-form input::placeholder { color: var(--muted); }
.form-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
.note { font-size: 12px; color: var(--muted); }
.primary {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--bg);
  background: var(--text);
  border: 0;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
}
.primary:disabled { opacity: .4; cursor: default; }

.icon {
  flex: none;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: none;
  color: var(--text);
  cursor: pointer;
  padding: 0;
}
.icon svg { width: 14px; height: 14px; }
.icon:hover { border-color: var(--muted); }
.icon:disabled { opacity: .3; cursor: default; }

/* score modal */
.score-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.score-form {
  display: grid;
  gap: 12px;
}
.score-input-wrap {
  display: flex;
  gap: 8px;
}
.score-input-wrap input {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  font: 500 16px "Geist Mono", monospace;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
}
.score-input-wrap input:focus {
  border-color: var(--muted);
}
.paste-btn {
  font: 500 12px "Geist Mono", monospace;
  padding: 0 12px;
  white-space: nowrap;
}
.score-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.quick-chip {
  font: 500 12px "Geist Mono", monospace;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.quick-chip:hover {
  border-color: var(--muted);
  background: color-mix(in srgb, var(--text) 5%, var(--surface));
}
.score-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}
.score-actions-right {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* scores log modal */
.scores-log-modal {
  width: min(480px, calc(100vw - 32px));
}
.scores-filter {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 12px;
  scrollbar-width: none;
}
.scores-filter::-webkit-scrollbar { display: none; }
.filter-pill {
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: none;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.filter-pill:hover { border-color: var(--muted); color: var(--text); }
.filter-pill.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.scores-summary {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--text) 4%, var(--surface));
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
}
.summary-stat { display: flex; flex-direction: column; }
.stat-label { font-size: 11px; color: var(--muted); }
.stat-val { font: 600 14px "Geist Mono", monospace; color: var(--text); }

.scores-list {
  display: grid;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 2px;
}
.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s;
}
.score-row:hover { border-color: var(--muted); }
.score-row-left { display: flex; flex-direction: column; gap: 2px; }
.score-row-game { font-weight: 500; font-size: 13px; }
.score-row-date { font-size: 11px; color: var(--muted); }
.score-row-val {
  font: 600 12px "Geist Mono", monospace;
  padding: 3px 8px;
  background: color-mix(in srgb, var(--done) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--done) 45%, var(--line));
  border-radius: 6px;
}
.scores-empty {
  text-align: center;
  padding: 28px 12px;
  color: var(--muted);
  font-size: 13px;
}

/* share card modal */
.share-modal {
  width: min(480px, calc(100vw - 32px));
}
.share-modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.share-filter {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.share-filter::-webkit-scrollbar { display: none; }
.share-pill {
  font: inherit;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: none;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.share-pill:hover { border-color: var(--muted); color: var(--text); }
.share-pill.active { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 500; }

.share-preview-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  background: color-mix(in srgb, var(--text) 3%, var(--bg));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.share-canvas {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgb(0 0 0 / .2);
}

.share-actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.share-feedback {
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--done);
  padding: 4px 0;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

#pastePanel:not([hidden]) {
  display: grid;
  gap: 6px;
  font-size: 12px;
}
#shareInput, #wordleDate {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
#shareInput { font-size: 16px; width: 100%; box-sizing: border-box; resize: vertical; }
#pasteStatus { color: var(--muted); min-height: 1em; margin: 0; }
#scoreWordleBoard:empty, .score-quick:empty { display: none; }

.wordle-board {
  display: grid;
  grid-template-columns: 1.5rem repeat(5, clamp(22px, 7vw, 36px));
  align-items: center;
  gap: 5px;
  width: max-content;
  margin: 0 auto;
}
.wordle-guess { color: var(--muted); font: 12px "Geist Mono", monospace; text-align: center; }
.wordle-tile { aspect-ratio: 1; background: var(--tile); border-radius: 5px; }
[data-result="g"] { --tile: #538d4e; }
[data-result="y"] { --tile: #b59f3b; }
[data-result="x"] { --tile: #787c7e; }
.wordle-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}
.wordle-legend span::before {
  content: "";
  display: inline-block;
  width: .7em;
  height: .7em;
  margin-right: .4em;
  background: var(--tile);
  border-radius: 2px;
}

/* ---------- account, sync & backup ---------- */
.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--done);
  display: inline-block;
  flex: none;
}
.sync-dot.syncing { background: #e09f3e; }
.sync-dot.error { background: #d64545; }

.account-modal { max-width: 440px; }
.account-page {
  display: grid;
  gap: 16px;
}
.account-header {
  align-items: center;
  margin-bottom: 12px;
}
.account-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  display: grid;
  gap: 12px;
}
.account-card[hidden] { display: none; }
.account-section {
  display: grid;
  gap: 10px;
  padding-top: 14px;
}
.account-section + .account-section {
  margin-top: 16px;
  border-top: 1px solid var(--line);
}
.auth-tabs {
  display: flex;
  gap: 6px;
}
.auth-form {
  margin-top: 4px;
  padding-top: 0;
  border-top: none;
}
.field-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.sync-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  display: grid;
  gap: 6px;
}
.sync-user-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sync-status-text {
  margin-left: auto;
  font: 500 12px "Geist Mono", monospace;
  color: var(--muted);
}
.sync-meta {
  font-size: 12px;
  color: var(--muted);
}
.sync-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  gap: 8px;
}
.backup-section h3 {
  font-size: 14px;
  font-weight: 600;
}
.backup-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.import-box {
  display: grid;
  gap: 8px;
  margin-top: 2px;
}
#importInput {
  font: 12px/1.4 "Geist Mono", monospace;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
  resize: vertical;
}
.import-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.merge-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
.import-btns {
  display: flex;
  gap: 8px;
  align-items: center;
}
.file-btn {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.cookie-tip {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.cookie-tip summary {
  cursor: pointer;
  user-select: none;
}
.cookie-tip p {
  margin-top: 6px;
}
.cookie-tip code {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 4px;
  color: var(--text);
}
