/* Fixed light theme -- deliberately not following prefers-color-scheme, so
   the brand looks the same for every visitor regardless of their device's
   dark-mode setting. */
:root {
  color-scheme: light;
  --bg: #e3f6f1;
  --fg: #16161a;
  --ink: #16161a;
  --muted: #6b6b74;
  --card-bg: #ffffff;
  --line: #16161a;

  --standard: #ff6b4a;
  --speed: #e24a8f;
  --infinite: #5b6ef5;
  --daily: #22b8a0;
  --chip-fg: #ffffff;

  /* Sequential ramp off --daily (light -> full hue) for the activity
     calendar -- one hue, monotone lightness, so "more riffs" reads as
     "darker" rather than a second color appearing. */
  --daily-tint-1: #c8ede7;
  --daily-tint-2: #85d8cb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background-color 0.3s ease;
}

/* ---------- topbar ---------- */
.topbar {
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
  background: var(--card-bg);
  border-bottom: 2.5px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  gap: 0.5rem;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.icon-btn {
  font-size: 0.95rem;
  line-height: 1;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  border: 2px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  padding: 0;
}
.icon-btn:active { transform: scale(0.92); }

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  height: 2rem;
  padding: 0 0.7rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card-bg);
}
.streak-flame { flex-shrink: 0; transition: fill 0.15s ease, stroke 0.15s ease; }
.streak-flame.lit { fill: var(--standard); stroke: color-mix(in srgb, var(--standard) 65%, black); }
.streak-num { font-size: 0.85rem; font-weight: 800; color: var(--ink); }

.login-btn {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink);
  background: transparent;
  border: 2px solid var(--line);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.login-btn:hover { background: var(--bg); }

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 9px;
  background: var(--card-bg);
  border: 2.5px solid var(--line);
  transform: rotate(-5deg);
  box-shadow: 2px 2px 0 var(--line);
}

.wordmark {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 800;
  font-size: 1.55rem;
  letter-spacing: -0.01em;
}

/* RiffDaily is longer than the old wordmark -- without this the topbar
   overflows and clips the sign-in/account button on narrow phones. */
@media (max-width: 420px) {
  .topbar { padding: 0.75rem 0.85rem; gap: 0.35rem; }
  .wordmark { font-size: 1.15rem; }
  .topbar-actions { gap: 0.3rem; }
}
@media (max-width: 340px) {
  .topbar { padding: 0.6rem 0.4rem; gap: 0.15rem; }
  .wordmark { font-size: 0.9rem; }
  .topbar-actions { gap: 0.15rem; }
  .logo-badge { width: 1.9rem; height: 1.9rem; }
  .icon-btn { width: 1.6rem; height: 1.6rem; }
  .streak-badge { padding: 0 0.4rem; }
  .login-btn { padding: 0.25rem 0.5rem; font-size: 0.68rem; }
}

/* ---------- layout ---------- */
main {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 2rem 1.5rem;
}

main > .card { width: 100%; max-width: 440px; }
.card { background: transparent; position: relative; }

/* ---------- home / hero ---------- */
#home {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  text-align: center;
}

.hero-logo {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 16px;
  background: var(--card-bg);
  border: 3px solid var(--line);
  transform: rotate(-5deg);
  box-shadow: 4px 4px 0 var(--line);
}
.hero-logo:hover, .hero-logo:focus-visible { animation: logo-wiggle 0.5s ease; }
@keyframes logo-wiggle {
  0% { transform: rotate(-5deg) scale(1); }
  25% { transform: rotate(7deg) scale(1.06); }
  50% { transform: rotate(-9deg) scale(1.06); }
  75% { transform: rotate(5deg) scale(1.03); }
  100% { transform: rotate(-5deg) scale(1); }
}
.hero-logo-badge {
  position: absolute;
  bottom: -0.55rem;
  right: -0.55rem;
  width: 1.7rem;
  height: 1.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--standard);
  color: var(--chip-fg);
  border: 2.5px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
  box-shadow: 2px 2px 0 var(--line);
}

.hero-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.2rem;
  font-weight: 800;
  margin: 0.4rem 0 0;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
  max-width: 32ch;
  margin: 0 0 0.6rem;
  font-weight: 500;
}

