/* Gembloom — styles */
:root {
  --bg0: #1a1030;
  --bg1: #2a1457;
  --bg2: #3b1d6e;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-line: rgba(255, 255, 255, 0.16);
  --ink: #f4eeff;
  --ink-dim: #c7b8e8;
  --accent: #ff6fb5;
  --accent2: #8b5cf6;
  --gold: #ffd54a;
  --cell: 30px;
  --clue: 18px;
  --cf: 13px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  overscroll-behavior: none;
}
body {
  background:
    radial-gradient(1200px 600px at 80% -10%, #4a2487 0%, transparent 55%),
    radial-gradient(900px 500px at 0% 110%, #7a2d8f 0%, transparent 50%),
    linear-gradient(160deg, var(--bg0), var(--bg1) 55%, var(--bg2));
  background-attachment: fixed;
  min-height: 100%;
  user-select: none; -webkit-user-select: none;
}

#app {
  max-width: 620px; margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
}

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 2px 10px;
}
.brand { display: flex; align-items: center; gap: 10px; flex: 1; }
.logo { font-size: 30px; filter: drop-shadow(0 2px 6px rgba(255,120,200,.5)); }
.brand h1 {
  margin: 0; font-size: 26px; letter-spacing: .5px;
  background: linear-gradient(90deg, #ffd1ec, #b69bff, #8ee9ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { margin: 0; font-size: 11px; color: var(--ink-dim); letter-spacing: .3px; }
.icon-btn {
  border: 1px solid var(--panel-line); background: var(--panel);
  color: var(--ink); width: 42px; height: 42px; border-radius: 14px;
  font-size: 20px; backdrop-filter: blur(8px);
}
.icon-btn:active { transform: scale(.92); }

/* ---- Tier tabs ---- */
.tier-tabs {
  display: flex; gap: 7px; overflow-x: auto; padding: 2px 2px 12px;
  scrollbar-width: none;
}
.tier-tabs::-webkit-scrollbar { display: none; }
.tier-tab {
  flex: 0 0 auto; border: 1px solid var(--panel-line); background: var(--panel);
  color: var(--ink-dim); border-radius: 16px; padding: 9px 15px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 70px; transition: .18s;
}
.tier-tab span { font-weight: 700; font-size: 14px; }
.tier-tab small { font-size: 10px; opacity: .8; }
.tier-tab.active {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 6px 18px rgba(160,80,220,.45);
}

/* ---- Cards ---- */
.tier-body { flex: 1; }
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px; padding: 2px;
}
.pcard {
  border: 1px solid var(--panel-line); background: var(--panel);
  border-radius: 18px; padding: 12px; display: flex; flex-direction: column;
  align-items: center; gap: 8px; backdrop-filter: blur(6px);
  transition: transform .12s;
}
.pcard:active { transform: scale(.96); }
.pcard.done { border-color: rgba(255,213,74,.5); box-shadow: 0 0 0 1px rgba(255,213,74,.25) inset; }
.mini {
  width: 86px; height: 86px; display: grid; gap: 1px;
  background: rgba(0,0,0,.18); padding: 4px; border-radius: 10px;
}
.mini i { border-radius: 2px; }
.mini i.e { background: rgba(255,255,255,.05); }
.pname { font-size: 13px; font-weight: 600; text-align: center; }
.pbest { font-size: 10px; color: var(--gold); }

/* ---- Generator panel ---- */
.gen-panel {
  text-align: center; padding: 26px 18px; margin-top: 8px;
  border: 1px solid var(--panel-line); background: var(--panel);
  border-radius: 24px; backdrop-filter: blur(6px);
}
.gen-art { font-size: 58px; filter: drop-shadow(0 6px 16px rgba(120,180,255,.5)); animation: float 3s ease-in-out infinite; }
.gen-panel h2 { margin: 8px 0 4px; font-size: 22px; }
.gen-panel p { color: var(--ink-dim); font-size: 13px; line-height: 1.5; margin: 0 auto 18px; max-width: 320px; }
.size-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 18px; flex-wrap: wrap; }
.size-chip {
  border: 1px solid var(--panel-line); background: rgba(255,255,255,.05);
  color: var(--ink-dim); padding: 9px 14px; border-radius: 13px; font-weight: 600;
}
.size-chip.active { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; }

