:root {
  --bg: #1a0f1f;
  --card: #2a1830;
  --card-2: #3a2442;
  --line: #4b3055;
  --text: #f6ecf7;
  --muted: #b39cba;
  --accent: #ff7a59;
  --yes: #3ddc97;
  --maybe: #ffc857;
  --no: #ff6b81;
  --radius: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(900px 500px at 50% -10%, #3b1f48 0%, var(--bg) 65%) fixed;
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#app { max-width: 640px; margin: 0 auto; padding: env(safe-area-inset-top) 16px 40px; }

h1, h2, h3 { margin: 0; }

input, textarea, select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #20122a;
  color: var(--text);
  font: inherit;
}
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button {
  font: inherit;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  color: var(--text);
  background: var(--card-2);
}
button:disabled { opacity: 0.55; cursor: wait; }
button.primary { background: var(--accent); color: #2b0f06; font-weight: 700; }
button.ghost { background: transparent; border: 1px solid var(--line); }

.error { color: var(--no); min-height: 1.4em; margin: 0; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0; }
.muted { color: var(--muted); }

/* ---------- auth ---------- */
.auth { padding-top: 12vh; display: grid; gap: 14px; }
.auth h1 { font-size: 2rem; }
.auth .sub { color: var(--muted); margin: 0 0 6px; }
.auth form { display: grid; gap: 12px; }
.auth label, .form label { display: grid; gap: 4px; font-size: 0.85rem; color: var(--muted); }
.link { background: none; padding: 0; color: var(--accent); text-decoration: underline; border-radius: 0; justify-self: start; }

/* ---------- shell ---------- */
.bar { display: flex; align-items: center; gap: 8px; padding: 14px 0 8px; }
.bar .title { font-weight: 800; font-size: 1.15rem; flex: 1; }
.bar .who { color: var(--muted); font-size: 0.85rem; }
.bar button { padding: 8px 12px; }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 6px 0 16px; background: var(--card); padding: 6px; border-radius: 999px; }
.tabs button { background: transparent; padding: 9px 6px; }
.tabs button[aria-selected="true"] { background: var(--accent); color: #2b0f06; font-weight: 700; }

.toolbar { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }
.toolbar select, .toolbar input { flex: 1; }
.progress { color: var(--muted); font-size: 0.85rem; margin: 0 0 12px; }

/* ---------- rate deck ---------- */
.deck-card {
  background: linear-gradient(160deg, var(--card-2), var(--card));
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px 22px;
  min-height: 220px;
  display: grid;
  gap: 14px;
  align-content: center;
  text-align: center;
}
.chip { justify-self: center; font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.deck-text { font-size: 1.5rem; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.rate-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0 10px; }
.rate-buttons button { padding: 16px 6px; font-weight: 700; font-size: 1rem; border-radius: 18px; }
.rate-buttons .yes { background: var(--yes); color: #052a1a; }
.rate-buttons .maybe { background: var(--maybe); color: #2e2100; }
.rate-buttons .no { background: var(--no); color: #33050e; }
.deck-extra { display: flex; justify-content: space-between; gap: 8px; }
.empty { text-align: center; color: var(--muted); padding: 36px 8px; }
.keys { color: var(--muted); font-size: 0.75rem; text-align: center; margin-top: 10px; }

/* ---------- answers ---------- */
.group h3 { font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin: 20px 0 8px; }
.row { background: var(--card); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; display: grid; gap: 10px; }
.row .text { overflow-wrap: anywhere; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 6px; }
.seg button { padding: 8px 4px; font-size: 0.9rem; background: #20122a; color: var(--muted); }
.seg button.yes[aria-pressed="true"] { background: var(--yes); color: #052a1a; font-weight: 700; }
.seg button.maybe[aria-pressed="true"] { background: var(--maybe); color: #2e2100; font-weight: 700; }
.seg button.no[aria-pressed="true"] { background: var(--no); color: #33050e; font-weight: 700; }
.seg .remove { background: transparent; color: var(--muted); padding: 8px 10px; }

/* ---------- matches ---------- */
.tonight { background: linear-gradient(160deg, #5a2a3a, var(--card-2)); border: 1px solid var(--accent); border-radius: 20px; padding: 18px; margin-bottom: 18px; text-align: center; display: grid; gap: 10px; }
.tonight .pick { font-size: 1.35rem; font-weight: 800; overflow-wrap: anywhere; }
.tonight .pick.spinning { opacity: 0.7; }
.section-title { font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; margin: 18px 0 8px; }
.section-title.hot { color: var(--yes); }
.section-title.talk { color: var(--maybe); }
.section-title.did { color: var(--muted); }
.match { background: var(--card); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; display: flex; gap: 12px; align-items: center; }
.match .body { flex: 1; overflow-wrap: anywhere; }
.match .cat { color: var(--muted); font-size: 0.75rem; }
.match.is-done .body { opacity: 0.55; text-decoration: line-through; }
.match button { padding: 8px 12px; font-size: 0.9rem; white-space: nowrap; }

/* ---------- misc ---------- */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--card-2); color: var(--text); padding: 10px 16px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity 200ms, transform 200ms; max-width: 90vw; z-index: 20;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: #5a1a28; }

dialog { width: min(480px, 94vw); border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text); padding: 0; }
dialog::backdrop { background: rgba(8, 3, 12, 0.75); }
.form { display: grid; gap: 12px; padding: 20px; }
.form .actions { display: flex; justify-content: flex-end; gap: 8px; }

#cover { position: fixed; inset: 0; background: #fff; color: #222; z-index: 100; overflow: auto; cursor: pointer; }
.cover-note { max-width: 520px; margin: 0 auto; padding: 40px 24px; font: 17px/1.6 system-ui, sans-serif; }
.cover-note h1 { font-size: 1.8rem; margin-bottom: 8px; }
.cover-note h2 { font-size: 1.1rem; margin: 18px 0 4px; }

@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