.bubble-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.bubble {
  --shadow-c: color-mix(in srgb, var(--standard) 55%, black);
  position: relative;
  width: 100%;
  min-height: 68px;
  border-radius: 20px;
  border: 2.5px solid var(--line);
  background: var(--standard);
  color: var(--chip-fg);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.75rem 1.1rem;
  cursor: pointer;
  text-align: left;
  box-shadow: 5px 5px 0 var(--shadow-c);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.bubble-speed { background: var(--speed); --shadow-c: color-mix(in srgb, var(--speed) 55%, black); }
.bubble-infinite { background: var(--infinite); --shadow-c: color-mix(in srgb, var(--infinite) 55%, black); }
.bubble-daily { background: var(--daily); --shadow-c: color-mix(in srgb, var(--daily) 55%, black); }
.bubble:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--shadow-c); }
.bubble:active { transform: translate(5px, 5px); box-shadow: 0 0 0 var(--shadow-c); }

.bubble-icon { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bubble-text { display: flex; flex-direction: column; gap: 0.1rem; }
.bubble-label { font-size: 1.05rem; font-weight: 800; }

.bubble-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--ink);
  background: var(--card-bg);
  border: 1.5px solid var(--line);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.bubble-badge svg { flex-shrink: 0; }

/* ---------- stage ---------- */
#stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  min-height: 220px;
  justify-content: center;
  text-align: center;
}

.quit-btn {
  position: absolute;
  top: -0.5rem;
  left: -0.5rem;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--card-bg);
  color: var(--fg);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.quit-btn:active { transform: scale(0.92); }

.prep { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.prep-count { font-size: 4rem; font-weight: 800; color: var(--mode-color, var(--standard)); animation: pop 1s ease; }
@keyframes pop {
  0% { transform: scale(0.6); opacity: 0; }
  30% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.prep-label { color: var(--muted); font-size: 0.9rem; margin: 0; font-weight: 600; }

.level-badge {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--ink);
  border: 2px solid var(--line);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
}

.prompt {
  font-size: 2.1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
  letter-spacing: -0.01em;
  max-height: 220px;
  overflow-y: auto;
  width: 100%;
  box-sizing: border-box;
  padding: 0 0.25rem;
  align-content: center;
}
.prompt-grow { min-height: 220px; }
.prompt span:not(.connector) { color: var(--mode-color, var(--standard)); }
.connector { color: var(--muted); font-size: 1.4rem; font-weight: 700; margin: 0 0.15rem; }

.timer-wrap { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.timer { font-size: 3.2rem; font-variant-numeric: tabular-nums; color: var(--fg); font-weight: 800; letter-spacing: -0.02em; }
.paused-badge {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--ink);
  border: 2px solid var(--line);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
}

/* ---------- daily transcript ---------- */
.transcript-box {
  width: 100%;
  min-height: 140px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--card-bg);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  box-sizing: border-box;
}
.transcript-text { margin: 0; font-size: 0.9rem; line-height: 1.5; text-align: left; color: var(--fg); }
.transcript-text .interim { color: var(--muted); }
.transcript-note { font-size: 0.78rem; color: var(--muted); font-style: italic; }

/* ---------- result ---------- */
.result {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  padding: 1.5rem 1.25rem;
  border: 2.5px solid var(--line);
  border-radius: 20px;
  background: var(--card-bg);
  box-shadow: 4px 4px 0 var(--line);
}
.result-words { font-size: 1.7rem; font-weight: 800; margin: 0; letter-spacing: -0.01em; }
.result-time { font-size: 1.05rem; color: var(--muted); margin: 0; font-weight: 600; }
.result-time strong { color: var(--fg); font-size: 1.5rem; }

.pill {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink);
  background: var(--card-bg);
  border: 2px solid var(--line);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.action-row, .result-actions { display: flex; gap: 0.75rem; }

