/*
 * when layout, skinned with the 2222 theme pack (/theme/theme.css, copied from
 * apps/2222/app/static/theme). Burnt-orange grain, cream ink, Crimson Pro.
 * Buttons, inputs, the action bar and dialogs follow apps/groupchat/public/style.css; option rows
 * follow livekaraoke's night rows (WHEN / WHERE / WHAT), so the apps read as siblings.
 */

* { box-sizing: border-box; }
body {
  margin: 0;
  font-size: 16px;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
button, input, select, textarea { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
html { touch-action: manipulation; }
.hidden { display: none !important; }

header, main, footer { width: min(560px, calc(100% - 32px)); margin: 0 auto; }
header { height: 60px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--veil-2); }
.wordmark { color: var(--ink); text-decoration: none; font-size: 18px; font-weight: 600; letter-spacing: -.3px; font-style: italic; }
main { min-height: 60vh; padding-top: 20px; padding-bottom: 40px; }

h1 { font-size: 30px; line-height: 1.15; font-weight: 400; letter-spacing: -.5px; margin: 0 0 6px; overflow-wrap: anywhere; }
h2 { font-size: 22px; line-height: 1.3; font-weight: 500; letter-spacing: -.3px; margin: 0 0 8px; }
p { margin: 0 0 12px; }

/* ---------- buttons ---------- */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: var(--r-sm); background: var(--cream); color: var(--ground-1);
  padding: 11px 16px; font-weight: 500; cursor: pointer; text-decoration: none; line-height: 1.2;
}
button:hover, .button:hover { background: var(--cream-bright); }
button:disabled { opacity: .45; cursor: default; }
[aria-disabled="true"] { opacity: .6; }
.quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--veil-3); font-weight: 400; }
.quiet:hover { background: var(--veil-2); }
.linkbtn { background: transparent; box-shadow: none; color: var(--muted); font-size: 15px; font-weight: 300; padding: 6px 2px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--veil-3); }
.linkbtn:hover { background: transparent; color: var(--ink); }
.close { background: transparent !important; box-shadow: none !important; color: var(--muted); font-size: 28px; line-height: 1; padding: 0 4px; font-weight: 300; }
button.block, .button.block, .profile > button[type=submit] { margin-top: 18px; width: 100%; min-height: 56px; padding: 14px 16px; font-size: 20px; }
.button.quiet.block { font-size: 17px; min-height: 52px; }

/* ---------- text ---------- */
.muted { color: var(--muted); font-size: 16px; }
.fine { color: var(--ink-3); font-size: 13px; font-style: italic; margin: 0; }
.fine.as { margin: 10px 0 0; font-size: 15px; }
.fine.as .linkbtn { font-size: 15px; font-style: italic; }
.fine.hint { margin: 6px 2px 0; }
.privacy { margin-top: 28px; text-align: center; color: var(--ink-4); }
.privacy a { color: inherit; }
.optional { color: var(--ink-4); font-style: italic; }
.error { color: var(--danger); font-size: 14px; white-space: pre-line; margin: 10px 0 0; }
.error:empty { display: none; }
.eyebrow { font-size: 15px; font-style: italic; color: var(--ink-2); margin: 0 0 4px; }

/* ---------- fields ---------- */
label { display: block; font-size: 15px; margin: 18px 0 7px; color: var(--ink-2); }
input, textarea {
  width: 100%; padding: 14px 15px; font-size: 19px; /* ≥16px stops iOS zooming on focus */
  background: var(--veil-2); border: 1px solid var(--veil-3); border-radius: var(--r-sm); color: var(--ink);
}
input::placeholder { color: var(--ink-4); }
input:focus { outline: none; border-color: var(--veil-4); }
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink); caret-color: var(--ink);
  -webkit-box-shadow: 0 0 0 1000px var(--veil-2) inset; box-shadow: 0 0 0 1000px var(--veil-2) inset;
  border-color: var(--veil-3); transition: background-color 9999s ease-out 0s;
}
input[type=time] { min-height: 54px; color-scheme: dark; }
.profile { display: grid; gap: 4px; margin-top: 8px; }

/* Where everyone is: the first question on Start. */
.where-q { margin: 22px 0 10px; font-size: 20px; font-style: italic; color: var(--ink); }
.where-list { display: grid; gap: 10px; }
.pick-where {
  width: 100%; display: grid; gap: 4px; justify-items: start; justify-content: start; text-align: left; padding: 16px 18px; min-height: 76px;
  background: var(--veil-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--veil-3); border-radius: var(--r-md); font-weight: 400;
}
.pick-where:hover { background: var(--veil-3); }
.pick-where b { font-size: 21px; font-weight: 500; }
.pick-where span { font-size: 16px; color: var(--muted); }
.where-as { margin: 2px 0 4px; }

