@font-face {
  font-family: 'Cairo';
  src: url('../fonts/cairo.woff2') format('woff2');
  font-weight: 200 900;
  font-display: swap;
}

:root {
  --sand: #fbf5e9;
  --sand-2: #f3e7d0;
  --card: #ffffff;
  --ink: #33261c;
  --ink-2: #5c4a3c;
  --muted: #8b7764;
  --line: rgba(51, 38, 28, .10);
  --clay: #c2571f;
  --clay-2: #d9701f;
  --clay-d: #8f3b12;
  --gold: #e0a83c;
  --nile: #1f6f78;
  --rose: #a51f3d;
  --ok: #2f7f4f;

  --r-xl: 26px;
  --r-lg: 20px;
  --r-md: 15px;
  --r-sm: 11px;

  --sh-1: 0 1px 2px rgba(51, 38, 28, .05), 0 6px 16px rgba(51, 38, 28, .06);
  --sh-2: 0 2px 6px rgba(51, 38, 28, .08), 0 18px 38px rgba(51, 38, 28, .14);
  --sh-3: 0 10px 30px rgba(143, 59, 18, .28);

  --ease: cubic-bezier(.2, .8, .3, 1);
  --tile: 0px;
  color-scheme: light;
}

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

html, body {
  margin: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(120% 80% at 50% -10%, #fffdf7 0%, rgba(255, 253, 247, 0) 60%),
    linear-gradient(180deg, var(--sand) 0%, var(--sand-2) 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
}

#app {
  position: fixed;
  inset: 0;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

/* ---------- screens ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(.995);
  transition: opacity .26s var(--ease), transform .26s var(--ease);
}
.screen.show {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

/* ---------- shared bits ---------- */
.icon-btn {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--sh-1);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.icon-btn:active { transform: scale(.93); }
.icon-btn svg { width: 20px; height: 20px; stroke: var(--ink); stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  margin-bottom: 10px;
}
.bar h2 { font-size: 19px; font-weight: 800; margin: 0; letter-spacing: -.2px; }
.bar-spacer { flex: 1; }

.btn {
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s var(--ease), filter .15s var(--ease);
}
.btn:active { transform: scale(.98); }
.btn.primary {
  color: #fff;
  background: linear-gradient(180deg, var(--clay-2), var(--clay));
  box-shadow: var(--sh-3);
}
.btn.ghost {
  color: var(--ink-2);
  background: rgba(255, 255, 255, .75);
  box-shadow: inset 0 0 0 1.5px var(--line);
}

/* ---------- home ---------- */
.home-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px 0;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  position: relative;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
}
.brand-mark span {
  position: absolute;
  inset: 0;
  border-radius: 13px;
  box-shadow: 0 3px 0 rgba(51, 38, 28, .10), var(--sh-1);
}
.brand-mark span:nth-child(1) { background: #fff; transform: translate(-6px, 6px) rotate(-9deg); }
.brand-mark span:nth-child(2) { background: #fff7e6; transform: translate(-1px, 1px) rotate(-4deg); }
.brand-mark span:nth-child(3) {
  background: linear-gradient(160deg, #fdf4e4, #f7e6c6);
  display: grid;
  place-items: center;
}
.brand-mark span:nth-child(3)::after {
  content: '';
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(160deg, #f6c453, #d98a1f);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .08);
}
.brand-text h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: -.6px;
}
.brand-text p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  max-width: 230px;
}

.home-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  justify-content: center;
  padding-bottom: 6px;
}

.play-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 18px;
  border: 0;
  border-radius: var(--r-xl);
  color: #fff;
  text-align: start;
  cursor: pointer;
  background: linear-gradient(145deg, #d9701f 0%, #c2571f 55%, #9c3f14 100%);
  box-shadow: var(--sh-3);
  overflow: hidden;
  transition: transform .18s var(--ease);
}
.play-card:active { transform: scale(.985); }
.play-card::after {
  content: '';
  position: absolute;
  inset: auto -30% -60% auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 214, 140, .45), rgba(255, 214, 140, 0) 65%);
}
.play-card-art { position: relative; width: 58px; height: 58px; flex: 0 0 auto; overflow: visible; }
.play-card { overflow: hidden; }
.mini-tile {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .12);
  display: grid;
  place-items: center;
}
.mini-tile::after {
  content: '';
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(160deg, #f6c453, #d98a1f);
}
.mini-tile[data-i="0"] { left: 0; top: 8px; transform: rotate(-8deg); }
.mini-tile[data-i="1"] { left: 9px; top: 0; transform: rotate(3deg); background: #fff7e6; }
.mini-tile[data-i="2"] { left: 16px; top: 15px; transform: rotate(7deg); }
.play-card-text { display: flex; flex-direction: column; gap: 2px; position: relative; z-index: 1; }
.play-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  opacity: .8;
}
.play-card-text strong { font-size: 24px; font-weight: 900; letter-spacing: -.4px; }
.play-sub { font-size: 12.5px; font-weight: 600; opacity: .85; }
.play-arrow {
  margin-inline-start: auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  position: relative;
  z-index: 1;
}
.play-arrow::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 8px;
  height: 8px;
  border-top: 2.4px solid #fff;
  border-inline-end: 2.4px solid #fff;
  transform: rotate(45deg);
  inset-inline-start: 3px;
}
[dir="rtl"] .play-arrow::after { transform: rotate(-135deg); inset-inline-start: 0; inset-inline-end: 3px; }