#play-again-btn, .ghost-btn {
  --shadow-c: var(--line);
  font-size: 1rem;
  font-weight: 800;
  padding: 0.75rem 1.6rem;
  border-radius: 999px;
  cursor: pointer;
  border: 2.5px solid var(--line);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  box-shadow: 3px 3px 0 var(--shadow-c);
}
#play-again-btn { --shadow-c: color-mix(in srgb, var(--standard) 55%, black); background: var(--standard); color: var(--chip-fg); }
.ghost-btn { background: var(--card-bg); color: var(--fg); }
.small-btn { font-size: 0.82rem; padding: 0.5rem 1rem; }
#play-again-btn:hover, .ghost-btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--shadow-c); }
#play-again-btn:active, .ghost-btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--shadow-c); }
.ghost-btn:disabled {
  cursor: not-allowed;
  opacity: 0.4;
  box-shadow: none;
}
.ghost-btn:disabled:hover { transform: none; box-shadow: none; }

.hint { font-size: 0.8rem; color: var(--muted); margin: 0; font-weight: 600; }

/* ---------- profile ---------- */
#profile { display: flex; flex-direction: column; gap: 1rem; }
.profile-head { display: flex; align-items: center; justify-content: space-between; }
.section-title { font-family: Georgia, serif; font-size: 1.5rem; font-weight: 800; margin: 0; }
.sub-title { font-size: 0.95rem; font-weight: 800; margin: 0.5rem 0 0; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.stat-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.9rem 0.5rem;
  border: 2.5px solid var(--line);
  border-radius: 16px;
  box-shadow: 3px 3px 0 var(--line);
  background: var(--card-bg);
}
.stat-num { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.stat-key { font-size: 0.72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }

.stat-tile-clickable { cursor: pointer; }
.stat-tile-clickable:active { transform: scale(0.97); }
.stat-tile-clickable.stat-tile-active { background: var(--bg); }
.stat-chevron { display: inline-block; font-size: 0.6rem; margin-left: 0.05rem; }

.stat-receipt {
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: -0.25rem;
}
.stat-receipt-headline { margin: 0; font-size: 0.8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stat-receipt-words { margin: 0; font-size: 1rem; font-weight: 800; line-height: 1.35; }
.stat-receipt-meta { margin: 0; font-size: 0.75rem; color: var(--muted); font-weight: 600; }

.section-hint { color: var(--muted); font-size: 0.78rem; line-height: 1.4; margin: -0.3rem 0 0.6rem; }

/* ---------- activity calendar ---------- */
.activity-calendar { display: flex; flex-direction: column; gap: 0.55rem; overflow-x: auto; padding: 2px; }
.activity-grid { display: flex; gap: 3px; width: fit-content; }
.activity-col { display: flex; flex-direction: column; gap: 3px; }
.activity-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1.5px solid var(--line);
  background: var(--card-bg);
  flex-shrink: 0;
}
.activity-cell-void { border-color: transparent; background: transparent; }
.activity-level-0 { background: var(--card-bg); }
.activity-level-1 { background: var(--daily-tint-1); }
.activity-level-2 { background: var(--daily-tint-2); }
.activity-level-3 { background: var(--daily); }
.activity-today { outline: 2px solid var(--line); outline-offset: 1px; }
.activity-legend { display: flex; align-items: center; gap: 0.3rem; font-size: 0.68rem; color: var(--muted); font-weight: 700; }
.activity-legend .activity-cell { width: 12px; height: 12px; }

.today-bar {
  display: flex;
  height: 22px;
  border: 2px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.today-bar-seg { height: 100%; min-width: 3px; }
.today-bar-seg:not(:last-child) { border-right: 2px solid var(--line); }
.today-bar-standard { background: var(--standard); }
.today-bar-speed { background: var(--speed); }
.today-bar-infinite { background: var(--infinite); }
.today-bar-daily { background: var(--daily); }

.today-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 0.15rem;
}
.today-row {
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--card-bg);
  font-size: 0.85rem;
  cursor: pointer;
}
.today-row-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.today-row-detail { margin: 0.5rem 0 0; padding-top: 0.5rem; border-top: 2px dashed var(--line); }
.today-row-detail p { margin: 0; font-size: 0.8rem; color: var(--muted); }
.h-mode { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.h-mode-standard { color: var(--standard); }
.h-mode-speed { color: var(--speed); }
.h-mode-infinite { color: var(--infinite); }
.h-mode-daily { color: var(--daily); }
.h-label { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-time { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }

.analysis-content { display: flex; flex-direction: column; gap: 0.5rem; }
.analysis-lead { font-size: 0.95rem; font-weight: 700; margin: 0; }
.analysis-row { display: flex; align-items: center; gap: 0.6rem; }
.analysis-cat { width: 9.5rem; flex-shrink: 0; font-size: 0.8rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.analysis-track {
  flex: 1;
  height: 18px;
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.analysis-fill { height: 100%; background: var(--speed); border-radius: 999px; min-width: 10px; }
.analysis-count { font-size: 0.8rem; font-weight: 800; width: 1.6rem; text-align: right; flex-shrink: 0; }

.empty-note { color: var(--muted); font-size: 0.82rem; line-height: 1.5; margin: 0.25rem 0 0; }

/* ---------- how-to-play (embedded in profile) ---------- */
.howto-box {
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  background: var(--card-bg);
}
.howto-box p { font-size: 0.88rem; line-height: 1.5; margin: 0 0 0.75rem; }
.howto-list { list-style: none; margin: 0 0 0.75rem; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.howto-list li { font-size: 0.85rem; line-height: 1.5; }
.howto-hint { color: var(--muted); font-size: 0.78rem !important; font-weight: 600; margin: 0 !important; }

/* ---------- how-to-play modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 40;
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  max-height: 85vh;
  overflow-y: auto;
  border: 2.5px solid var(--line);
  border-radius: 20px;
  background: var(--card-bg);
  box-shadow: 5px 5px 0 var(--line);
  padding: 1.5rem 1.25rem 1.25rem;
}
.modal-close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  width: 1.8rem;
  height: 1.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  color: var(--fg);
  border: 2px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
}
.modal-close:active { transform: scale(0.92); }
.modal-title { font-family: Georgia, "Times New Roman", serif; font-size: 1.4rem; font-weight: 800; margin: 0 0 0.9rem; letter-spacing: -0.01em; }
.modal-card .howto-box { border: none; padding: 0; }

/* ---------- group member management ---------- */
.member-modal-card { max-width: 420px; }
.member-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.6rem; }
.member-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  font-size: 0.82rem;
}
.member-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-role { font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.02em; }
.member-stat { margin-left: auto; display: inline-flex; align-items: center; gap: 0.2rem; font-weight: 700; color: var(--muted); font-size: 0.78rem; }
.member-stat + .member-stat { margin-left: 0.5rem; }
.member-flame { flex-shrink: 0; }
.member-count-note { font-size: 0.75rem; color: var(--muted); margin: 0 0 0.7rem; }
.member-approval-toggle { border-top: 2px dashed var(--line); padding-top: 0.7rem; margin-top: 0.3rem; }
.member-approval-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; font-weight: 700; cursor: pointer; }
.pending-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.4rem; }
.pending-row .member-name { flex: 1; }
.member-row-confirm { flex-direction: column; align-items: stretch; gap: 0.4rem; }
.member-row-confirm p { margin: 0; font-weight: 700; line-height: 1.4; }
.member-remove-btn { flex-shrink: 0; }

.share-modal-card { max-width: 440px; }
.share-preview-img {
  display: block;
  width: 100%;
  border-radius: 16px;
  border: 2px solid var(--line);
  margin: 0 0 1rem;
}
.share-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

/* ---------- account dropdown (topbar) ---------- */
.account-menu { position: relative; }
.account-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 150px;
  background: var(--card-bg);
  border: 2px solid var(--line);
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--line);
  overflow: hidden;
  z-index: 15;
}
.account-dropdown-item {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  text-decoration: none;
  background: none;
  border: none;
  border-bottom: 2px solid var(--line);
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: inherit;
  color: var(--fg);
  cursor: pointer;
}
.account-dropdown-item:hover { background: var(--bg); }
.account-dropdown form .account-dropdown-item { border-bottom: none; }
.account-dropdown-danger { color: var(--standard); }

