/* SuperParty — SuperPark Glasgow brand palette
   purple #662483 · yellow #f0ff00 · turquoise #77f1b6 · pink #ff008c        */

:root {
  --purple: #662483;
  --yellow: #f0ff00;
  --turquoise: #77f1b6;
  --deep: #390253;
  --pink: #ff008c;
  --orange: #f7941e;
  --blue: #4aa8ff;

  --bg: #24003a;
  --surface: #360a50;
  --surface-2: #45185f;
  --line: #5b2b76;
  --text: #f6eefb;
  --muted: #bda3cf;

  --radius: 14px;
  --tap: 44px;
  --pad: 14px;

  /* The curve SuperBrief uses — iOS sheet motion, not a linear slide. */
  --ease: cubic-bezier(.32, .72, 0, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 ui-rounded, "Segoe UI", system-ui, -apple-system, sans-serif;
  overscroll-behavior-y: none;
}
button, input, select { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }

/* ------------------------------------------------------------- sign in */

.auth-page { display: grid; place-items: center; min-height: 100dvh; padding: 24px;
  background: radial-gradient(120% 80% at 50% 0%, #5c1580 0%, transparent 60%), var(--bg); }
.auth-card { width: min(380px, 100%); text-align: center; }
.auth-logo { width: 92px; height: auto; margin-bottom: 12px; }
.auth-card h1 { margin: 0; font-size: 34px; letter-spacing: -0.02em; }
.auth-card h1 span { color: var(--yellow); }
.auth-sub { margin: 4px 0 28px; color: var(--muted); }
.auth-card form { display: grid; gap: 6px; text-align: left; }
.auth-card label { font-size: 13px; color: var(--muted); margin-top: 10px; }
.auth-error { color: var(--pink); font-size: 13px; margin: 12px 0 0; }
input, select {
  width: 100%; min-height: var(--tap); padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; outline: none;
}
input:focus, select:focus { border-color: var(--purple); }
.auth-card button[type=submit], .primary {
  margin-top: 20px; min-height: var(--tap); border-radius: 22px;
  background: var(--yellow); color: #12001f; font-weight: 700; width: 100%;
}
.primary:disabled { opacity: 0.5; }

/* --------------------------------------------------------------- shell */

.top {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) var(--pad) 10px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-size: 19px; font-weight: 700; line-height: 1.1; }
.brand span { color: var(--yellow); }
.sub { grid-column: 1; font-size: 11px; color: var(--muted); }
.clock { grid-column: 2; grid-row: 1 / span 2; font-size: 22px; font-weight: 700; color: var(--turquoise);
  font-variant-numeric: tabular-nums; }
.icon-btn { grid-column: 3; grid-row: 1 / span 2; width: var(--tap); height: var(--tap);
  border-radius: 12px; background: var(--surface-2); font-size: 17px; }

.modes { display: flex; gap: 4px; margin: 12px var(--pad) 0; padding: 4px;
  background: var(--surface); border-radius: 22px; }
.modes button { flex: 1; min-height: 36px; border-radius: 18px; font-weight: 700;
  font-size: 13px; letter-spacing: 0.04em; color: var(--muted);
  transition: background 260ms var(--ease), color 260ms var(--ease); }
.modes button[aria-pressed="true"] { background: var(--yellow); color: #12001f; }

main { padding: 0 var(--pad) calc(28px + env(safe-area-inset-bottom)); }

h2.section { margin: 20px 2px 8px; font-size: 10.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; }
h2.section em { font-style: normal; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 11px; }

.card { background: var(--surface); border-radius: var(--radius); padding: 14px;
  margin-bottom: 8px; position: relative; overflow: hidden;
  animation: rise 320ms var(--ease) both;
  transition: background 200ms var(--ease), transform 200ms var(--ease); }
.card.edge::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--accent, var(--purple)); }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(0.985); } }
@media (prefers-reduced-motion: reduce) { .card { animation: none; } }

/* ------------------------------------------------------------ live card */

.live { border: 1.5px solid var(--turquoise); padding: 16px; }
.live.is-room { border-color: var(--pink); }
.live-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.live-head h3 { margin: 0; font-size: 17px; }
.live-head .slot { color: var(--muted); font-size: 12px; white-space: nowrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 0; }
.chip { font-size: 9px; font-weight: 700; letter-spacing: 0.06em; padding: 4px 8px;
  border-radius: 10px; background: var(--surface-2); color: var(--text); }
