:root {
  --bg: #f6f6fb;
  --card: #ffffff;
  --text: #1c1b29;
  --muted: #6b6a80;
  --accent: #4f46e5;
  --done: #16a34a;
  --border: #e3e2ee;
  /* Fills behind white text stay deep in both themes so the text stays readable. */
  --accent-fill: #4f46e5;
  --done-fill: #16a34a;
  --header: #4f46e5;
  /* Room kept clear of notches, camera cutouts and rounded screen corners. The Android app
     sets --app-inset-* from the screen it is on (MainActivity), since its WebView has no env(). */
  --inset-top: max(env(safe-area-inset-top, 0px), var(--app-inset-top, 0px));
  --inset-right: max(env(safe-area-inset-right, 0px), var(--app-inset-right, 0px));
  --inset-bottom: max(env(safe-area-inset-bottom, 0px), var(--app-inset-bottom, 0px));
  --inset-left: max(env(safe-area-inset-left, 0px), var(--app-inset-left, 0px));
  /* Side padding of the page; tighter on narrow screens. */
  --gutter: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12111a;
    --card: #1d1c28;
    --text: #ecebf5;
    --muted: #9a99ad;
    --accent: #818cf8;
    --done: #4ade80;
    --border: #2e2d3d;
    --header: #3730a3;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #12111a;
  --card: #1d1c28;
  --text: #ecebf5;
  --muted: #9a99ad;
  --accent: #818cf8;
  --done: #4ade80;
  --border: #2e2d3d;
  --header: #3730a3;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.4 system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}
header {
  background: var(--header);
  color: #fff;
  padding-top: max(20px, calc(var(--inset-top) + 8px)); padding-bottom: 16px;
  padding-left: max(var(--gutter), var(--inset-left));
  padding-right: max(var(--gutter), var(--inset-right));
}
header h1 { margin: 0; font-size: 22px; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.menu-btn {
  font: inherit; font-size: 22px; line-height: 1; width: 36px; height: 36px; margin-right: -8px;
  background: none; color: #fff; border: none; border-radius: 50%; cursor: pointer;
}
.menu-btn:hover, .menu-btn:focus-visible { background: rgb(255 255 255 / 0.2); }
/* The level, points and bar form one button that opens the Progress sheet. */
.score {
  display: block; width: calc(100% + 16px); margin: 0 -8px; padding: 6px 8px; font: inherit; font-size: 15px; text-align: left;
  background: none; color: #fff; border: none; border-radius: 10px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.score:hover, .score:focus-visible { background: rgb(255 255 255 / 0.12); }
.score-top { display: flex; justify-content: space-between; }
.award-count + .award-count { margin-left: 8px; }
.bar { display: block; height: 6px; background: rgb(255 255 255 / 0.3); border-radius: 3px; margin-top: 8px; overflow: hidden; }
#progress { display: block; height: 100%; background: #fff; width: 0; transition: width 0.4s; }
.score-next { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 8px; margin-top: 6px; font-size: 13px; }
#to-next { opacity: 0.85; }
/* Says the header opens awards and history; pulses until the sheet has been opened once. */
.progress-cue { margin-left: auto; padding: 3px 10px; border-radius: 999px; background: rgb(255 255 255 / 0.2); font-weight: 600; white-space: nowrap; }
.score:hover .progress-cue, .score:focus-visible .progress-cue { background: rgb(255 255 255 / 0.3); }
.progress-cue.new { animation: cue-pulse 1.8s ease-in-out 4; }
@keyframes cue-pulse { 50% { box-shadow: 0 0 0 4px rgb(255 255 255 / 0.35); background: rgb(255 255 255 / 0.32); } }
@media (prefers-reduced-motion: reduce) { .progress-cue.new { animation: none; } }

main {
  max-width: 560px; margin: 0 auto; padding-top: 16px; padding-bottom: calc(96px + var(--inset-bottom));
  padding-left: max(var(--gutter), var(--inset-left));
  padding-right: max(var(--gutter), var(--inset-right));
}
section, .fold { margin-bottom: 24px; }
.fold > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
  -webkit-tap-highlight-color: transparent;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after {
  content: ''; margin-left: auto; width: 8px; height: 8px; flex: none;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform 0.2s;
}
.fold[open] > summary::after { transform: rotate(-135deg); }
.fold > summary h2 { margin: 0; padding-block: 6px; }
.fold[open] > summary { margin-bottom: 8px; }
h2 { font-size: 17px; margin: 0 0 8px; }
h2 small { color: var(--muted); font-weight: normal; margin-left: 6px; }
.today-title { font-size: 22px; margin-bottom: 12px; }
.today-title small { font-size: 15px; }
#today-section { margin-bottom: 20px; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.habit {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px;
}
.habit .name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.habit small { color: var(--muted); font-size: 13px; }
.habit.done .title { text-decoration: line-through; color: var(--muted); }
.emoji { font-size: 22px; }
.streak { font-weight: 600; }
.streak.zero { opacity: 0.4; font-weight: normal; }
.shields { font-size: 0.85em; margin-left: -4px; }
/* A today row is one big button: the whole row checks the habit off. */
.check-row {
  width: 100%; min-height: 60px; font: inherit; color: inherit; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.check-row:active { transform: scale(0.99); }
.pile-row { display: flex; gap: 8px; align-items: stretch; }
.pile-row .check-row { flex: 1; min-width: 0; }
.pile-row .minus {
  flex: none; min-width: 52px; font: inherit; font-size: 22px; font-weight: 600; color: var(--accent); cursor: pointer;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
}
.pile-hint { display: block; margin: 4px 0 12px; }
.pile-hint[hidden], #stack-field[hidden] { display: none; }
#habit-pile { justify-self: stretch; max-width: 100%; }
.check-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;
  border: 2px solid var(--accent); color: #fff; font-size: 18px;
}
.done .check { background: var(--done-fill); border-color: var(--done-fill); }
.flash { animation: flash 1.6s ease-out; }
@keyframes flash { from { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); } }
.divider { color: var(--muted); font-size: 13px; padding: 6px 4px 0; }
.yesterday { margin-top: 16px; }
.yesterday h3 { font-size: 15px; margin: 0 0 8px; }
.yesterday h3 small { display: block; color: var(--muted); font-weight: normal; font-size: 13px; margin-top: 2px; }
.edit, .delete, .key, .habit .pause {
  flex: none; min-width: 44px; height: 44px; margin: -6px 0; display: grid; place-items: center;
  background: none; border: none; border-radius: 8px; color: var(--muted); font-size: 18px; cursor: pointer;
}
.edit + .delete, .key + .edit, .pause + .edit { margin-left: -8px; }
.habit.paused > .emoji { opacity: 0.5; }
.habit .pause { font-variant-emoji: text; }
.streak.comeback { color: var(--done); white-space: nowrap; }
.pause-note { color: var(--accent); }
.pause-form { display: grid; gap: 6px; margin-top: 12px; }
.pause-form button[type=submit] { margin-top: 8px; }
.editing { border-color: var(--accent); }
.cancel { font: inherit; background: none; color: var(--muted); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; cursor: pointer; }
.delete.armed { color: #fff; background: #dc2626; font-size: 13px; padding: 0 10px; margin-left: 4px; }

.badge-tiles { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.badge-tile { display: grid; justify-items: center; gap: 2px; padding: 12px 8px; background: var(--bg); border: 2px solid transparent; border-radius: 12px; text-align: center; }
.badge-tile.tier-bronze { border-color: #c98a4b; }
.badge-tile.tier-silver { border-color: #a9b1ba; }
.badge-tile.tier-gold { border-color: #e2b007; }
.badge-tile.tier-platinum { border-color: #7cc4c0; }
.badge-tile.tier-ruby { border-color: #d1104f; box-shadow: 0 0 0 2px rgba(209, 16, 79, 0.25); }
.badge-tile .streak-bonus { color: var(--accent); font-weight: 600; }
.badge-tile .badge-emoji { font-size: 28px; }
.badge-tiles > .muted { grid-column: 1 / -1; }
.badge-tile small { color: var(--muted); font-size: 12px; }
.progress-level { font-weight: 600; }
.sheet-body h3 { margin: 6px 0 0; font-size: 15px; }
.muted { color: var(--muted); font-size: 14px; }

form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.field-label { font-size: 14px; color: var(--muted); margin-bottom: -4px; padding: 0; }
input, #habit-pile { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); }
input[name=name] { flex: 1; min-width: 0; }
.emoji-btn {
  width: 48px; height: 42px; flex: none; font-size: 24px; line-height: 1; cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg);
}
.emoji-btn[aria-expanded="true"] { border-color: var(--accent); }
.emoji-picker { display: grid; gap: 8px; }
.emoji-picker[hidden] { display: none; }
/* Two rows that scroll sideways, so the picker stays short. */
.emoji-grid {
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, 44px); grid-auto-columns: 44px; gap: 4px;
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; padding-bottom: 4px;
}
.emoji-grid button {
  height: 44px; padding: 0; font-size: 24px; line-height: 1; cursor: pointer;
  border: 2px solid transparent; border-radius: 8px; background: var(--bg);
}
.emoji-grid button[aria-pressed="true"] { border-color: var(--accent); }
.emoji-custom { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.emoji-custom input { width: 64px; text-align: center; }
.days { border: none; padding: 0; margin: 0; display: grid; gap: 8px; min-width: 0; }
.days legend { margin-bottom: 8px; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.presets button {
  font: inherit; font-size: 13px; padding: 5px 10px; cursor: pointer;
  background: none; color: var(--accent); border: 1px solid var(--border); border-radius: 999px;
}
.day-chips { display: flex; justify-content: space-between; gap: 4px; }
.day-chips label { flex: 1; max-width: 48px; }
.day-chips input { position: absolute; opacity: 0; pointer-events: none; }
.day-chips span {
  display: grid; place-items: center; aspect-ratio: 1; border-radius: 50%; cursor: pointer; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); color: var(--muted); background: var(--bg);
}
.day-chips input:checked + span { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
.day-chips input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.time-input { justify-self: start; min-width: 140px; }
.toggle-row { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; padding: 4px 0; cursor: pointer; }
.toggle-row input { margin: 3px 0 0; width: 18px; height: 18px; flex: none; }
.toggle-row > span { display: flex; flex-direction: column; }
.toggle-row small { color: var(--muted); font-size: 13px; }
/* Same disclosure chevron as the foldable sections. */
.private-group summary {
  cursor: pointer; padding: 10px 12px; color: var(--muted); font-size: 14px; list-style: none;
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px dashed var(--border); border-radius: 12px;
}
.private-group summary::-webkit-details-marker { display: none; }
.private-group summary::after {
  content: ''; margin-left: auto; width: 7px; height: 7px; flex: none;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform 0.2s;
}
.private-group details[open] summary::after { transform: rotate(-135deg); }
.private-group details[open] summary { margin-bottom: 8px; }
/* Habits from a task pack: grouped like the private ones, but with a solid border. */
.pack-group summary { border-style: solid; color: var(--text); font-weight: 600; }
/* Task Packs sheet: each pack is a row-sized button, each of its habits a tickable row. */
.from-pack { width: 100%; margin-bottom: 12px; }
#browse-packs { margin-top: 8px; }
.pack { width: 100%; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.pack .chevron { color: var(--muted); font-size: 22px; }
.pack-habit { cursor: pointer; }
.pack-habit input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.pack-habit.added { opacity: 0.6; cursor: default; }
.pack-title { margin: 8px 0 4px; }
.packs-back { padding: 0; }
.pack-add { width: 100%; margin-top: 4px; }
#packs-body .muted.small { font-size: 13px; }
button[type=submit], #copy-data, #import-btn, #feedback-send {
  font: inherit; background: var(--accent-fill); color: #fff; border: none; border-radius: 8px; padding: 10px 16px; cursor: pointer;
}
#add-form [type=submit] { margin-top: 6px; padding: 12px 16px; }

/* Floating add button. */
.fab {
  position: fixed; z-index: 5; width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
  right: max(20px, var(--inset-right)); bottom: max(20px, var(--inset-bottom));
  background: var(--accent-fill); color: #fff; font-size: 30px; line-height: 1;
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.25);
}
@media (min-width: 600px) { .fab { right: calc(50% - 280px + 16px); } }

/* Empty state for a first run. */
.empty {
  display: grid; justify-items: center; gap: 10px; text-align: center; padding: 24px 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
}
.empty[hidden] { display: none; }
.empty-emoji { font-size: 44px; margin: 0; }
.empty h3 { margin: 0; font-size: 18px; }
.empty p { margin: 0; }
.starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 4px 0; }
.starter {
  font: inherit; font-size: 14px; padding: 8px 12px; cursor: pointer;
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 999px;
}
.move { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.move p { margin: 0; }
.move textarea { font: 13px/1.4 ui-monospace, monospace; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); resize: vertical; }
#import-btn.armed { background: #dc2626; }
.note {
  margin: 0 0 16px; padding: 10px 12px; font-size: 14px; color: var(--muted);
  background: var(--card); border: 1px dashed var(--border); border-radius: 8px;
}

#toast {
  position: fixed; left: 50%; bottom: calc(92px + var(--inset-bottom)); transform: translate(-50%, 80px);
  display: flex; align-items: center; gap: 12px; z-index: 10;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  width: max-content; max-width: calc(100vw - 32px); margin: 0;
  opacity: 0; transition: transform 0.25s, opacity 0.25s; pointer-events: none;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }
#toast.actionable { pointer-events: auto; }
#toast-action { font: inherit; font-weight: 600; background: none; border: none; color: inherit; padding: 4px 0; cursor: pointer; text-decoration: underline; }
#toast-action[hidden] { display: none; }

.confirm {
  width: min(320px, calc(100% - 32px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 20px; border: none; border-radius: 14px;
  background: var(--card); color: var(--text); text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.confirm form { margin: 0; padding: 0; border: none; background: none; box-shadow: none; }
.confirm::backdrop { background: rgba(0, 0, 0, 0.45); }
.confirm h2 { margin: 0 0 6px; font-size: 20px; }
.confirm p { margin: 0 0 18px; color: var(--muted); }
.confirm .confirm-emoji { font-size: 40px; margin: 0 0 4px; color: inherit; }
.confirm .row { justify-content: center; gap: 8px; }
.confirm .cancel { font: inherit; padding: 9px 16px; }
.confirm .moved-steps { margin: 0 0 18px; padding-left: 22px; text-align: left; color: var(--muted); }
.confirm .moved-steps li + li { margin-top: 6px; }

/* Header menu and the sheet it opens */
.menu {
  margin: 0; inset: max(12px, var(--inset-top)) max(12px, var(--inset-right)) auto auto;
  min-width: 200px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px - var(--inset-top)); overflow-y: auto; padding: 6px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--card); color: var(--text); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.menu::backdrop { background: rgba(0, 0, 0, 0.2); }
.menu-item {
  display: block; width: 100%; font: inherit; text-align: left; padding: 10px 12px;
  background: none; color: inherit; border: none; border-radius: 8px; cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--bg); }
.menu-item[hidden] { display: none; }
.sheet {
  width: min(480px, calc(100% - 32px)); padding: 16px; border: none; border-radius: 14px;
  background: var(--card); color: var(--text); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.sheet::backdrop { background: rgba(0, 0, 0, 0.45); }
.sheet { max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
/* The title and ✕ stay in view while a long sheet scrolls. */
.sheet-head { position: sticky; top: -16px; z-index: 1; margin: -16px -16px 0; padding: 16px 16px 10px; background: var(--card); }
/* On phones the sheets slide up from the bottom edge. */
@media (max-width: 600px) {
  .sheet {
    width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 18px 18px 0 0;
    padding-bottom: max(16px, var(--inset-bottom));
  }
  .sheet[open] { animation: sheet-up 0.22s ease-out; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sheet-head h2 { margin: 0; font-size: 20px; }
.close { flex: none; font: inherit; background: none; border: none; color: var(--muted); font-size: 18px; padding: 4px 8px; cursor: pointer; }
.sheet .move { border: none; padding: 0; }
.sheet-body { display: grid; gap: 10px; }
.sheet-body p { margin: 0; }
.sheet-body textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); resize: vertical; }

/* Feedback inbox: a compact table with filters */
.inbox { max-height: 60vh; overflow-y: auto; }
.inbox-tools { display: grid; gap: 8px; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: 13px; padding: 4px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.chip[aria-pressed=true] { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
.inbox-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.inbox-filters input, .inbox-filters select, #beta-features select, .role-pick {
  font: inherit; font-size: 14px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); min-width: 0;
}
.inbox-filters input { flex: 1 1 140px; }
.inbox-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.fb-row { cursor: pointer; border-top: 1px solid var(--border); }
.fb-row:hover, .fb-row:focus-visible, .fb-row.open { background: var(--bg); outline: none; }
.fb-row td { padding: 8px 4px; vertical-align: top; }
.fb-status { width: 18px; }
.fb-text { overflow: hidden; }
.fb-text > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-from { font-size: 12px; font-weight: 600; color: var(--text); }
.fb-from.none { font-weight: 400; color: var(--muted); font-style: italic; }
.fb-meta { width: 92px; text-align: right; color: var(--muted); font-size: 12px; line-height: 1.3; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; background: var(--muted); }
.dot.new { background: #2563eb; }
.dot.waiting { background: #d97706; }
.dot.answered { background: #16a34a; }
.fb-detail td { background: var(--bg); padding: 4px 8px 12px; }
.inbox-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 13px; }
.inbox .delete { font-size: 13px; }

/* Feedback threads: the sender's view and the inbox detail */
.threads { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.thread { background: var(--bg); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; }
.thread-text { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.messages { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.msg { padding: 6px 10px; border-radius: 10px; max-width: 90%; background: var(--card); border: 1px solid var(--border); }
.msg.mine { justify-self: end; background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
.msg.mine .who { color: rgb(255 255 255 / 0.85); }
.msg p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.who { color: var(--muted); font-size: 12px; }
.reactions { display: flex; gap: 4px; margin-top: 8px; }
.reactions button {
  font: inherit; font-size: 18px; padding: 2px 8px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--card);
}
.reactions button[aria-pressed=true] { border-color: var(--accent-fill); box-shadow: 0 0 0 1px var(--accent-fill); }
.reply-box { display: flex; gap: 6px; align-items: flex-end; margin-top: 8px; }
.reply-box textarea {
  flex: 1; min-width: 0; font: inherit; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--text); resize: vertical;
}
.reply-send { font: inherit; background: var(--accent-fill); color: #fff; border: none; border-radius: 8px; padding: 8px 12px; cursor: pointer; }
.reply-send:disabled { opacity: 0.6; }
.menu-btn.has-unread { position: relative; }
.menu-btn.has-unread::after {
  content: ''; position: absolute; top: 5px; right: 6px; width: 8px; height: 8px; border-radius: 50%;
  background: #f97316; box-shadow: 0 0 0 2px var(--accent-fill);
}
.help { display: grid; gap: 10px; max-height: 70vh; overflow-y: auto; }
.help h2 { margin: 8px 0 0; font-size: 17px; }
.help h3 { margin: 0; font-size: 15px; }
.help p { margin: 2px 0 10px; color: var(--muted); font-size: 14px; }
.help ul { margin: 2px 0 10px; padding-left: 20px; font-size: 14px; }
.help li + li { margin-top: 4px; }
.banner {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 16px; padding: 10px 6px 10px 12px;
  background: var(--card); border: 1px solid var(--accent); border-radius: 12px; font-size: 14px;
}
.banner[hidden] { display: none; }
.banner p { margin: 0; flex: 1 1 200px; }
.banner .link { font-weight: 600; }
.banner.quiet { border: 1px dashed var(--border); color: var(--muted); }
.banner .close { padding: 2px 8px; }

/* Friends */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: grid; gap: 12px; }
.panel[hidden], .code-box[hidden], .row[hidden], .days[hidden] { display: none; }
.panel p { margin: 0; }
.profile { display: flex; align-items: center; gap: 12px; }
.profile .name { display: flex; flex-direction: column; min-width: 0; }
.profile small { color: var(--muted); font-size: 13px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px; letter-spacing: 0.5px; background: var(--accent-fill);
}
.friend .avatar { width: 34px; height: 34px; font-size: 13px; }
.friend .nick { width: 100%; }
.primary, .secondary { font: inherit; border-radius: 8px; padding: 9px 16px; cursor: pointer; }
.primary { background: var(--accent-fill); color: #fff; border: none; }
.secondary { background: none; color: var(--accent); border: 1px solid var(--accent); }
.primary:disabled, .secondary:disabled { opacity: 0.6; cursor: wait; }
.link { font: inherit; font-size: 14px; background: none; border: none; padding: 0; color: var(--accent); cursor: pointer; text-align: left; justify-self: start; }
.link.danger, .secondary.danger { color: #dc2626; }
.secondary.danger { border-color: #dc2626; }
.danger-zone { display: grid; gap: 12px; justify-items: start; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--border); }
.link.danger.armed { color: #dc2626; font-weight: 600; }
.code-box { display: grid; gap: 8px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 8px; }
.code-box code { font: 600 20px/1.3 ui-monospace, monospace; letter-spacing: 1px; user-select: all; word-break: break-all; }
.code-box .row { justify-content: flex-end; }
.code-input { flex: 1; min-width: 0; font-family: ui-monospace, monospace; text-transform: uppercase; }
.code-input::placeholder { text-transform: none; font-family: system-ui, sans-serif; }
.code-box .row button { flex: 1 1 auto; }
/* A key is ~20 characters: give it the whole line and the button the line below. */
#beta-join .code-input { flex: 1 1 100%; }
a.primary { display: block; text-align: center; text-decoration: none; }
#open-in-app { margin-bottom: 12px; }
#invite-elsewhere { margin-bottom: 12px; }

/* Small screens, like a flip phone's cover display (about 360×350): tighter spacing so the
   menu, Today and the sheets stay usable. These follow the live size, so they switch
   on and off as the screen changes (folding, rotating, split screen). */
@media (max-width: 360px) {
  :root { --gutter: 12px; }
  .habit { gap: 10px; padding: 10px; }
  .check { width: 28px; height: 28px; font-size: 16px; }
  .emoji { font-size: 20px; }
  .day-chips { gap: 2px; }
  .sheet, .confirm { padding-left: 12px; padding-right: 12px; }
  .sheet-head { margin-left: -12px; margin-right: -12px; padding-left: 12px; padding-right: 12px; }
}
@media (max-height: 560px) {
  header { padding-top: max(10px, calc(var(--inset-top) + 4px)); padding-bottom: 8px; }
  header h1 { font-size: 18px; }
  .title-row { margin-bottom: 0; }
  .score { padding: 4px 8px; font-size: 14px; }
  .bar { margin-top: 6px; }
  .score-next { margin-top: 4px; font-size: 12px; }
  .progress-cue { padding: 1px 8px; }
  main { padding-top: 10px; padding-bottom: calc(76px + var(--inset-bottom)); }
  .today-title { font-size: 19px; margin-bottom: 8px; }
  .today-title small { font-size: 14px; }
  .check-row { min-height: 52px; }
  .fab {
    width: 48px; height: 48px; font-size: 26px;
    right: max(14px, var(--inset-right)); bottom: max(14px, var(--inset-bottom));
  }
  #toast { bottom: calc(72px + var(--inset-bottom)); }
  .sheet { max-height: calc(100dvh - 8px - var(--inset-top)); }
  .sheet-head h2 { font-size: 18px; }
  /* The sheet itself scrolls here, so lists inside it don't need their own scrollbar. */
  .help, .inbox { max-height: none; }
  .confirm { padding: 14px; }
  .confirm .confirm-emoji { font-size: 30px; }
  .confirm h2 { font-size: 18px; }
  .confirm p { margin-bottom: 12px; }
  .menu-item { padding: 8px 12px; }
  .empty { padding: 16px 12px; }
  .empty-emoji { font-size: 34px; }
}
.award-icon { width: 1.25em; height: 1.25em; vertical-align: -0.3em; }

/* Beta program (admin dialog) */
#beta-dialog h3 { margin: 16px 0 6px; }
#beta-dialog h3:first-child { margin-top: 0; }
#beta-dialog .list + .secondary { margin-top: 8px; width: 100%; }

/* Admin dialog: one tab per right, and the role designer */
.admin-tabs { margin-bottom: 12px; }
.role-add { margin-bottom: 8px; }
.role-add select { flex: 1 1 120px; }
.role-pick { max-width: 45%; }
#role-feature-picks { margin-top: 6px; }
#role-features { max-width: none; width: 100%; }
.key[hidden] { display: none; }
#role-form h3 { margin: 16px 0 4px; }

/* "View as" preview: a bar on top of everything until Exit */
.preview-bar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 10px;
  padding: calc(6px + var(--inset-top, 0px)) 16px 6px; background: #f59e0b; color: #1f1300; font-size: 14px; font-weight: 600;
}
.preview-bar[hidden] { display: none; }
.preview-bar span { flex: 1; min-width: 0; }
.preview-bar button { font: inherit; font-size: 13px; border: none; border-radius: 999px; padding: 4px 12px; background: #1f1300; color: #fff; cursor: pointer; }
#viewas-lang { max-width: none; width: 100%; }

/* Points history in the Progress sheet. */
.points-history h3 { margin-top: 20px; }
.history-level { border-bottom: 1px solid var(--border); }
.history-level > summary, .history-level.start { display: flex; justify-content: space-between; gap: 8px; padding: 10px 0; cursor: pointer; }
.history-level.start { color: var(--muted); cursor: default; border-bottom: 0; }
.history-level.current > summary { color: var(--accent); }
.history-level > summary b, .history-sum b, .history-day b:last-child { white-space: nowrap; }
.history-days, .history-days ul, .history-sum { list-style: none; padding: 0; margin: 0; }
.history-day { padding: 6px 0 10px; }
.history-day > div { display: flex; justify-content: space-between; font-size: 14px; }
.history-day li, .history-sum li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 8px; padding: 3px 0 3px 12px; font-size: 14px; }
.history-sum li { padding-left: 0; }
.history-day li b { font-weight: 500; }
.history-day small { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.history-award { color: var(--accent); }
.beta-tag { display: inline-block; padding: 0 6px; border-radius: 8px; background: rgba(127, 90, 240, 0.15); font-size: 12px; font-weight: 600; vertical-align: middle; }
.history-level > summary { list-style: none; }
.history-level > summary::-webkit-details-marker { display: none; }
.history-level > summary > span::after { content: '›'; display: inline-block; margin-left: 6px; color: var(--muted); transition: transform 0.2s; }
.history-level[open] > summary > span::after { transform: rotate(90deg); }

/* Child mode: the Children sheet. */
.kid-face {
  display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%;
  font-size: 22px; line-height: 1;
}
.kid-card { flex-wrap: wrap; }
.kid-card .name { min-width: 120px; }
.kid-actions { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }
.kid-actions > * { flex: 1 1 auto; white-space: nowrap; }
.kid-add, .kid-save, .kid-join-open { width: 100%; margin-top: 12px; }
.kids-back { margin-bottom: 8px; }
.kid-form { display: grid; gap: 8px; }
.kid-emojis, .kid-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.kid-emojis input, .kid-colors input { position: absolute; opacity: 0; pointer-events: none; }
.kid-emojis span {
  display: grid; place-items: center; width: 44px; height: 44px; font-size: 26px; cursor: pointer;
  border: 2px solid var(--border); border-radius: 12px; background: var(--card);
}
.kid-colors span { display: block; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; }
.kid-emojis input:checked + span, .kid-colors input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 2px var(--card) inset; }
.kid-emojis input:focus-visible + span, .kid-colors input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.kid-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; }
.kid-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.kid-buttons > * { flex: 1 1 auto; white-space: nowrap; }
#kids-body > .kid-open { width: 100%; }
#kids-body > .kid-edit { margin-top: 14px; }

/* Child mode: the child's own screen, over everything else. */
body.kid-mode { overflow: hidden; }
.kid-view {
  position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100dvh; z-index: 100; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(12px + var(--inset-top, 0px)) 16px calc(24px + var(--inset-bottom, 0px));
  background: color-mix(in srgb, var(--kid, #f59e0b) 14%, var(--bg));
  color: var(--text); user-select: none; -webkit-user-select: none;
}
.kid-view[hidden] { display: none; }
.kid-top { display: flex; align-items: center; gap: 10px; }
.kid-face.big { width: 52px; height: 52px; font-size: 30px; }
.kid-name { font-size: 24px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kid-stars { font-size: 22px; font-weight: 700; white-space: nowrap; }
/* The way back is deliberately quiet: a small lock in a ring that fills while it's held. */
@property --hold { syntax: '<percentage>'; inherits: false; initial-value: 0%; }
.kid-exit {
  position: relative; display: grid; place-items: center; width: 48px; height: 48px; padding: 0; flex: none;
  font: inherit; color: var(--muted); background: none; border: none; border-radius: 50%;
  cursor: pointer; touch-action: none; -webkit-touch-callout: none;
  /* Android's WebView starts selecting text on a long press, which cancels the hold. */
  user-select: none; -webkit-user-select: none;
}
.kid-exit span { font-size: 18px; opacity: 0.55; }
.kid-exit::before {
  content: ''; position: absolute; inset: 4px; border-radius: 50%; --hold: 0%; transition: --hold 0s;
  background: conic-gradient(var(--kid) var(--hold), color-mix(in srgb, var(--muted) 25%, transparent) 0);
  -webkit-mask: radial-gradient(circle, transparent 15px, #000 16px); mask: radial-gradient(circle, transparent 15px, #000 16px);
}
.kid-exit.holding::before { --hold: 100%; transition: --hold 3s linear; }
.kid-exit.holding span { opacity: 1; }
.kid-lock-hint {
  position: absolute; top: 100%; right: 0; margin-top: 4px; padding: 4px 8px; border-radius: 8px; white-space: nowrap;
  font-size: 12px; font-style: normal; color: var(--text); background: var(--card); border: 1px solid var(--border);
}
.kid-read {
  display: block; margin: 0 auto 14px; padding: 12px 20px; border-radius: 999px; font: inherit; font-size: 18px; font-weight: 700;
  color: #fff; background: var(--kid); border: none; cursor: pointer;
}
.kid-ring {
  --p: 0%;
  width: 120px; height: 120px; margin: 18px auto; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--kid) var(--p), color-mix(in srgb, var(--kid) 18%, var(--card)) 0);
}
.kid-ring span {
  display: grid; place-items: center; width: 92px; height: 92px; border-radius: 50%;
  background: var(--card); font-size: 28px; font-weight: 700;
}
.kid-free { text-align: center; font-size: 22px; margin: 40px 8px; }
.kid-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.kid-tile {
  display: grid; grid-template-rows: 1fr auto; overflow: hidden;
  background: var(--card); border: 3px solid var(--kid); border-radius: 22px;
}
.kid-say {
  position: relative; display: grid; justify-items: center; gap: 6px; padding: 16px 8px 10px; font: inherit; color: inherit;
  background: none; border: none; cursor: pointer;
}
.kid-speaker {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-size: 16px; background: color-mix(in srgb, var(--kid) 22%, var(--card));
}
.kid-emoji { font-size: 64px; line-height: 1; }
.kid-label { font-size: 16px; font-weight: 600; text-align: center; }
.kid-tile.speaking { animation: kid-talk 0.5s ease-in-out 3; }
@keyframes kid-talk { 50% { transform: scale(1.04); box-shadow: 0 0 0 6px color-mix(in srgb, var(--kid) 35%, transparent); } }
.kid-check {
  position: relative; min-height: 64px; font: inherit; font-size: 34px; font-weight: 700; color: #fff;
  background: var(--kid); border: none; cursor: pointer;
}
.kid-check small {
  position: absolute; top: 8px; right: 10px; font-size: 14px; min-width: 22px; padding: 1px 6px;
  border-radius: 11px; background: rgba(0, 0, 0, 0.25);
}
.kid-check:active { filter: brightness(0.9); }
.kid-tile.done { background: color-mix(in srgb, var(--kid) 20%, var(--card)); }
.kid-tile.done .kid-check { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--text); background: color-mix(in srgb, var(--kid) 35%, var(--card)); cursor: default; }
.kid-check small.kid-done-label { position: static; padding: 0; background: none; font-size: 18px; }
.kid-warn { color: #b45309; font-weight: 600; }
.kid-warn-box { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, #f59e0b 16%, var(--card)); }
.kid-today { color: var(--accent); font-weight: 600; }
.kid-undo { flex: none; min-width: 44px; min-height: 44px; font-size: 20px; color: var(--accent); background: none; border: none; cursor: pointer; }

/* Under Today: the children, one tap to hand the phone over. */
.kid-row { margin-top: 16px; }
.kid-row h3 { font-size: 15px; margin: 0 0 8px; }
.kid-row-list { display: flex; flex-wrap: wrap; gap: 8px; }
.kid-chip {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; min-height: 52px; font: inherit; text-align: left;
  color: var(--text); background: var(--card); border: 1px solid var(--border); border-radius: 999px; cursor: pointer;
}
.kid-chip b { display: block; font-size: 15px; }
.kid-chip small { display: block; font-size: 12px; color: var(--muted); }
.kid-cheer {
  position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100dvh; z-index: 101; display: grid; place-content: center; justify-items: center; gap: 8px;
  font-size: 32px; font-weight: 700; pointer-events: none; text-align: center;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  animation: kid-pop 0.4s ease-out;
}
.kid-cheer[hidden] { display: none; }
.kid-cheer-icon { font-size: 110px; line-height: 1; animation: kid-spin 1s ease-out; }
.kid-cheer.big .kid-cheer-icon { font-size: 150px; }
@keyframes kid-pop { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
@keyframes kid-spin { from { transform: rotate(-30deg) scale(0.4); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .kid-cheer, .kid-cheer-icon { animation: none; }
  .kid-exit.holding::before { transition: none; }
  .kid-tile.speaking { animation: none; outline: 4px solid var(--kid); }
}

/* Admin → Beta program: a switch per role under each feature */
#beta-features .feature-roles { flex-direction: column; align-items: stretch; gap: 6px; }
.chip:disabled { opacity: .6; cursor: default; }

/* Content creators: the suggest form, and published packs in Admin → Packs. */
.suggest-fields { display: grid; gap: 10px; min-width: 0; margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: 12px; }
.suggest-fields legend { padding: 0 4px; }
.suggest-fields input:not([type=checkbox]), .suggest-fields select { min-width: 0; }
fieldset.suggest-fields.invalid, div.suggest-fields.invalid { border-color: #dc2626; }
.suggest-fields .invalid { outline: 2px solid #dc2626; outline-offset: 1px; border-radius: 8px; }
.suggest-pair { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px; }
.suggest-pair [name=emoji] { text-align: center; }
.suggest-stack, .suggest-age { display: grid; gap: 10px; }
.suggest-stack[hidden], .suggest-age[hidden] { display: none; }
.suggest-forms { display: grid; gap: 12px; }
.suggest-actions { display: grid; gap: 8px; }
.suggest-note { display: grid; gap: 10px; }
.suggest-note[hidden] { display: none; }
.pack-creator, .pack-more { margin-top: 12px; }
.pack-creator button { flex: 1 1 100%; }
.pack-more { justify-content: space-between; }
.feedback-about { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-weight: 600; }
.feedback-about[hidden] { display: none; }
.stage-chips { margin-top: 6px; }
.stage-roles { flex-basis: 100%; }
.live-item:not(.live-pack) { margin-left: 16px; }
.live-item { flex-wrap: wrap; }
.live-item[hidden] { display: none; }
.live-toggle { display: block; margin-top: 2px; font-size: 0.85em; text-align: start; }
.live-item .stage-chips { flex-basis: 100%; }

/* Admin → 📈 Usage. The tables scroll sideways inside the sheet rather than widening it. */
#beta-dialog .sheet-body { grid-template-columns: minmax(0, 1fr); }
#usage-report { display: grid; gap: 10px; min-width: 0; }
.usage-scroll { overflow-x: auto; max-width: 100%; }
.usage-table { width: 100%; border-collapse: collapse; font-size: 0.9em; font-variant-numeric: tabular-nums; }
.usage-table th, .usage-table td { padding: 6px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.usage-table th:first-child, .usage-table td:first-child { text-align: left; }
.usage-table th { font-weight: 600; color: var(--muted); white-space: normal; vertical-align: bottom; }
.usage-errors { list-style: none; padding: 0; display: grid; gap: 8px; }
.usage-errors li { overflow-wrap: anywhere; }
.usage-errors small { display: block; color: var(--muted); }

/* 🏟 Clubs (feature org-units, ui/club/view.js): the demo club. */
.club-demo-bar { margin: 0; padding: 8px 10px; border-radius: 10px; background: #fff7ed; color: #9a3412; font-size: 0.9em; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .club-demo-bar { background: #431407; color: #fed7aa; } }
:root[data-theme=dark] .club-demo-bar { background: #431407; color: #fed7aa; }
.club-title { display: flex; align-items: center; gap: 10px; }
.club-title small { display: block; }
.club-emoji { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; font-size: 24px; flex: none; }
.club-as { margin: 0; }
.club-hello { margin: 0; font-size: 1.1em; font-weight: 600; }
.club-card { list-style: none; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); display: grid; gap: 8px; }
.club-card p { margin: 0; }
.club-card h3 { margin: 4px 0 0; font-size: 15px; }
.club-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px; }
.club-card-head span { color: var(--muted); font-size: 0.9em; }
.club-packs { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.club-list { border-top: 1px solid var(--border); padding-top: 8px; }
.club-list-head { display: flex; justify-content: space-between; gap: 8px; }
.club-list ol, .club-list ul { margin: 6px 0; padding-left: 22px; display: grid; gap: 2px; }
.club-xp { color: var(--done); font-weight: 600; white-space: nowrap; }
.club-note { color: var(--muted); font-size: 0.88em; }
.club-tag { font-size: 0.8em; color: var(--muted); white-space: nowrap; }
.club-members, .club-soon { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.club-members li, .club-soon li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.club-members small, .club-soon small { color: var(--muted); white-space: nowrap; }
.club-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.club-actions button { flex: 1 1 auto; }
.club-qr-box { display: grid; justify-items: center; gap: 4px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; }
.club-qr { width: min(220px, 60vw); height: auto; border-radius: 6px; }
.club-qr-code { margin: 0; font: 600 1.2em/1.2 ui-monospace, monospace; letter-spacing: 0.15em; }
.club-qr-left { margin: 0; font-variant-numeric: tabular-nums; }
.club-grid { border-collapse: collapse; font-size: 0.88em; font-variant-numeric: tabular-nums; }
.club-grid th, .club-grid td { padding: 4px 6px; text-align: center; border-bottom: 1px solid var(--border); white-space: nowrap; }
.club-grid th[scope=row], .club-grid thead th:first-child { text-align: left; }
.club-grid thead th { color: var(--muted); font-weight: 600; }
.club-grid .club-rate { font-weight: 600; }
.club-roll-save { width: 100%; margin: 8px 0; }
.club-came { color: var(--done); font-weight: 700; }
.club-missed { color: var(--muted); }
.club-alerts { margin: 0; padding-left: 18px; }
.club-roll li { flex-wrap: wrap; align-items: center; }
.club-marks { gap: 4px; }
.club-marks .chip { padding: 4px 8px; }
.club-roll-sum { margin: 4px 0; }
.club-cds { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.club-cd { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.club-cd button { justify-self: start; }
.club-cd-expired, .club-cd-approved { opacity: 0.7; }
.club-steps { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.club-step { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.club-step-name { flex: 1 1 140px; min-width: 0; }
.club-step-min { flex: 0 0 4em; width: 4em; }
.club-step-btns { display: flex; gap: 2px; }
.club-step-btns .chip { padding: 4px 8px; }
.club-check { display: flex; align-items: center; gap: 8px; }
.club-xp-pick { display: grid; gap: 4px; }
.club-xp-pick button { justify-self: start; }
.club-invite-text { font-size: 0.9em; overflow-wrap: anywhere; user-select: text; }
.club-setup-name { display: block; width: 100%; box-sizing: border-box; margin-top: 4px; }

/* Shared children (part of child mode, src/ui/share-kid.js) */
.kid-share { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.kid-share p { margin: 0 0 8px; }
.kid-share .link { display: block; margin-top: 8px; }
.share-code { display: inline-block; font-size: 1.15rem; letter-spacing: 0.06em; padding: 6px 10px; border-radius: 8px; background: rgba(127, 127, 127, 0.12); user-select: all; }
.kid-join input { width: 100%; font-family: ui-monospace, monospace; letter-spacing: 0.04em; }
.kid-join button { margin-top: 12px; width: 100%; }
.club-medals { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.club-medal { display: grid; justify-items: center; min-width: 44px; padding: 4px 6px; border-radius: 10px; background: rgba(127, 127, 127, 0.1); }
.club-medal span { font-size: 24px; line-height: 1.2; }
.club-medal small { color: var(--muted); font-size: 0.75em; }
.club-medal-locked span { filter: grayscale(1); opacity: 0.35; }
.club-own-new { display: flex; gap: 6px; margin-top: 6px; }
.club-own-new input { flex: 1 1 0; width: 0; min-width: 0; }
.club-own-new button { flex: none; }
.club-own .club-members li { align-items: center; }
.club-own .chip { padding: 2px 8px; }
.club-tell-text { width: 100%; box-sizing: border-box; font: inherit; }
.club-cd p { margin: 0; }
.club-cd-spots { color: var(--accent); font-weight: 600; }
.club-task-spots { display: flex; align-items: center; gap: 12px; }
.club-task-spots span { min-width: 8em; text-align: center; font-weight: 600; }
.club-set-name, .club-set-team-name { display: block; width: 100%; box-sizing: border-box; margin-top: 4px; }
.club-set-team .chips { margin-bottom: 4px; }
.club-set-time { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.club-swatch { width: 36px; height: 36px; min-width: 36px; padding: 0; border-radius: 50%; }
.club-swatch[aria-pressed="true"] { outline: 3px solid var(--text, currentColor); outline-offset: 2px; }
.club-licence-bar { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; margin: 6px 0; }
.club-licence-bar span { display: block; height: 100%; background: var(--accent); }
.club-licence-remind { color: var(--accent); font-weight: 600; }
.club-covers { padding-left: 1.2em; margin: 0; }
.club-covers li { margin: 4px 0; }
.club-tn { width: 100%; border-collapse: collapse; font-size: 0.95em; }
.club-tn th, .club-tn td { padding: 6px 4px; border-bottom: 1px solid var(--border); }
.club-tn thead th { color: var(--muted); font-weight: 600; text-align: center; }
.club-tn td { text-align: center; }
.club-tn td:last-child { white-space: nowrap; }
.club-tn th[scope="row"] { overflow-wrap: anywhere; hyphens: auto; }
.club-tn th[scope="row"] { text-align: left; font-weight: 500; }
.club-tn-up { color: var(--done); font-weight: 700; }
.club-tn-down { color: #ea580c; font-weight: 700; }
.club-tn-same { color: var(--muted); }
.club-tn-checks { font-weight: 600; }
.club-support-bar { display: block; width: 100%; text-align: left; border: 0; margin-bottom: 10px; font-weight: 600; cursor: pointer; }
.club-task-name { display: block; width: 100%; box-sizing: border-box; margin-top: 4px; }