/* ---------- auth pages (login / register) ---------- */
.auth-card { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; text-align: center; }
.auth-back { align-self: flex-start; font-size: 0.82rem; font-weight: 700; color: var(--muted); text-decoration: none; margin-bottom: 0.5rem; }
.auth-back:hover { color: var(--fg); }
.auth-title { font-family: Georgia, serif; font-size: 1.6rem; font-weight: 800; margin: 0.3rem 0 0; }
.auth-sub { color: var(--muted); font-size: 0.85rem; line-height: 1.5; max-width: 30ch; margin: 0 0 0.5rem; }
.privacy-card { text-align: left; align-items: stretch; }
.privacy-card .auth-sub { max-width: none; }
.privacy-body { font-size: 0.85rem; line-height: 1.55; }
.privacy-body h2 { font-size: 0.95rem; margin: 1rem 0 0.4rem; }
.privacy-body p { margin: 0 0 0.6rem; }
.privacy-body ul { margin: 0 0 0.6rem; padding-left: 1.2rem; }
.privacy-body li { margin-bottom: 0.35rem; }
.privacy-body a { color: var(--fg); }
/* Always rendered (even empty) so a validation error never shifts the
   layout when it appears/disappears -- the space is reserved up front. */
.field-error {
  min-height: 1rem;
  margin: 0;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1rem;
  color: var(--standard);
}
.auth-form { width: 100%; display: flex; flex-direction: column; gap: 0.4rem; text-align: left; }
.auth-label { font-size: 0.78rem; font-weight: 800; margin-top: 0.4rem; }
.auth-input {
  font: inherit;
  font-size: 0.95rem;
  padding: 0.65rem 0.8rem;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--fg);
}
.auth-input:focus { outline: 2px solid var(--infinite); outline-offset: 1px; }
.auth-submit {
  margin-top: 0.6rem;
  font-size: 1rem;
  font-weight: 800;
  padding: 0.75rem 1.6rem;
  border-radius: 999px;
  border: 2.5px solid var(--line);
  background: var(--standard);
  color: var(--chip-fg);
  cursor: pointer;
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--standard) 55%, black);
}
.auth-submit:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 color-mix(in srgb, var(--standard) 55%, black); }
.auth-submit:active { transform: translate(3px, 3px); box-shadow: 0 0 0 color-mix(in srgb, var(--standard) 55%, black); }
.auth-switch { font-size: 0.85rem; color: var(--muted); margin: 0.4rem 0 0; }
.auth-switch a { color: var(--fg); font-weight: 700; }
.auth-links-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
}
.auth-links-row a { color: var(--fg); font-weight: 700; text-decoration: underline; }
.auth-switch-link {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--fg);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}
.code-input { text-align: center; font-size: 1.3rem; font-weight: 800; letter-spacing: 0.5rem; }
.auth-devbox {
  width: 100%;
  box-sizing: border-box;
  margin-top: 0.75rem;
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  text-align: left;
}
.auth-dev-label { font-size: 0.75rem; font-weight: 800; color: var(--muted); margin: 0 0 0.3rem; }
.auth-dev-cred { font-size: 0.82rem; margin: 0.15rem 0; }
.auth-dev-cred code { background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 0.05rem 0.35rem; }

