:root {
  /* Warm ivory & sand palette (no pure white). */
  --bg: #efe7d8;
  --surface: #fbf6ec;
  --surface-2: #f1e8d8;
  --field: #fffaf1;
  --text: #22201b;
  --muted: #6e6658;
  --border: #e2d6c1;
  --primary: #0f766e;
  --primary-ink: #fbf6ec;
  --primary-soft: #d5efe9;
  --accent: #c2410c;
  --gold: #b7791f;
  --danger: #b42318;
  --good: #15803d;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 8px 24px rgb(0 0 0 / 0.06);
  --radius: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141412;
    --surface: #1e1d1a;
    --field: #24231f;
    --surface-2: #272622;
    --text: #f1eee7;
    --muted: #a39f95;
    --border: #35332e;
    --primary: #2dd4bf;
    --primary-ink: #062b27;
    --primary-soft: #11332f;
    --accent: #fb923c;
    --gold: #f6c05c;
    --danger: #f87171;
    --good: #4ade80;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }

/* --- top bar ---------------------------------------------------------- */

/* Language → brand on the left, profile on the right. */
/* One row: language → brand | Speak/Listen/Write (centered) | profile.
   Narrower screens move the switch to a centered second row. */
.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: "brand modes account";
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand-group { grid-area: brand; }
.tabs-account { grid-area: account; justify-self: end; }
@media (max-width: 960px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand account" "modes modes";
    row-gap: 12px;
  }
}

/* Speak / Listen / Write: segmented switch, centered in the header. */
.modes {
  grid-area: modes; justify-self: center;
  display: flex; gap: 4px; width: fit-content; max-width: 100%; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
}
.modes a {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  padding: 8px 20px 8px 16px; border-radius: 999px; text-decoration: none;
  color: var(--muted); font-weight: 600;
}
.modes svg {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.modes a:hover { color: var(--text); }
.modes a.active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
@media (max-width: 520px) {
  .modes { width: 100%; }
  .modes a { padding: 8px 8px; gap: 6px; font-size: 0.92rem; }
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none;
}

.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--primary); display: grid; place-items: center;
}
.brand-mark svg { width: 20px; height: 20px; fill: none; stroke: var(--primary-ink); stroke-width: 2; stroke-linecap: round; }
.brand-mark svg rect { fill: var(--primary-ink); stroke: none; }

.brand-group { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand { white-space: nowrap; }
.brand-from { display: flex; color: var(--muted); }
.brand-from svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Visually hidden, still read by screen readers. */
/* --- profile page (Common Voice-style) ---------------------------------- */

.card.profile-layout { position: relative; display: grid; grid-template-columns: 240px minmax(0, 1fr); padding: 0; overflow: hidden; }
/* × on Profile / Admin cards: back to the previous page. */
.page-close { position: absolute; top: 14px; right: 14px; z-index: 1; }
.profile-nav {
  display: flex; flex-direction: column; gap: 8px; padding: 32px 20px;
  background: linear-gradient(var(--surface-2), var(--surface));
}
.profile-nav a {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px;
  text-decoration: none; color: var(--muted); font-weight: 600;
}
.profile-nav a:hover { color: var(--text); }
.profile-nav a.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgb(0 0 0 / 0.08); }
.profile-nav svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.profile-main { padding: 32px 36px 36px; min-width: 0; }
@media (max-width: 760px) {
  .card.profile-layout { grid-template-columns: 1fr; padding: 0; }
  .profile-nav { flex-direction: row; padding: 14px 16px 0; background: none; }
  .profile-nav a { padding: 9px 14px; }
  .profile-main { padding: 20px 16px 24px; }
}

/* Form fields with the label sitting on the top border. */
.ogrid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 24px; }
@media (max-width: 600px) { .ogrid { grid-template-columns: 1fr; } }
.ofield { position: relative; }
.ofield input, .ofield select { height: 52px; padding: 15px 13px 12px; border-radius: 6px; }
.ofield label {
  position: absolute; top: -8px; left: 10px; padding: 0 5px;
  background: var(--surface); color: var(--muted); font-size: 0.78rem; line-height: 1rem;
}
.lede + .pform { margin-top: 24px; }
.pdivider { border: none; border-top: 1px solid var(--border); margin: 26px 0; }
.pconsent b { display: block; margin-bottom: 4px; font-size: 1rem; }
.psave { display: flex; justify-content: center; }
.psave .btn { min-width: 220px; }