.chip.prem { background: #4a2a00; color: var(--orange); }
.chip.room { color: var(--blue); }
.chip.warn { background: #4a0020; color: var(--pink); }

.rail { margin: 26px 4px 4px; position: relative; height: 76px; }
.rail .track { position: absolute; left: 22px; right: 22px; top: 0; height: 4px;
  background: var(--line); border-radius: 2px; }
.rail .fill { position: absolute; left: 22px; top: 0; height: 4px; background: var(--turquoise);
  border-radius: 2px; transition: width 600ms ease; }
.rail .node { position: absolute; top: -4px; transform: translateX(-50%); text-align: center;
  background: none; border: 0; padding: 0; }
.rail .node.low .lab, .rail .node.low .tm { transform: translateY(22px); }
.rail .node.low::after { content: ""; position: absolute; left: 50%; top: 14px; width: 1px;
  height: 20px; background: var(--line); }
.rail .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-2);
  margin: 0 auto; transition: background 260ms var(--ease), box-shadow 260ms var(--ease); }
.rail .node.tickable { cursor: pointer; }
.rail .node.tickable .dot { box-shadow: 0 0 0 2px var(--surface-2); }
.rail .node.tickable:active .dot { transform: scale(1.35); }
.rail .node.ticked .dot { background: var(--turquoise); box-shadow: 0 0 0 2px var(--turquoise); }
.rail .node.ticked .lab { color: var(--turquoise); font-weight: 700; }
.rail .tick-mark { display: block; font-size: 8px; line-height: 10px; color: #12001f; }
.rail .node.done .dot { background: var(--turquoise); }
.rail .node.at .dot { width: 14px; height: 14px; margin-top: -2px;
  box-shadow: 0 0 0 3px rgba(119, 241, 182, 0.35); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(119, 241, 182, 0.12); } }
.rail .lab { font-size: 9.5px; margin-top: 8px; color: var(--muted); white-space: nowrap;
  transition: transform 200ms var(--ease); }
.rail .node.done .lab { color: var(--text); font-weight: 700; }
.rail .tm { font-size: 9px; color: var(--muted); font-variant-numeric: tabular-nums;
  transition: transform 200ms var(--ease); }
.rail .split { position: absolute; top: -18px; transform: translateX(-50%);
  font-size: 9px; font-weight: 700; color: var(--pink); white-space: nowrap; }