.auth-success {
  width: 100%;
  box-sizing: border-box;
  background: color-mix(in srgb, var(--daily) 18%, var(--card-bg));
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.settings-section { width: 100%; box-sizing: border-box; text-align: left; padding-top: 1rem; margin-top: 1rem; border-top: 2px dashed var(--line); }
.settings-section:first-of-type { padding-top: 0; margin-top: 0.2rem; border-top: none; }
.settings-section-title { font-size: 0.95rem; font-weight: 800; margin: 0 0 0.35rem; }
.settings-current { font-size: 0.82rem; color: var(--muted); margin: 0 0 0.5rem; }
.verify-badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.verify-badge-yes { background: color-mix(in srgb, var(--daily) 25%, var(--card-bg)); }
.verify-badge-no { background: color-mix(in srgb, var(--standard) 20%, var(--card-bg)); }

.field-wrap { position: relative; width: 100%; }
.field-wrap .auth-input { padding-right: 2.5rem; width: 100%; box-sizing: border-box; }
.field-status-icon {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%) scale(0.6);
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 900;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.field-status-icon.ok, .field-status-icon.bad { opacity: 1; transform: translateY(-50%) scale(1); }
.field-status-icon.ok { background: var(--daily); }
.field-status-icon.bad { background: var(--standard); }
.field-status-icon.checking { opacity: 1; transform: translateY(-50%) scale(1); background: var(--muted); }
.resend-form { margin-top: 0.5rem; }
.settings-submit { padding: 0.6rem 1.3rem; font-size: 0.88rem; }
.settings-section-signout { display: flex; justify-content: center; }
.settings-signout { color: var(--standard); }
.settings-privacy { font-size: 0.75rem; color: var(--muted); text-align: center; line-height: 1.5; margin: 0.5rem 0 0; }
.settings-privacy a { color: var(--fg); font-weight: 700; }

.settings-danger-zone {
  width: 100%;
  box-sizing: border-box;
  margin-top: 1rem;
  border: 2px dashed var(--standard);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  text-align: left;
}
.settings-danger-zone summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--standard);
}
.settings-danger-note { font-size: 0.76rem; color: var(--muted); line-height: 1.5; margin: 0.6rem 0; }
.settings-danger-submit { background: var(--standard); }

