:root{
  --bg:#131c26; --ink:#ffffff; --muted:#8fa3b8; --panel:#1a2635; --line:#2a3a4d; --blue:#5b87f0; --blueEdge:#3e63c7;
  --inset:#101821; --edge:#223245; --track:#26364a; --dot:rgba(255,255,255,.07); --row:#3a4656; --hi:#fff;
  --pink:#e0707a; --cyan:#4fb0b8; --lime:#8dbb6b; --orange:#e3a553;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none}
html,body{margin:0;height:100%;overflow:hidden;overscroll-behavior:none;
  background:var(--bg);color:var(--ink);
  font-family:"Outfit",system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif}
body{background-image:radial-gradient(var(--dot) 1.4px,transparent 1.5px);background-size:24px 24px}
button{font:inherit;color:inherit;border:0;cursor:pointer;touch-action:manipulation}
.hidden{display:none!important}

/* ---------- HUD ---------- */
#hud{display:flex;align-items:center;gap:10px;padding:8px 12px;height:52px;flex:none}
.hudbtn{background:var(--panel);border:1px solid var(--line);border-radius:12px;height:36px;min-width:40px;padding:0 10px;font-weight:800;font-size:15px}
#modeTag{flex:1;display:flex;flex-direction:column;line-height:1.1;min-width:0}
#modeText{font-weight:900;letter-spacing:.12em;font-size:12px;color:var(--muted)}
#diffText{font-weight:900;font-size:16px}
#timer{font-weight:900;font-size:24px;font-variant-numeric:tabular-nums;letter-spacing:.02em}

/* ---------- stage ---------- */
#stage{position:relative;flex:1;min-height:180px;display:flex}
#view{position:relative;flex:1;min-width:0}
#gl{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none;outline:none}
#tip{position:absolute;left:0;right:0;bottom:8px;text-align:center;font-weight:700;font-size:13px;color:var(--muted);pointer-events:none;transition:opacity .2s}
#tip.hide{opacity:0}

/* ---------- tray ---------- */
#tray{display:flex;gap:6px;padding:6px 8px;flex:none;justify-content:center}
.chip{position:relative;flex:1 1 0;max-width:64px;aspect-ratio:1;background:var(--panel);border:2px solid var(--line);border-radius:14px;padding:2px;transition:transform .08s,border-color .15s,opacity .15s}
.chip canvas{width:100%;height:100%;display:block}
.chip.selected{border-color:var(--hi);transform:translateY(-3px);box-shadow:0 0 0 2px var(--dot)}
.chip.placed{opacity:.38}
.chip.locked{opacity:.6;border-style:dashed}
.chip.locked::after{content:"\1F512";position:absolute;right:2px;bottom:0;font-size:11px}
.chip.shake{animation:shake .25s}
@keyframes shake{25%{transform:translateX(-4px)}75%{transform:translateX(4px)}}

/* ---------- side buttons + actions ---------- */
#actions{display:flex;gap:8px;padding:6px 12px 12px;flex:none;transition:opacity .15s}
#actions .k{height:54px;font-size:17px}
.off{opacity:.35;pointer-events:none}
#actions .k{background:var(--panel);border:1px solid var(--line);border-radius:12px;font-weight:800;font-size:16px;display:flex;align-items:center;justify-content:center;flex-direction:column;line-height:1.05}
#actions .k:active{background:#2a3a4d;transform:scale(.96)}
.placebtn{flex:2;background:var(--lime)!important;color:#0b1410;border-color:var(--lime)!important;box-shadow:0 0 16px rgba(182,255,26,.35)}
.placebtn.bad{background:#3a4656!important;color:#8fa3b8;border-color:#3a4656!important;box-shadow:none}
.ghostbtn{flex:1;background:transparent!important}

@media (max-height:620px){
  #hud{height:44px}
  #actions{padding-bottom:6px}
  #actions .k{height:46px}
}

/* ---------- tap controls ---------- */
.nextbtn{flex:1.4;border-color:var(--cyan)!important;color:var(--cyan)}
.nextbtn.dim{opacity:.4;border-color:var(--line)!important;color:var(--muted)}
#tip.warn{color:#ff6b6b;opacity:1}
#tip{font-size:14px}

/* ---------- pages (match the other games) ---------- */
.note{color:var(--muted);font-weight:600;font-size:14px;line-height:1.45;text-align:center;margin:8px 0}

.how{display:flex;flex-direction:column;gap:18px}
.hrow{display:flex;gap:14px;align-items:flex-start}
.hrow p{margin:0;color:var(--muted);font-size:17px;line-height:1.35;font-weight:500}
.hrow b{color:var(--ink)}
.hicon{flex:none;width:46px;height:46px;border-radius:12px;display:flex;align-items:center;justify-content:center;font-style:normal;font-weight:900;font-size:22px;color:#2a1a00;box-shadow:0 4px 0 rgba(0,0,0,.3)}
.hicon.blank{background:var(--track);box-shadow:none}
.hicon.amber{background:#e3a553}
.hicon.cream{background:#f1e6cf}

.seg{display:flex;background:var(--inset);border:2px solid var(--line);border-radius:16px;padding:4px;margin-bottom:12px}
.seg button{flex:1;height:44px;border-radius:12px;background:none;color:var(--muted);font-weight:800;font-size:18px}
.seg button.on{background:var(--panel);color:var(--ink);box-shadow:0 3px 0 var(--edge)}

.set-row{display:flex;align-items:center;justify-content:space-between;font-weight:800;font-size:20px;padding:14px 4px}

.pause-badge{ --pause-bg: #38b6ff; --pause-edge: #1e7fc0; --pause-ink: #0a2a44; }   /* the rest of the Paused screen: pause.css (shared) */
#winCube{width:min(64vw,260px);height:auto;max-height:30vh;object-fit:contain;margin:6px 0 2px;filter:drop-shadow(0 8px 14px rgba(0,0,0,.35))}
#winNote{color:var(--orange);font-weight:900;min-height:22px;font-size:18px}
#winStats{color:var(--muted);font-weight:700;font-size:15px}

body.light{--bg:#e9eef5;--ink:#14202e;--muted:#5d6e82;--panel:#ffffff;--line:#cbd5e1;--inset:#dde5ee;--edge:#c3cedb;--track:#c3cedb;--dot:rgba(20,32,46,.09);--row:#cfd8e3;--hi:#14202e}
body.light .placebtn.bad{background:#c3cedb!important;color:#5d6e82;border-color:#c3cedb!important}
body.light .big{color:#fff}

#tutbar{flex:none;margin:0 10px 4px;display:grid;gap:4px;background:var(--panel);border:2px solid var(--blue);border-radius:16px;padding:6px 10px 8px}
#tutbar.hidden{display:none}
#tutbar .tut-top{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;min-height:30px}
#tutbar .tut-top .tut-dots{justify-self:center;display:flex;gap:6px;list-style:none;margin:0;padding:0}
#tutbar .tut-dots li.on{width:22px;background:var(--blue)}
#tutbar .tut-dots li.past{background:var(--blueEdge)}
#tutbar .heading{margin:0;font-size:17px}
#tutbar .lede{margin:0;font-size:14px;color:var(--muted)}
#tutbar .tut-note{min-height:2.4em;font-size:14px}
#tutbar .tut-note.good{color:var(--ink)}
#tutbar .tut-nav .big{padding-top:8px;padding-bottom:8px;min-height:0;font-size:16px}
.pulse{animation:pulse 1s ease-in-out infinite;position:relative;z-index:2}
@keyframes pulse{0%,100%{box-shadow:0 0 0 0 rgba(91,135,240,.0)}50%{box-shadow:0 0 0 6px rgba(91,135,240,.65)}}
@media (max-height:700px){
  .big{height:auto}
  .set-row{padding:8px 4px}
}

.chip.recall{flex:0 0 auto;width:44px;max-width:44px;align-self:center;aspect-ratio:1;font-size:24px;line-height:1;color:var(--ink,#fff);display:flex;align-items:center;justify-content:center;padding:0;border-style:dashed}

/* difficulty pill, the same as the other games */
.level-pill{display:inline-block;padding:1px 10px;border-radius:999px;background:var(--lv,#5b86f0);color:#fff;font-size:.85em;font-weight:900;vertical-align:1px}
.today-line .level-pill{margin:0 4px}
/* bottom Close button stays put, and the last row clears it */
/* menu foot + other games pop-up */

/* Surrender: a quiet red link on the pause screen, and the red "Surrendered" on the leaderboard and menu */
.soft.linkbtn.surrender{color:#e5484d}
.soft.linkbtn.surrender.sure{font-weight:900}
/* every panel: the content sits in the vertical middle and only the Close button stays at the bottom */

/* Settings: one card of rows, like Speed Word Search */

/* Other games on a short screen (a phone on its side): three across, so all the games and Close fit without scrolling */
/* the piece tray always fits across, even on a narrow phone (the first and last pieces were cut off) */
.chip{min-width:0}
@media (max-width:420px){#tray{gap:4px;padding:6px 6px}.chip.recall{width:38px;max-width:38px}}
/* a phone on its side: a shorter header, tray and buttons so the cube gets room and the buttons are not cut off */
@media (max-height:440px){
  #hud{height:38px;padding:4px 12px}
  #stage{min-height:60px}
  #tray{padding:4px 8px}
  .chip{max-width:44px}
  .chip.recall{width:36px;max-width:36px}
  #tip{display:none}
  #actions{padding:4px 12px 6px}
  #actions .k{height:40px;font-size:15px}
}

/* the main block starts at the same height as in the other games (sits centred between the top and the two buttons at the bottom) */

/* After surrendering, every game says SURRENDERED in red. */   /* the space is kept, so it appearing never moves the screen */

/* Full-screen pages: the layout, recessed track, Close and Play the tutorial buttons come from BaseGameDiscord's panels.css. Only Cubit's own bits are here. */
body{ --surface: var(--panel); --surface-edge: var(--line); }                    /* the colour names panels.css uses */
.heading{ font-size: 25.6px; font-weight: 900; }
.sheet > .seg, .sheet > .note{ flex: none; margin: 0; }
body.practicing .sheet.sheet{ --close-bottom: calc(env(safe-area-inset-bottom) + 40px); }
/* leaderboard rows look the same as in the other games */

/* the practice picker: the same pop-up as Support (dark recessed card, raised buttons, blue Close) */

/* Settings groups: rows pressed together inside a group; Support and Owner tools are buttons of their own */
#settings .panel-body > .set-btn{ display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 14px 16px; border-radius: 16px; font-size: 18px; text-align: left; color: var(--ink); font-weight: 800; }

.soft.wide{ width: 100%; flex: none; }
.big.inset, .soft.inset{ background: var(--inset); border-color: var(--inset); box-shadow: none; color: var(--muted); }
.soft.linkbtn{ background: none; border: 0; box-shadow: none; color: var(--muted); }

/* the menu is the shared one (base.css, menu-layout.css): the page just centres it */

/* the cube screen: one of the shared shell's screens, wider than the menus and edge to edge */
#game.screen{ max-width: 720px; width: calc(100% + 32px); margin: 0 -16px; justify-content: flex-start; gap: 0; }

/* the loading logo: the solved cube (the same one as the icon), turning. The sign-in card copies it, still. */
.big-logo{ display:flex; align-items:center; justify-content:center; perspective:700px; --s:104px; width:var(--s); height:var(--s); margin:0 auto; }
.cube3d{ position:relative; width:var(--s); height:var(--s); transform-style:preserve-3d; transform:rotateX(-30deg) rotateY(-45deg); }
.logo-spin .cube3d{ animation:cube-turn 5s linear infinite; }
@keyframes cube-turn{ from{ transform:rotateX(-30deg) rotateY(-45deg); } to{ transform:rotateX(-30deg) rotateY(315deg); } }
.cf{ position:absolute; inset:0; display:grid; grid:repeat(3,1fr) / repeat(3,1fr); box-sizing:border-box; border:2.5px solid #121826; backface-visibility:hidden; }
.cf i{ display:block; }
.cf i.r{ border-right:2.5px solid #1a2030; }
.cf i.d{ border-bottom:2.5px solid #1a2030; }
.cf-f{ transform:translateZ(calc(var(--s)/2)); }
.cf-b{ transform:rotateY(180deg) translateZ(calc(var(--s)/2)); }
.cf-r{ transform:rotateY(90deg) translateZ(calc(var(--s)/2)); }
.cf-l{ transform:rotateY(-90deg) translateZ(calc(var(--s)/2)); }
.cf-t{ transform:rotateX(90deg) translateZ(calc(var(--s)/2)); }
.cf-u{ transform:rotateX(-90deg) translateZ(calc(var(--s)/2)); }
@media (prefers-reduced-motion:reduce){ .logo-spin .cube3d{ animation-duration:14s; } }
