/*
 * Solitaire – style.css
 * All styles. Zero inline CSS in HTML.
 *
 * FONTS: Place .woff2 files in ./fonts/ directory.
 * Download from https://fonts.google.com:
 *   Playfair Display (Bold 700, Black 900)
 *   DM Sans (Regular 400, Medium 500, SemiBold 600, Bold 700)
 *   JetBrains Mono (Medium 500)
 */

/* ── Self-hosted Font Faces (latin subset, from Google Fonts) ── */
/* DM Sans – variable font, single file covers all weights */
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('./fonts/DMSans-Latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('./fonts/DMSans-Latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('./fonts/DMSans-Latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('./fonts/DMSans-Latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Playfair Display – same file for 700 and 900 */
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('./fonts/PlayfairDisplay-Latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('./fonts/PlayfairDisplay-Latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* JetBrains Mono */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('./fonts/JetBrainsMono-Latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Reset & Variables ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #1a472a; --bg2: #0f2d1a;
  --felt: #1e5c34; --felt2: #267a45;
  --card-bg: #fff; --card-bdr: #d4d4d4; --card-sh: rgba(0,0,0,.32);
  --red: #c0392b; --blk: #1a1a2e;
  --gold: #f4c542; --gold2: #c9a227;
  --txt: #fff; --txtd: rgba(255,255,255,.55);
  --pbg: rgba(0,0,0,.32); --pbdr: rgba(255,255,255,.08);
  --ac: #4ade80; --ac2: #22c55e;
  --slb: rgba(255,255,255,.13);
  --S: 1;
  --cw: calc(75px * var(--S)); --ch: calc(105px * var(--S)); --cr: calc(7px * var(--S));
  --fc: calc(15px * var(--S)); --fs: calc(30px * var(--S)); --fst: calc(11px * var(--S));
  --gap: calc(8px * var(--S));
}

html, body {
  width: 100%; height: 100%; overflow: hidden;
  font-family: 'DM Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg2); color: var(--txt);
  touch-action: none; user-select: none; -webkit-user-select: none;
}

/* ── Themes ── */
.t-classic  { --bg:#1a472a;--bg2:#0f2d1a;--felt:#1e5c34;--felt2:#267a45;--ac:#4ade80;--gold:#f4c542 }
.t-midnight { --bg:#141428;--bg2:#0a0a1a;--felt:#1c1c3a;--felt2:#28284a;--ac:#818cf8;--gold:#c084fc;--ac2:#6366f1;--gold2:#a855f7 }
.t-ocean    { --bg:#0c2d48;--bg2:#071e32;--felt:#134568;--felt2:#1a5a8a;--ac:#38bdf8;--gold:#22d3ee;--ac2:#0ea5e9;--gold2:#06b6d4 }
.t-sunset   { --bg:#4a1a2e;--bg2:#2d0f1c;--felt:#6b2040;--felt2:#8a2a52;--ac:#fb923c;--gold:#f97316;--ac2:#ea580c;--gold2:#dc2626 }
.t-sakura   { --bg:#3d2040;--bg2:#2a1530;--felt:#4d2a52;--felt2:#5e3565;--ac:#f9a8d4;--gold:#f472b6;--ac2:#ec4899;--gold2:#db2777 }
.t-arctic   { --bg:#d8dfe8;--bg2:#c8d0da;--felt:#e4eaf0;--felt2:#f0f4f8;--ac:#3b82f6;--gold:#6366f1;--ac2:#2563eb;--gold2:#4f46e5;--txt:#1e293b;--txtd:rgba(30,41,59,.45);--pbg:rgba(255,255,255,.55);--pbdr:rgba(0,0,0,.07);--slb:rgba(0,0,0,.09);--card-sh:rgba(0,0,0,.12);--blk:#111 }

/* ── Game Area ── */
#G {
  width: 100%; height: 100%;
  background: radial-gradient(ellipse at 50% 30%, var(--felt2), var(--felt) 50%, var(--bg) 90%, var(--bg2));
  position: relative; overflow: hidden;
}
#G::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='6' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='1' cy='1' r='.4' fill='%23000' fill-opacity='.04'/%3E%3C/svg%3E");
}

/* ── Toolbar ── */
#bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; padding: 4px 6px;
  background: var(--pbg); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--pbdr); gap: 4px; height: 44px;
}
#bar .L, #bar .R { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
#bar .C { display: flex; align-items: center; gap: 4px; flex: 1; justify-content: center; overflow: hidden; }

.st {
  font-family: 'JetBrains Mono', 'Cascadia Code', 'Menlo', monospace;
  font-size: 12px; color: var(--txt); background: rgba(0,0,0,.2);
  padding: 3px 7px; border-radius: 5px;
  display: flex; align-items: center; gap: 3px; white-space: nowrap;
}
.st i { color: var(--txtd); font-style: normal; font-size: 8px; text-transform: uppercase; letter-spacing: .3px; }

.b {
  font-family: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
  font-size: 11px; font-weight: 600; padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.08); border-radius: 7px;
  cursor: pointer; display: flex; align-items: center; gap: 4px;
  color: var(--txt); background: rgba(255,255,255,.09);
  white-space: nowrap; -webkit-tap-highlight-color: transparent;
  transition: background .12s;
}
.b:active { transform: scale(.94); }
.b:hover { background: rgba(255,255,255,.15); }
.b svg { width: 15px; height: 15px; flex-shrink: 0; }
.b.ba { background: var(--ac); color: #000; border-color: var(--ac); }
.b .bl { display: inline; }

/* ── Board ── */
#B {
  position: absolute; z-index: 1; top: 44px; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; align-items: center; padding: 10px 6px;
}
#TR, #TB {
  display: grid;
  grid-template-columns: repeat(7, var(--cw));
  gap: var(--gap);
  justify-content: center;
  width: min-content;
}
#TR { margin-bottom: calc(12px * var(--S)); align-items: start; }
#TB { flex: 1; }

#SK  { grid-column: 1; }
#WS  { grid-column: 2; }
.sl.fd[data-index="0"] { grid-column: 4; }
.sl.fd[data-index="1"] { grid-column: 5; }
.sl.fd[data-index="2"] { grid-column: 6; }
.sl.fd[data-index="3"] { grid-column: 7; }

/* ── Slots ── */
.sl {
  width: var(--cw); min-height: var(--ch);
  border: 1.5px solid var(--slb); border-radius: var(--cr);
  position: relative; flex-shrink: 0; background: rgba(0,0,0,.05);
}
.sl.fd { background: rgba(255,255,255,.025); }
.sl.fd::after {
  content: attr(data-suit); position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: calc(24px * var(--S)); opacity: .12; pointer-events: none;
}
.sl.tc {
  min-height: calc(var(--ch) + 200px);
  border-color: transparent; background: transparent;
}
.sl.tc.emp::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: var(--ch); border: 1.5px solid var(--slb);
  border-radius: var(--cr); background: rgba(0,0,0,.03);
}

/* ── Cards ── */
.c {
  width: var(--cw); height: var(--ch); position: absolute;
  border-radius: var(--cr); cursor: pointer;
  will-change: transform; -webkit-tap-highlight-color: transparent;
}
.ci { width: 100%; height: 100%; border-radius: var(--cr); position: relative; overflow: hidden; }

/* Face-down backs */
.c.dn .ci   { border: 2px solid #3a62a8; box-shadow: 0 1px 4px rgba(0,0,0,.3); background: linear-gradient(135deg,#2a5298,#1e3a6e); }
.c.dn .ci::before {
  content: ''; position: absolute; inset: 3px;
  border: 1px solid rgba(255,255,255,.1); border-radius: 3px;
  background: repeating-linear-gradient(45deg,transparent,transparent 4px,rgba(255,255,255,.025) 4px,rgba(255,255,255,.025) 8px);
}
.c.dn.bk-r .ci { background: linear-gradient(135deg,#982a2a,#6e1e1e); border-color: #a83a3a; }
.c.dn.bk-g .ci { background: linear-gradient(135deg,#2a6e3a,#1e4e28); border-color: #3a8a4a; }
.c.dn.bk-p .ci { background: linear-gradient(135deg,#6a2a98,#4a1e6e); border-color: #7a3aa8; }
.c.dn.bk-k .ci { background: linear-gradient(135deg,#2a2a2e,#18181c); border-color: #444; }
.c.dn.bk-img .ci { border-color: rgba(255,255,255,.2); }
.c.dn.bk-img .ci::before { display: none; }
.c.dn .ci .backImg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; border-radius: calc(var(--cr) - 2px);
}

/* Face-up */
.c.up .ci { background: var(--card-bg); border: 1px solid var(--card-bdr); box-shadow: 0 1px 5px var(--card-sh); }
.c .tl, .c .br {
  position: absolute; font-family: 'Playfair Display', Georgia, serif;
  font-weight: 900; font-size: var(--fc); line-height: 1; text-align: center;
}
.c .tl { top: calc(4px * var(--S)); left: calc(5px * var(--S)); }
.c .br { bottom: calc(4px * var(--S)); right: calc(5px * var(--S)); transform: rotate(180deg); }
.c .sc { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: var(--fs); line-height: 1; }
.c .stl, .c .sbr { position: absolute; font-size: var(--fst); line-height: 1; }
.c .stl { top: calc(19px * var(--S)); left: calc(5px * var(--S)); }
.c .sbr { bottom: calc(19px * var(--S)); right: calc(5px * var(--S)); transform: rotate(180deg); }
.c.r .tl, .c.r .br, .c.r .sc, .c.r .stl, .c.r .sbr { color: var(--red); }
.c.bk .tl, .c.bk .br, .c.bk .sc, .c.bk .stl, .c.bk .sbr { color: var(--blk); }
.c.drag { z-index: 10000 !important; filter: drop-shadow(0 14px 28px rgba(0,0,0,.45)); transition: none !important; pointer-events: none; }
.c.sel .ci { box-shadow: 0 0 0 2.5px var(--gold), 0 2px 12px rgba(244,197,66,.35); }
.c.hint { animation: hp .55s ease-in-out 3; }
@keyframes hp { 0%,100% { filter: none; } 50% { filter: drop-shadow(0 0 10px var(--ac)); } }

/* ── Stock ── */
#SK.sl { cursor: pointer; border-color: rgba(255,255,255,.2); z-index: 50; }
#SK.sl.es { border-style: dashed; border-color: rgba(255,255,255,.14); background: rgba(0,0,0,.07); }
#SK.sl.es::after {
  content: '↻'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: calc(24px * var(--S)); color: rgba(255,255,255,.22); pointer-events: none;
}
#WS.sl { border-color: transparent; background: transparent; }

/* ── Auto-Complete Button ── */
#acBtn {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  z-index: 500; padding: 14px 28px;
  font-family: 'DM Sans', system-ui, sans-serif; font-size: 15px; font-weight: 700;
  color: #000; background: var(--ac);
  border: 2px solid rgba(255,255,255,.25); border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 6px 28px rgba(0,0,0,.35), 0 0 20px rgba(74,222,128,.3);
  transition: transform .4s cubic-bezier(.34,1.56,.64,1), opacity .3s;
  opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 8px;
  -webkit-tap-highlight-color: transparent;
}
#acBtn.show { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto; animation: acp 2s ease-in-out infinite; }
#acBtn:active { transform: translateX(-50%) scale(.95) !important; }
@keyframes acp {
  0%, 100% { box-shadow: 0 6px 28px rgba(0,0,0,.35), 0 0 20px rgba(74,222,128,.25); }
  50%      { box-shadow: 0 6px 28px rgba(0,0,0,.35), 0 0 35px rgba(74,222,128,.5); }
}

/* ── Modals ── */
.mo {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.72); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.mo.on { opacity: 1; pointer-events: auto; }
.md {
  background: linear-gradient(145deg, rgba(28,28,48,.96), rgba(18,18,32,.98));
  border: 1px solid rgba(255,255,255,.1); border-radius: 16px;
  padding: 22px; max-width: 400px; width: 92%; max-height: 85vh;
  overflow-y: auto; box-shadow: 0 20px 70px rgba(0,0,0,.5);
  transform: scale(.9); transition: transform .25s;
  position: relative; color: #fff;
}
.mo.on .md { transform: scale(1); }
.md h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 22px; font-weight: 900; margin-bottom: 3px;
  background: linear-gradient(135deg, var(--gold), var(--ac));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.md .sub { font-size: 12px; color: rgba(255,255,255,.4); margin-bottom: 14px; }
.md h3 {
  font-size: 10px; font-weight: 600; color: rgba(255,255,255,.35);
  text-transform: uppercase; letter-spacing: 1px; margin: 13px 0 5px;
}
.mx {
  position: absolute; top: 10px; right: 10px;
  background: none; border: none; color: rgba(255,255,255,.35);
  font-size: 22px; cursor: pointer; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center; border-radius: 8px;
}
.mx:hover { background: rgba(255,255,255,.1); color: #fff; }

/* Settings controls */
.sr { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.sr label { font-size: 12px; font-weight: 500; color: rgba(255,255,255,.8); }
.sr-ctrl { display: flex; align-items: center; gap: 6px; }
.sr-a { font-size: 10px; opacity: .35; }
.sr-A { font-size: 16px; font-weight: 700; opacity: .5; }

input[type=range] { -webkit-appearance: none; width: 110px; height: 6px; background: rgba(255,255,255,.13); border-radius: 3px; outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; background: var(--ac); border-radius: 50%; cursor: pointer; }

.tg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin: 5px 0; }
.tb {
  padding: 7px 5px; border-radius: 9px;
  border: 2px solid rgba(255,255,255,.07); background: rgba(255,255,255,.03);
  color: #fff; font-size: 10px; font-weight: 600;
  cursor: pointer; text-align: center; transition: all .12s;
}
.tb:hover { border-color: rgba(255,255,255,.2); }
.tb.on { border-color: var(--gold); background: rgba(244,197,66,.08); }
.pv { width: 100%; height: 20px; border-radius: 5px; margin-bottom: 3px; }
.pv-classic  { background: linear-gradient(135deg, #1e5c34, #267a45); }
.pv-midnight { background: linear-gradient(135deg, #1c1c3a, #28284a); }
.pv-ocean    { background: linear-gradient(135deg, #134568, #1a5a8a); }
.pv-sunset   { background: linear-gradient(135deg, #6b2040, #8a2a52); }
.pv-sakura   { background: linear-gradient(135deg, #4d2a52, #5e3565); }
.pv-arctic   { background: linear-gradient(135deg, #e8ecf0, #f0f4f8); }

/* Difficulty / filter buttons */
.dg { display: flex; gap: 6px; margin: 6px 0; flex-wrap: wrap; }
.db {
  flex: 1; min-width: 70px; padding: 9px 6px; border-radius: 11px;
  border: 2px solid rgba(255,255,255,.08); background: rgba(255,255,255,.03);
  color: #fff; font-size: 12px; font-weight: 600;
  cursor: pointer; text-align: center; transition: all .12s;
}
.db:hover { border-color: rgba(255,255,255,.25); }
.db.on { border-color: var(--ac); background: rgba(74,222,128,.08); }
.db small { display: block; opacity: .35; font-size: 9px; margin-top: 2px; }

/* Card back picker */
.cbg { display: flex; gap: 5px; margin: 5px 0; flex-wrap: wrap; }
.cbb {
  flex: 0 0 auto; width: 56px; height: 72px; padding: 4px;
  border-radius: 9px; border: 2px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.03); color: #fff;
  font-size: 9px; font-weight: 600; cursor: pointer; text-align: center;
  transition: all .12s; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; overflow: hidden;
}
.cbb:hover { border-color: rgba(255,255,255,.2); }
.cbb.on { border-color: var(--ac); background: rgba(74,222,128,.08); }
.cpv { width: 36px; height: 44px; border-radius: 4px; flex-shrink: 0; }
.cpv img { width: 100%; height: 100%; object-fit: cover; border-radius: 3px; }
.cpv-blue   { background: linear-gradient(135deg, #2a5298, #1e3a6e); }
.cpv-red    { background: linear-gradient(135deg, #982a2a, #6e1e1e); }
.cpv-green  { background: linear-gradient(135deg, #2a6e3a, #1e4e28); }
.cpv-purple { background: linear-gradient(135deg, #6a2a98, #4a1e6e); }
.cpv-black  { background: linear-gradient(135deg, #2a2a2e, #18181c); }

.upload-btn {
  flex: 0 0 auto; width: 56px; height: 72px; padding: 4px;
  border-radius: 9px; border: 2px dashed rgba(255,255,255,.15);
  background: rgba(255,255,255,.02); color: rgba(255,255,255,.4);
  font-size: 9px; cursor: pointer; text-align: center;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; transition: all .12s;
}
.upload-btn:hover { border-color: rgba(255,255,255,.3); color: rgba(255,255,255,.6); }
.upload-icon { font-size: 18px; opacity: .6; }

/* Leaderboard */
.lbt { width: 100%; font-size: 11px; border-collapse: collapse; }
.lbt th { color: rgba(255,255,255,.35); font-weight: 600; text-align: left; padding: 4px 3px; font-size: 9px; text-transform: uppercase; }
.lbt td { padding: 4px 3px; border-top: 1px solid rgba(255,255,255,.05); color: #fff; }
.lbt .rc { width: 22px; color: var(--gold); font-weight: 700; }
.lbt .scc { font-family: 'JetBrains Mono', 'Cascadia Code', monospace; color: var(--ac); }
.lb-empty { text-align: center; color: rgba(255,255,255,.35); padding: 14px; font-size: 12px; }
.lb-filters { margin-bottom: 8px; }
.lb-reset { margin-top: 10px; text-align: center; }

/* ── Welcome Modal ── */
#WM .md { text-align: center; max-width: 360px; }
#WM h2 { font-size: 26px; }
.wcf { font-size: 32px; margin: 8px 0; letter-spacing: 3px; opacity: .85; }
.choose-label { font-size: 12px; color: rgba(255,255,255,.4); margin-bottom: 10px; }
.wdb {
  display: block; width: 100%; padding: 14px; margin: 6px 0;
  border-radius: 13px; border: 2px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04); color: #fff;
  font-size: 14px; font-weight: 700; cursor: pointer;
  text-align: center; transition: all .12s;
}
.wdb:hover { border-color: var(--ac); background: rgba(74,222,128,.07); transform: scale(1.02); }
.wdb:active { transform: scale(.97); }
.wdb small { display: block; font-weight: 400; font-size: 10px; opacity: .4; margin-top: 2px; }
.wdb-section { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.06); }
.wdb-section-title { font-size: 10px; color: rgba(255,255,255,.3); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }

/* ── Crop Modal ── */
#cropModal .md { max-width: 340px; text-align: center; }
#cropWrap {
  position: relative; width: 100%; max-width: 280px;
  margin: 10px auto; background: #111;
  border-radius: 8px; overflow: hidden; touch-action: none;
}
#cropCanvas { display: block; width: 100%; cursor: move; }
.crop-actions { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }

/* ── Win Overlay ── */
#WO { position: fixed; inset: 0; z-index: 8000; pointer-events: none; }
#WO.on { pointer-events: auto; }
#WC { position: absolute; inset: 0; width: 100%; height: 100%; }
#WN {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0);
  text-align: center; transition: transform .5s cubic-bezier(.34,1.56,.64,1); z-index: 8001;
}
#WO.on #WN { transform: translate(-50%, -50%) scale(1); }
#WN h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 40px; font-weight: 900;
  background: linear-gradient(135deg, var(--gold), #fff, var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
#WN .ws {
  font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
  font-size: 13px; color: rgba(255,255,255,.45); margin: 8px 0 16px;
}
#WN .b { pointer-events: auto; display: inline-flex; font-size: 14px; padding: 11px 22px; }

/* ── Toast ── */
#toast {
  position: fixed; bottom: 70px; left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: rgba(0,0,0,.85); color: #fff;
  padding: 7px 16px; border-radius: 9px;
  font-size: 12px; font-weight: 500;
  opacity: 0; transition: all .25s;
  z-index: 9998; pointer-events: none; white-space: nowrap;
}
#toast.sh { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Desktop Scaling ── */
@media (min-width: 900px) {
  :root { --cw:calc(82px*var(--S));--ch:calc(114px*var(--S));--cr:calc(8px*var(--S));--fc:calc(16px*var(--S));--fs:calc(34px*var(--S));--fst:calc(12px*var(--S));--gap:calc(10px*var(--S)); }
  #bar { height: 48px; padding: 5px 12px; gap: 6px; }
  .st { font-size: 13px; padding: 4px 9px; }
  .st i { font-size: 9px; }
  .b { font-size: 12px; padding: 7px 12px; }
}
@media (min-width: 1200px) {
  :root { --cw:calc(90px*var(--S));--ch:calc(126px*var(--S));--gap:calc(12px*var(--S));--fc:calc(18px*var(--S));--fs:calc(38px*var(--S));--fst:calc(13px*var(--S)); }
}

/* ── Phone ── */
@media (max-width: 600px) {
  :root { --cw:calc(47px*var(--S));--ch:calc(66px*var(--S));--fc:calc(11px*var(--S));--fs:calc(20px*var(--S));--fst:calc(8px*var(--S));--gap:calc(4px*var(--S)); }
  #bar { height: 38px; padding: 3px 4px; gap: 2px; }
  .st { font-size: 10px; padding: 2px 4px; gap: 2px; }
  .st i { font-size: 7px; }
  .b { font-size: 10px; padding: 4px 6px; }
  .b .bl { display: none; }
  .b svg { width: 13px; height: 13px; }
  #B { top: 38px; padding: 5px 2px; }
  #WN h1 { font-size: 26px; }
}
@media (max-width: 380px) {
  :root { --cw:calc(42px*var(--S));--ch:calc(59px*var(--S));--fc:calc(10px*var(--S));--fs:calc(17px*var(--S));--fst:calc(7px*var(--S)); }
  .st i { display: none; }
  .st { padding: 2px 3px; font-size: 9px; }
}