.share-transcript {
  width: 100%;
  box-sizing: border-box;
  margin-top: 0.4rem;
  border: 2px dashed var(--daily);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  text-align: left;
}
.share-transcript summary { cursor: pointer; font-weight: 800; font-size: 0.85rem; color: var(--daily); }
.share-transcript-body { font-size: 0.85rem; line-height: 1.6; margin: 0.6rem 0 0; white-space: pre-wrap; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--line);
  color: var(--bg);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  z-index: 20;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

/* ---------- daily transcript view + send (result screen) ---------- */
.transcript-view-wrap { width: 100%; display: flex; flex-direction: column; gap: 0.5rem; align-items: center; }
.transcript-view-box { text-align: left; width: 100%; }
.transcript-toggle {
  background: none;
  border: none;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.transcript-toggle:hover { color: var(--fg); }
.daily-post-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; align-items: stretch; }
.daily-post-actions button { flex: 1 1 0; min-width: 150px; font-size: 0.95rem; padding: 0.65rem 1rem; text-align: center; white-space: nowrap; }
.send-status { font-size: 0.8rem; color: var(--muted); font-weight: 700; text-align: center; margin: 0; }
.send-btn {
  --shadow-c: color-mix(in srgb, var(--daily) 55%, black);
  font-size: 0.95rem;
  font-weight: 800;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  cursor: pointer;
  border: 2.5px solid var(--line);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  box-shadow: 3px 3px 0 var(--shadow-c);
  background: var(--daily);
  color: var(--chip-fg);
}
.send-btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--shadow-c); }
.send-btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--shadow-c); }
.send-btn:disabled { opacity: 0.6; cursor: default; transform: none; box-shadow: 3px 3px 0 var(--shadow-c); }

/* ---------- board ---------- */
#board { display: flex; flex-direction: column; gap: 1rem; }
main:has(#board:not(.hidden)) { align-items: flex-start; }

.board-title { margin: 0; text-align: center; }

.board-tabs-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: nowrap; }
.board-actions-row { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.board-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}
.board-tab {
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card-bg);
  color: var(--fg);
  cursor: pointer;
}
.board-tab.active { background: var(--infinite); color: var(--chip-fg); }

/* ---------- groups dropdown (replaces the old sliding per-group tabs) ---------- */
.groups-menu-wrap { position: relative; flex-shrink: 0; }
.groups-menu-trigger { display: inline-flex; align-items: center; gap: 0.3rem; }
.groups-menu-caret { font-size: 0.7em; opacity: 0.7; }
.groups-menu-panel {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  z-index: 15;
  min-width: 230px;
  max-width: min(320px, 80vw);
  max-height: 320px;
  overflow-y: auto;
  background: var(--card-bg);
  border: 2px solid var(--line);
  border-radius: 14px;
  box-shadow: 3px 3px 0 var(--line);
  padding: 0.5rem;
}
.groups-menu-list { display: flex; flex-direction: column; gap: 0.35rem; }
.groups-menu-empty { margin: 0.2rem 0.2rem 0; }
.groups-menu-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 0.35rem 0.4rem 0.35rem 0.65rem;
}
.groups-menu-row.active { background: color-mix(in srgb, var(--infinite) 16%, var(--card-bg)); border-color: var(--infinite); }
.groups-menu-select {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: none;
  border: none;
  font: inherit;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--fg);
  cursor: pointer;
  padding: 0.2rem 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.groups-menu-row-actions { display: flex; gap: 0.25rem; flex-shrink: 0; }
