/* Cubed Thinkers: every style for the landing page and the four game pages. */
:root {
  --red: #e53935;
  --red-dark: #8e1b19;
  --green: #43a047;
  --green-dark: #1f5e22;
  --bg: #0f1420;
  --bg-2: #18213a;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-strong: rgba(20, 27, 44, 0.92);
  --border: rgba(255, 255, 255, 0.12);
  --text: #eef1f7;
  --muted: #9aa5bd;
  --accent: #7aa2ff;
  --radius: 14px;
  --ghost: var(--red);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(120% 90% at 50% 20%, var(--bg-2) 0%, var(--bg) 70%);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
button {
  font: inherit; color: inherit; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel);
  border-radius: 10px; padding: 9px 14px;
  transition: background .15s, border-color .15s, transform .08s, opacity .15s;
}
button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .38; cursor: not-allowed; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- App layout ---------- */
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.topbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
}
.brand { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: .2px; white-space: nowrap; }
.brand[role="button"] { justify-self: start; cursor: pointer; border-radius: 8px; padding: 2px 6px; margin-left: -6px; transition: background .15s; }
.brand[role="button"]:hover { background: rgba(255, 255, 255, 0.08); }
.brand[role="button"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.brand span { color: var(--muted); font-weight: 500; }

.turn {
  display: flex; align-items: center; gap: 10px; justify-self: center;
  padding: 8px 16px; border-radius: 999px; background: var(--panel); border: 1px solid var(--border);
  font-weight: 600; white-space: nowrap; min-width: 0;
}
.dot {
  width: 14px; height: 14px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.8) 0 12%, transparent 40%), var(--c, #888);
  box-shadow: 0 0 10px var(--c, transparent);
}
.dot.red { --c: var(--red); }
.dot.green { --c: var(--green); }
.turn.thinking .dot { animation: pulse 1s ease-in-out infinite; }
.ellipsis::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
@keyframes pulse { 50% { transform: scale(1.35); } }

.score-col { justify-self: end; position: relative; }
.score { display: flex; gap: 6px; }
.side-btns { position: absolute; right: 0; top: calc(100% + 8px); z-index: 6; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.side-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; font-size: 13px; border-radius: 10px;
  background: rgba(20, 27, 44, .88); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.side-btn svg { width: 16px; height: 16px; flex: none; }
.side-btn[aria-pressed="true"] { color: var(--muted); }
.viewbar { padding-left: 110px !important; padding-right: 110px !important; }   /* keep clear of the Menu/Sound column */
#boardMode button.sel { background: rgba(122,162,255,.25); border-color: rgba(122,162,255,.6); }
.score-item {
  display: flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--border); font-size: 13px; color: var(--muted); white-space: nowrap;
}
.score-item b { color: var(--text); font-size: 16px; min-width: 1ch; text-align: right; }
.score-item small { font-size: 11px; opacity: .8; }

