/* Pokie Picker — Swiss futurist theme. One typeface, one accent, the motion is in the type. */
@font-face {
  font-family: "Archivo";
  src: url("archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --bg: #0b0b0c;
  --panel: #131315;
  --fg: #f2f0ea;
  --dim: rgba(242, 240, 234, .46);
  --line: rgba(242, 240, 234, .16);
  --acc: #c6ff00;          /* accent, and player 1 */
  --p2: #7db8ff;           /* player 2 */
  --ink: #0b0b0c;          /* text on the accent */
  --font: "Archivo", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --pad: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--fg);
  font-family: var(--font); font-variant-numeric: tabular-nums;
  overflow: hidden; overscroll-behavior: none; touch-action: manipulation;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); margin: 0; }

.label, .links button, .room, .sheet header p, .ghost, .solid {
  font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; font-stretch: 112%; line-height: 1;
}

/* ---------- frame ---------- */
.app {
  height: 100dvh; max-width: 760px; margin: 0 auto;
  display: flex; flex-direction: column;
  padding: calc(6px + env(safe-area-inset-top)) calc(var(--pad) + env(safe-area-inset-right))
           calc(8px + env(safe-area-inset-bottom)) calc(var(--pad) + env(safe-area-inset-left));
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}

.top { flex: none; height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.players { display: flex; align-items: center; gap: 14px; min-width: 0; }
.wordmark { font-weight: 800; font-stretch: 125%; letter-spacing: .08em; font-size: 13px; text-transform: uppercase; white-space: nowrap; }
.who { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who i { flex: none; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--c); }
.who.on i { background: var(--c); }
.who.me span { border-bottom: 1.5px solid var(--c); padding-bottom: 2px; }
.who.off { color: var(--dim); }
.who.s0 { --c: var(--acc); } .who.s1 { --c: var(--p2); } .who.wait { --c: var(--dim); color: var(--dim); }
.room { flex: none; min-height: 44px; padding: 0 0 0 12px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.room b { font-size: 15px; font-weight: 800; letter-spacing: .22em; font-stretch: 125%; color: var(--acc); }
.room:hover { color: var(--acc); }

.board { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }

/* ---------- chain: the three decisions ---------- */
.chain { flex: none; list-style: none; margin: 0; padding: 0; }
.row {
  height: clamp(32px, 5.6dvh, 44px); display: grid; grid-template-columns: 30px 24px minmax(0, 1fr); align-items: center;
  border-bottom: 1px solid var(--line); color: var(--dim); transition: color .25s;
}
.row .num { font-size: 11px; font-weight: 600; letter-spacing: .12em; }
.row .txt {
  font-size: clamp(15px, 2.9dvh, 20px); font-weight: 800; font-stretch: 100%; text-transform: uppercase; letter-spacing: .02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .18s;
}
.row.live { color: var(--fg); }
.row.done { color: var(--fg); }
.row.done .txt { opacity: 1; }
.row.done.fly .txt { transition-delay: .5s; }
.row.skip .num, .row.skip .shape { opacity: .35; }
.shape { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; flex: none; overflow: visible; }
.row.done .shape, .poster .shape { fill: currentColor; }
.row.done .shape { color: var(--acc); }
.row.live .shape { animation: turn 1.1s linear infinite; transform-origin: 50% 55%; }
@keyframes turn { to { transform: rotate(360deg); } }

/* ---------- stage: the live decision ---------- */
.stage { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.stage-label, .stage-note { position: absolute; top: 12px; z-index: 3; display: flex; align-items: center; gap: 8px; max-width: 62%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.stage-label { left: 0; color: var(--dim); }
.stage-note { right: 0; max-width: 38%; color: var(--acc); opacity: 0; transition: opacity .25s; }
.stage-note.show { opacity: 1; }
.stage-note.err { color: #ff8a7a; }
.stretch { position: absolute; inset: 0; transform-origin: 50% 50%; will-change: transform; }
.strip { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.item {
  position: absolute; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 800; text-transform: uppercase; line-height: .9; white-space: nowrap; letter-spacing: -.01em;
}
.item.hint { color: var(--dim); }
.item.won { animation: land .5s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes land { 0% { transform: scale(1.09); } 100% { transform: scale(1); } }
/* neighbours fade into the background above and below the payline */
.stage::before, .stage::after { content: ""; position: absolute; left: 0; right: 0; height: calc((100% - var(--h, 100px)) / 2); z-index: 2; pointer-events: none; }
.stage::before { top: 0; background: linear-gradient(var(--bg) 10%, rgba(11, 11, 12, .8) 60%, rgba(11, 11, 12, .66)); }
.stage::after { bottom: 0; background: linear-gradient(rgba(11, 11, 12, .66), rgba(11, 11, 12, .8) 40%, var(--bg) 90%); }
.payline { position: absolute; left: 0; right: 0; top: 50%; height: var(--h, 100px); transform: translateY(-50%); z-index: 3; pointer-events: none; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.payline::before, .payline::after { content: ""; position: absolute; top: 50%; width: 10px; height: 2px; background: var(--acc); }
.payline::before { left: 0; } .payline::after { right: 0; }
.payline i { position: absolute; left: 0; right: 0; bottom: -2px; height: 3px; background: var(--acc); transform: scaleX(0); transform-origin: left; transition: transform .2s ease-in; }
.stage.hit .payline i { transform: scaleX(1); transition: transform .38s cubic-bezier(.2, .8, .2, 1); }
.flyer { color: var(--acc); position: fixed; z-index: 20; margin: 0; pointer-events: none; transform-origin: 0 0; will-change: transform, opacity; }

/* ---------- poster: the payoff ---------- */
.poster {
  position: absolute; inset: 0; z-index: 6; background: var(--acc); color: var(--ink);
  display: flex; flex-direction: column; padding: 14px 14px 12px; cursor: pointer; overflow: hidden;
}
.poster.in { animation: wipe .55s cubic-bezier(.7, 0, .2, 1) both; }
@keyframes wipe { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0 0 0 0); } }
.poster-head, .poster-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.poster-head { padding-bottom: 10px; border-bottom: 1.5px solid var(--ink); }
.poster-foot { padding-top: 10px; border-top: 1.5px solid var(--ink); }
.poster .shapes { display: flex; gap: 5px; }
.poster.in .shapes .shape { animation: lock .7s cubic-bezier(.2, 1.4, .4, 1) .35s both; }
.poster.in .shapes .shape:nth-child(1) { --from: -26px; } .poster.in .shapes .shape:nth-child(3) { --from: 26px; }
@keyframes lock { from { transform: translateX(var(--from, 0)) rotate(-120deg); opacity: 0; } to { transform: none; opacity: 1; } }
.poster-body { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; }
.pl { display: flex; flex-direction: column; }
.pl + .pl { margin-top: 10px; }
.pl .label { height: 20px; display: flex; align-items: center; gap: 7px; }
.pl .plines { display: flex; flex-direction: column; font-weight: 900; text-transform: uppercase; line-height: .9; white-space: nowrap; letter-spacing: -.01em; }
.poster.in .pl { animation: rise .6s cubic-bezier(.2, .9, .2, 1) both; animation-delay: calc(.22s + var(--i) * .11s); }
@keyframes rise { from { transform: translateY(46px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- dock ---------- */
.dock { flex: none; padding-top: 12px; }
.spin {
  width: 100%; height: clamp(54px, 9dvh, 68px); background: var(--acc); color: var(--ink);
  font-size: 20px; font-weight: 800; font-stretch: 125%; letter-spacing: .42em; text-indent: .42em; text-transform: uppercase;
  transition: transform .08s, background .2s, color .2s; position: relative; overflow: hidden;
}
.spin:active:not(:disabled) { transform: scale(.985); }
.spin:disabled { background: transparent; color: var(--dim); box-shadow: inset 0 0 0 1px var(--line); cursor: default; }
.spin.busy::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--acc); transform-origin: left; animation: fill var(--dur, 6s) linear both; }
@keyframes fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.links { display: flex; justify-content: space-between; gap: 6px; }
.links button { min-height: 44px; padding: 0 2px; color: var(--dim); }
.links button:hover, .links button[aria-pressed="true"] { color: var(--fg); }
.links button:disabled { opacity: .4; cursor: default; }

/* ---------- sheets ---------- */
.sheet {
  width: min(94vw, 560px); max-height: 88dvh; padding: 0; border: 1px solid var(--line); background: var(--panel); color: var(--fg);
  -webkit-user-select: text; user-select: text;
}
.sheet.small { width: min(94vw, 440px); }
.sheet[open] { display: flex; flex-direction: column; }
.sheet > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.sheet::backdrop { background: rgba(0, 0, 0, .72); }
.sheet header { flex: none; padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.sheet h2 { margin: 0; font-size: 26px; font-weight: 800; font-stretch: 125%; text-transform: uppercase; letter-spacing: .02em; line-height: 1; }
.sheet header p { margin: 10px 0 0; color: var(--dim); line-height: 1.5; letter-spacing: .08em; text-transform: none; font-size: 12.5px; font-stretch: 100%; }
.sheet header p b { color: var(--acc); }
.sheet-body { flex: 1; min-height: 0; overflow: auto; padding: 12px 18px; overscroll-behavior: contain; }
.sheet footer { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.grow { flex: 1; }
.ghost, .solid { min-height: 44px; padding: 0 16px; }
.ghost { box-shadow: inset 0 0 0 1px var(--line); color: var(--fg); }
.ghost:hover { box-shadow: inset 0 0 0 1px var(--fg); }
.solid { background: var(--acc); color: var(--ink); font-weight: 800; }

/* editor */
.opt { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto; align-items: center; gap: 6px; }
.opt .shape { color: var(--dim); }
.opt input, #nameInput {
  width: 100%; min-width: 0; height: 46px; padding: 0 2px; background: none; color: var(--fg); border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  font: 600 17px var(--font); outline: none;
}
.opt input:focus, #nameInput:focus { border-bottom-color: var(--acc); }
.opt input::placeholder, #nameInput::placeholder { color: var(--dim); font-weight: 400; }
.mini { height: 44px; min-width: 44px; padding: 0 8px; color: var(--dim); font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.mini.if { color: var(--acc); }
.mini:hover { color: var(--fg); }
.sub { margin: 4px 0 12px 10px; padding-left: 14px; border-left: 1px solid var(--line); }
.iflabel { height: 26px; display: flex; align-items: center; gap: 6px; color: var(--acc); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.add { height: 44px; color: var(--dim); font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.add:hover { color: var(--fg); }
.readonly { color: var(--dim); font-size: 13px; padding: 4px 0 12px; }

/* history */
.hi { padding: 12px 0; border-bottom: 1px solid var(--line); }
.hi .path { font-size: 17px; font-weight: 800; text-transform: uppercase; line-height: 1.15; overflow-wrap: anywhere; }
.hi .path i { font-style: normal; color: var(--acc); padding: 0 6px; }
.hi .meta { margin-top: 7px; color: var(--dim); display: flex; gap: 8px; align-items: center; }
.hi .meta b { width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--dim)); }
.empty { color: var(--dim); font-size: 14px; padding: 12px 0; }

/* room */
.bigcode { font-size: clamp(56px, 20vw, 92px); font-weight: 900; font-stretch: 125%; letter-spacing: .08em; line-height: 1; color: var(--acc); }
.link { margin-top: 10px; font-size: 13px; color: var(--dim); overflow-wrap: anywhere; -webkit-user-select: all; user-select: all; }
.status { min-height: 14px; margin-top: 14px; color: var(--acc); }

#measure { position: absolute; left: -99999px; top: 0; visibility: hidden; pointer-events: none; font-family: var(--font); font-size: 100px; font-weight: 800; text-transform: uppercase; line-height: 1; white-space: nowrap; letter-spacing: -.01em; }
#measure span { display: block; width: max-content; }

/* ---------- responsive ---------- */
@media (max-width: 600px) {
  .sheet, .sheet.small { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; }
  .sheet header { padding-top: calc(18px + env(safe-area-inset-top)); }
}
@media (max-height: 520px) {
  .top { height: 40px; }
  .row { height: 28px; }
  .links button { min-height: 36px; }
  .stage-label, .stage-note { top: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .row.live .shape, .item.won, .poster.in, .poster.in .pl, .poster.in .shapes .shape, .spin.busy::after { animation: none; }
  .stage.hit .payline i { transition: none; }
}