.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 16px;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--sh-1);
  cursor: pointer;
  font-family: inherit;
  text-align: start;
  transition: transform .16s var(--ease);
}
.tile-btn:active { transform: scale(.97); }
.tile-ico { width: 34px; height: 34px; border-radius: 11px; background: #fdf2dd; display: grid; place-items: center; }
.tile-ico svg { width: 20px; height: 20px; stroke: var(--clay); stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tile-lbl { font-size: 15px; font-weight: 800; }
.tile-sub { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.home-note {
  margin: 2px 0 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}

/* ---------- levels ---------- */
.level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  overflow-y: auto;
  padding: 4px 2px 20px;
  -webkit-overflow-scrolling: touch;
}
.lv {
  position: relative;
  aspect-ratio: 1;
  border: 0;
  border-radius: var(--r-md);
  background: var(--card);
  box-shadow: var(--sh-1);
  font-family: inherit;
  font-size: 17px;
  font-weight: 900;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: transform .15s var(--ease);
}
.lv:active { transform: scale(.94); }
.lv.done { background: linear-gradient(180deg, #fff8e8, #fdf0d6); }
.lv.boss { box-shadow: inset 0 0 0 2px rgba(165, 31, 61, .35), var(--sh-1); }
.lv.locked { color: #c3b4a3; background: rgba(255, 255, 255, .55); box-shadow: none; }
.lv .st { display: flex; gap: 2px; height: 9px; }
.lv .st i { width: 7px; height: 7px; border-radius: 50%; background: rgba(51, 38, 28, .2); }
.lv .st i.on { background: var(--gold); }
.lv .crown { position: absolute; top: -5px; inset-inline-end: -4px; width: 18px; height: 18px; border-radius: 50%; background: var(--rose); box-shadow: 0 2px 6px rgba(165, 31, 61, .35); }
.lv .crown::after { content: ''; position: absolute; inset: 0; margin: auto; width: 8px; height: 6px; border-radius: 1px; background: #fff; clip-path: polygon(0 100%, 0 30%, 25% 55%, 50% 10%, 75% 55%, 100% 30%, 100% 100%); }

/* ---------- game ---------- */
.game-bar { margin-bottom: 6px; }
.game-title { display: flex; flex-direction: column; align-items: center; flex: 1; line-height: 1.15; }
.game-title strong { font-size: 16px; font-weight: 900; }
.game-title span { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.score-chip {
  min-width: 62px;
  height: 42px;
  padding: 0 12px;
  border-radius: 21px;
  background: var(--card);
  box-shadow: var(--sh-1);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.board-wrap {
  flex: 1;
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 4px 0;
}
.board { position: relative; }

.tile {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 13%;
  background:
    radial-gradient(80% 60% at 30% 12%, rgba(255, 255, 255, .30), rgba(255, 255, 255, 0) 62%),
    linear-gradient(180deg,
      color-mix(in srgb, var(--tc, #d9cbb2) 38%, #fffdf8) 0%,
      color-mix(in srgb, var(--tc, #d9cbb2) 82%, #fffdf8) 100%);
  box-shadow: 0 2px 0 rgba(51, 38, 28, .16), 0 6px 14px rgba(51, 38, 28, .10),
    inset 0 0 0 1.5px color-mix(in srgb, var(--tc, #d9cbb2) 55%, transparent);
  display: grid;
  place-items: center;
  cursor: pointer;
  transform: translate3d(var(--x, 0px), var(--y, 0px), 0) scale(var(--s, 1));
  transition: transform .17s var(--ease), box-shadow .17s var(--ease), opacity .2s linear;
  will-change: transform;
  overflow: hidden;
}
.tile::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 -2px 0 rgba(51, 38, 28, .07), inset 0 0 0 1px rgba(51, 38, 28, .07);
}
.tile svg { width: 84%; height: 84%; display: block; pointer-events: none; filter: saturate(1.12) contrast(1.06); }
.tile.blocked { filter: brightness(.965) saturate(.92); }
.tile.pickable:active { --s: 1.06; }
.tile.hint { animation: hintPulse 1.15s var(--ease) infinite; }
.tile.gone { opacity: 0; transform: translate3d(var(--x), var(--y), 0) scale(.72); pointer-events: none; }
.tile.deal { animation: dealIn .32s var(--ease) both; animation-delay: var(--d, 0ms); }

.tile .ice {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(210, 240, 255, .78), rgba(160, 215, 240, .62) 45%, rgba(225, 245, 255, .8));
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .8);
  display: grid;
  place-items: center;
  backdrop-filter: blur(.4px);
}
.tile .ice::after {
  content: '';
  width: 46%;
  height: 46%;
  background:
    linear-gradient(#fff, #fff) center/2px 100% no-repeat,
    linear-gradient(#fff, #fff) center/100% 2px no-repeat,
    linear-gradient(#fff, #fff) center/2px 100% no-repeat;
  transform: rotate(45deg);
  opacity: .85;
  border-radius: 2px;
}
.tile.fog svg { filter: blur(3px) saturate(0); opacity: .18; }
.tile.fog::after {
  content: '?';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 40%;
  font-weight: 900;
  color: rgba(51, 38, 28, .38);
}

@keyframes hintPulse {
  0%, 100% { box-shadow: 0 2px 0 rgba(51, 38, 28, .13), 0 6px 14px rgba(51, 38, 28, .1); }
  50% { box-shadow: 0 0 0 3px rgba(224, 168, 60, .65), 0 8px 18px rgba(224, 168, 60, .3); }
}
@keyframes dealIn {
  from { opacity: 0; transform: translate3d(var(--x), calc(var(--y) - 14px), 0) scale(.82); }
  to { opacity: 1; transform: translate3d(var(--x), var(--y), 0) scale(1); }
}

/* ---------- tray / rack / tools ---------- */
.tray {
  flex: 0 0 auto;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  margin: 0 -4px;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, .92));
  box-shadow: 0 -10px 30px rgba(51, 38, 28, .07), inset 0 1px 0 rgba(255, 255, 255, .9);
  backdrop-filter: blur(10px);
}
.rack-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}
.rack-count { font-variant-numeric: tabular-nums; }
.rack {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 7px;
}
.slot {
  position: relative;
  aspect-ratio: 1 / 1.06;
  border-radius: 13px;
  background: rgba(255, 255, 255, .6);
  box-shadow: inset 0 0 0 1.5px rgba(139, 119, 100, .22);
  display: grid;
  place-items: center;
  transition: background .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}
.slot.filled {
  background: #fff;
  box-shadow: inset 0 0 0 1.5px rgba(51, 38, 28, .06), 0 3px 0 rgba(51, 38, 28, .1);
}
.slot svg { width: 72%; height: 72%; }
.slot.locked { background: repeating-linear-gradient(45deg, rgba(139, 119, 100, .1) 0 6px, rgba(139, 119, 100, .04) 6px 12px); }
.slot.locked::after {
  content: '';
  width: 40%;
  height: 34%;
  border-radius: 3px;
  border: 2px solid rgba(139, 119, 100, .5);
  border-top: 0;
}
.slot.pop { animation: slotPop .34s var(--ease); }
.slot.warn { animation: slotWarn .5s var(--ease); }
@keyframes slotPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.16); box-shadow: 0 0 0 6px rgba(224, 168, 60, .35); }
  100% { transform: scale(1); }
}
@keyframes slotWarn {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.tool {
  border: 0;
  background: transparent;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 0;
}
.tool-ico {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 15px;
  background: var(--card);
  box-shadow: var(--sh-1);
  display: grid;
  place-items: center;
  transition: transform .15s var(--ease), opacity .15s var(--ease);
}
.tool:active .tool-ico { transform: scale(.92); }
.tool svg { width: 21px; height: 21px; stroke: var(--ink-2); stroke-width: 2.1; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tool-lbl { font-size: 10.5px; font-weight: 800; color: var(--muted); }
.tool .badge {
  position: absolute;
  top: -5px;
  inset-inline-end: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--clay);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(194, 87, 31, .35);
}
.tool.empty .tool-ico { opacity: .42; }
.tool.empty .badge { background: rgba(139, 119, 100, .6); box-shadow: none; }

/* ---------- settings ---------- */
.set-list { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding-bottom: 24px; }
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--card);
  box-shadow: var(--sh-1);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  text-align: start;
}
.row-static { cursor: default; }
.row-lbl { flex: 1; }
.row-danger { color: var(--rose); justify-content: center; font-weight: 800; }
.row-how { justify-content: space-between; }
.chev { width: 9px; height: 9px; border-top: 2px solid var(--muted); border-inline-end: 2px solid var(--muted); transform: rotate(45deg); }
[dir="rtl"] .chev { transform: rotate(-135deg); }
.sw {
  width: 46px;
  height: 27px;
  border-radius: 14px;
  background: rgba(139, 119, 100, .25);
  position: relative;
  transition: background .18s var(--ease);
}
.sw::after {
  content: '';
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .18s var(--ease);
}
.sw.on { background: var(--clay); }
.sw.on::after { transform: translateX(19px); }
[dir="rtl"] .sw.on::after { transform: translateX(-19px); }
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border-radius: var(--r-md);
  background: rgba(139, 119, 100, .12);
}
.seg button {
  height: 42px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.seg button.sel { background: var(--card); color: var(--clay); box-shadow: var(--sh-1); }
.set-foot { text-align: center; font-size: 11.5px; color: var(--muted); font-weight: 600; margin: 14px 0 0; }

/* ---------- overlays ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: 16px;
  background: rgba(51, 38, 28, .32);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s var(--ease);
  z-index: 40;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.sheet {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, #fffdf8, #fff);
  border-radius: var(--r-xl);
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--sh-2);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translateY(18px) scale(.98);
  transition: transform .26s var(--ease);
}
.overlay.show .sheet { transform: none; }
.sheet h3 { margin: 0; font-size: 21px; font-weight: 900; text-align: center; letter-spacing: -.3px; }
.sheet p { margin: 0; text-align: center; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.end-stars { display: flex; justify-content: center; gap: 6px; height: 30px; }
.end-stars i {
  width: 26px;
  height: 26px;
  background: rgba(51, 38, 28, .1);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.end-stars i.on { background: linear-gradient(180deg, #f7cf6a, var(--gold)); animation: starIn .4s var(--ease) both; }
.end-stars i.on:nth-child(2) { animation-delay: .1s; }
.end-stars i.on:nth-child(3) { animation-delay: .2s; }
@keyframes starIn { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.end-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.end-stats div {
  background: #fdf7ec;
  border-radius: var(--r-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.end-stats strong { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }
.end-stats span { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .6px; text-transform: uppercase; }
.how-list { margin: 0; padding-inline-start: 18px; display: flex; flex-direction: column; gap: 8px; }
.how-list li { font-size: 14px; font-weight: 600; color: var(--ink-2); line-height: 1.45; }

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 10px);
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(51, 38, 28, .92);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
  z-index: 60;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.fx-layer { position: absolute; inset: 0; pointer-events: none; z-index: 50; }
.fx-tile {
  position: fixed;
  border-radius: 13%;
  background: linear-gradient(180deg, #fff, #fdf9f1);
  box-shadow: 0 2px 0 rgba(51, 38, 28, .13), 0 6px 14px rgba(51, 38, 28, .12);
  display: grid;
  place-items: center;
  transition: transform .24s var(--ease), opacity .24s var(--ease);
}
.fx-tile svg { width: 74%; height: 74%; }
.fx-spark {
  position: fixed;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  animation: spark .52s var(--ease) forwards;
}
@keyframes spark {
  from { transform: translate(0, 0) scale(1); opacity: 1; }
  to { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: 0; }
}

/* ---------- small screens ---------- */
@media (max-height: 640px) {
  .brand-text h1 { font-size: 22px; }
  .play-card { padding: 14px; }
  .play-card-text strong { font-size: 21px; }
  .tool-ico { width: 42px; height: 42px; }
  .tray { padding-top: 9px; }
}
@media (min-width: 520px) {
  #app { max-width: 460px; margin: 0 auto; }
}


/* ---------- coins and shop ---------- */
.home-actions { display: flex; align-items: center; gap: 8px; }
.coin-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  padding: 0 12px 0 8px;
  border: 0;
  border-radius: 21px;
  background: var(--card);
  box-shadow: var(--sh-1);
  font-family: inherit;
  font-size: 14px;
  font-weight: 900;
  color: var(--ink);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.coin-chip.small { height: 34px; padding: 0 10px 0 6px; font-size: 13px; }
.coin {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe08a, #e0a83c 55%, #b7801f);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .55), 0 1px 2px rgba(143, 59, 18, .3);
  flex: 0 0 auto;
}
.coin-chip.small .coin { width: 16px; height: 16px; }
.game-chips { display: flex; align-items: center; gap: 6px; }
.tile-btn.wide { grid-column: span 2; flex-direction: row; align-items: center; gap: 12px; }
.tile-btn.wide .tile-ico { flex: 0 0 auto; }
.tile-btn.wide .tile-lbl { margin-inline-start: 0; }
.tile-btn.wide .tile-sub { margin-inline-start: auto; }

.shop-list { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding-bottom: 8px; }
.shop-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--sh-1);
}
.shop-ico {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 13px;
  background: #fdf2dd;
  display: grid;
  place-items: center;
}
.shop-ico svg { width: 21px; height: 21px; stroke: var(--clay); stroke-width: 2.1; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.shop-txt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.shop-txt strong { font-size: 14.5px; font-weight: 800; }
.shop-txt small { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.buy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--clay-2), var(--clay));
  color: #fff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(194, 87, 31, .28);
}
.buy .coin { width: 15px; height: 15px; }
.shop-note { font-size: 11.5px; color: var(--muted); font-weight: 600; text-align: center; margin: 10px 6px 0; }
.end-coins {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--r-md);
  background: #fdf4e2;
  font-weight: 900;
  color: var(--clay-d);
  font-size: 16px;
}

/* ---------- polish pass: streak card, reward box, shop rows ---------- */
.streak-card {
  border: 0;
  font-family: inherit;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--sh-1);
  text-align: start;
  flex: 0 0 auto;
}
.streak-card:active { transform: scale(.99); }
.pips { display: flex; gap: 4px; flex: 0 0 auto; }
.pips i { width: 9px; height: 9px; border-radius: 50%; background: rgba(51, 38, 28, .14); display: block; }
.pips i.on { background: linear-gradient(180deg, #f7cf6a, var(--gold)); }
.streak-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.streak-txt strong { font-size: 14px; font-weight: 800; }
.streak-txt small { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.box-badge {
  margin-inline-start: auto;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(160deg, #e0a83c, #c2571f);
  box-shadow: 0 3px 0 rgba(51, 38, 28, .14);
}
.box-badge[hidden] { display: none; }

.box-art { position: relative; width: 104px; height: 92px; margin: 2px auto 0; }
.box-body {
  position: absolute;
  inset: auto 0 0 0;
  height: 58px;
  border-radius: 12px;
  background: linear-gradient(180deg, #e0a83c, #b9752a);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .12), 0 8px 16px rgba(51, 38, 28, .18);
}
.box-lid {
  position: absolute;
  left: -4px;
  right: -4px;
  top: 24px;
  height: 20px;
  border-radius: 8px;
  background: linear-gradient(180deg, #f2c25a, #d99a2f);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .10);
}
.box-lock {
  position: absolute;
  left: 50%;
  top: 40px;
  transform: translateX(-50%);
  width: 20px;
  height: 22px;
  border-radius: 5px;
  background: #8f1b44;
}
.box-art.open .box-lid { animation: lidPop .55s cubic-bezier(.3, .8, .3, 1) forwards; }
.box-art.open .box-lock { opacity: 0; transition: opacity .2s; }
@keyframes lidPop { to { transform: translateY(-30px) rotate(-14deg); opacity: 0; } }
.box-reward { display: none; flex-direction: column; gap: 8px; }
.box-reward.show { display: flex; }
.box-reward .rw { display: flex; align-items: center; gap: 8px; justify-content: center; font-weight: 800; font-size: 15.5px; }
.box-reward .rw svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--clay);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shop-row { padding: 10px 12px; gap: 11px; }
.shop-ico { position: relative; width: 38px; height: 38px; border-radius: 12px; }
.shop-ico svg { width: 20px; height: 20px; }
.shop-ico .own {
  position: absolute;
  top: -6px;
  inset-inline-end: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
  font-size: 10.5px;
  font-weight: 900;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px var(--card);
}
.shop-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.shop-txt strong { font-size: 14.5px; font-weight: 800; }
.shop-txt small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 700; line-height: 1.25; }
.shop-row .buy { flex: 0 0 auto; }

.play-card-art { width: 52px; height: 52px; }
.mini-tile { width: 34px; height: 34px; border-radius: 10px; }
.mini-tile::after { display: none; }
.mini-tile[data-i="0"] { left: 0; top: 6px; }
.mini-tile[data-i="1"] { left: 8px; top: 0; }
.mini-tile[data-i="2"] { left: 14px; top: 13px; }

.brand-mark span:nth-child(3)::after { display: none; }
.brand-mark span:nth-child(3) svg { width: 34px; height: 34px; }
.score-chip { display: flex; align-items: center; justify-content: center; gap: 5px; }
.sc-ico { display: grid; place-items: center; }
.sc-ico svg { width: 15px; height: 15px; fill: var(--gold); stroke: none; }

/* ==================== mockup theme: warm Egyptian scene ==================== */
:root {
  --wood-1: #c07f43;
  --wood-2: #8a5124;
  --wood-3: #5f3413;
  --stone-1: #fffdf6;
  --stone-2: #f4e7cc;
  --stone-3: #cbb083;
  --gold: #f2c25a;
  --gold-d: #c9922a;
  --blue-1: #4a8ede;
  --blue-2: #24589b;
  --green-1: #7ad964;
  --green-2: #2f9c37;
  --green-3: #1f7a2a;
}
html, body { background: #123c58; }
.screen { background: linear-gradient(180deg, #fdf7ea, #f3e2c4 70%, #eed9b4); }
.scene { position: absolute; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.scene-svg { width: 100%; height: 100%; display: block; }
.scene.dim .scene-svg { filter: saturate(.9) brightness(.95); }
.scene::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 248, 232, .06) 30%, rgba(255, 246, 226, .5) 72%, rgba(255, 246, 226, .9) 100%);
}
#sGame .scene::after {
  background: linear-gradient(180deg, rgba(255, 248, 232, .12) 0%, rgba(255, 246, 226, .68) 40%, rgba(255, 246, 226, .94) 100%);
}

.home-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px calc(10px + env(safe-area-inset-bottom, 0px));
}
.hud { display: flex; align-items: center; gap: 7px; }
.hud-avatar {
  width: 44px; height: 44px; flex: 0 0 auto; border: 0; padding: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 28%, #ffe0b8, #e2a163 70%, #c9873f);
  box-shadow: 0 0 0 3px #fffaf0, 0 0 0 5px rgba(95, 52, 19, .55), 0 5px 12px rgba(0, 0, 0, .28);
  overflow: hidden;
}
.hud-avatar svg { width: 100%; height: 100%; display: block; }
.hud-pill {
  display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 4px 0 10px;
  border-radius: 19px;
  background: linear-gradient(180deg, #9a5c2a, #5f3413);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 3px 0 rgba(0, 0, 0, .22), 0 6px 12px rgba(0, 0, 0, .2);
  color: #fff8e8; font-size: 15px; font-weight: 900;
  flex: 1 1 auto; min-width: 0; justify-content: space-between;
}
.hud-pill .hud-ico { display: grid; place-items: center; }
.hud-pill .hud-ico svg { width: 19px; height: 19px; fill: var(--gold); stroke: none; }
.hud-pill .coin { width: 19px; height: 19px; }
.plus {
  width: 25px; height: 25px; flex: 0 0 auto; border: 0; border-radius: 50%; padding: 0;
  font-family: inherit; font-size: 17px; font-weight: 900; line-height: 1; color: #fff;
  background: radial-gradient(circle at 40% 28%, #a6ef7c, #3ea63c 70%, #2b8a2e);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18), 0 2px 4px rgba(0, 0, 0, .3);
  display: grid; place-items: center;
}
.hud-gear {
  width: 40px; height: 40px; flex: 0 0 auto; border: 0; border-radius: 50%; padding: 0;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #9a5c2a, #5f3413);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 3px 0 rgba(0, 0, 0, .22), 0 6px 12px rgba(0, 0, 0, .2);
}
.hud-gear svg { width: 21px; height: 21px; stroke: #ffe9bf; stroke-width: 2.1; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.sign { display: flex; justify-content: center; padding-top: 6px; }
.sign-board {
  position: relative; padding: 8px 30px 10px; border-radius: 16px;
  background:
    repeating-linear-gradient(92deg, rgba(0, 0, 0, .05) 0 2px, rgba(255, 255, 255, .04) 2px 9px),
    linear-gradient(180deg, #c98a4b, #a2652f 55%, #8a5124);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .32), inset 0 -7px 0 rgba(0, 0, 0, .18), 0 9px 18px rgba(50, 25, 0, .32);
}
.sign-board::before {
  content: ''; position: absolute; inset: 5px; border-radius: 12px;
  border: 2px solid rgba(255, 238, 200, .35); pointer-events: none;
}
.sign-board h1 {
  margin: 0; font-size: 33px; line-height: 1.05; font-weight: 900; letter-spacing: .3px;
  color: #fff8e6; text-align: center;
  text-shadow: 0 3px 0 #6b3c1a, 0 5px 10px rgba(0, 0, 0, .38);
}
.sign-sub {
  display: block; margin-top: 2px; text-align: center; font-size: 9.5px; font-weight: 800;
  letter-spacing: 2.2px; text-transform: uppercase; color: #ffe9bf; opacity: .8;
}
.sign-peg {
  position: absolute; top: 6px; width: 11px; height: 11px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff0c2, #c9922a 70%, #8a5f14);
  box-shadow: 0 2px 3px rgba(0, 0, 0, .35);
}
.sign-peg.left { left: 20%; }
.sign-peg.right { right: 20%; }

.home-mid { flex: 1 1 auto; display: flex; align-items: flex-start; justify-content: space-between; min-height: 0; padding-top: 4px; }
.side-col { display: flex; flex-direction: column; gap: 10px; }
.side-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: 90px; padding: 9px 6px 7px; border: 0; border-radius: 15px;
  font-family: inherit; color: #fff6e2; font-size: 12px; font-weight: 900;
  background:
    repeating-linear-gradient(92deg, rgba(0, 0, 0, .06) 0 2px, rgba(255, 255, 255, .03) 2px 8px),
    linear-gradient(180deg, #9a5c2a, #5f3413);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 4px 0 rgba(0, 0, 0, .2), 0 7px 14px rgba(0, 0, 0, .2);
}
.side-btn:active { transform: translateY(2px); }
.side-ico { display: grid; place-items: center; }
.side-ico svg { width: 26px; height: 26px; stroke: #ffe1a8; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.side-lbl { font-size: 12px; letter-spacing: .2px; }
.dot {
  position: absolute; top: -7px; inset-inline-end: -7px; min-width: 21px; height: 21px; padding: 0 5px;
  border-radius: 11px; background: radial-gradient(circle at 40% 30%, #ff8271, #cf2a1d 70%);
  color: #fff; font-size: 11.5px; font-weight: 900; display: grid; place-items: center;
  box-shadow: 0 0 0 2px #fff6e2, 0 2px 4px rgba(0, 0, 0, .3);
}
.dot[hidden] { display: none; }
.lvl-badge {
  display: flex; flex-direction: column; align-items: center; gap: 1px; width: 78px;
  padding: 8px 4px 9px; border: 0; border-radius: 16px; font-family: inherit; color: #fff;
  background: linear-gradient(180deg, #3d84cc, #1b4a86);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .38), 0 4px 0 rgba(0, 0, 0, .22), 0 7px 14px rgba(0, 0, 0, .2);
}
.lb-star { display: grid; place-items: center; }
.lb-star svg { width: 19px; height: 19px; fill: var(--gold); stroke: none; }
.lb-lbl { font-size: 9.5px; font-weight: 800; letter-spacing: 1.3px; text-transform: uppercase; opacity: .88; }
.lvl-badge b { font-size: 21px; font-weight: 900; line-height: 1.1; }

.home-bottom { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.play-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 64px;
  border: 0; border-radius: 32px; font-family: inherit; font-size: 26px; font-weight: 900; letter-spacing: .4px;
  color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .3);
  background: linear-gradient(180deg, #86dd6b, #34a53c 52%, #1f7a2a);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, .45), inset 0 -7px 0 rgba(0, 0, 0, .16),
    0 0 0 4px #f2c25a, 0 0 0 7px rgba(95, 52, 19, .7), 0 12px 22px rgba(0, 0, 0, .3);
}
.play-btn:active { transform: translateY(2px); }
.play-arrow { display: grid; place-items: center; }
.play-arrow svg { width: 22px; height: 22px; fill: #fff; stroke: none; }
.home-sub { margin: 0; font-size: 11.5px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: #7a5a34; }
.home-links { display: flex; align-items: center; gap: 10px; font-size: 11.5px; font-weight: 800; color: #7a5a34; }
.link-pill {
  display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 12px;
  border: 0; border-radius: 15px; font-family: inherit; font-size: 12px; font-weight: 900; color: #fff6e2;
  background: linear-gradient(180deg, #9a5c2a, #5f3413);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 2px 0 rgba(0, 0, 0, .2);
}
.link-pill .hud-ico svg { width: 14px; height: 14px; stroke: #ffe1a8; stroke-width: 2.2; fill: none; }

#sGame { padding-bottom: 0; }
.game-bar { position: relative; z-index: 1; }
.game-bar .icon-btn,
.game-bar .coin-chip,
.game-bar .score-chip {
  background: linear-gradient(180deg, #9a5c2a, #5f3413);
  color: #fff8e8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 3px 0 rgba(0, 0, 0, .22), 0 6px 12px rgba(0, 0, 0, .2);
}
.game-bar .icon-btn svg { stroke: #ffe9bf; }
.game-title { position: relative; z-index: 1; }
.game-title strong { color: #3a2410; text-shadow: 0 1px 0 rgba(255, 255, 255, .7); }
.game-title span { color: #7a5a34; }
.board-wrap { position: relative; z-index: 1; }
.tray {
  position: relative; z-index: 1; border-radius: 22px 22px 0 0;
  background:
    repeating-linear-gradient(92deg, rgba(0, 0, 0, .05) 0 2px, rgba(255, 255, 255, .035) 2px 9px),
    linear-gradient(180deg, #c07f43, #8a5124 55%, #6b3c1a);
  box-shadow: 0 -8px 24px rgba(40, 20, 0, .25), inset 0 2px 0 rgba(255, 255, 255, .25);
}
.rack-head { color: #ffe9bf; }
.rack-head .rack-count { color: #ffe9bf; opacity: .8; }
.rack-wood {
  padding: 7px; border-radius: 16px;
  background: linear-gradient(180deg, #5a3315, #7a4a22);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, .45), inset 0 -1px 0 rgba(255, 255, 255, .12);
}
.slot {
  background: linear-gradient(180deg, #4b2a10, #6b3c1a);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, .5);
  border-radius: 11px;
}
.slot.filled { background: linear-gradient(180deg, #fffdf6, #f0e2c4); box-shadow: 0 2px 0 #c9ae7f, inset 0 1px 0 #fff; }
.slot.locked { background: repeating-linear-gradient(45deg, rgba(0, 0, 0, .3) 0 6px, rgba(0, 0, 0, .18) 6px 12px); }
.tool { color: #fff8e8; }
.tool-ico {
  position: relative; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 26%, #5b9ae4, #24589b 70%, #1a4276);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .4), inset 0 -5px 0 rgba(0, 0, 0, .18),
    0 0 0 3px #f2c25a, 0 0 0 5px rgba(95, 52, 19, .6), 0 6px 12px rgba(0, 0, 0, .25);
}
.tool-ico svg { width: 25px; height: 25px; stroke: #fff; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tool-lbl { color: #fff8e8; font-size: 11px; font-weight: 800; text-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.tool .badge { box-shadow: 0 0 0 2px #fff6e2; }

.tile {
  background:
    radial-gradient(90% 70% at 30% 12%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg,
      color-mix(in srgb, var(--tc, #d9cbb2) 10%, #fffdf6) 0%,
      color-mix(in srgb, var(--tc, #d9cbb2) 30%, #f3e5c8) 100%);
  box-shadow: 0 3px 0 #c9ae7f, 0 6px 12px rgba(60, 35, 10, .24), inset 0 1px 0 #fff;
  border-radius: 14%;
}

.bar .icon-btn { background: linear-gradient(180deg, #9a5c2a, #5f3413); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 3px 0 rgba(0, 0, 0, .2); }
.bar .icon-btn svg { stroke: #ffe9bf; }
.bar h2 { color: #3a2410; }
.lv {
  background: linear-gradient(180deg, #fffdf6, #f2e4c6);
  box-shadow: 0 3px 0 #cbb083, 0 6px 12px rgba(60, 35, 10, .16), inset 0 1px 0 #fff;
}
.lv.done { background: linear-gradient(180deg, #fff8e2, #f6e2b4); }
.shop-row {
  background: linear-gradient(180deg, #fffdf6, #f6ead2);
  box-shadow: 0 3px 0 #d9c39a, 0 6px 12px rgba(60, 35, 10, .14), inset 0 1px 0 #fff;
}
.shop-row .buy {
  background: linear-gradient(180deg, #86dd6b, #2f9c37 60%, #1f7a2a);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .4), 0 3px 0 rgba(0, 0, 0, .2);
  color: #fff;
}
.set-list .row { background: linear-gradient(180deg, #fffdf6, #f6ead2); box-shadow: 0 3px 0 #d9c39a, inset 0 1px 0 #fff; }

.tile {
  background:
    radial-gradient(90% 70% at 30% 10%, rgba(255, 255, 255, .7), rgba(255, 255, 255, 0) 58%),
    linear-gradient(180deg,
      color-mix(in srgb, var(--tc, #d9cbb2) 2%, #fffef8) 0%,
      color-mix(in srgb, var(--tc, #d9cbb2) 7%, #fbf2dd) 60%,
      color-mix(in srgb, var(--tc, #d9cbb2) 12%, #f2e5c8) 100%);
  box-shadow: 0 3px 0 #cdb389, 0 7px 13px rgba(60, 35, 10, .26), inset 0 1.5px 0 #fffdf7;
}
.home-preview { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; }
.hp-tile {
  width: 46px; height: 46px; flex: 0 0 auto; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #fffdf4, #f4e7c9);
  box-shadow: 0 3px 0 #cdb389, 0 6px 12px rgba(60, 35, 10, .24), inset 0 1px 0 #fff;
}
.hp-tile svg { width: 78%; height: 78%; }
.hp-tile:nth-child(1) { transform: rotate(-7deg) translateY(4px); }
.hp-tile:nth-child(2) { transform: rotate(2deg) translateY(-3px); z-index: 1; }
.hp-tile:nth-child(3) { transform: rotate(8deg) translateY(5px); }
.tray { padding: 9px 12px calc(8px + env(safe-area-inset-bottom, 0px)); }
.rack-wood { padding: 6px; }
.slot { aspect-ratio: 1 / 1; border-radius: 10px; }
.tools { margin-top: 9px; gap: 6px; }
.tool-ico { width: 48px; height: 48px; }
.tool-ico svg { width: 22px; height: 22px; }
.tool-lbl { font-size: 10.5px; }
.rack-head { margin-bottom: 5px; }

/* ==================== art pass: contrast, saturation, wood ==================== */
.scene::after {
  background:
    radial-gradient(120% 80% at 50% 8%, rgba(255, 246, 214, .16), rgba(255, 246, 214, 0) 55%),
    linear-gradient(180deg, rgba(255, 240, 205, 0) 55%, rgba(120, 72, 24, .18) 100%);
}
.scene-svg { filter: saturate(1.35) contrast(1.06); }
#sGame .scene-svg { filter: saturate(1.2) contrast(1.02) brightness(.9); }
#sGame .scene::after {
  background:
    radial-gradient(70% 46% at 50% 46%, rgba(52, 30, 8, .34), rgba(52, 30, 8, 0) 72%),
    linear-gradient(180deg, rgba(40, 24, 6, .18) 0%, rgba(255, 240, 210, .1) 60%, rgba(60, 34, 10, .3) 100%);
}
.tile {
  border: 1.5px solid #9d7a48;
  background:
    radial-gradient(80% 60% at 32% 10%, rgba(255, 255, 255, .85), rgba(255, 255, 255, 0) 62%),
    linear-gradient(180deg, #fffef7 0%, #fbf1d9 56%, #efe1bf 100%);
  box-shadow:
    inset 0 2px 0 #fffef9,
    inset 0 -3px 0 rgba(150, 112, 58, .28),
    0 4px 0 #a98a55,
    0 9px 16px rgba(48, 28, 6, .38);
}
.tile.blocked { filter: brightness(.94) saturate(.86); }
.tile svg { filter: saturate(1.25) contrast(1.12) drop-shadow(0 1px 0 rgba(255, 255, 255, .55)); }
.tile.pickable:active { transform: translate3d(var(--x, 0px), var(--y, 0px), 0) scale(.97); }
.board-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(72% 58% at 50% 46%, rgba(66, 38, 8, .42) 0%, rgba(66, 38, 8, .22) 52%, rgba(66, 38, 8, 0) 78%);
  pointer-events: none;
}
.board { z-index: 1; }
.sign-board,
.side-btn,
.hud-pill,
.hud-gear,
.link-pill,
.tray,
.game-bar .icon-btn,
.game-bar .coin-chip,
.game-bar .score-chip {
  position: relative;
  background-image:
    repeating-linear-gradient(90deg, rgba(52, 26, 4, .22) 0 1.5px, rgba(255, 255, 255, 0) 1.5px 34px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .07) 0 1px, rgba(0, 0, 0, 0) 1px 6px),
    linear-gradient(180deg, #b1743a, #8a5124 55%, #6b3c1a);
  box-shadow:
    inset 0 2px 0 rgba(255, 236, 196, .42),
    inset 0 -5px 0 rgba(0, 0, 0, .26),
    0 0 0 1.5px rgba(64, 34, 8, .55),
    0 6px 14px rgba(40, 20, 0, .32);
}
.sign-board {
  background-image:
    repeating-linear-gradient(90deg, rgba(52, 26, 4, .26) 0 1.5px, rgba(255, 255, 255, 0) 1.5px 42px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .08) 0 1px, rgba(0, 0, 0, 0) 1px 7px),
    linear-gradient(180deg, #c8873f, #a2652f 52%, #7d4519);
}
.tray {
  background-image:
    repeating-linear-gradient(90deg, rgba(52, 26, 4, .22) 0 1.5px, rgba(255, 255, 255, 0) 1.5px 46px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .06) 0 1px, rgba(0, 0, 0, 0) 1px 8px),
    linear-gradient(180deg, #a96c33, #7d4519 60%, #5f3413);
}
.hud-pill, .link-pill, .hud-gear { background-image: linear-gradient(180deg, #a3672f, #6b3c1a); }
.hud-pill { box-shadow: inset 0 2px 0 rgba(255, 236, 196, .38), inset 0 -4px 0 rgba(0, 0, 0, .26), 0 0 0 1.5px rgba(64, 34, 8, .5), 0 5px 12px rgba(40, 20, 0, .3); }
.rack-wood {
  background-image:
    repeating-linear-gradient(90deg, rgba(30, 14, 2, .3) 0 1.5px, rgba(255, 255, 255, 0) 1.5px 40px),
    linear-gradient(180deg, #4a2709, #6b3c1a);
  box-shadow: inset 0 4px 10px rgba(0, 0, 0, .55), 0 0 0 1.5px rgba(40, 20, 4, .5);
}
.slot { box-shadow: inset 0 4px 8px rgba(0, 0, 0, .6), inset 0 -1px 0 rgba(255, 255, 255, .1); }
.slot.filled { box-shadow: inset 0 2px 0 #fff, 0 3px 0 #a98a55, 0 6px 10px rgba(40, 20, 4, .4); border: 1.5px solid #9d7a48; }
.home-sub, .home-links { color: #5c3d18; text-shadow: 0 1px 0 rgba(255, 246, 226, .7); }
.sign-board h1 { text-shadow: 0 3px 0 #5f3413, 0 6px 12px rgba(0, 0, 0, .45); }
.tile svg { width: 75%; height: 75%; }
.tile::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, .30), rgba(255, 255, 255, 0) 68%);
  pointer-events: none;
}
.tile svg { position: relative; z-index: 1; }