/* Who's invited: names as chips, typed into one box. */
.names {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px; min-height: 56px; cursor: text;
  background: var(--veil-2); border: 1px solid var(--veil-3); border-radius: var(--r-sm);
}
.names:focus-within { border-color: var(--veil-4); }
#chips { display: contents; }
.names input { flex: 1; min-width: 120px; width: auto; border: 0; background: transparent; padding: 6px 6px; }
.name-chip { display: inline-flex; align-items: center; gap: 2px; padding: 4px 4px 4px 12px; border-radius: var(--r-pill); background: var(--veil-3); color: var(--ink); font-size: 17px; }
.name-chip button { background: transparent; color: var(--ink-2); padding: 0 8px; font-size: 20px; font-weight: 300; min-height: 32px; }

/* ---------- toggles: Nights | Times, and Can go | Maybe | Can't go ---------- */
.toggle, .answer { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; border-radius: var(--r-pill); box-shadow: inset 0 0 0 1px var(--veil-3); padding: 3px; }
.toggle { margin: 22px 0 8px; }
.toggle button, .answer button {
  min-height: 48px; border-radius: var(--r-pill); background: transparent; color: var(--ink-2); font-weight: 400; font-size: 17px; padding: 8px 6px;
}
.toggle button:hover, .answer button:hover { background: var(--veil-1); }
.toggle button[aria-pressed="true"] { background: var(--cream); color: var(--ground-1); font-weight: 500; }
.answer { margin-top: 10px; grid-column: 1 / -1; }
.answer button[aria-pressed="true"][data-v="y"] { background: var(--accent); color: var(--ground-0); font-weight: 500; }
.answer button[aria-pressed="true"][data-v="m"] { background: var(--cream); color: var(--ground-1); font-weight: 500; }
.answer button[aria-pressed="true"][data-v="n"] { background: var(--veil-3); color: var(--ink); font-weight: 500; }
.answer.two { margin: 14px 0 6px; }
.mode-note { margin: 4px 2px 0; font-size: 15px; font-style: italic; }

/* ---------- the month ---------- */
.month { margin-top: 14px; }
.month-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.month-head b { font-weight: 500; font-style: italic; font-size: 19px; }
.nav { background: transparent; color: var(--ink); font-size: 28px; font-weight: 300; min-width: 48px; min-height: 44px; padding: 0; }
.nav:hover { background: var(--veil-1); }
.dow, .days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dow span { text-align: center; font-size: 13px; color: var(--ink-4); padding: 4px 0; }
.day {
  position: relative; aspect-ratio: 1; min-height: 42px; padding: 0; border-radius: 50%;
  background: transparent; color: var(--ink); font-size: 18px; font-weight: 400; font-variant-numeric: tabular-nums;
}
.day:hover { background: var(--veil-2); }
.day.today { box-shadow: inset 0 0 0 1px var(--veil-4); }
.day[aria-pressed="true"] { background: var(--accent); color: var(--ground-0); font-weight: 500; }
.day:disabled { opacity: .25; background: transparent; }
.day i { position: absolute; right: 8%; top: 6%; min-width: 17px; height: 17px; border-radius: 9px; background: var(--cream); color: var(--ground-1); font-size: 11px; font-style: normal; font-weight: 600; line-height: 17px; }