/* Arena: Red's clock | the cube | Green's clock. The clocks are grid cells, so they never cover the cube. */
.arena {
  flex: 1; min-height: 0; display: grid; gap: 0 12px; padding: 0 12px;
  grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "l s r";
}
.arena.no-clocks { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) !important; grid-template-areas: "s" !important; padding: 0 !important; }
#stage { grid-area: s; position: relative; min-height: 0; min-width: 0; }
#clock1 { grid-area: l; } #clock2 { grid-area: r; }
.clock {
  --c: var(--red);
  align-self: center; width: clamp(128px, 13vw, 170px); display: grid; gap: 8px; padding: 14px;
  border-radius: 16px; background: var(--panel); border: 1px solid var(--border);
  opacity: .55; transition: opacity .25s, box-shadow .25s, border-color .25s;
}
.clock[data-p="2"] { --c: var(--green); }
.clock.active { opacity: 1; border-color: var(--c); box-shadow: 0 0 0 1px var(--c), 0 0 26px -6px var(--c); }
.clk-head { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-weight: 700; min-width: 0; }
.clk-tag { color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; }
.clk-time { font: 700 30px/1.05 ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.clk-time.none { font: 500 12px/1.3 system-ui, -apple-system, sans-serif; color: var(--muted); letter-spacing: 0; }
.clock.low .clk-time { color: #ff6b6b; animation: lowtime 1s ease-in-out infinite; }
.clock.crit .clk-time { color: #ff4f4f; }
@keyframes lowtime { 50% { opacity: .55; } }
.clk-sp { display: flex; gap: 6px; }
.clk-sp:empty { display: none; }
.sp-ico {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--c); color: var(--c); opacity: .4;
}
.sp-ico.on { background: var(--c); color: #0b1020; opacity: 1; }
.sp-ico svg { width: 14px; height: 14px; }
.setup-title { margin: 0 0 14px; font-size: 16px; color: var(--muted); font-weight: 600; text-align: left; }
.option-row { padding: 10px 12px; margin-bottom: 14px; border-radius: 12px; background: rgba(122,162,255,.08); border: 1px solid rgba(122,162,255,.25); text-align: left; }
.tiltbar .tw-ico { display: inline-grid; place-items: center; min-width: 36px; padding: 4px 6px; }
.tiltbar .tw-ico svg { width: 18px; height: 18px; }
.tiltbar button.sel { background: rgba(122,162,255,.25); border-color: rgba(122,162,255,.6); }
.tiltbar .tw-go { background: var(--accent); color: #0b1020; font-weight: 700; border-color: transparent; padding: 4px 12px; }
.tiltbar .tw-go:hover:not(:disabled) { background: #9bb9ff; }
.cell.slice-out .ball { opacity: .45; }
#view3d { position: absolute; inset: 0; }
#view3d canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; outline: none; }
#view3d canvas.dragging { cursor: grabbing; }
#view3d canvas.can-place { cursor: pointer; }

.stage-hint {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  font-size: 12px; color: var(--muted); background: rgba(0,0,0,.25); padding: 5px 12px; border-radius: 999px;
  pointer-events: none; white-space: nowrap; transition: opacity .6s; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis;
}
.stage-hint.faded { opacity: 0; }
/* Gameplay tips: fade in near the top of the board now and then; never take clicks. */
.tip {
  position: absolute; left: 50%; top: 10px; z-index: 3; display: flex; align-items: baseline; gap: 9px;
  width: max-content; max-width: calc(100% - 24px); padding: 7px 14px; border-radius: 12px; pointer-events: none;
  font-size: 13px; line-height: 1.4; color: var(--text); background: rgba(20,27,44,.86); border: 1px solid rgba(159,232,255,.25);
  box-shadow: 0 8px 24px rgba(0,0,0,.35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; transform: translate(-50%, -6px); transition: opacity .6s ease, transform .6s ease;
}
.tip.show { opacity: 1; transform: translate(-50%, 0); }
.tip-label { flex: none; font: 600 10.5px/1 var(--font-hud); letter-spacing: .16em; text-transform: uppercase; color: var(--phosphor); }
@media (prefers-reduced-motion: reduce) { .tip { transition: none; transform: translate(-50%, 0); } }
.notice {
  position: absolute; left: 50%; top: 8px; transform: translateX(-50%); font-size: 12px;
  background: rgba(229, 57, 53, .18); border: 1px solid rgba(229, 57, 53, .4); padding: 6px 12px; border-radius: 999px; white-space: nowrap;
}

/* ---------- Layers view ---------- */
#layers {
  position: absolute; inset: 0; display: grid; place-content: center;
  grid-template-columns: repeat(var(--k, 3), auto);
  gap: 18px; padding: 16px; overflow: auto; --cs: 64px; --n: 3;
}
#layers.with-notice { padding-top: 48px; }
.layer { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.layer h3 { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .4px; text-transform: uppercase; }
.board {
  display: grid; grid-template-columns: repeat(var(--n), var(--cs)); grid-template-rows: repeat(var(--n), var(--cs));
  gap: calc(var(--cs) * 0.08); padding: calc(var(--cs) * 0.1);
  background: rgba(255,255,255,.04); border: 1px solid var(--border); border-radius: var(--radius);
}
.cell {
  position: relative; padding: 0; border-radius: calc(var(--cs) * 0.16); width: var(--cs); height: var(--cs);
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
}
.cell:disabled { cursor: default; opacity: 1; }
.ball {
  position: absolute; inset: 12%; border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,.85) 0 7%, rgba(255,255,255,0) 32%),
    radial-gradient(circle at 50% 55%, var(--c) 45%, var(--cd) 100%);
  box-shadow: 0 4px 10px rgba(0,0,0,.45);
  transition: opacity .3s;
}
.ball.red { --c: var(--red); --cd: var(--red-dark); }
.ball.green { --c: var(--green); --cd: var(--green-dark); }
.ball.pop { animation: pop .28s cubic-bezier(.34,1.56,.64,1); }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.cell.win .ball { animation: glow 1s ease-in-out infinite; }
@keyframes glow {
  0%, 100% { transform: scale(1); box-shadow: 0 0 6px 2px var(--c); }
  50% { transform: scale(1.1); box-shadow: 0 0 22px 8px var(--c); }
}
.cell.win { border-color: rgba(255,255,255,.5); }
.cell.slice-preview { box-shadow: inset 0 0 0 2px rgba(122,162,255,.75); background: rgba(122,162,255,.12); }
.cell.locked { background: rgba(255,255,255,.015); border-style: dashed; border-color: rgba(255,255,255,.07); }
.cell.dim .ball { opacity: .5; filter: saturate(.6); }
@media (hover: hover) {
  #layers.interactive .cell:not(:disabled):hover { border-color: rgba(255,255,255,.35); }
  #layers.interactive .cell:not(:disabled):hover::after {
    content: ""; position: absolute; inset: 12%; border-radius: 50%; background: var(--ghost); opacity: .35;
  }
}

/* ---------- Banner ---------- */
/* Result: a compact strip pinned to the top of the board area, so the winning balls stay in view. */
.banner {
  position: absolute; left: 50%; top: 8px; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 24px); text-align: left;
  display: grid; grid-template-columns: minmax(0, auto) auto; align-items: center; gap: 2px 18px;
  background: var(--panel-strong); border: 1px solid var(--border); border-radius: 14px;
  padding: 10px 10px 10px 16px; box-shadow: 0 14px 34px rgba(0,0,0,.45);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: dropin .3s cubic-bezier(.2,.9,.3,1.15);
}
.banner h2 { grid-column: 1; margin: 0; font-size: 19px; display: flex; align-items: center; gap: 8px; }
.banner h2 .dot { width: 16px; height: 16px; }
.banner p { grid-column: 1; margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.35; max-width: 40ch; }
.banner .row { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 6px; flex-wrap: nowrap; }
.banner .row button { padding: 7px 12px; font-size: 13.5px; border-radius: 9px; white-space: nowrap; }
@keyframes dropin { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (max-width: 620px) {
  .banner { grid-template-columns: minmax(0, 1fr); width: calc(100% - 20px); top: 6px; padding: 9px 10px; gap: 2px; }
  .banner h2 { font-size: 17px; }
  .banner .row { grid-column: 1; grid-row: auto; margin-top: 6px; flex-wrap: wrap; }   /* 4 buttons (online / after a robot game) wrap */
  .banner .row button { flex: 1 1 auto; padding: 7px 6px; font-size: 13px; }
}

.primary { background: var(--accent); border-color: transparent; color: #0b1020; font-weight: 700; }
.primary:hover:not(:disabled) { background: #9bb9ff; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom));
}
.toolbar button { display: inline-flex; align-items: center; gap: 7px; }
.toolbar svg { width: 17px; height: 17px; flex: none; }
.toolbar button[aria-pressed="true"] { background: rgba(122,162,255,.22); border-color: rgba(122,162,255,.55); }

/* ---------- Home: retro-space title screen over the live demo ----------
   Layout: hero on the left (cube shown off to the right by the camera), other games below the fold. */
:root {
  --font-display: "Syncopate", "Eurostile", "Arial Black", system-ui, sans-serif;
  --font-hud: "Chakra Petch", ui-monospace, "SF Mono", Menlo, monospace;
  --phosphor: #9fe8ff;
  --space: #060912;
}
body.home {
  background:
    radial-gradient(1px 1px at 23px 41px, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(1px 1px at 141px 97px, rgba(255,255,255,.35), transparent 60%),
    radial-gradient(1.5px 1.5px at 77px 163px, rgba(159,232,255,.45), transparent 60%),
    radial-gradient(1px 1px at 199px 13px, rgba(255,255,255,.3), transparent 60%),
    radial-gradient(130% 90% at 72% 40%, #141c33 0%, var(--space) 70%);
  background-size: 220px 220px, 220px 220px, 220px 220px, 220px 220px, 100% 100%;
}
body.home .topbar, body.home .viewbar, body.home .toolbar, body.home #hint,
body.home #banner, body.home .clock, body.home #layers { display: none !important; }
body.home #view3d { display: block !important; opacity: .72; }   /* the demo stays in the background */
.overlay.home-mode { display: block; padding: 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.home-page { position: relative; min-height: 100%; color: var(--text); }
.home-page::before {   /* vignette + faint scanlines, fixed over the demo */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.022) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse 75% 85% at 68% 46%, rgba(6,9,18,0) 30%, rgba(6,9,18,.78) 100%),
    linear-gradient(90deg, rgba(6,9,18,.82) 0%, rgba(6,9,18,.35) 48%, rgba(6,9,18,0) 70%);
}
.home-hero {
  min-height: 92vh; min-height: 92svh; max-width: 640px; display: flex; flex-direction: column; justify-content: center;
  gap: 18px; padding: 56px clamp(20px, 6vw, 88px) 40px;
}
.brandline {
  display: flex; align-self: flex-start; align-items: center; gap: 10px; font: 600 13px/1 var(--font-hud); letter-spacing: .32em; text-transform: uppercase;
  background: none; border: 0; padding: 4px 0; border-radius: 4px; color: inherit;
}
.brandline:hover:not(:disabled) { background: none; }
.brandline:disabled { opacity: 1; cursor: default; }   /* already on the Cubed Thinkers main page */
.brandline { flex-wrap: wrap; row-gap: 6px; gap: 16px; }
.brandline:hover:not(:disabled) .ct-logo { filter: drop-shadow(0 0 10px rgba(159,232,255,.45)); }
#btnHomeResume:not([hidden]) + #btnHome2p {   /* Resume takes the main style while it's showing */ background: rgba(10,16,32,.55); color: #e8f7ff; border-color: rgba(159,232,255,.45); }
.ct-logo { height: 52px; width: auto; flex: none; display: block; }   /* below ~240px wide the wordmark blurs */
.ct-presents { color: var(--muted); letter-spacing: .24em; }
.home-title {
  margin: 0; display: flex; flex-direction: column; font: 700 clamp(46px, 8.6vw, 112px)/.92 var(--font-display);
  letter-spacing: .01em; text-transform: uppercase; color: #f1f4fb; text-wrap: balance;
  /* red/green channel offset: the two players' colours, like a CRT signal */
  text-shadow: -0.045em 0 rgba(229,57,53,.62), 0.045em 0 rgba(67,160,71,.62), 0 0 42px rgba(159,232,255,.22);
}
.home-tag { margin: 6px 0 0; font: 600 clamp(17px, 2.2vw, 22px)/1.2 var(--font-hud); letter-spacing: .14em; text-transform: uppercase; color: var(--phosphor); }
.home-desc { margin: 0; max-width: 46ch; font-size: 16px; line-height: 1.55; color: #c3cbe0; }
.home-title.three-line { font-size: clamp(40px, 7vw, 92px); }   /* "3×3×3 / Knots & / Crosses": keep the block about as tall as two lines */
.home-title span { white-space: nowrap; }   /* each hero line is one deliberate line ("Knots &" must not split) */
.home-tag { text-wrap: balance; }
@media (min-width: 900px) { .home-tag { white-space: nowrap; } }   /* taglines run a little wider than the description column */
.home-title .size-line { font-size: .62em; letter-spacing: .06em; margin-bottom: .1em; }
/* Game facts: one cell per fact, joined like a readout strip. */
.home-stats {
  list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-self: flex-start; max-width: 100%;
  border: 1px solid rgba(159,232,255,.28); border-radius: 3px; background: rgba(6,9,18,.5);
  font: 500 13px/1 var(--font-hud); letter-spacing: .14em; text-transform: uppercase; color: #c3cbe0;
}
.home-stats li { display: flex; align-items: baseline; gap: 7px; padding: 10px 14px; }
.home-stats li + li { border-left: 1px solid rgba(159,232,255,.28); }
.home-stats b { font: 700 17px/1 var(--font-display); color: var(--phosphor); letter-spacing: 0; }
@media (max-width: 700px) {   /* phones: three equal columns, number over label, so the strip never wraps onto a second row */
  .home-stats { display: grid; grid-template-columns: repeat(3, 1fr); align-self: stretch; font-size: 11px; letter-spacing: .1em; }
  .home-stats li { flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 12px; }
}
.home-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.cta {
  font: 600 15px/1 var(--font-hud); letter-spacing: .16em; text-transform: uppercase;
  padding: 16px 26px; border-radius: 4px; border: 1px solid rgba(159,232,255,.45); background: rgba(10,16,32,.55); color: #e8f7ff;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
.cta:hover:not(:disabled) { background: rgba(159,232,255,.14); }
.cta-main { background: var(--phosphor); color: #06121a; border-color: transparent; }
.cta-main:hover:not(:disabled) { background: #c2f1ff; }
.live-chip {
  display: inline-flex; align-self: flex-start; align-items: center; gap: 10px; margin-top: 10px; padding: 7px 12px;
  font: 500 12px/1.2 var(--font-hud); letter-spacing: .12em; text-transform: uppercase; color: #c3cbe0;
  border: 1px solid rgba(159,232,255,.22); background: rgba(6,9,18,.55); border-radius: 3px; max-width: 100%;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #ff5252; box-shadow: 0 0 10px #ff5252; animation: livepulse 1.6s ease-in-out infinite; flex: none; }
@keyframes livepulse { 50% { opacity: .35; } }
.live-label { color: var(--phosphor); font-weight: 600; }
.live-text { font-variant-numeric: tabular-nums; min-width: 0; transition: color .2s; }
.live-chip[data-state="tilt"] { border-color: rgba(159,232,255,.6); box-shadow: 0 0 18px -6px var(--phosphor); }
.live-chip[data-state="tilt"] .live-text { color: var(--phosphor); font-weight: 600; }
.live-chip[data-state="win-red"] { border-color: var(--red); }
.live-chip[data-state="win-red"] .live-text { color: #ff8a80; font-weight: 600; }
.live-chip[data-state="win-green"] { border-color: var(--green); }
.live-chip[data-state="win-green"] .live-text { color: #9be7a0; font-weight: 600; }
.home-more { position: relative; padding: 36px clamp(20px, 6vw, 88px) 24px; background: linear-gradient(180deg, rgba(6,9,18,0), rgba(6,9,18,.92) 60px); }
.more-title { margin: 0 0 18px; font: 700 14px/1.2 var(--font-display); letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.more-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.more-grid .game-card { background: rgba(14,20,38,.78); border-color: rgba(159,232,255,.16); border-radius: 6px; }
.more-grid .game-card:hover:not(:disabled) { border-color: rgba(159,232,255,.5); background: rgba(20,30,56,.9); }
.more-grid .gc-text b { font: 700 15px/1.2 var(--font-display); letter-spacing: .04em; text-transform: uppercase; }
.more-grid .soon { grid-column: 1 / -1; border: 1px dashed rgba(159,232,255,.22); border-radius: 6px; display: grid; place-items: center; padding: 14px; color: var(--muted); font: 500 13px/1.4 var(--font-hud); letter-spacing: .1em; text-transform: uppercase; text-align: center; }
.home-foot { padding: 18px clamp(20px, 6vw, 88px) 28px; font: 500 12px/1 var(--font-hud); letter-spacing: .14em; text-transform: uppercase; color: rgba(154,165,189,.6); background: rgba(6,9,18,.92); }
@media (max-width: 700px) {
  .home-hero { justify-content: flex-start; padding-top: 34px; min-height: 0; padding-bottom: 46vh; }
  .home-page::before { background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.022) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, rgba(6,9,18,.86) 0%, rgba(6,9,18,.55) 45%, rgba(6,9,18,.1) 65%, rgba(6,9,18,.6) 100%); }
}

/* ---------- Menu ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(8, 11, 20, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); overflow: auto;
}
.overlay[hidden] { display: none; }
.card {
  width: min(460px, 100%); background: var(--panel-strong); border: 1px solid var(--border);
  border-radius: 22px; padding: 26px 24px; box-shadow: 0 30px 80px rgba(0,0,0,.55); text-align: center; margin: auto;
}
.logo { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.logo .dot { width: 26px; height: 26px; }
.card h1 { margin: 0 0 6px; font-size: 26px; }
.sub { margin: 0 0 22px; color: var(--muted); }
.menu-main { display: grid; gap: 12px; }
.big { padding: 16px; font-size: 18px; font-weight: 700; border-radius: 14px; }
.opt { display: grid; gap: 8px; margin-bottom: 16px; text-align: left; }
.opt-label { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 8px; }
.seg button.sel { background: rgba(122,162,255,.22); border-color: var(--accent); }
.card .row { display: flex; gap: 10px; margin-top: 6px; }
.card .row button { flex: 1; padding: 12px; }
.viewbar { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 12px; padding: 0 10px 6px; }
.seg-mini {
  display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--border);
}
.mini-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding: 0 6px 0 5px; }
.seg-mini button { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; border-color: transparent; background: transparent; }
.seg-mini button.sel { background: rgba(122,162,255,.25); border-color: rgba(122,162,255,.6); }
.toolbar button.accent { border-color: rgba(122,162,255,.65); background: rgba(122,162,255,.16); color: #d6e3ff; font-weight: 600; }
.toolbar button.accent[aria-pressed="true"] { background: rgba(122,162,255,.34); }
.settings { display: grid; gap: 10px; margin-top: 18px; text-align: left; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.switch input {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none; cursor: pointer; position: relative;
  width: 38px; height: 22px; border-radius: 999px; background: rgba(255,255,255,.16); transition: background .15s;
}
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform .15s;
}
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cell.threat::before {
  content: ""; position: absolute; inset: 24%; border-radius: 50%; border: 2px solid var(--tc);
  animation: threat 1.1s ease-in-out infinite;
}
.cell.t-red { --tc: var(--red); }
.cell.t-green { --tc: var(--green); }
@keyframes threat { 0%, 100% { opacity: .85; transform: scale(1); } 50% { opacity: .35; transform: scale(1.15); box-shadow: 0 0 12px var(--tc); } }
.tiltbar { flex-wrap: wrap; justify-content: center; max-width: 100%; }
.tiltbar button { min-width: 34px; font-size: 14px; }
.tiltbar .tw-group { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; }
.tiltbar .tw-group + .tw-group { border-left: 1px solid var(--border); padding-left: 4px; margin-left: 2px; }
.tiltbar .tw-turn { font-size: 19px; line-height: 1; min-width: 38px; }
.tiltbar button.tilt-text { font-size: 12px; }
.tiltbar .tilt-info { font-size: 11.5px; color: var(--muted); padding: 0 6px; white-space: nowrap; }
.tiltbar.flash { animation: tiltflash .6s ease-out; }
@keyframes tiltflash { from { box-shadow: 0 0 0 3px rgba(122,162,255,.6); } to { box-shadow: 0 0 0 0 rgba(122,162,255,0); } }
.noscript-note {
  text-align: left; font-size: 14px; line-height: 1.5; color: var(--text);
  background: rgba(229,57,53,.12); border: 1px solid rgba(229,57,53,.4); border-radius: 12px; padding: 12px 14px;
}
.noscript-note b { display: block; margin-bottom: 4px; }
.game-list { display: grid; gap: 12px; }
.game-card { display: flex; align-items: center; gap: 16px; text-align: left; padding: 14px 16px; border-radius: 16px; }
.gc-icon {
  flex: none; width: 54px; height: 54px; display: grid; gap: 3px; padding: 6px;
  grid-template-columns: repeat(var(--n), 1fr); border-radius: 12px; background: rgba(255,255,255,.06);
}
.gc-icon i { border-radius: 50%; background: rgba(200,212,255,.25); }
.gc-icon i.g { background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.8) 0 12%, transparent 40%), var(--green); }
.gc-icon i.on { background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.8) 0 12%, transparent 40%), var(--red); }
.gc-text { display: grid; gap: 2px; min-width: 0; }
.gc-text b { font-size: 17px; }
.gc-text span { color: var(--muted); font-size: 14px; }
.gc-text small { color: var(--muted); font-size: 12px; opacity: .8; }
.link-btn { display: block; background: none; border: none; color: var(--muted); padding: 2px 0; margin: -6px 0 8px; font-size: 14px; }
.link-btn:hover:not(:disabled) { background: none; color: var(--text); }
.rules { margin-top: 18px; text-align: left; color: var(--muted); font-size: 14px; }
.rules summary { cursor: pointer; color: var(--text); font-weight: 600; }
.rules ul { padding-left: 18px; margin: 8px 0 0; line-height: 1.5; }

/* Links that replaced buttons now that each game has its own page: they look exactly as before. */
a.brandline, a.game-card, a.link-big { color: inherit; text-decoration: none; }
a.game-card, a.link-big { border: 1px solid var(--border); background: var(--panel); transition: background .15s, border-color .15s; }
a.game-card:hover, a.link-big:hover { background: rgba(255, 255, 255, 0.12); }
a.link-big { display: block; text-align: center; }
a.link-big.primary { background: var(--accent); border-color: transparent; color: #0b1020; }
a.link-big.primary:hover { background: #9bb9ff; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#btnOnWrongGame { margin-top: 12px; }
/* Play a Friend: the privacy note behind a small info button. */
.net-info { margin-top: 16px; text-align: center; }
.info-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; font-size: 12.5px; color: var(--muted); background: none; border-color: transparent; }
.info-btn:hover:not(:disabled) { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.info-btn svg { width: 15px; height: 15px; flex: none; }
.info-btn[aria-expanded="true"] { color: var(--text); }
.net-info .net-note { margin-top: 6px; }

/* Landing page: the game cards on their own, in the home pages' retro-space style. */
.landing .home-hero { min-height: 0; padding-bottom: 8px; }
.landing .home-more { background: none; padding-top: 12px; }
.landing .more-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.landing .more-grid .game-card.featured { border-color: rgba(159,232,255,.45); }
.landing .ct-logo { height: 56px; }
.landing-sub { margin: 0; max-width: 46ch; font-size: 16px; line-height: 1.55; color: #c3cbe0; }

/* ---------- Play a Friend (online) ---------- */
.net-note { margin: 16px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); text-align: left; }
.net-warn { color: #ffb4a8; }
.text-in { width: 100%; font: inherit; color: var(--text); background: rgba(255,255,255,.06); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; user-select: text; -webkit-user-select: text; }
.text-in:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.code-in { font: 700 28px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .35em; text-align: center; text-transform: uppercase; padding-left: .35em; }
.seg.wrap { flex-wrap: wrap; }
.seg.wrap button { flex: 1 1 40%; }
.room-code { font: 700 44px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .3em; padding-left: .3em; margin: 8px 0 12px; color: #fff; user-select: all; -webkit-user-select: all; }
.net-status { margin: 12px 0 0; min-height: 1.4em; font-size: 14px; line-height: 1.45; color: var(--muted); }
.net-status:empty { margin: 0; min-height: 0; }
.net-status.ok { color: #9be7a0; }
.net-status.err { color: #ff8a80; }
.players { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; text-align: left; }
.players li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border); min-width: 0; }
.players li.empty { opacity: .6; border-style: dashed; }
.players .pl-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.players .pl-tag { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
/* In-game connection status: a pill in the controls row above the board. */
.netbar {
  display: flex; align-items: center; gap: 8px; max-width: 100%; min-height: 34px; padding: 3px 4px 3px 11px;
  border-radius: 10px; font-size: 12.5px; line-height: 1.3; background: var(--panel); border: 1px solid var(--border);
}
.netbar .net-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: #43a047; box-shadow: 0 0 8px #43a047; }
.netbar[data-state="wait"] { border-color: rgba(255,179,0,.6); }
.netbar[data-state="wait"] .net-dot { background: #ffb300; box-shadow: 0 0 8px #ffb300; animation: livepulse 1.2s ease-in-out infinite; }
.netbar[data-state="lost"] { border-color: rgba(229,57,53,.6); }
.netbar[data-state="lost"] .net-dot { background: #e53935; box-shadow: 0 0 8px #e53935; }
#netText { min-width: 0; }
.netbar button { padding: 4px 10px; font-size: 12px; border-radius: 7px; white-space: nowrap; flex: none; }
.netbar button.primary { padding: 5px 12px; }
#btnResign.armed { border-color: rgba(229,57,53,.7); background: rgba(229,57,53,.2); }
@media (max-width: 620px) { .netbar { flex-wrap: wrap; justify-content: center; text-align: center; } }

[hidden] { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .topbar { grid-template-columns: 1fr auto; padding: 8px 10px; gap: 8px; }
  .brand { display: none; }
  .turn { justify-self: start; padding: 7px 12px; font-size: 14px; }
  .score-item { padding: 5px 8px; font-size: 12px; gap: 5px; }
  .score-item .lbl { display: none; }
  .score-item b { font-size: 15px; }
  .side-btn { padding: 7px; }
  .side-lbl { display: none; }
  .viewbar { padding-left: 6px !important; padding-right: 50px !important; }
  /* Clocks become a row above the cube so they never overlap it. */
  .arena { grid-template-columns: 1fr 1fr; grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "l r" "s s"; gap: 6px 8px; padding: 0 8px; }
  .clock { width: auto; align-self: stretch; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 8px; padding: 7px 10px; border-radius: 12px; }
  .clk-head { grid-column: 1 / -1; font-size: 13px; }
  .clk-time { font-size: 22px; }
  .sp-ico { width: 20px; height: 20px; }
  .sp-ico svg { width: 12px; height: 12px; }
  .toolbar { gap: 6px; padding: 8px; }
  .toolbar button { padding: 8px 10px; font-size: 14px; }
}
@media (max-width: 420px) {
  .viewbar { gap: 4px 6px; padding: 0 6px 4px; }
  .tiltbar .tilt-info { flex-basis: 100%; text-align: center; padding: 2px 0 1px; }
  .tiltbar button.tilt-text { padding: 4px 6px; }
  .seg-mini button { padding: 4px 7px; font-size: 12px; }
  .mini-label { padding: 0 3px; }
  .toolbar .lbl-long { display: none; }
  .toolbar { flex-wrap: nowrap; gap: 4px; }
  .toolbar button { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 3px; padding: 7px 2px; font-size: 11.5px; }
  .score-item small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* ---------- Daily Puzzle (gravity-cube/daily/, shared/daily.js) and the links to it ---------- */
.new-tag {
  display: inline-block; margin-left: 9px; padding: 3px 6px 2px; border-radius: 3px; vertical-align: middle;
  font: 700 10px/1 var(--font-hud); letter-spacing: .14em; text-transform: uppercase; background: var(--phosphor); color: #06121a;
}
a.cta { display: inline-flex; align-items: center; text-decoration: none; }
/* Landing page: the Gravity Cube card with its "Daily Puzzle" strip attached underneath. */
.card-with-daily { display: flex; flex-direction: column; min-width: 0; }
.card-with-daily .game-card { flex: 1; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.daily-link {
  display: flex; align-items: center; gap: 9px; padding: 11px 16px; color: #e8f7ff; text-decoration: none;
  border: 1px solid rgba(159,232,255,.45); border-top: 0; border-radius: 0 0 6px 6px; background: rgba(159,232,255,.08);
  font: 600 13px/1 var(--font-hud); letter-spacing: .14em; text-transform: uppercase; transition: background .15s;
}
.daily-link:hover { background: rgba(159,232,255,.16); }
.daily-link .new-tag { margin-left: auto; }
.dl-ico { width: 10px; height: 10px; border: 2px solid var(--phosphor); transform: rotate(45deg); flex: none; }

/* The page: logo | title | attempts + sound. */
.daily-top { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }   /* equal sides: the title sits in the true centre */
.daily-top .daily-logo { justify-self: start; }
.daily-logo { display: flex; align-items: center; border-radius: 6px; }
.daily-logo img { display: block; }
.daily-logo .logo-wide { height: 38px; width: auto; }
.daily-logo .logo-icon { display: none; height: 34px; width: 34px; }
.daily-logo:hover img { filter: drop-shadow(0 0 8px rgba(159,232,255,.4)); }
.daily-title { text-align: center; min-width: 0; }
.daily-title h1 { margin: 0; font: 700 18px/1.15 var(--font-display); letter-spacing: .06em; text-transform: uppercase; }
.daily-title h1 .new-tag { font-size: 9.5px; }
.daily-sub {
  margin: 5px 0 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 8px;
  font: 500 13px/1.2 var(--font-hud); letter-spacing: .12em; text-transform: uppercase; color: var(--phosphor);
}
.daily-sub .sep { color: var(--muted); }
.daily-sub .you { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 600; }
.daily-right { display: flex; align-items: center; gap: 12px; justify-self: end; }
.pips { display: flex; gap: 6px; }
.pip { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--phosphor); position: relative; }
.pip.left { background: var(--phosphor); box-shadow: 0 0 8px rgba(159,232,255,.45); }
.pip.used { border-color: rgba(229,57,53,.85); }
.pip.used::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: rgba(229,57,53,.85); transform: rotate(45deg); }
.pip.win { background: var(--green); border-color: var(--green); box-shadow: 0 0 8px var(--green); }
.viewbar.daily-bar { padding-left: 10px !important; padding-right: 10px !important; align-items: center; }
.daily-bar .turn { padding: 5px 13px; font-size: 13.5px; }
.daily-bar .turn.thinking .dot { animation: pulse 1s ease-in-out infinite; }
.sp-ico.mine { --c: var(--mine, var(--red)); }
.sp-ico.theirs { --c: var(--theirs, var(--green)); }
.tiltbar .tilts-left, .their-tilts { gap: 4px; }
.tiltbar .tilts-left .sp-ico, .their-tilts .sp-ico { width: 22px; height: 22px; }
.their-tilts .none { font-size: 12px; color: var(--muted); padding: 0 6px 0 0; }
#dRoll { order: -1; }
.daily-hint-note { top: auto; bottom: 40px; transform: translate(-50%, 0); }
/* Cards: how to play, statistics, finished. */
.daily-card { text-align: left; }
.daily-card h1 { font: 700 20px/1.2 var(--font-display); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 10px; }
.daily-lead { color: var(--text); font-size: 16px; line-height: 1.5; margin-bottom: 14px; }
.daily-rules { margin: 0 0 16px; padding-left: 18px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.daily-rules b { color: var(--text); }
.daily-never { margin: 0 0 14px; }
.stat-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 20px; text-align: center; }
.stat-nums b { display: block; font: 700 26px/1.1 var(--font-display); color: var(--phosphor); }
.stat-nums span { display: block; margin-top: 4px; font-size: 11.5px; color: var(--muted); line-height: 1.25; }
.stat-dist { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 8px; align-items: center; font: 600 13px/1 var(--font-hud); }
.bar i { display: block; min-width: 24px; padding: 4px 7px; border-radius: 3px; font-style: normal; text-align: right; background: rgba(255,255,255,.14); }
.bar-row.mine .bar i { background: var(--phosphor); color: #06121a; }
.done-grid { margin: 8px 0 14px; font-size: 30px; line-height: 1.2; letter-spacing: 3px; text-align: center; }
.done-theme { display: flex; align-items: baseline; gap: 4px; margin: 0 0 6px; }
.done-theme .mini-label { padding-left: 0; }
#dDoneText { margin-bottom: 16px; line-height: 1.45; }
#dShareFallback { margin: 14px 0 0; }
#dShareBox { resize: none; font: 14px/1.4 ui-monospace, "SF Mono", Menlo, monospace; }
.next-in { margin: 18px 0 16px; text-align: center; color: var(--muted); font-size: 14px; }
.next-in b { font: 700 18px/1 ui-monospace, "SF Mono", Menlo, monospace; color: var(--text); margin-left: 6px; font-variant-numeric: tabular-nums; }
.daily-view-board { margin: 4px auto 0; text-align: center; }
@media (max-width: 760px) {
  .daily-top { grid-template-columns: auto minmax(0, 1fr) auto; }
  .daily-logo .logo-wide { display: none; }
  .daily-logo .logo-icon { display: block; }
  .daily-title h1 { font-size: 14.5px; }
  .daily-sub { font-size: 11.5px; letter-spacing: .08em; margin-top: 4px; gap: 3px 10px; }
  .daily-sub .sep { display: none; }
  .daily-right { gap: 8px; }
  .pips { gap: 4px; }
  .pip { width: 11px; height: 11px; }
}
@media (max-width: 420px) {
  .daily-title h1 .new-tag { margin-left: 4px; padding: 2px 4px 1px; font-size: 8.5px; letter-spacing: .08em; }
  .stat-nums b { font-size: 21px; }
  .done-grid { font-size: 25px; }
}

/* ---------- Screen-relative Twist bar (shared/twist-ui.js): Row / Column / Face buttons with a little picture ---------- */
.tiltbar .tw-kind { display: inline-flex; align-items: center; gap: 5px; min-width: 0; padding: 4px 8px; font-size: 12.5px; }
.tiltbar .tw-kind svg { width: 16px; height: 16px; }
@media (max-width: 420px) { .tiltbar .tw-kind span { display: none; } .tiltbar .tw-kind { padding: 4px 7px; } }

/* Daily Puzzle side panels (you / the defender), styled like the game's clock panels. Three rows in both panels:
   who, what's happening ("Move 1 of 2 · Your move" / "Defender · Replying"), tilts or twists left. */
.daily-side { align-content: start; }
.daily-side .side-mid { display: grid; gap: 3px; min-width: 0; }
.daily-side .side-move { font: 700 19px/1.15 var(--font-hud); letter-spacing: .02em; }
.daily-side .side-role { color: var(--text); }
.daily-side .side-status { font-size: 12.5px; line-height: 1.35; color: var(--muted); min-height: 1.35em; }
.daily-side .side-none { font-size: 12px; color: var(--muted); }
@media (max-width: 760px) {
  /* Phones: two equal compact cards in a row above the cube; each row of text on one line. */
  .daily-side { display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; text-align: left; gap: 5px; padding: 8px 10px; }
  .daily-side .clk-head { font-size: 13px; }
  .daily-side .side-mid { display: flex; align-items: baseline; gap: 6px; min-height: 18px; white-space: nowrap; overflow: hidden; }
  .daily-side .side-move { font-size: 14px; flex: none; }
  .daily-side .side-status { font-size: 12px; min-height: 0; overflow: hidden; text-overflow: ellipsis; }
  .daily-side .side-status:not(:empty)::before { content: "· "; }
  .daily-side .side-sp { min-height: 20px; align-items: center; }
}
/* Daily Puzzle on small phones: short title, one-row Tilt / Twist bar, short button labels. */
.daily-title .t-short, .toolbar .lbl-short { display: none; }
@media (max-width: 420px) {
  .daily-title .t-long { display: none; }
  .daily-title .t-short { display: inline; }
  .daily-title h1 { white-space: nowrap; }
  .toolbar .lbl-short { display: inline; }
  .daily-bar .tiltbar .mini-label { display: none; }
  .viewbar.daily-bar, .viewbar.tut-bar { padding-left: 6px !important; padding-right: 6px !important; }
  .daily-bar .tiltbar button, .tut-bar .tiltbar button { padding: 4px 5px; min-width: 0; }
  .daily-bar .tiltbar .tw-kind, .tut-bar .tiltbar .tw-kind { padding: 4px 5px; }
  .tut-bar .tiltbar .mini-label { display: none; }
  .tut-bar .tiltbar .tw-group + .tw-group { padding-left: 3px; margin-left: 1px; }
  .daily-bar .tiltbar .tw-group + .tw-group { padding-left: 3px; margin-left: 1px; }
}
@media (max-width: 420px) { .toolbar .wide-only { display: none !important; } }   /* e.g. Share: it's on the Results card too */

/* ---------- How to play tutorials (<slug>/tutorial/, shared/tutorial.js) ---------- */
.tut-app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.tut-top { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }   /* equal sides: the title sits in the true centre */
.tut-top .daily-logo { justify-self: start; }
.tut-title { margin: 0; text-align: center; font: 700 17px/1.2 var(--font-display); letter-spacing: .06em; text-transform: uppercase; }
.tut-title span { display: block; font: 600 11.5px/1.2 var(--font-hud); letter-spacing: .18em; color: var(--phosphor); margin-bottom: 3px; }
.tut-right { justify-self: end; }
.tut-mock { pointer-events: none; }
.viewbar.tut-bar { padding-left: 10px !important; padding-right: 10px !important; min-height: 6px; }
.tut-stage { flex: 1; min-height: 0; position: relative; }
.tut-caption { padding: 8px 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); display: grid; justify-items: center; }
.tut-caption > div { width: min(560px, 100%); background: var(--panel-strong); border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px; display: grid; gap: 8px; text-align: center; }
.tut-progress { display: flex; align-items: center; justify-content: center; gap: 10px; }
.tut-dots { display: flex; gap: 6px; }
.tut-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.18); }
.tut-dots i.done { background: rgba(159,232,255,.45); }
.tut-dots i.now { background: var(--phosphor); box-shadow: 0 0 8px rgba(159,232,255,.7); }
.tut-step { font: 600 11px/1 var(--font-hud); letter-spacing: .14em; color: var(--muted); }
#tText { margin: 0; font-size: 16px; line-height: 1.45; min-height: 2.9em; }
.tut-row { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.tut-row button, .tut-row a { padding: 8px 14px; font-size: 14px; border-radius: 10px; text-decoration: none; color: inherit; border: 1px solid var(--border); background: var(--panel); }
.tut-row .tut-small { padding: 5px 10px; font-size: 12.5px; color: var(--muted); }
.tut-row a.primary { color: #0b1020; border-color: transparent; background: var(--accent); font-weight: 700; }
.tut-end-title { margin: 0; font: 700 16px/1.3 var(--font-display); letter-spacing: .06em; text-transform: uppercase; }
/* The pointer: a glowing fingertip that glides between targets and ripples when it "taps". */
.tut-pointer { position: fixed; left: 0; top: 0; z-index: 30; pointer-events: none; opacity: 0; transition: transform .45s cubic-bezier(.3,.8,.3,1), opacity .25s; }
.tut-pointer.on { opacity: 1; }
.tut-finger { position: absolute; left: -14px; top: -14px; width: 28px; height: 28px; border-radius: 50%; border: 3px solid #fff; background: rgba(159,232,255,.35); box-shadow: 0 0 14px rgba(159,232,255,.85); }
.tut-finger::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid #fff; opacity: 0; }
.tut-pointer.tap .tut-finger::after { animation: tutTap .6s ease-out; }
@keyframes tutTap { from { transform: scale(1); opacity: .9; } to { transform: scale(2.4); opacity: 0; } }
.tut-label { position: absolute; top: 22px; left: 0; transform: translateX(-50%); white-space: nowrap; padding: 4px 9px; border-radius: 999px; background: var(--phosphor); color: #06121a; font: 700 12px/1.2 var(--font-hud); letter-spacing: .06em; box-shadow: 0 6px 18px rgba(0,0,0,.4); }
.tut-pointer.edge-right .tut-label { transform: translateX(-90%); }
.tut-pointer.edge-left .tut-label { transform: translateX(-10%); }
@media (max-width: 760px) {
  .tut-title { font-size: 14px; }
  #tText { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { .tut-pointer { transition: opacity .2s; } }
/* Game home page: the How to play clip link, under the main buttons. */
.home-howto { display: inline-flex; align-self: flex-start; align-items: center; gap: 9px; margin-top: 2px; padding: 6px 2px; color: #c3cbe0; text-decoration: none; font: 600 13px/1 var(--font-hud); letter-spacing: .14em; text-transform: uppercase; }
.home-howto:hover { color: var(--phosphor); }
.home-howto-play { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid rgba(159,232,255,.6); display: grid; place-items: center; flex: none; }
.home-howto-play::before { content: ""; margin-left: 2px; border-style: solid; border-width: 5px 0 5px 8px; border-color: transparent transparent transparent var(--phosphor); }
.home-howto-len { color: var(--muted); font-weight: 500; letter-spacing: .08em; }
/* How to play clip over the game (shell.js #howtoWrap): the tutorial page in a frame, with Close where its logo was. */
.howto-wrap { position: fixed; inset: 0; z-index: 40; background: var(--bg); }
.howto-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
.howto-close { position: absolute; left: max(12px, env(safe-area-inset-left)); top: max(12px, env(safe-area-inset-top)); z-index: 1; }
.tut-embed .daily-logo { visibility: hidden; }   /* the parent's Close button sits here */

/* ---------- Online screen: Find a player (matchmaking, shared/matchmaking.js) + host / join side by side ---------- */
.on-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 420px) { .on-pair { grid-template-columns: 1fr; } }      /* narrow phones: stacked */
#btnFindPlayer { position: relative; }
.beta-tag {
  display: inline-block; margin-left: 9px; padding: 3px 5px 2px; border-radius: 3px; vertical-align: middle;
  font: 700 9.5px/1 var(--font-hud); letter-spacing: .14em; text-transform: uppercase;
  background: transparent; color: currentColor; border: 1px solid currentColor; opacity: .85;
}
.mm-search { text-align: left; }
.mm-row { display: flex; align-items: baseline; gap: 14px; margin: 0 0 6px; }
.mm-timer { font: 700 34px/1 ui-monospace, "SF Mono", Menlo, monospace; color: #fff; }
.mm-count { color: var(--muted); font-size: 13px; }
.mm-choices { margin: 12px 0 4px; }
.mm-choices .sub { margin-bottom: 10px; }
.mm-search .row { margin-top: 16px; }

/* ---------- Home: How to play + Pass & play on one small row ---------- */
.home-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 22px; }
.home-pass {
  display: inline-flex; align-items: center; margin: 0; padding: 6px 2px; min-height: 44px;   /* a full tap target */
  font: 500 13px/1.2 var(--font-hud); letter-spacing: .06em; color: #c3cbe0;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(159,232,255,.45);
}
.home-pass:hover:not(:disabled) { color: var(--phosphor); }
.home-sub .home-howto { min-height: 44px; }
/* Daily Puzzle results card: the small link to the game's Online screen. */
.daily-person { display: table; margin: -4px auto 10px; padding: 12px 4px; min-height: 44px; box-sizing: border-box; text-align: center; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 420px) {   /* phones: both links on one row */
  .home-sub { flex-wrap: nowrap; justify-content: space-between; gap: 8px; }
  .home-sub .home-howto { gap: 7px; letter-spacing: .1em; font-size: 12px; white-space: nowrap; }
  .home-sub .home-howto-play { width: 20px; height: 20px; }
  .home-pass { font-size: 12px; letter-spacing: .02em; white-space: nowrap; }
}
