:root {
  --bg: #111114;
  --card: #1b1b21;
  --raise: #24242c;
  --line: #2e2e38;
  --text: #f5f5f7;
  --muted: #9b9baa;
  --down: #c6ff3d;
  --down-ink: #172000;
  --maybe: #ffb53d;
  --maybe-ink: #2a1a00;
  --nah: #565663;
  --danger: #ff6b6b;
  --radius: 18px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--down); }

#app { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 110px); }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 18px; }
.logo { font-size: 34px; font-weight: 900; letter-spacing: -1.5px; margin: 0; }
.logo span { color: var(--down); }
.sub { color: var(--muted); font-size: 14px; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card.hint { border-style: dashed; }
.card h2 { margin: 0 0 6px; font-size: 18px; }
.card p { margin: 0 0 12px; color: var(--muted); }
.card p:last-child { margin-bottom: 0; }

.beep.highlight { border-color: var(--down); }
.beep-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.who { font-weight: 700; }
.crew { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.when { font-size: 13px; font-weight: 700; color: var(--down); white-space: nowrap; }
.when.later { color: var(--maybe); }
.what { font-size: 22px; font-weight: 700; line-height: 1.2; margin: 2px 0 6px; overflow-wrap: anywhere; }
.where { color: var(--text); margin-bottom: 12px; overflow-wrap: anywhere; }
.where a { color: inherit; text-decoration-color: var(--muted); }

.answers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.answers button {
  border: 1px solid var(--line); background: var(--raise); border-radius: 14px; padding: 12px 4px;
  font-weight: 800; font-size: 15px;
}
.answers button .n { font-weight: 600; opacity: .7; margin-left: 4px; }
.answers button[aria-pressed="true"].down { background: var(--down); color: var(--down-ink); border-color: var(--down); }
.answers button[aria-pressed="true"].maybe { background: var(--maybe); color: var(--maybe-ink); border-color: var(--maybe); }
.answers button[aria-pressed="true"].nah { background: var(--nah); border-color: var(--nah); }

.who-said { margin-top: 10px; font-size: 14px; color: var(--muted); display: grid; gap: 2px; }
.who-said b { color: var(--text); font-weight: 600; }
.who-said .tag { font-weight: 800; margin-right: 4px; }
.tag.down { color: var(--down); } .tag.maybe { color: var(--maybe); } .tag.nah { color: var(--muted); }

.note-row { display: flex; gap: 8px; margin-top: 10px; }
.note-row input { flex: 1; }

.beep-foot { display: flex; justify-content: flex-end; margin-top: 10px; }

/* forms */
input, textarea {
  width: 100%; background: var(--raise); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; outline: none;
}
input:focus, textarea:focus { border-color: var(--down); }
textarea { resize: none; }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
.row { display: flex; gap: 8px; }
.row > input { flex: 1; min-width: 0; }

.btn {
  border: 0; border-radius: 14px; padding: 12px 18px; font-weight: 800;
  background: var(--down); color: var(--down-ink);
}
.btn.ghost { background: var(--raise); color: var(--text); border: 1px solid var(--line); }
.btn.small { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.btn.link { background: none; color: var(--muted); padding: 6px 0; font-weight: 600; text-decoration: underline; }
.btn.danger { color: var(--danger); }
.btn.wide { width: 100%; padding: 15px; font-size: 17px; }
.btn:disabled { opacity: .5; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--raise); border-radius: 999px; padding: 8px 14px;
  font-size: 14px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--down); color: var(--down-ink); border-color: var(--down); }
.chip small { opacity: .7; font-weight: 500; margin-left: 4px; }
.places { margin-top: 8px; max-height: 168px; overflow-y: auto; }

/* crews */
.phrase {
  font: 700 17px/1.2 ui-monospace, "SF Mono", Menlo, monospace; background: var(--raise); border: 1px dashed var(--down);
  color: var(--down); padding: 10px 12px; border-radius: 12px; margin: 10px 0; overflow-wrap: anywhere;
}
.members { color: var(--muted); font-size: 14px; margin: 8px 0 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* onboarding */
.hero { padding: 12vh 4px 0; }
.hero .logo { font-size: 64px; letter-spacing: -3px; }
.hero p { font-size: 19px; color: var(--muted); margin: 8px 0 28px; }
.hero ul { color: var(--muted); padding-left: 20px; margin: 28px 0 0; }

/* empty */
.empty { text-align: center; color: var(--muted); padding: 40px 12px; }
.empty .big { font-size: 48px; }

/* floating beep button */
.fab {
  position: fixed; right: max(16px, calc(50% - 264px)); bottom: calc(env(safe-area-inset-bottom) + 84px);
  border: 0; border-radius: 999px; padding: 16px 24px; background: var(--down); color: var(--down-ink);
  font-weight: 900; font-size: 18px; box-shadow: 0 8px 30px rgba(198, 255, 61, .25);
}

/* bottom nav */
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; background: rgba(17, 17, 20, .92); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs button {
  flex: 1; max-width: 186px; background: none; border: 0; padding: 14px 0 12px; color: var(--muted); font-weight: 700; font-size: 14px;
}
nav.tabs button[aria-current="page"] { color: var(--text); }
nav.tabs button[aria-current="page"]::after { content: ""; display: block; width: 18px; height: 3px; background: var(--down); border-radius: 2px; margin: 4px auto 0; }

/* sheet */
dialog#sheet {
  width: 100%; max-width: 560px; margin: auto auto 0; border: 0; border-radius: 24px 24px 0 0;
  background: var(--card); color: var(--text); padding: 20px 16px calc(env(safe-area-inset-bottom) + 20px);
  max-height: 92dvh; overflow-y: auto;
}
dialog#sheet::backdrop { background: rgba(0, 0, 0, .6); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; font-size: 22px; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 150px); transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100% - 32px); z-index: 10;
}
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.error { background: var(--danger); color: #fff; }