.icon-btn-sm {
  width: 1.7rem;
  height: 1.7rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--fg);
  font-size: 0.78rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.icon-btn-sm:hover { background: var(--bg); }
.icon-btn-sm.danger { color: var(--standard); border-color: var(--standard); }
.icon-btn-sm-muted { opacity: 0.4; background: var(--bg); }
.icon-btn-sm-muted:hover { opacity: 0.6; }
.groups-menu-rename-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.25rem 0.45rem;
  border: 2px solid var(--infinite);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
}
.groups-menu-confirm { flex-direction: column; align-items: stretch; gap: 0.4rem; padding: 0.5rem 0.55rem; }
.groups-menu-confirm p { margin: 0; font-size: 0.78rem; font-weight: 700; line-height: 1.4; }
.groups-menu-confirm-actions { display: flex; gap: 0.4rem; }
.groups-menu-confirm-actions button { flex: 1; }

/* ---------- + Group popover ---------- */
.group-new-wrap { position: relative; flex-shrink: 0; }
.group-actions {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 15;
  min-width: 230px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--card-bg);
  border: 2px solid var(--line);
  border-radius: 14px;
  box-shadow: 3px 3px 0 var(--line);
  padding: 0.6rem;
}
.group-form { display: flex; gap: 0.5rem; }
.group-input { flex: 1; padding: 0.5rem 0.7rem; font-size: 0.85rem; }
.group-invite-note {
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--card-bg);
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  margin: 0;
}

.board-content { display: flex; flex-direction: column; gap: 0.9rem; }

.board-divider { display: flex; align-items: center; gap: 0.6rem; color: var(--muted); font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.board-divider::before, .board-divider::after { content: ""; flex: 1; height: 2px; background: var(--line); opacity: 0.25; }

.your-card {
  position: relative;
  border: 2.5px solid var(--line);
  border-left: 6px solid var(--daily);
  border-radius: 18px;
  padding: 1rem 1.1rem 1.3rem;
  background: var(--card-bg);
  box-shadow: 4px 4px 0 var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.your-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.your-card-user { font-size: 0.85rem; font-weight: 800; }
.your-card-words { font-size: 1.05rem; font-weight: 800; margin: 0.1rem 0; }
.your-card-transcript { font-size: 0.85rem; line-height: 1.45; margin: 0; color: var(--fg); }
.your-card-rank { font-size: 0.72rem; font-weight: 700; color: var(--muted); }
.your-card-delete {
  flex-shrink: 0;
  width: 1.7rem;
  height: 1.7rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card-bg);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.your-card-delete:hover { background: var(--bg); }
.your-card-confirm { padding: 1rem 1.1rem; }
.your-card-confirm p { margin: 0 0 0.6rem; font-size: 0.85rem; font-weight: 700; line-height: 1.4; }

.corner-badge {
  position: absolute;
  bottom: -0.6rem;
  right: 0.9rem;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--ink);
  background: var(--card-bg);
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}

.board-preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem 0.7rem; }
.preview-card {
  position: relative;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 0.65rem 0.75rem 1rem;
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  cursor: pointer;
}
.preview-card:hover { background: var(--bg); }
.preview-card:focus-visible { outline: 2px solid var(--infinite); outline-offset: 2px; }
.preview-user { font-size: 0.78rem; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-words { font-size: 0.78rem; font-weight: 700; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-time { font-size: 0.7rem; font-weight: 700; color: var(--muted); }
.preview-transcript {
  margin-top: 0.15rem;
  padding-top: 0.4rem;
  border-top: 1.5px dashed var(--line);
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--fg);
}

.upvote-btn-corner {
  position: absolute;
  bottom: -0.6rem;
  right: 0.7rem;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card-bg);
  color: var(--fg);
  cursor: pointer;
}
.upvote-btn-corner:disabled { cursor: default; opacity: 0.55; }
.upvote-btn-corner.upvote-btn-active { background: var(--standard); color: var(--chip-fg); opacity: 1; }

/* ---------- utility ---------- */
.hidden { display: none !important; }
#stage > *:not(.hidden), #profile > *:not(.hidden), #board > *:not(.hidden) { animation: fade-in 0.2s ease; }
@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