.state-box { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--surface-2); border-radius: 12px; padding: 12px; margin-top: 16px; }
.state-box b { display: block; font-size: 12.5px; color: var(--turquoise); }
.state-box.is-room b { color: var(--pink); }
.state-box small { color: var(--muted); font-size: 10.5px; }
.state-box .count { font-size: 19px; font-weight: 700; color: var(--yellow);
  font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --------------------------------------------------------------- tasks */

.task { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center;
  padding-left: 12px; }
.task .t { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.task .owner { font-size: 8.5px; }
.task .what { grid-column: 1 / -1; font-size: 10.5px; color: var(--muted); }
.task .hint { font-size: 8.5px; letter-spacing: 0.08em; color: var(--line);
  text-transform: uppercase; }
/* The swipe is for speed; this is the target nobody can miss. 36px tall so it
   clears the accessible minimum on a phone held one-handed. */
.task-foot { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px;
  justify-content: space-between; margin-top: 2px; }
.tick-btn { min-height: 34px; padding: 0 16px; border-radius: 10px;
  background: var(--surface-2); color: var(--text); font-size: 11px; font-weight: 800;
  letter-spacing: 0.06em; transition: transform 140ms var(--ease), background 140ms var(--ease); }
.tick-btn:active { transform: scale(0.94); background: var(--turquoise); color: #12001f; }
.swipe.is-due .tick-btn { background: var(--turquoise); color: #12001f; }
.swipe.is-late .tick-btn { background: var(--pink); color: #2e0742; }
.swipe-body.is-dragging { transition: none; }
.task .eta { font-size: 10px; font-weight: 700; color: var(--accent, var(--muted)); text-align: right; }
/* swipe to clear */
.swipe { position: relative; margin-bottom: 8px; border-radius: var(--radius);
  overflow: hidden; }
/* Cleared either way: a right-swipe alone collides with the iOS back gesture
   when the card starts near the left edge of the screen. */
.swipe-bg { position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: space-between; padding: 0 22px; background: var(--turquoise);
  color: #12001f; font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  opacity: calc(0.25 + var(--swipe, 0) * 0.75); }
.swipe-bg span:last-child { opacity: 0; }
.swipe.to-left .swipe-bg span:first-child { opacity: 0; }
.swipe.to-left .swipe-bg span:last-child { opacity: 1; }
.swipe-body { margin-bottom: 0; touch-action: pan-y;
  transition: transform 320ms var(--ease); will-change: transform; }
.swipe.is-clearing { max-height: 0; margin-bottom: 0; opacity: 0;
  transition: max-height 280ms var(--ease) 120ms, opacity 200ms var(--ease) 120ms,
    margin 280ms var(--ease) 120ms; }
.swipe.is-due .task, .card.is-due { background: #3d1054; }
.swipe.is-late .task, .card.is-late { background: #3a0a2a; }
.swipe.is-late .t, .swipe.is-late .eta { color: var(--pink); }
.card.is-due { background: #3d1054; }
.card.is-late { background: #3a0a2a; }
.card.is-late .t, .card.is-late .eta { color: var(--pink); }
.card.is-done { opacity: 0.45; }
.card.is-done .tick { background: var(--turquoise); color: #12001f; }

/* --------------------------------------------------------------- rooms */

.rooms { display: grid; grid-template-columns: repeat(auto-fit, minmax(58px, 1fr)); gap: 6px; }
.room { background: var(--surface); border-radius: 12px; padding: 10px 4px 8px; text-align: center;
  position: relative; overflow: hidden; }
.room::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--accent); }
.room b { font-size: 12px; }
.room small { display: block; font-size: 7.5px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--accent); margin-top: 2px; }
.room i { display: block; font-style: normal; font-size: 8px; color: var(--muted); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------- kitchen */

.banner { background: var(--surface-2); border-radius: var(--radius); padding: 14px; margin-bottom: 8px; }
.banner b { color: var(--yellow); font-size: 11px; letter-spacing: 0.06em; }
.banner p { margin: 6px 0 0; font-size: 10.5px; color: var(--muted); }

.batch-row { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 5px 0; border-bottom: 1px solid rgba(91, 43, 118, 0.5); }
.batch-row:last-child { border-bottom: 0; }
.batch-row span { font-size: 11.5px; }
.batch-row b { color: var(--yellow); font-variant-numeric: tabular-nums; }

.ticket .head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ticket h3 { margin: 0; font-size: 14px; }
.ticket .cook { font-size: 12px; font-weight: 700; color: var(--orange); white-space: nowrap; }
.ticket .table { font-size: 9.5px; color: var(--muted); text-align: right; }
.ticket.due .cook { color: var(--pink); }
.ticket .food { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.ticket .food span { font-size: 9px; font-weight: 700; background: var(--surface-2);
  border-radius: 9px; padding: 4px 7px; }
.ticket .go { margin-top: 12px; width: 100%; min-height: 38px; border-radius: 19px;
  background: var(--pink); color: #12001f; font-weight: 700; font-size: 12px; }
.ticket .go.later { background: var(--surface-2); color: var(--muted); }
.ticket.is-done { opacity: 0.45; }

/* --------------------------------------------------------------- sheet */

.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(10, 0, 20, 0.6);
  display: grid; align-items: end; animation: fade 160ms ease both; }
@keyframes fade { from { opacity: 0; } }
.sheet-inner { background: var(--surface); border-radius: 20px 20px 0 0; padding: 18px var(--pad)
  calc(24px + env(safe-area-inset-bottom)); max-height: 88dvh; overflow: auto;
  animation: up 420ms var(--ease) both; }
@keyframes up { from { transform: translateY(100%); } }
.sheet h3 { margin: 0 0 4px; font-size: 16px; }
.sheet .row { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--line); }
.sheet .row:last-of-type { border-bottom: 0; }
.sheet .row small { display: block; color: var(--muted); font-size: 10.5px; }
.sheet .ghost { min-height: 36px; padding: 0 14px; border-radius: 18px;
  background: var(--surface-2); font-size: 12px; font-weight: 700;
  transition: background 200ms var(--ease), transform 160ms var(--ease); }
.sheet .ghost:active { transform: scale(0.95); }
.sheet .ghost.on { background: var(--turquoise); color: #12001f; }
.room-edit { display: grid; grid-template-columns: 1fr 74px 54px; gap: 8px; align-items: center;
  margin-bottom: 8px; }
.room-edit input { min-height: 38px; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 60;
  animation: toast-in 320ms var(--ease) both;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 20px;
  padding: 10px 16px; font-size: 12px; animation: rise 200ms ease both; }
.empty { text-align: center; color: var(--muted); font-size: 12px; padding: 26px 10px; }

/* ----------------------------------------------------------- test clock */
/* Demo instance only — the live app never renders this. */

.timebar { border: 1px dashed var(--pink); background: #2e0742; }
.tt-label { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; color: var(--pink);
  margin-bottom: 10px; }
.tt-row { display: flex; gap: 6px; margin-bottom: 6px; }
.tt-row:last-child { margin-bottom: 0; }
.tt { flex: 1; min-height: 36px; border-radius: 10px; background: var(--surface-2);
  font-size: 12px; font-weight: 700; transition: 140ms ease; }
.tt:active { transform: scale(0.95); }
.tt.wide { font-size: 11px; }
.ticket-total { margin-top: 8px; font-size: 9.5px; color: var(--muted);
  border-top: 1px solid rgba(91, 43, 118, 0.6); padding-top: 7px; }

/* ------------------------------------------------------- arriving parties */

.arrive .arrive-head { display: flex; justify-content: space-between; align-items: baseline;
  gap: 8px; padding-left: 10px; }
.arrive .arrive-head b { font-size: 14px; }
.arrive .arrive-head span { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.arrive .arrive-sub { padding-left: 10px; margin-top: 4px; font-size: 10.5px; color: var(--muted); }
.arrive-go { margin-top: 11px; width: 100%; min-height: 40px; border-radius: 20px;
  background: var(--blue); color: #06121f; font-weight: 700; font-size: 12px;
  letter-spacing: 0.04em; transition: transform 160ms var(--ease), filter 160ms var(--ease); }
.arrive-go:active { transform: scale(0.97); filter: brightness(1.1); }

/* ------------------------------------------------------ one room, one day */

.day-strip { position: relative; height: 30px; border-radius: 8px; background: var(--surface);
  margin: 4px 0 4px; overflow: hidden; }
.day-block { position: absolute; top: 5px; bottom: 5px; background: var(--purple);
  border-radius: 5px; min-width: 4px; }
.day-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--turquoise); }
.day-scale { display: flex; justify-content: space-between; font-size: 9px; color: var(--muted);
  margin-bottom: 14px; }
.slot { padding: 12px 14px 12px 16px; }
.slot .slot-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.slot .slot-head b { font-size: 13px; }
.slot .slot-head span { font-size: 10px; color: var(--muted); }
.slot .slot-times { display: flex; gap: 14px; margin-top: 9px; }
.slot .slot-times span { font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.slot .slot-times i { display: block; font-style: normal; font-size: 8px; font-weight: 400;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.slot .slot-sub { margin-top: 8px; font-size: 10px; color: var(--muted); }
.slot.is-past { opacity: 0.45; }
.slot.is-now { background: #3d1054; }

/* kitchen: order marked done */
.ticket .go.is-done-btn { background: var(--turquoise); color: #12001f; }
.ticket .go { transition: transform 160ms var(--ease), filter 160ms var(--ease); }
.ticket .go:active { transform: scale(0.97); }

@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }
.room { transition: transform 160ms var(--ease), background 200ms var(--ease); }
.room:active { transform: scale(0.95); }
@media (prefers-reduced-motion: reduce) {
  .card, .sheet-inner, .toast { animation: none; }
  .swipe-body, .rail .fill { transition: none; }
}

/* ------------------------------------------------------------ debug mode */

/* Debug has to be unmistakable at a glance: an admin who forgets he is in it
   and starts working a real Saturday is the only way this feature hurts. */
body.is-debug { box-shadow: inset 0 0 0 3px var(--pink); }
body.is-debug .top { background: linear-gradient(90deg, #2e0742, var(--surface, #390253)); }
body.is-debug .brand::after {
  content: 'DEBUG';
  margin-left: 8px; padding: 2px 6px; border-radius: 6px;
  background: var(--pink); color: #2e0742;
  font-size: 9px; font-weight: 800; letter-spacing: 0.1em; vertical-align: middle;
}
.tt-note { font-size: 11px; line-height: 1.4; color: var(--muted); margin: -4px 0 10px; }
.tt.on { background: var(--pink); color: #2e0742; }
.tt small { display: block; font-size: 9px; font-weight: 600; opacity: 0.75; margin-top: 2px; }
.tt-days { flex-wrap: wrap; }
.tt-days .tt { flex: 1 1 60px; }
.sheet-note { font-size: 12px; line-height: 1.5; color: var(--muted); margin: 2px 0 14px; }