/* Admin window: like Profile, with a reddish side panel so it's unmistakable. */
.admin-layout .profile-nav { background: linear-gradient(#f6dcd8, #fbefed); }
.admin-layout .profile-nav .count {
  margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-size: 0.8rem; text-align: center;
}
@media (prefers-color-scheme: dark) { .admin-layout .profile-nav { background: linear-gradient(#3a1c19, #2a1816); } }
@media (max-width: 760px) { .admin-layout .profile-nav { background: none; } }

/* Old-browser banner (plain colours: it must work where newer CSS doesn't). */
.old-browser {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  background: #7a2e12; color: #fbf6ec; font-size: 0.95rem; line-height: 1.4;
}
.old-browser span { flex: 1; }
.old-browser button {
  flex: none; width: 32px; height: 32px; border: 1px solid #fbf6ec; border-radius: 50%;
  background: transparent; color: #fbf6ec; font-size: 1.3rem; line-height: 1; cursor: pointer;
}

/* Touch-only devices: keyboard shortcuts don't apply. */
@media (hover: none) and (pointer: coarse) {
  .shortcut-hint, .vote-row kbd, .actions kbd { display: none; }
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lang-btn {
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 7px 12px 7px 9px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 0.95rem;
}
.lang-btn:hover { background: var(--surface-2); color: var(--text); }
.lang-btn .chevron {
  width: 16px; height: 16px; margin-left: -2px; flex: none;
  fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform 0.15s ease;
}
.lang-btn[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.flag {
  display: flex; width: 24px; height: 16px; flex: none; overflow: hidden;
  border-radius: 3px; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.12);
}
.flag svg { width: 100%; height: 100%; }

/* Bone white, in dark mode too, so the window keeps its light palette
   (same as the profile menu). */
.lang-dialog {
  --surface: #fbf6ec; --surface-2: #efe5d3; --text: #22201b; --muted: #6e6658;
  --border: #e2ddd2; --primary: #0f766e;
  /* Anchored under the globe button; top/left are set from JS. */
  position: fixed; margin: 0; inset: auto;
  width: min(320px, calc(100vw - 32px)); padding: 14px;
  background: #f9f6ee; color: var(--text);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.08), 0 12px 32px rgb(0 0 0 / 0.16);
}
.lang-dialog::backdrop { background: transparent; }
.lang-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.lang-head h2 { margin: 0; font-size: 1.15rem; }
.lang-dialog ul { list-style: none; margin: 0; padding: 0; max-height: min(320px, 50vh); overflow-y: auto; }
.lang-dialog ul:focus { outline: none; } /* the highlighted row shows where you are */
.lang-dialog li {
  display: flex; align-items: baseline; gap: 8px; padding: 10px 12px; border-radius: 10px; cursor: pointer;
}
.lang-dialog li .native { font-weight: 600; }
.lang-dialog li .alt { color: var(--muted); font-size: 0.85rem; }
.lang-dialog li .tick { margin-left: auto; color: var(--primary); align-self: center; display: flex; }
.lang-dialog li .tick svg { width: 16px; height: 16px; }
.lang-dialog li.active { background: var(--surface-2); }
.lang-dialog li[aria-selected="true"] .native { color: var(--primary); }

.tabs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tabs a {
  padding: 8px 14px; border-radius: 999px; text-decoration: none;
  color: var(--muted); font-weight: 600;
}
.tabs a:hover { background: var(--surface-2); color: var(--text); }
.tabs a.active { background: var(--primary-soft); color: var(--primary); }
/* The Profile tab can hold a contributor's initial and name; keep long names on one line. */
/* Header profile button + its account menu. */
.profile-wrap { position: relative; }
.profile-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 7px 10px 7px 14px; border-radius: 999px; border: none; background: none;
  color: var(--muted); font-weight: 600;
}
.profile-btn:hover { background: var(--surface-2); color: var(--text); }
.profile-btn.active { background: var(--primary-soft); color: var(--primary); }
.profile-label { display: inline-flex; align-items: center; gap: 7px; }
.profile-btn .tab-name { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-btn .chevron {
  width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2;
  stroke-linecap: round; stroke-linejoin: round; transition: transform 0.15s ease;
}
.profile-btn[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.profile-menu {
  /* Bone white, with a light palette even in dark mode (like the language list). */
  --surface-2: #efe5d3; --text: #22201b; --muted: #6e6658; --border: #e2d6c1;
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30;
  min-width: 230px; max-width: calc(100vw - 32px); padding: 6px;
  background: #f9f6ee; color: var(--text); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.08), 0 12px 32px rgb(0 0 0 / 0.16);
}
.profile-menu[hidden] { display: none; }
.menu-head { padding: 8px 12px 10px; color: var(--muted); font-size: 0.88rem; }
.profile-menu .menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 8px;
  border: none; background: none; color: var(--text); font: inherit; font-weight: 600;
  text-decoration: none; text-align: left; cursor: pointer;
}
.profile-menu .menu-item:hover, .profile-menu .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.profile-menu .menu-item svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--border); }

/* Log in / create account window. */
.auth-dialog {
  width: min(400px, calc(100vw - 32px)); padding: 20px; margin: auto;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.auth-dialog::backdrop { background: rgb(0 0 0 / 0.35); }
.auth-dialog .hint { color: var(--muted); font-size: 0.86rem; }
.auth-submit { width: 100%; margin-top: 4px; }
.auth-switch { text-align: center; margin: 14px 0 0; color: var(--muted); font-size: 0.92rem; }
.link-btn { border: none; background: none; padding: 0; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }

.avatar {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--primary); color: var(--primary-ink);
  font-size: 0.78rem; font-weight: 700; line-height: 1;
}
@media (max-width: 520px) {
  .topbar { padding: 12px 16px; }
  .tabs { flex-wrap: nowrap; gap: 2px; }
  .tabs a { padding: 7px 9px; font-size: 0.92rem; }
  .topbar { column-gap: 8px; }
  .brand-group { gap: 6px; }
  /* Phones: the initial alone stands for the name (it's in the tab's tooltip/label). */
  .profile-btn .avatar + .tab-name { display: none; }
  .profile-btn { padding-left: 8px; }
}
@media (max-width: 360px) {
  /* Very narrow: the flag alone shows the language (still read by screen readers). */
  #lang-name {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
}

/* --- stats strip ------------------------------------------------------ */

.stats {
  display: flex; gap: 28px; justify-content: center; flex-wrap: wrap;
  padding: 12px 16px; font-size: 0.9rem; color: var(--muted);
}
.stats[hidden] { display: none; }
.stats b { color: var(--text); font-variant-numeric: tabular-nums; }

/* --- layout ----------------------------------------------------------- */

main {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 16px 40px; /* clear space below the header */
}
@media (max-width: 520px) { main { padding-top: 20px; } }

.speak-card, .listen-card { max-width: 860px; margin: 0 auto; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
@media (max-width: 520px) { .card { padding: 20px 16px; } }

.instruction {
  text-align: center; color: var(--muted); font-weight: 600;
  margin: 0 0 18px; font-size: 0.95rem;
}
/* Headline instruction (Speak, Listen): the app's green; bone white on the dark card in dark mode. */
.instruction-title { color: var(--primary); }
@media (prefers-color-scheme: dark) { .instruction-title { color: #f9f6ee; } }
.instruction-hint { display: block; margin-top: 2px; font-weight: 400; font-size: 0.88rem; }

/* --- progress pills --------------------------------------------------- */

.pills { display: flex; justify-content: center; gap: 8px; margin-bottom: 18px; }
.pill {
  width: 40px; height: 8px; border-radius: 999px; background: var(--surface-2);
  border: none; padding: 0; cursor: pointer;
}
.pill.done { background: var(--primary); }
.pill.current { outline: 2px solid var(--primary); outline-offset: 2px; }

/* --- prompt ----------------------------------------------------------- */

.prompt {
  min-height: 150px;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; gap: 10px; padding: 12px 8px;
}
.prompt .main {
  font-size: clamp(1.4rem, 3.4vw, 2rem); font-weight: 600; line-height: 1.3;
  overflow-wrap: anywhere;
}
.prompt .sub { color: var(--muted); font-size: 1.05rem; }
.lang-tag {
  display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
}

/* --- recorder --------------------------------------------------------- */

.recorder { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 22px 0 6px; }

.mic {
  position: relative;
  width: 92px; height: 92px; border-radius: 50%;
  border: none; cursor: pointer;
  background: var(--primary); color: var(--primary-ink);
  display: grid; place-items: center;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--primary) 40%, transparent);
  transition: transform 0.12s ease, background 0.2s ease;
}
.mic:hover { transform: scale(1.04); }
.mic:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.mic svg { width: 38px; height: 38px; position: relative; z-index: 1; }
/* Waiting for the microphone/audio to start (can take a moment on some devices). */
.mic.starting { animation: mic-starting 0.9s ease-in-out infinite; cursor: progress; }
@keyframes mic-starting { 50% { opacity: 0.6; transform: scale(0.96); } }
@media (prefers-reduced-motion: reduce) { .mic.starting { animation: none; opacity: 0.7; } }
.mic.recording { background: var(--accent); box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 40%, transparent); }
.mic .ring {
  position: absolute; inset: -6px; border-radius: 50%;
  border: 3px solid var(--accent); opacity: 0; pointer-events: none;
  transform: scale(var(--level, 1));
  transition: transform 0.08s linear;
}
.mic.recording .ring { opacity: 0.55; }

.rec-status { font-size: 0.9rem; color: var(--muted); min-height: 1.4em; font-variant-numeric: tabular-nums; }
.rec-status.live { color: var(--accent); font-weight: 600; }

/* --- buttons ---------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-weight: 600;
  text-decoration: none; color: var(--text);
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--primary) 88%, black); }
.btn.big { padding: 14px 28px; font-size: 1.05rem; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { color: var(--text); }
.btn.yes { border-color: var(--good); color: var(--good); }
.btn.no { border-color: var(--danger); color: var(--danger); }
.btn.yes:hover:not(:disabled) { background: color-mix(in srgb, var(--good) 12%, transparent); }
.btn.no:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.btn svg { width: 18px; height: 18px; }

.actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.actions.centered { justify-content: center; }
.actions .group { display: flex; gap: 8px; flex-wrap: wrap; }

kbd {
  font-family: ui-monospace, monospace; font-size: 0.75em;
  padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--muted);
}

/* --- side clip list --------------------------------------------------- */

/* --- Speak: submit button that fills up as clips are recorded ------------- */

.submit-btn {
  position: relative; overflow: hidden; isolation: isolate;
  min-width: 250px; height: 56px; padding: 0 28px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent); background: var(--primary-soft);
  color: color-mix(in srgb, var(--primary) 70%, #000); /* readable on both the light and filled green */
  font: inherit; font-weight: 700; font-size: 1.05rem; letter-spacing: 0.01em;
  cursor: not-allowed; transition: transform 0.15s ease, box-shadow 0.25s ease, color 0.25s ease;
}
.submit-fill {
  position: absolute; inset: 0; z-index: -1; width: var(--progress, 0%);
  background: color-mix(in srgb, var(--primary) 22%, var(--primary-soft));
  transition: width 0.45s ease;
}
@media (prefers-color-scheme: dark) { .submit-btn { color: var(--primary); } }
.submit-label { display: inline-flex; align-items: center; gap: 10px; }
.submit-label svg { width: 20px; height: 20px; }
.submit-btn.ready, .submit-btn.uploading {
  border-color: transparent; color: var(--primary-ink);
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 85%, #fff), var(--primary) 55%, color-mix(in srgb, var(--primary) 80%, #000));
  box-shadow: 0 8px 22px color-mix(in srgb, var(--primary) 35%, transparent), inset 0 1px 0 rgb(255 255 255 / 0.18);
}
.submit-btn.ready { cursor: pointer; }
.submit-btn.pop { animation: submit-ready 0.5s ease; }
.submit-btn.ready .submit-fill { display: none; }
.submit-btn.ready:hover { transform: translateY(-2px); box-shadow: 0 12px 28px color-mix(in srgb, var(--primary) 42%, transparent); }
.submit-btn.ready:active { transform: translateY(0); }
.submit-btn.uploading { cursor: progress; }
.submit-btn.uploading .submit-fill { background: rgb(255 255 255 / 0.18); }
@keyframes submit-ready { 0% { transform: scale(0.96); } 60% { transform: scale(1.03); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .submit-btn, .submit-fill { transition: none; animation: none !important; } }

/* --- Speak: sliding reel of the batch's sentences ------------------------ */

.reel {
  position: relative; overflow: hidden; margin: -6px -28px 22px; padding: 6px 0 10px;
  /* Fade the neighbours out towards the card edges. */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent);
}
.reel-track { display: flex; gap: 12px; width: max-content; transition: transform 0.35s ease; }
@media (prefers-reduced-motion: reduce) { .reel-track { transition: none; } }
/* Cards size to their sentence so it stays on one line (capped for very long ones). */
.slot {
  flex: none; width: max-content; min-width: 170px; max-width: min(560px, 80vw);
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 14px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--border); cursor: pointer; text-align: left;
  opacity: 0.55; transform: scale(0.94); transition: opacity 0.35s ease, transform 0.35s ease;
}
.slot:hover { opacity: 0.8; }
.slot.current { opacity: 1; transform: none; border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.slot:not(.current) .icon-btn { pointer-events: none; } /* clicks select the card instead */
.slot .text { font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.slot .row { display: flex; align-items: center; gap: 6px; }
.slot .num {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 0.75rem; font-weight: 700; background: var(--surface-2); color: var(--muted); flex: none;
}
.slot .num svg { width: 14px; height: 14px; }
.slot.has-clip .num { background: var(--primary); color: var(--primary-ink); }
.slot .num.vote-up { background: var(--good); color: #fbf6ec; }
.slot .num.vote-down { background: var(--danger); color: #fbf6ec; }
/* Listen: the vote already given on a reviewed clip. */
.vote-row .btn.chosen:disabled { opacity: 1; box-shadow: 0 0 0 2px currentColor; }
.slot .meta { margin-left: auto; font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 520px) {
  .reel { margin: -4px -16px 18px; }
  /* Phones: smaller text and padding so even the longest sentence fits on one line. */
  .slot { min-width: 150px; max-width: calc(100vw - 24px); padding: 10px; }
  .slot .text { font-size: 0.78rem; }
}
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); display: grid; place-items: center; cursor: pointer; padding: 0;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 15px; height: 15px; }

/* --- forms ------------------------------------------------------------ */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 0.92rem; }
.field .hint { font-size: 0.82rem; color: var(--muted); }
input[type="text"], input[type="password"], select, textarea {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--field);
}
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.92rem; }
.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; accent-color: var(--primary); }

.charbar { display: flex; flex-wrap: wrap; gap: 4px; }
.charbar button {
  min-width: 34px; height: 32px; padding: 0 8px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-size: 1rem;
}
.charbar button:hover { border-color: var(--primary); }


/* --- misc ------------------------------------------------------------- */

.page-title { font-size: 1.5rem; margin: 6px 0 4px; }
.lede { color: var(--muted); margin: 0 0 20px; }
.center { text-align: center; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h2 { color: var(--text); margin-top: 0; }
.big-check {
  width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 14px;
  background: var(--primary-soft); color: var(--primary); display: grid; place-items: center;
}
.big-check svg { width: 36px; height: 36px; }
.hidden { display: none !important; }
.mono { font-family: ui-monospace, monospace; font-size: 0.85rem; overflow-wrap: anywhere; }

.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 0.82rem; }
.table-wrap { overflow-x: auto; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-weight: 600; font-size: 0.92rem; opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fbf6ec; }

.footer {
  display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 18px 24px; font-size: 0.85rem; color: var(--muted); border-top: 1px solid var(--border);
  background: var(--surface); /* same as the header */
}
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-weight: 600; }
.footer-links svg {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.footer-links a:hover { color: var(--text); text-decoration: underline; }
@media (max-width: 520px) { .footer { padding: 16px; } }

/* About / Contact / Privacy */
.info-page { position: relative; max-width: 720px; margin: 0 auto; }
.info-page .page-title { padding-right: 40px; }
.info-body { line-height: 1.6; }
.info-body h2 { font-size: 1.05rem; margin: 22px 0 6px; }
.info-body ul { padding-left: 20px; margin: 6px 0; }
.info-body li { margin: 4px 0; }

.play-big {
  width: 92px; height: 92px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--primary); color: var(--primary-ink); display: grid; place-items: center;
  margin: 22px auto 8px;
}
.play-big svg { width: 36px; height: 36px; }
.vote-row { display: flex; justify-content: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.vote-row .btn { min-width: 130px; }