.big-btn {
  border: none; border-radius: 16px; padding: 15px 22px; width: 100%;
  font-size: 16px; font-weight: 700; color: #fff; letter-spacing: .3px;
  background: linear-gradient(135deg, #ff6fb5, #8b5cf6);
  box-shadow: 0 8px 22px rgba(160,80,220,.5);
}
.big-btn:active { transform: translateY(2px); }
.ghost-btn {
  border: 1px solid var(--panel-line); background: transparent; color: var(--ink-dim);
  border-radius: 14px; padding: 12px; width: 100%; font-size: 14px; margin-top: 9px;
}

.footnote { text-align: center; color: var(--ink-dim); font-size: 11px; padding: 16px 0 4px; opacity: .8; }

/* =================== PLAY =================== */
.play-top { gap: 8px; }
.play-title { flex: 1; text-align: center; }
.play-title h2 { margin: 0; font-size: 17px; }
.timer { font-size: 12px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.hearts { display: flex; gap: 2px; min-width: 42px; justify-content: flex-end; }
.heart { color: #ff5c8a; font-size: 16px; }
.heart.lost { color: rgba(255,255,255,.18); }
.zen { font-size: 11px; color: var(--gold); border: 1px solid rgba(255,213,74,.4); padding: 2px 8px; border-radius: 10px; }

.board-scroll {
  flex: 1; display: flex; align-items: flex-start; justify-content: center;
  overflow: auto; padding: 6px 0;
}
.board {
  display: grid;
  grid-template-columns: calc(var(--mr) * var(--clue)) calc(var(--n) * var(--cell));
  grid-template-rows: calc(var(--mc) * var(--clue)) calc(var(--n) * var(--cell));
  touch-action: none;
}
.corner { grid-area: 1 / 1; }
.col-clues {
  grid-area: 1 / 2; display: grid;
  grid-template-columns: repeat(var(--n), var(--cell));
}
.cc {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding-bottom: 4px; line-height: 1.05;
}
.row-clues {
  grid-area: 2 / 1; display: grid;
  grid-template-rows: repeat(var(--n), var(--cell));
}
.rc {
  display: flex; align-items: center; justify-content: flex-end; gap: 5px;
  padding-right: 6px;
}
.cc b, .rc b {
  font-size: var(--cf); font-weight: 800; font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.cc b { line-height: 1.12; }
.zerorun { color: rgba(255,255,255,.25) !important; }
.clue-done { opacity: .3; }
.clue-done b { text-decoration: line-through; }

.cells {
  grid-area: 2 / 2; display: grid;
  grid-template-columns: repeat(var(--n), var(--cell));
  grid-template-rows: repeat(var(--n), var(--cell));
  background: rgba(0,0,0,.22);
  border-radius: 8px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.08) inset;
}
.cell {
  position: relative;
  border-right: 1px solid rgba(255,255,255,.06);
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.02);
}
.cell.tr { border-top: 2px solid rgba(255,255,255,.22); }
.cell.tc { border-left: 2px solid rgba(255,255,255,.22); }
.cell.filled {
  box-shadow: 0 1px 3px rgba(0,0,0,.4) inset, 0 0 6px rgba(255,255,255,.12);
  border-radius: 3px;
}
.cell.filled::after {
  content: ''; position: absolute; top: 12%; left: 16%; width: 34%; height: 28%;
  background: rgba(255,255,255,.55); border-radius: 50%; filter: blur(.5px);
}
.cell.marked::before {
  content: '✕'; position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center;
  color: rgba(255,255,255,.32); font-size: calc(var(--cell) * .5); font-weight: 700;
}
.cell.pop { animation: pop .28s ease; }
.cell.err { animation: shake .35s ease; background: rgba(255,60,90,.5) !important; }
.cell.hinted { animation: glow 1s ease; }
.cell.reveal { animation: reveal .5s ease; }

/* ---- Toolbar ---- */
.toolbar {
  display: flex; gap: 9px; justify-content: center; flex-wrap: wrap;
  padding: 12px 4px 8px;
}
.swatch {
  width: 46px; height: 46px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.25);
  box-shadow: 0 4px 10px rgba(0,0,0,.35), 0 2px 6px rgba(255,255,255,.15) inset;
}
.swatch.rainbow { background: conic-gradient(#ff5c8a,#ffd54a,#10b981,#06b6d4,#8b5cf6,#ff5c8a); }
.swatch.active, .tool.active {
  transform: scale(1.12);
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,.5), 0 6px 16px rgba(0,0,0,.4);
}
.tool {
  width: 46px; height: 46px; border-radius: 14px;
  border: 1px solid var(--panel-line); background: var(--panel);
  color: var(--ink); font-size: 19px;
}
.swatch:active, .tool:active { transform: scale(.92); }

.actions { display: flex; gap: 8px; padding: 4px 2px 2px; }
.act {
  flex: 1; border: 1px solid var(--panel-line); background: var(--panel);
  color: var(--ink); border-radius: 13px; padding: 12px 6px; font-size: 13px; font-weight: 600;
}
.act:active { transform: scale(.96); }

/* =================== Overlays =================== */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(12,6,28,.72); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fade .3s ease;
}
.dialog {
  background: linear-gradient(160deg, rgba(60,30,100,.95), rgba(40,20,70,.95));
  border: 1px solid var(--panel-line); border-radius: 26px;
  padding: 26px 22px; text-align: center; max-width: 360px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.dialog h2 {
  margin: 6px 0 10px; font-size: 28px;
  background: linear-gradient(90deg, #ffd1ec, #ffd54a); -webkit-background-clip: text;
  background-clip: text; color: transparent;
}
.dialog p { color: var(--ink-dim); font-size: 14px; margin: 0 0 16px; }
.solved-meta { margin: 14px 0 18px !important; }
.big-emoji { font-size: 54px; }
.spark { font-size: 46px; animation: spin 2.4s linear infinite; }
.reveal-art {
  display: grid; gap: 1.5px; width: 180px; height: 180px; margin: 6px auto 4px;
  padding: 6px; background: rgba(0,0,0,.25); border-radius: 14px;
}
.reveal-art i { border-radius: 2px; }
.reveal-art i.e { background: transparent; }

/* ---- Settings sheet ---- */
.sheet-wrap {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end;
  background: rgba(10,5,24,.6); animation: fade .25s ease;
}
.sheet {
  width: 100%; max-width: 620px; margin: 0 auto;
  background: linear-gradient(160deg, #341a63, #241043);
  border-radius: 26px 26px 0 0; border-top: 1px solid var(--panel-line);
  padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
  animation: slideup .3s ease;
}
.sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.25); margin: 0 auto 10px; }
.sheet h2 { margin: 4px 0 14px; font-size: 20px; text-align: center; }
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 4px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.toggle-row span { font-size: 15px; font-weight: 600; }
.toggle-row small { display: block; font-size: 11px; color: var(--ink-dim); margin-top: 2px; }
.switch {
  width: 50px; height: 30px; border-radius: 15px; background: rgba(255,255,255,.15);
  position: relative; transition: .2s; flex: 0 0 auto;
}
.switch i {
  position: absolute; top: 3px; left: 3px; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; transition: .2s;
}
.toggle-row.on .switch { background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.toggle-row.on .switch i { left: 23px; }
.sheet .big-btn { margin-top: 18px; }

/* ---- Loader ---- */
.loader {
  position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  background: rgba(12,6,28,.7); backdrop-filter: blur(6px);
}
.loader p { color: var(--ink-dim); }
.spinner { font-size: 52px; animation: spin 1.1s linear infinite; }

/* ---- Confetti ---- */
.confetti { position: fixed; inset: 0; z-index: 55; pointer-events: none; overflow: hidden; }
.confetti span {
  position: absolute; top: -16px; width: 10px; height: 14px; border-radius: 2px;
  animation-name: fall; animation-timing-function: linear; animation-fill-mode: forwards;
}

/* ---- Keyframes ---- */
@keyframes pop { 0% { transform: scale(.4); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@keyframes glow { 0% { box-shadow: 0 0 0 3px rgba(255,213,74,.9); } 100% { box-shadow: 0 0 0 0 rgba(255,213,74,0); } }
@keyframes reveal { 0% { filter: brightness(2.2) saturate(1.6); } 100% { filter: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fall {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(104vh) rotate(540deg); opacity: .9; }
}

@media (max-width: 360px) {
  .brand h1 { font-size: 22px; }
  .swatch, .tool { width: 42px; height: 42px; }
}

/* =================== HUB =================== */
.hub { display: flex; flex-direction: column; flex: 1; }
.hub-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px; }
.hub-title {
  margin: 0; font-size: 30px; letter-spacing: .5px; text-align: center; flex: 1;
  background: linear-gradient(90deg, #ffd1ec, #b69bff, #8ee9ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.mascot {
  position: relative; width: min(62vw, 230px); aspect-ratio: 1; margin: 8px auto 4px;
  border-radius: 28px; overflow: hidden;
  box-shadow: 0 16px 40px rgba(0,0,0,.4), 0 0 0 4px rgba(255,255,255,.1) inset;
}
.mascot svg { width: 100%; height: 100%; display: block; }
.mascot-glow {
  position: absolute; inset: -20% -20% auto -20%; height: 60%;
  background: radial-gradient(circle, rgba(255,255,200,.35), transparent 70%);
  pointer-events: none;
}
.hub-sub { text-align: center; color: var(--ink); font-size: 15px; margin: 6px 0 16px; }
.hub-sub b { color: var(--gold); }
.mode-list { display: flex; flex-direction: column; gap: 12px; }
.mode-card {
  display: flex; align-items: center; gap: 14px; text-align: left;
  border: 1px solid var(--panel-line); background: var(--panel); backdrop-filter: blur(6px);
  border-radius: 20px; padding: 16px 18px; color: var(--ink);
  transition: transform .12s;
}
.mode-card:active { transform: scale(.97); }
.mode-emoji { font-size: 34px; filter: drop-shadow(0 3px 6px rgba(0,0,0,.4)); }
.mode-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.mode-text b { font-size: 18px; }
.mode-text small { font-size: 12px; color: var(--ink-dim); line-height: 1.35; }
.mode-arrow { font-size: 26px; color: var(--ink-dim); }

/* =================== JOURNEY BANNER =================== */
.journey-banner {
  display: flex; align-items: center; gap: 12px; width: 100%;
  border: none; border-radius: 18px; padding: 14px 16px; margin: 2px 0 12px;
  background: linear-gradient(120deg, #ff6fb5, #8b5cf6 60%, #5b8def);
  box-shadow: 0 8px 22px rgba(140,70,210,.45); color: #fff; text-align: left;
}
.journey-banner:active { transform: scale(.98); }
.jb-emoji { font-size: 26px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.3)); }
.jb-text { flex: 1; display: flex; flex-direction: column; }
.jb-text b { font-size: 17px; }
.jb-text small { font-size: 12px; opacity: .92; }
.jb-go { font-weight: 700; font-size: 14px; background: rgba(255,255,255,.2); padding: 7px 12px; border-radius: 12px; }

/* =================== LOGIN =================== */
.hub.login { align-items: center; text-align: center; justify-content: center; min-height: 88vh; padding: 0 6px; }
.login .hub-title { font-size: 40px; margin-bottom: 6px; }
.login-mascot { width: min(46vw, 170px); margin: 6px auto 14px; }
.login-prompt { font-size: 17px; color: var(--ink); margin: 0 0 12px; font-weight: 600; }
.login-input {
  width: 100%; max-width: 320px; border: 1px solid var(--panel-line);
  background: rgba(255,255,255,.1); color: var(--ink); border-radius: 14px;
  padding: 15px 16px; font-size: 17px; text-align: center; margin-bottom: 12px;
  -webkit-appearance: none;
}
.login-input::placeholder { color: var(--ink-dim); }
.login-input:focus { outline: none; border-color: var(--accent); background: rgba(255,255,255,.16); }
.login-remember { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; color: var(--ink-dim); margin-bottom: 16px; }
.login-remember input { width: 18px; height: 18px; accent-color: var(--accent); }
.hub.login .big-btn, .hub.login .ghost-btn { max-width: 320px; }
.login-hint { font-size: 11px; color: var(--ink-dim); margin-top: 16px; max-width: 300px; line-height: 1.5; }

.profile-line { text-align: center; font-size: 12px; color: var(--ink-dim); margin: 2px 0 18px; }
.link-btn { background: none; border: none; color: var(--accent); font-size: 12px; text-decoration: underline; padding: 0; }

/* =================== CROSSWORD =================== */
.cw-wrap { display: flex; justify-content: center; padding: 10px 0 4px; }
.cw-grid {
  display: grid; grid-template-columns: repeat(var(--n), var(--cwcell));
  gap: 2px; padding: 6px; background: rgba(0,0,0,.25); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.cwc {
  position: relative; width: var(--cwcell); height: var(--cwcell);
  background: #f4eeff; border-radius: 4px; display: flex; align-items: center; justify-content: center;
}
.cwc.blk { background: transparent; }
.cwn { position: absolute; top: 1px; left: 3px; font-size: calc(var(--cwcell)*.26); color: #5a4a7a; font-style: normal; font-weight: 700; }
.cwl { font-size: calc(var(--cwcell)*.5); font-weight: 700; color: #2a1457; line-height: 1; }
.cwc.hl { background: #cdb8ff; }
.cwc.sel { background: var(--gold); box-shadow: 0 0 0 2px #fff inset; }
.cwc.bad .cwl { color: #d1003e; }
.cwc.bad { background: #ffd1dd; }

.cw-cluebar {
  display: flex; align-items: center; gap: 8px; margin: 4px 2px 8px;
  background: var(--panel); border: 1px solid var(--panel-line); border-radius: 14px; padding: 4px;
}
.cw-cluebar button {
  border: none; background: rgba(255,255,255,.1); color: var(--ink); width: 38px; height: 38px;
  border-radius: 10px; font-size: 20px; flex: 0 0 auto;
}
.cw-cluebar #clueText { flex: 1; font-size: 14px; font-weight: 600; padding: 0 4px; line-height: 1.3; }
.cw-actions { display: flex; gap: 8px; padding: 2px; margin-bottom: 8px; }

.keyboard { display: flex; flex-direction: column; gap: 7px; padding: 4px 0 calc(6px + env(safe-area-inset-bottom)); }
.kbrow { display: flex; gap: 5px; justify-content: center; }
.key {
  flex: 1 1 0; max-width: 38px; height: 48px; border: none; border-radius: 9px;
  background: linear-gradient(180deg, #5a3f8f, #46307094); color: #fff; font-size: 17px; font-weight: 700;
  box-shadow: 0 2px 0 rgba(0,0,0,.3);
}
.key:active { transform: translateY(1px); background: var(--accent2); }
.key.wide { max-width: 56px; flex: 1.4 1 0; font-size: 18px; background: linear-gradient(180deg, #6b4ba3, #4a3380); }

.cw-cards .cw-thumb, .cw-card .cw-thumb { width: 86px; height: 86px; display: flex; }
.cw-mini { display: grid; gap: 2px; width: 86px; height: 86px; }
.cw-mini i { background: #efe7ff; border-radius: 2px; }
.cw-mini i.b { background: rgba(255,255,255,.07); }

/* =================== JIGSAW =================== */
.jig-sizes { flex-wrap: wrap; }
.jig-sizes .size-chip { display: flex; flex-direction: column; align-items: center; line-height: 1.1; padding: 8px 14px; }
.jig-sizes .size-chip small { font-size: 9px; opacity: .8; }
.jig-thumb { width: 100%; aspect-ratio: 1; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 10px rgba(0,0,0,.3); }
.jig-thumb svg { width: 100%; height: 100%; display: block; }
.jig-card { padding: 8px; }

.jig-stage {
  position: relative; width: 100%; margin: 6px 0; overflow: hidden;
  border-radius: 14px; background: rgba(255,255,255,.04);
  touch-action: none;
}
.jig-viewport {
  position: relative; width: 100%; margin: 6px 0; overflow: auto;
  -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y;
  border-radius: 14px; background: rgba(0,0,0,.18);
  box-shadow: 0 8px 24px rgba(0,0,0,.3) inset;
  overscroll-behavior: contain;
}
.jig-sizer { position: relative; }
.jig-world { position: absolute; top: 0; left: 0; transform-origin: 0 0; }

.jig-controls { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 6px 2px calc(8px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
.zbtn {
  border: 1px solid var(--panel-line); background: var(--panel); color: var(--ink);
  border-radius: 12px; min-width: 44px; height: 44px; font-size: 18px; font-weight: 700; padding: 0 12px;
}
.zbtn:active { transform: scale(.94); }
.zbtn.grow { flex: 1; min-width: 0; font-size: 14px; }
.zlbl { font-size: 13px; color: var(--ink-dim); min-width: 46px; text-align: center; font-variant-numeric: tabular-nums; }
.jig-ghost {
  position: absolute; background-size: cover; border-radius: 6px;
  opacity: .14; outline: 2px dashed rgba(255,255,255,.3); transition: opacity .3s;
  pointer-events: none;
}
.jig-ghost.show { opacity: .4; }
.jig-piece {
  position: absolute; top: 0; left: 0; cursor: grab; touch-action: none;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.45));
  will-change: transform;
}
.jig-piece.dragging { cursor: grabbing; filter: drop-shadow(0 10px 14px rgba(0,0,0,.55)); }
.jig-piece.placed { filter: none; }
.jig-win { width: 200px; height: 200px; margin: 6px auto; border-radius: 16px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.jig-win svg, .jig-win-img { width: 100%; height: 100%; display: block; object-fit: cover; }

/* jigsaw photos */
.sec-title { font-size: 14px; color: var(--ink-dim); margin: 14px 2px 8px; font-weight: 700; }
.sec-title small { font-weight: 400; opacity: .8; font-size: 11px; }
.jig-thumb img { width: 100%; height: 100%; display: block; object-fit: cover; }
.upload-card { align-items: center; justify-content: center; gap: 6px; border-style: dashed; cursor: pointer; min-height: 120px; }
.upload-plus {
  width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 34px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2));
}
.photo-card { position: relative; }
.photo-del {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%;
  border: none; background: rgba(0,0,0,.55); color: #fff; font-size: 14px; line-height: 1;
}

/* =================== MINESWEEPER =================== */
.ms-levels { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 4px; }
.level-card {
  border: 1px solid var(--panel-line); background: var(--panel); backdrop-filter: blur(6px);
  border-radius: 18px; padding: 14px; color: var(--ink); display: flex; flex-direction: column;
  align-items: center; gap: 4px; position: relative;
}
.level-card:active { transform: scale(.96); }
.level-card b { font-size: 17px; margin-top: 4px; }
.level-card small { font-size: 11px; color: var(--ink-dim); }
.level-art { width: 70px; height: 70px; }
.ms-mini { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; width: 70px; height: 70px; }
.ms-mini i { border-radius: 3px; opacity: .85; }
.level-card .pbest { color: var(--gold); font-size: 11px; }

.ms-wrap { display: flex; justify-content: center; padding: 8px 0; overflow: auto; }
.ms-board {
  display: grid; grid-template-columns: repeat(var(--ms-n), var(--ms-cell)); gap: 2px;
  padding: 6px; background: rgba(0,0,0,.25); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35); touch-action: manipulation;
}
.ms-cell {
  width: var(--ms-cell); height: var(--ms-cell); border: none; border-radius: 4px;
  background: linear-gradient(150deg, #6e4fa6, #46307a);
  box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 1px 1px rgba(255,255,255,.18) inset;
  font-size: var(--ms-font); font-weight: 800; line-height: 1; padding: 0;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.ms-cell:active { filter: brightness(1.15); }
.ms-cell.rev {
  background: rgba(255,255,255,.05); box-shadow: 0 1px 2px rgba(0,0,0,.25) inset;
}
.ms-cell.flag { background: linear-gradient(150deg, #f6c560, #e09b2d); }
.ms-cell.maybe { background: linear-gradient(150deg, #8676bd, #4a3a86); color: #ffe08a; font-weight: 900; }
.ms-hint { font-size: 11px; color: var(--ink-dim); margin-left: 10px; align-self: center; }
.ms-cell.mine { background: radial-gradient(circle at 50% 45%, #ffd9a0, #c98b3a); }
.ms-cell.boom { background: radial-gradient(circle at 50% 45%, #ff8aa8, #d1003e); }
.ms-cell.wrong { background: rgba(209,0,62,.35); color: #ffd1dd; }

.ms-tools { display: flex; justify-content: center; padding: 8px 2px calc(10px + env(safe-area-inset-bottom)); }
.ms-flagbtn {
  border: 1px solid var(--panel-line); background: var(--panel); color: var(--ink);
  border-radius: 14px; padding: 12px 20px; font-size: 15px; font-weight: 600;
}
.ms-flagbtn.on { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff; }
.ms-flagbtn span { font-size: 18px; }
.play-title h2 { display: flex; align-items: center; justify-content: center; gap: 4px; }
