/* =====================================================================
 * THE NEW LOOK (every page since 4 Nov 2026, except the classic copy in legacy/, <body data-ui="classic">):
 * loaded after styles.css, so everything here overrides it. One look everywhere (the home pages' retro-space
 * style carried into the game, setup, menus and Daily Puzzle), a slimmer HUD and tighter phone layouts.
 * styles.css stays as the classic base, so legacy/ keeps looking exactly as it did.
 * ===================================================================== */
:root {
  --accent: #9fe8ff;          /* phosphor, as on the home pages (was blue) */
  --accent-soft: rgba(159,232,255,.16);
  --accent-line: rgba(159,232,255,.55);
  --panel-strong: rgba(10,15,30,.94);
  --border: rgba(159,232,255,.16);
}
body {
  font-family: var(--font-hud);
  background:
    radial-gradient(1px 1px at 23px 41px, rgba(255,255,255,.4), transparent 60%),
    radial-gradient(1px 1px at 141px 97px, rgba(255,255,255,.25), transparent 60%),
    radial-gradient(1.5px 1.5px at 77px 163px, rgba(159,232,255,.3), transparent 60%),
    radial-gradient(130% 90% at 50% 30%, #141c33 0%, var(--space) 72%);
  background-size: 220px 220px, 220px 220px, 220px 220px, 100% 100%;
}

/* ----- buttons: squarer, phosphor accent, a press you can feel ----- */
button, a.link-big { border-radius: 4px; letter-spacing: .03em; }
button:active:not(:disabled), a.link-big:active, .cta:active { transform: scale(.96); }
button { transition: background .15s, border-color .15s, transform .1s cubic-bezier(.3,1.6,.5,1), opacity .15s; }
.primary, a.link-big.primary { background: var(--phosphor); color: #06121a; }
.primary:hover:not(:disabled), a.link-big.primary:hover { background: #c2f1ff; }
.seg button.sel, .seg-mini button.sel, .tiltbar button.sel, #boardMode button.sel { background: var(--accent-soft); border-color: var(--accent-line); color: #e8f7ff; }
.tiltbar .tw-go { background: var(--phosphor); color: #06121a; }
.tiltbar .tw-go:hover:not(:disabled) { background: #c2f1ff; }
.seg-mini { border-radius: 4px; }
.seg-mini button { border-radius: 3px; }

/* ----- top bar: name left, scores + Sound + Menu in one row on the right (no floating column) ----- */
.brand { font: 700 15px/1 var(--font-display); letter-spacing: .08em; text-transform: uppercase; }
.score-col { display: flex; align-items: center; gap: 8px; grid-column: -2; grid-row: 1; }   /* stays right when the turn pill is hidden */
.side-btns { position: static; flex-direction: row-reverse; align-items: center; gap: 6px; }
.side-btn { border-radius: 4px; padding: 7px 10px; }
.viewbar { padding-left: 10px !important; padding-right: 10px !important; }
.score-item { border-radius: 4px; }
.score-item b { font-family: var(--font-display); font-size: 14px; }
.turn { border-radius: 4px; font-weight: 600; letter-spacing: .04em; }

/* ----- player panels: the turn indicator now (the pill is for online only); slim when there's no clock ----- */
.clock { border-radius: 6px; padding: 10px 12px; gap: 6px; width: clamp(120px, 12vw, 160px); }
.clk-head { font-weight: 600; letter-spacing: .03em; }
.clk-time { font-family: var(--font-display); font-size: 24px; letter-spacing: 0; }
.clk-time.none { font: 600 13px/1.2 var(--font-hud); color: var(--c); letter-spacing: .06em; text-transform: uppercase; min-height: 1.2em; }
.clock.thinking .dot { animation: pulse 1s ease-in-out infinite; }
.clock.active { box-shadow: 0 0 0 1px var(--c), 0 0 30px -8px var(--c); }
.sp-ico { width: 22px; height: 22px; }
.sp-ico svg { width: 13px; height: 13px; }

/* ----- result banner: bigger title, a little pop ----- */
.banner { border-radius: 6px; border-color: var(--accent-line); animation: nuiPop .45s cubic-bezier(.2,1.5,.4,1); }
.banner h2 { font: 700 17px/1.2 var(--font-display); letter-spacing: .05em; text-transform: uppercase; }
@keyframes nuiPop { 0% { opacity: 0; transform: translate(-50%, -14px) scale(.92); } 100% { opacity: 1; transform: translate(-50%, 0) scale(1); } }

/* The board gives a short shake on a win (shared/newui.js adds .nui-shake). */
#stage.nui-shake { animation: nuiShake .42s cubic-bezier(.36,.07,.19,.97); }
@keyframes nuiShake { 15% { transform: translate(-5px, 2px); } 30% { transform: translate(5px, -2px); } 45% { transform: translate(-3px, 1px); } 60% { transform: translate(3px, 0); } 80% { transform: translate(-1px, 0); } }
@media (prefers-reduced-motion: reduce) { #stage.nui-shake { animation: none; } }

/* ----- bottom bar: Undo, New game and (when "Show board layers" is on) the 3D / Layers switch and layer focus ----- */
.toolbar { align-items: center; }
.toolbar > button { border-radius: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: 13px; padding: 10px 16px; }
.tb-board { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.tb-board:not(:has(> :not([hidden]))) { display: none; }
.toolbar .seg-mini button { flex: none; flex-direction: row; padding: 5px 9px; font-size: 12.5px; letter-spacing: .02em; min-width: 0; }
.stage-hint, .tip { font-family: var(--font-hud); border-radius: 4px; }

/* ----- cards: setup, pause, Play a Friend ----- */
.card { border-radius: 8px; border-color: var(--accent-line); background: var(--panel-strong); box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 60px -30px var(--phosphor); }
.card h1 { font: 700 21px/1.2 var(--font-display); letter-spacing: .06em; text-transform: uppercase; }
.sub { font-size: 14px; letter-spacing: .1em; text-transform: uppercase; color: var(--phosphor); }
.setup-title, .opt-label { font-family: var(--font-hud); letter-spacing: .12em; }
.big { font: 600 15px/1 var(--font-hud); letter-spacing: .14em; text-transform: uppercase; padding: 16px; border-radius: 4px;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px); }
.card .row button { text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.seg button { border-radius: 4px; }
/* Setup: difficulty as three big tiles; colour / who first / clock folded into Options. */
#menuSetup .seg[data-name="difficulty"] button { padding: 18px 6px; font: 600 15px/1 var(--font-hud); letter-spacing: .12em; text-transform: uppercase; }
#menuGame > .rules { display: none; }   /* the rules live in the pause menu and the How to play clip */
.setup-more, .settings-more, .card .rules { margin: 4px 0 14px; border: 1px solid var(--border); border-radius: 4px; text-align: left; }
.setup-more > summary, .settings-more > summary, .card .rules > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  font: 600 13px/1.2 var(--font-hud); letter-spacing: .12em; text-transform: uppercase; color: var(--text);
}
.setup-more > summary::-webkit-details-marker, .settings-more > summary::-webkit-details-marker, .card .rules > summary::-webkit-details-marker { display: none; }
.setup-more > summary::after, .settings-more > summary::after, .card .rules > summary::after { content: "▸"; margin-left: auto; color: var(--phosphor); transition: transform .15s; }
.setup-more[open] > summary::after, .settings-more[open] > summary::after, .card .rules[open] > summary::after { transform: rotate(90deg); }
.setup-summary { color: var(--muted); font-weight: 500; letter-spacing: .06em; text-transform: none; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setup-more > .opt { padding: 0 12px; }
.setup-more > .opt:last-child { padding-bottom: 4px; }
.settings-more .settings { margin: 0; padding: 0 12px 12px; }
.card .rules { margin-top: 0; }
.card .rules ul { margin: 0; padding: 0 12px 12px 30px; }
/* Pause: Resume across the top, then three smaller buttons in a row. */
#menuPause .menu-main { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
#menuPause .menu-main > :first-child { grid-column: 1 / -1; }
#menuPause .menu-main > :not(:first-child) { font-size: 12px; letter-spacing: .08em; padding: 13px 4px; clip-path: none; display: grid; place-items: center; }
#menuPause .sub { margin-bottom: 16px; }

/* ----- game home pages: no description paragraph, the buttons in an even grid ----- */
.home-desc { display: none; }
.home-cta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 460px; width: 100%; }
.home-cta .cta { justify-content: center; text-align: center; padding: 16px 10px; font-size: 14px; }
/* Vs Robot | Play a Friend (2 Players is inside it), Daily Puzzle and Resume across the full width. */
#btnHome2p { display: none; }
#btnHomeResume, #btnHomeDaily { grid-column: 1 / -1; }
#btnHomeResume:not([hidden]) ~ #btnHomeRobot { background: rgba(10,16,32,.55); color: #e8f7ff; border-color: rgba(159,232,255,.45); }
.cta-daily { border-color: var(--phosphor); box-shadow: inset 0 0 22px -10px var(--phosphor); }
.cta-daily { position: relative; }
.cta-daily .new-tag { position: absolute; top: 4px; right: 12px; margin: 0; padding: 2px 4px 1px; font-size: 8.5px; }   /* a corner badge: the label stays on one line */
@media (max-width: 700px) {
  /* Phones: the live cube is the hero at the top (View3D.ambientNarrowY in newui.js), text and buttons below it. */
  .home-hero { padding-top: 22px; padding-bottom: 28px; gap: 14px; }
  .home-hero .brandline { margin-bottom: 30vh; margin-bottom: 30svh; }
  .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,.55) 0%, rgba(6,9,18,0) 12%, rgba(6,9,18,0) 36%, rgba(6,9,18,.82) 52%, rgba(6,9,18,.92) 100%); }
  .home-title { font-size: clamp(40px, 13vw, 60px); }
  .home-title.three-line { font-size: clamp(34px, 11vw, 52px); }
  .home-cta { gap: 8px; }
  .home-cta .cta { padding: 15px 6px; font-size: 13px; letter-spacing: .12em; }
  .ct-logo { height: 40px; }
}

/* ----- landing page: a Daily Challenges banner above the games; each game's Daily Puzzle link stays under its card ----- */
.landing-sub { display: none; }
.today { padding: 22px clamp(20px, 6vw, 88px) 8px; }
.more-grid .gc-text > span { display: none; }   /* game cards: title and facts only (the blurb repeats the game page) */
.today-tile {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; color: inherit; text-decoration: none;
  border: 1px solid var(--accent-line); border-radius: 6px; background: rgba(159,232,255,.07); transition: background .15s, transform .1s;
}
.today-tile:hover { background: rgba(159,232,255,.14); }
.today-tile:active { transform: scale(.98); }
.today-banner .dl-ico { width: 16px; height: 16px; margin: 0 6px; }
.today-banner .today-text b { font-size: 16px; }
/* Daily Challenges page (daily/): the demo cube fixed behind, a tile per puzzle with today's result and stats. */
.hub-3d { position: fixed !important; inset: 0; }
.hub-hero { max-width: 600px; }
.hub-hero .home-title { font-size: clamp(30px, 8.4vw, 76px); }   /* "Challenges" is long: keep it inside a phone */
.hub-grid { display: grid; gap: 12px; }
.hub-tile {
  display: grid; gap: 12px; padding: 14px 16px; color: inherit; text-decoration: none; border-radius: 6px;
  border: 1px solid var(--accent-line); background: rgba(8,13,28,.82); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  transition: background .15s, border-color .15s, transform .1s;
}
.hub-tile:hover, .hub-tile:focus-visible { background: rgba(20,30,56,.9); border-color: var(--phosphor); }
.hub-tile:active { transform: scale(.98); }
.hub-head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.hub-stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--border); padding-top: 10px; text-align: center; }
.hub-stats > span { display: grid; gap: 3px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.hub-stats b { font: 700 18px/1.1 var(--font-display); color: var(--phosphor); letter-spacing: 0; }
.hub-tile.done .today-go { background: none; color: var(--phosphor); border: 1px solid var(--accent-line); }
/* "Play the games": back to the landing page, as a tile so it reads as a way in, not a footnote. */
.hub-games { border-color: rgba(140,230,150,.45); background: linear-gradient(100deg, rgba(67,160,71,.16), rgba(10,16,30,.82) 60%); }
.hub-games:hover, .hub-games:focus-visible { border-color: #9fffa8; background: linear-gradient(100deg, rgba(67,160,71,.26), rgba(20,30,56,.9) 60%); }
.hub-games .today-go { background: #9fffa8; font-size: 20px; padding: 4px 12px 6px; }
.hub-icons { display: flex; flex: none; }
.hub-icons .gc-icon.gc-cube { width: 32px; height: 32px; padding: 1px; border-radius: 4px; background: rgba(8,14,26,.9); }
.hub-icons .gc-icon + .gc-icon { margin-left: -20px; }
.hub-icons .gc-icon:nth-child(2) { transform: translateY(-5px); } .hub-icons .gc-icon:nth-child(3) { transform: translateY(5px); }
.hub-next { margin: 0; font-size: 14px; color: var(--muted); letter-spacing: .06em; }
.hub-next b { font: 700 16px/1 var(--font-display); color: var(--text); margin-left: 6px; }
.today-tile .gc-icon, .hub-tile .gc-icon { width: 46px; height: 46px; padding: 5px; gap: 2px; border-radius: 4px; position: relative; }
.today-tile.solved .gc-icon::after, .hub-tile.solved .gc-icon::after { content: "✓"; position: absolute; right: -6px; bottom: -6px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font: 700 11px/1 var(--font-hud); background: var(--phosphor); color: #06121a; }
.today-text { display: grid; gap: 4px; min-width: 0; }
.today-text b { font: 700 14px/1.2 var(--font-display); letter-spacing: .05em; text-transform: uppercase; }
.today-text span { font-size: 13px; color: var(--muted); letter-spacing: .04em; }
.today-go { margin-left: auto; flex: none; font: 600 12px/1 var(--font-hud); letter-spacing: .14em; text-transform: uppercase; padding: 9px 12px; border-radius: 3px; background: var(--phosphor); color: #06121a; }
.today-tile.done .today-go { background: none; color: var(--phosphor); border: 1px solid var(--accent-line); }

/* ----- "New UI test" tag (home pages only), linking back to the classic page ----- */
.nui-tag {
  position: fixed; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 50; display: none; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 3px; font: 600 11px/1 var(--font-hud); letter-spacing: .12em; text-transform: uppercase;
  color: #06121a; background: #ffd166; text-decoration: none; box-shadow: 0 6px 18px rgba(0,0,0,.4);
}
.nui-tag span { opacity: .7; }
body.home .nui-tag { display: inline-flex; }

/* ----- phones: in-game HUD ----- */
@media (max-width: 760px) {
  .brand { display: block; font-size: 12.5px; justify-self: start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .topbar:not(.daily-top):not(.tut-top) { grid-template-columns: minmax(0, 1fr) auto; }   /* the game's bar only */
  .topbar .turn:not([hidden]) { grid-column: 1; grid-row: 2; justify-self: start; }
  .side-btn { padding: 7px; }
  /* Panels: two compact cards: who on top, then the time or status with the tilts / twists beside it. */
  .clock { width: auto; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 3px 6px; padding: 7px 10px; }
  .clk-head { grid-column: 1 / -1; font-size: 13px; flex-wrap: nowrap; min-width: 0; }
  .clk-tag { overflow: hidden; text-overflow: ellipsis; }
  .clk-sp { grid-column: 2; grid-row: 2; gap: 3px; align-self: center; }
  .clk-time { grid-column: 1; grid-row: 2; font-size: 19px; align-self: center; }
  .clk-time.none { font-size: 11.5px; }
  .sp-ico { width: 18px; height: 18px; }
  .sp-ico svg { width: 11px; height: 11px; }
  .toolbar button { font-size: 12px; padding: 10px 12px; }
}
@media (max-width: 760px) {
  .toolbar { flex-wrap: wrap; }
  .tb-board { flex: 1 1 100%; }      /* phones: the board switches get their own row above the buttons */
  .toolbar > button { flex: 1 1 0; }
}
@media (max-width: 420px) {
  .toolbar > button { font-size: 10.5px; letter-spacing: .03em; white-space: nowrap; }
  .toolbar .seg-mini button { padding: 5px 8px; font-size: 12px; }
}

/* ===== Daily Puzzle (shared/daily.js with SITE.newUI) ===== */
/* How to play: three pictures, one line each. */
.nui-steps { display: grid; gap: 12px; margin: 4px 0 16px; padding: 0; list-style: none; }
.nui-steps li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 14px; align-items: center; }
.nui-pic { width: 52px; height: 52px; border-radius: 6px; border: 1px solid var(--accent-line); background: rgba(159,232,255,.06); display: grid; place-items: center; position: relative; overflow: hidden; }
.nui-pic svg { width: 30px; height: 30px; color: var(--phosphor); }
.nui-steps b { display: block; font: 700 13px/1.3 var(--font-display); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 2px; }
.nui-steps span { color: var(--muted); font-size: 14px; line-height: 1.35; }
.nui-ball { position: absolute; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 12%, transparent 40%), var(--mine, var(--red)); }
.nui-pic.drop .nui-ball { animation: nuiDrop 1.8s cubic-bezier(.5,0,.6,1) infinite; }
.nui-pic.drop::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 9px; height: 2px; background: var(--phosphor); opacity: .6; }
@keyframes nuiDrop { 0%, 10% { top: 4px; } 55% { top: 29px; } 63% { top: 25px; } 70%, 100% { top: 29px; } }
.nui-pic.tilt svg { animation: nuiTilt 2.4s ease-in-out infinite; }
@keyframes nuiTilt { 0%, 30% { transform: rotate(0); } 55%, 80% { transform: rotate(-90deg); } 100% { transform: rotate(-90deg); } }
.nui-pic.win i { width: 8px; height: 8px; border-radius: 50%; background: var(--mine, var(--red)); position: absolute; animation: nuiGlow 1.6s ease-in-out infinite; }
@keyframes nuiGlow { 50% { box-shadow: 0 0 10px 2px var(--mine, var(--red)); } }
.nui-small { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.45; }
/* Feedback on each move: a word over the board. */
.nui-toast {
  position: absolute; left: 50%; top: 40%; z-index: 4; pointer-events: none; transform: translate(-50%, -50%);
  padding: 10px 18px; border-radius: 4px; font: 700 15px/1 var(--font-display); letter-spacing: .08em; text-transform: uppercase;
  background: rgba(10,15,30,.9); border: 1px solid currentColor; box-shadow: 0 0 30px -6px currentColor; opacity: 0;
}
.nui-toast.good { color: #7ee08a; }
.nui-toast.bad { color: #ff8a80; }
.nui-toast.show { animation: nuiToast 1.1s ease-out forwards; }
@keyframes nuiToast { 0% { opacity: 0; transform: translate(-50%, -40%) scale(.85); } 18% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); } 30% { transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -62%); } }
@media (prefers-reduced-motion: reduce) { .nui-toast.show { animation: none; opacity: 1; } .nui-pic * { animation: none !important; } }
/* Results card: the share row first and big. */
.daily .done-grid { font-size: 34px; margin: 4px 0 6px; }
.nui-done-sub { text-align: center; margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.nui-streak { display: flex; justify-content: center; gap: 22px; margin: 0 0 16px; }
.nui-streak div { text-align: center; }
.nui-streak b { display: block; font: 700 22px/1.1 var(--font-display); color: var(--phosphor); }
.nui-streak span { font-size: 11.5px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.daily #dDoneShare { padding: 15px; font-size: 15px; }
.daily .done-more { margin: 14px 0 0; border: 1px solid var(--border); border-radius: 4px; }
.daily .done-more > summary { list-style: none; cursor: pointer; padding: 11px 12px; display: flex; font: 600 13px/1.2 var(--font-hud); letter-spacing: .12em; text-transform: uppercase; }
.daily .done-more > summary::-webkit-details-marker { display: none; }
.daily .done-more > summary::after { content: "▸"; margin-left: auto; color: var(--phosphor); transition: transform .15s; }
.daily .done-more[open] > summary::after { transform: rotate(90deg); }
.daily .done-more > :not(summary) { margin-left: 12px; margin-right: 12px; }
.daily .done-more > :last-child { margin-bottom: 12px; }

.daily .done-more #dDoneText { text-transform: none; letter-spacing: 0; color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.daily .done-more .row { margin: 0 12px 8px; }
.daily .done-more .menu-main { gap: 8px; }
.daily .done-more .row button, .daily .done-more .big { font-size: 12.5px; padding: 12px; letter-spacing: .1em; }

/* Game icons (trial): a little glass cube per game (SITE.cubeIcon, from GAMES[].icon3d). */
.gc-icon.gc-cube { display: block; padding: 2px; background: radial-gradient(circle at 50% 60%, rgba(67,160,71,.22), rgba(67,160,71,.04) 70%); box-shadow: inset 0 0 0 1px rgba(67,160,71,.35); }
.gc-icon.gc-cube svg { display: block; width: 100%; height: 100%; overflow: visible; }
.today-tile .gc-icon.gc-cube, .hub-tile .gc-icon.gc-cube { padding: 2px; }

/* Landing: the logo lines up with the title's left edge (in the hero's flex column it was stretched and centred). */
.landing .home-hero > .ct-logo { align-self: flex-start; }