/* ---------- lists and option rows (livekaraoke's night card) ---------- */
.list-label { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 24px 0 8px; margin: 0; font-size: 14px; color: var(--muted); }
.list-label.first { padding-top: 4px; }
.list-label b { font-weight: 500; color: var(--ink-2); font-style: italic; font-size: 17px; }
.list { border-top: 1px solid var(--veil-2); }
.card {
  display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 14px; row-gap: 2px;
  padding: 15px 2px; border-bottom: 1px solid var(--veil-2); color: inherit; text-decoration: none;
}
.card > * { grid-column: 1; min-width: 0; }
.card.tap { cursor: pointer; }
.card.tap:hover { background: var(--veil-1); }
.card.tap:active { background: var(--veil-2); }
.card > .chev { grid-column: 2; grid-row: 1 / 6; align-self: center; color: var(--ink-4); font-size: 24px; line-height: 1; }
.card.tap:hover > .chev { color: var(--accent); }
.card > .x { grid-column: 2; grid-row: 1; }
.card.row { padding: 10px 2px; }
button.card { width: 100%; text-align: left; background: transparent; border-radius: 0; font-weight: 400; justify-content: stretch; }
.x { background: transparent; color: var(--ink-3); font-size: 24px; font-weight: 300; padding: 0 8px; min-height: 40px; }
.add-time { color: var(--accent); font-style: italic; font-size: 16px; }
.when { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: 21px; color: var(--ink); }
.when-date { font-weight: 500; white-space: nowrap; }
.when-window { color: var(--ink-2); font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
.when-dot { color: var(--ink-4); }
.chip { margin-left: auto; font-size: 15px; font-style: italic; color: var(--ink-3); white-space: nowrap; border: 0; background: transparent; padding: 0; border-radius: 0; }
.chip.lead { color: var(--accent); }
.where { display: block; font-weight: 500; font-size: 20px; line-height: 1.25; color: var(--ink); overflow-wrap: anywhere; }
.what { display: block; font-size: 16px; line-height: 1.4; color: var(--muted); font-variant-numeric: tabular-nums; }
.card .people { display: block; font-size: 16px; line-height: 1.4; color: var(--ink-2); }
.card .people .maybe { color: var(--ink-3); }
.you { display: block; font-size: 15px; font-style: italic; color: var(--accent); margin-top: 2px; }
.card.off .when { text-decoration: line-through; text-decoration-color: var(--ink-4); color: var(--ink-3); }
.card.want { animation: want 1.6s ease-out; }
@keyframes want { 0%, 40% { background: var(--accent-soft); } 100% { background: transparent; } }
.mine .card .where { font-size: 19px; }

/* ---------- the poll ---------- */
.event-link {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%; margin: 8px 0 6px; padding: 9px 16px;
  border-radius: var(--r-pill); box-shadow: inset 0 0 0 1px var(--veil-3); color: var(--ink); text-decoration: none; font-size: 17px;
}
.event-link > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-link .out { color: var(--accent); }
.event-link:hover { background: var(--veil-1); }
.linkbtn.danger { color: var(--danger); margin-top: 8px; }
.poll-head { margin-bottom: 4px; }
.poll-head .muted { margin: 6px 0 2px; font-size: 18px; }
.due { color: var(--ink-3); font-style: italic; font-size: 15px; margin: 0; }
.due-chip { margin-top: 20px; background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--veil-3); border-radius: var(--r-pill); font-weight: 400; font-style: italic; font-size: 16px; padding: 10px 16px; }
.due-chip::after { content: ' ›'; color: var(--ink-4); font-style: normal; }

.host { margin: 18px 0 4px; padding: 14px 0 0; border-top: 1px solid var(--veil-2); }
.progress { font-size: 18px; color: var(--ink); margin: 0 0 4px; }
.host-links { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.host .fine.on { margin-top: 6px; color: var(--accent); }
.remind-card { margin: 14px 0 0; padding: 14px 16px; border-radius: var(--r-md); background: var(--accent-soft); display: grid; gap: 10px; }
.remind-card p { margin: 0; color: var(--cream); font-size: 17px; }
.remind-card .quiet { min-height: 48px; font-size: 17px; box-shadow: inset 0 0 0 1px var(--veil-4); }

.who-list { display: grid; gap: 8px; }
.pick-name {
  width: 100%; min-height: 58px; justify-content: space-between; padding: 12px 18px; font-size: 20px; font-weight: 400;
  background: var(--veil-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--veil-3); border-radius: var(--r-md);
}
.pick-name:hover { background: var(--veil-3); }
.pick-name .chip { margin-left: 12px; }
.pick-name.other { background: transparent; font-style: italic; color: var(--ink-2); }

/* Live: the code to scan, who's here, and who's choosing what. */
.qr-box { text-align: center; margin: 14px 0 6px; }
.qr { display: flex; justify-content: center; padding: 6px 0 2px; }
.qr svg { width: min(280px, 74vw); height: auto; background: #fff; border-radius: 12px; padding: 10px; box-shadow: 0 2px 12px #0006; }
.scan-note { margin: 12px 0 0; font-size: 19px; font-style: italic; color: var(--ink); }
.qr-box .linkbtn { font-size: 14px; }
.here { margin: 2px 0 6px; font-size: 15px; color: var(--ink-2); }
.here:empty { display: none; }
.here i { color: var(--ink-3); }
.card .ghosts { display: block; font-size: 15px; font-style: italic; color: var(--ink-3); }
.card .ghosts:empty { display: none; }

/* The decided night. */
.hero { padding: 6px 0 10px; }
.hero h1 { font-style: italic; font-size: 32px; }
.said { color: var(--accent); font-style: italic; font-size: 18px; margin: 8px 0 0; }
.ask { font-size: 19px; margin: 14px 0 0; }
.tallyline { margin-top: 12px; }
.others { margin-top: 18px; }
.others > summary { font-size: 15px; color: var(--ink-3); font-style: italic; cursor: pointer; list-style: none; padding: 10px 0; }
.others > summary::-webkit-details-marker { display: none; }
.others[open] > summary { color: var(--ink-2); }

/* The host's sheet for one option. */
.who-said { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 10px 0 4px; font-size: 17px; }
.who-said dt { color: var(--ink-3); font-style: italic; }
.who-said dd { margin: 0; color: var(--ink); }
.who-said .none { color: var(--ink-4); font-style: italic; }

.time-add { display: flex; gap: 8px; }
.time-add input { flex: 1; }
.time-add .quiet { white-space: nowrap; min-height: 54px; }
.steps { margin: 8px 0 14px; padding-left: 22px; font-size: 18px; line-height: 1.45; }
.steps li { margin-bottom: 6px; }

/* ---------- pinned action bar ---------- */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: 12px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--grain), linear-gradient(180deg, var(--ground-2), var(--ground-1));
  border-top: 1px solid var(--veil-3); box-shadow: 0 -10px 30px #0006;
  animation: barIn .25s ease-out;
}
.bar-inner { width: min(560px, 100%); margin: 0 auto; display: flex; gap: 8px; }
.actionbar .primary { flex: 1; background: var(--accent); color: var(--ground-0); border-radius: var(--r-pill); font-size: 19px; min-height: 56px; padding: 14px 16px; }
.actionbar .primary:hover { background: var(--accent); filter: brightness(1.07); }
.actionbar .quiet { border-radius: var(--r-pill); min-height: 56px; padding: 14px 16px; font-size: 16px; white-space: nowrap; color: var(--ink); }
.actionbar .quiet.wide { flex: 1; font-size: 18px; }
.bar-note { width: min(560px, 100%); margin: 0 auto 10px; text-align: center; font-size: 16px; font-style: italic; color: var(--cream); }
.bar-note:empty, .actionbar .fine:empty { display: none; }
.actionbar .fine { width: min(560px, 100%); margin: 7px auto 0; text-align: center; }
.actionbar .fine a, .actionbar .fine .linkbtn { color: var(--ink-2); font-size: 13px; padding: 0; font-style: italic; }
body.with-bar main { padding-bottom: 160px; }
@keyframes barIn { from { transform: translateY(100%); } }

/* ---------- dialogs (raised grain surfaces) ---------- */
dialog {
  color: var(--ink); width: min(440px, calc(100% - 24px)); max-height: 90dvh; overflow: auto; padding: 22px;
  background: var(--ground-2); background-image: var(--grain), linear-gradient(180deg, var(--ground-3), var(--ground-2));
  border: 1px solid var(--veil-3); border-radius: var(--r-lg); box-shadow: 0 24px 80px #0007;
}
dialog::backdrop { background: #000a; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 4px; }
.dialog-head h2 { margin: 0; }
dialog .list { margin: 8px 0 4px; }
.help-list { display: grid; gap: 8px; margin-top: 10px; }
.help-list .quiet { width: 100%; min-height: 52px; justify-content: space-between; font-size: 18px; padding: 12px 16px; }
.help-list .quiet.on { box-shadow: inset 0 0 0 2px var(--accent); }
.help-list small { font-size: 15px; color: var(--ink-3); font-style: italic; }
dialog .fine.after { margin-top: 12px; font-size: 14px; }

/* ---------- privacy ---------- */
.policy { max-width: 560px; }
.policy h2 { margin-top: 28px; }
.policy p { font-size: 17px; color: var(--ink-2); }
.policy .back { margin-top: 28px; }

@media (max-width: 400px) {
  h1 { font-size: 27px; }
  .when { font-size: 19px; }
  .answer button { font-size: 16px; }
  .actionbar .quiet { padding: 13px 12px; }
}
@media (prefers-reduced-motion: reduce) { .actionbar, .card.want { animation: none; } }
