@import "../css/tokens.css";

/* Word Weave — letter-wheel crossword. Phone-first, drawn look: a scenic sky
   per pack, a walnut plank board for the crossword, a frosted rope-rimmed
   wheel, and the site's amber (#F59E0B) as the one accent. */
:root {
  --amber-50: #FFFBEB; --amber-100: #FEF3C7; --amber-200: #FDE68A; --amber-300: #FCD34D;
  --amber-400: #FBBF24; --amber-500: #F59E0B; --amber-600: #D97706; --amber-700: #B45309;
  --amber-800: #92400E; --amber-900: #78350F; --amber-950: #451A03;
  --walnut-1: #5A3416; --walnut-2: #7A4A22; --walnut-3: #96602E; --walnut-4: #B3773B;
  --cream: #FFF8E6; --cream-2: #F6E7C4;
  --good: #16A34A; --bad: #DC2626; --bonus: #7C3AED;
  --ink: #2A1506;
  --wheel: min(72vw, 300px, 40vh);
  --letter: max(44px, calc(var(--wheel) * 0.2));
  --cell: 40px; --gap: 4px;
  --hud-h: 52px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: #FFFDF5;
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--amber-500); outline-offset: 2px; }

/* ---------- site chrome ---------- */
.hub-bar {
  width: 100%; max-width: 600px; padding: 8px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: var(--text-xs); font-family: var(--font-label);
  border-bottom: 1px solid rgba(217, 119, 6, 0.2);
  background: rgba(255, 251, 235, 0.92); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 50;
}
.hub-bar a { color: var(--amber-800); text-decoration: none; font-weight: 700; min-height: 44px; display: inline-flex; align-items: center; }
.hub-bar span { color: var(--amber-900); opacity: .8; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-rail, .ad-section { width: 100%; max-width: 600px; margin: 6px auto; text-align: center; }
.ad-well { min-height: 52px; display: flex; align-items: center; justify-content: center; background: rgba(254, 243, 199, 0.4); border-radius: var(--radius-input); overflow: hidden; }

/* ---------- the scene stage ---------- */
.ww {
  position: relative; width: 100%; max-width: 480px; margin: 0 auto;
  min-height: calc(100vh - 150px);
  display: flex; flex-direction: column;
  border-radius: 22px; overflow: hidden; isolation: isolate;
  box-shadow: 0 14px 40px rgba(69, 26, 3, .18);
  --sky1: #FFE9A8; --sky2: #FFB765; --hill1: #7FB069; --hill2: #4E8A45; --sun: #FFF4C2; --stars: 0; --sun-y: 30%;
  background: linear-gradient(180deg, var(--sky1), var(--sky2));
}
.ww-sky { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.ww-sun {
  position: absolute; left: 50%; top: var(--sun-y); width: 46%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, var(--sun) 0 22%, rgba(255,255,255,.35) 24%, rgba(255,255,255,0) 68%);
}
.ww-stars {
  position: absolute; inset: 0; opacity: var(--stars);
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 60%, transparent 62%),
    radial-gradient(1px 1px at 28% 8%, #fff 60%, transparent 62%),
    radial-gradient(1.5px 1.5px at 44% 22%, #fff 60%, transparent 62%),
    radial-gradient(1px 1px at 63% 12%, #fff 60%, transparent 62%),
    radial-gradient(2px 2px at 78% 26%, #fff 60%, transparent 62%),
    radial-gradient(1px 1px at 88% 9%, #fff 60%, transparent 62%),
    radial-gradient(1.5px 1.5px at 20% 34%, #fff 60%, transparent 62%),
    radial-gradient(1px 1px at 54% 36%, #fff 60%, transparent 62%),
    radial-gradient(1px 1px at 92% 40%, #fff 60%, transparent 62%),
    radial-gradient(1.5px 1.5px at 36% 45%, #fff 60%, transparent 62%);
}
.ww-hill { position: absolute; left: -20%; right: -20%; height: 42%; border-radius: 50% 50% 0 0 / 100% 100% 0 0; }
.ww-hill--far { bottom: 14%; background: var(--hill1); opacity: .85; transform: scaleX(1.15) translateX(6%); }
.ww-hill--near { bottom: 0; height: 34%; background: var(--hill2); transform: scaleX(1.25) translateX(-8%); }
.ww-hill--near::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(0,0,0,.12)); }

/* 32 pack scenes */
.ww[data-scene="meadow"]   { --sky1:#FFF0B8; --sky2:#FFC46B; --hill1:#8CC46E; --hill2:#4F9A4A; --sun:#FFFBE0; }
.ww[data-scene="forest"]   { --sky1:#DCEFD2; --sky2:#8FBF8A; --hill1:#3E7A46; --hill2:#22512C; --sun:#F4FFE8; --sun-y:22%; }
.ww[data-scene="ocean"]    { --sky1:#CFEFFF; --sky2:#5FB6E8; --hill1:#2E8BC9; --hill2:#1A5F9E; --sun:#FFFFFF; }
.ww[data-scene="canyon"]   { --sky1:#FFD9A3; --sky2:#F28C4B; --hill1:#C2582F; --hill2:#7F3319; --sun:#FFF1C9; }
.ww[data-scene="mountain"] { --sky1:#E6F1FF; --sky2:#9DBDE8; --hill1:#7C8FB0; --hill2:#F3F7FF; --sun:#FFFFFF; --sun-y:24%; }
.ww[data-scene="night"]    { --sky1:#101A3A; --sky2:#2B3A78; --hill1:#1E2A55; --hill2:#0F1636; --sun:#FFF4C8; --stars:1; --sun-y:22%; }
.ww[data-scene="pond"]     { --sky1:#E9F7EF; --sky2:#9ED7B5; --hill1:#4FA57A; --hill2:#2B7A55; --sun:#FFFCE8; }
.ww[data-scene="prairie"]  { --sky1:#FFF4C7; --sky2:#F9C874; --hill1:#D9A93E; --hill2:#A97B22; --sun:#FFFDF0; }
.ww[data-scene="reef"]     { --sky1:#B8F0F7; --sky2:#3FC1D6; --hill1:#F26D8D; --hill2:#B93E6A; --sun:#FFFFFF; --sun-y:20%; }
.ww[data-scene="falls"]    { --sky1:#E8F4F8; --sky2:#A9CFDD; --hill1:#5D8F7B; --hill2:#33634F; --sun:#FFFFFF; --sun-y:22%; }
.ww[data-scene="autumn"]   { --sky1:#FFE4B5; --sky2:#F5A25A; --hill1:#D9662E; --hill2:#8E3A16; --sun:#FFF6DA; }
.ww[data-scene="desert"]   { --sky1:#FFF1CC; --sky2:#F8B966; --hill1:#E6B26A; --hill2:#C98A3E; --sun:#FFFFFF; --sun-y:26%; }
.ww[data-scene="bamboo"]   { --sky1:#EEF9E4; --sky2:#B6E0A0; --hill1:#6FB35E; --hill2:#3F8639; --sun:#FFFFFF; }
.ww[data-scene="aurora"]   { --sky1:#0E2A3A; --sky2:#1E7F6C; --hill1:#12384A; --hill2:#0A1E2C; --sun:#9CF5D2; --stars:1; --sun-y:26%; }
.ww[data-scene="lavender"] { --sky1:#F3E9FF; --sky2:#C9A7F2; --hill1:#8F6BD2; --hill2:#5E3F9E; --sun:#FFFFFF; }
.ww[data-scene="storm"]    { --sky1:#B8C2CF; --sky2:#5C6B80; --hill1:#3F4E63; --hill2:#26313F; --sun:#E4EAF2; --sun-y:22%; }
.ww[data-scene="blossom"]  { --sky1:#FFF0F5; --sky2:#FFB3C9; --hill1:#E87D9C; --hill2:#B5476B; --sun:#FFFFFF; }
.ww[data-scene="jungle"]   { --sky1:#D8F0C8; --sky2:#6FB36A; --hill1:#2F7A3B; --hill2:#174C22; --sun:#F7FFE0; --sun-y:20%; }
.ww[data-scene="fjord"]    { --sky1:#EAF4FF; --sky2:#A6C8EE; --hill1:#6C86A8; --hill2:#DCE9F7; --sun:#FFFFFF; --sun-y:22%; }
.ww[data-scene="volcano"]  { --sky1:#FFD2A6; --sky2:#E3623A; --hill1:#6B2E24; --hill2:#2F1410; --sun:#FFE0B0; }
.ww[data-scene="moonbay"]  { --sky1:#1B2450; --sky2:#3C4F96; --hill1:#27386F; --hill2:#141C40; --sun:#FFFBEA; --stars:1; --sun-y:24%; }
.ww[data-scene="valley"]   { --sky1:#FFF6D8; --sky2:#BFE39A; --hill1:#7FBF5A; --hill2:#3E8A3A; --sun:#FFFFFF; }
.ww[data-scene="lake"]     { --sky1:#E9F2FA; --sky2:#B9D3EA; --hill1:#7AA6C7; --hill2:#4A7FA6; --sun:#FFFFFF; }
.ww[data-scene="mesa"]     { --sky1:#FFD6A8; --sky2:#FF8E5A; --hill1:#B44E2C; --hill2:#6D2A18; --sun:#FFF3D0; --sun-y:36%; }
.ww[data-scene="marsh"]    { --sky1:#EAF6E2; --sky2:#A8D3A0; --hill1:#5C9E61; --hill2:#2E6B3E; --sun:#FFFFFF; }
.ww[data-scene="ridge"]    { --sky1:#F1F5FB; --sky2:#C3D2E6; --hill1:#8A9BB5; --hill2:#55667F; --sun:#FFFFFF; --sun-y:24%; }
.ww[data-scene="harbor"]   { --sky1:#2A2A5C; --sky2:#7B4E8E; --hill1:#3A2F5F; --hill2:#1F1A3C; --sun:#FFD37A; --stars:.7; --sun-y:40%; }
.ww[data-scene="savanna"]  { --sky1:#FFD59A; --sky2:#E9773F; --hill1:#A9632B; --hill2:#4A2A12; --sun:#FFE7B5; --sun-y:38%; }
.ww[data-scene="cave"]     { --sky1:#2B2140; --sky2:#5A3F86; --hill1:#3A2C5C; --hill2:#1C1530; --sun:#C8B8FF; --stars:.5; --sun-y:30%; }
.ww[data-scene="rainbow"]  { --sky1:#E6F3FF; --sky2:#A8D5F5; --hill1:#6BB07A; --hill2:#3C7F4E; --sun:#FFFFFF; }
.ww[data-scene="garden"]   { --sky1:#141A3E; --sky2:#3E2F6E; --hill1:#2B4A3A; --hill2:#142A20; --sun:#F5EFC8; --stars:1; --sun-y:24%; }
.ww[data-scene="summit"]   { --sky1:#FFE3C4; --sky2:#F9A46B; --hill1:#9D7FA8; --hill2:#F7EFF2; --sun:#FFFFFF; --sun-y:34%; }
.ww[data-scene="rainbow"] .ww-sky::before {
  content: ""; position: absolute; left: 50%; top: 26%; width: 120%; aspect-ratio: 1; transform: translate(-50%, 0);
  border-radius: 50%; opacity: .55;
  background: radial-gradient(circle, transparent 58%, #F87171 58.5% 61%, #FBBF24 61.5% 64%, #34D399 64.5% 67%, #60A5FA 67.5% 70%, #A78BFA 70.5% 73%, transparent 73.5%);
}
.ww[data-scene="aurora"] .ww-sky::before {
  content: ""; position: absolute; inset: 0 0 40% 0; opacity: .7;
  background: linear-gradient(100deg, transparent 10%, rgba(120,255,200,.35) 30%, rgba(180,120,255,.3) 50%, rgba(120,255,200,.3) 70%, transparent 90%);
  filter: blur(14px);
}

/* ---------- HUD ---------- */
.ww-hud {
  display: flex; align-items: center; gap: 6px; padding: 8px 10px 4px; min-height: var(--hud-h);
}
.ww-hud__btn, .ww-coins {
  min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 14px; background: rgba(255, 251, 235, .82); color: var(--amber-900);
  box-shadow: 0 3px 0 rgba(120, 53, 15, .35), 0 6px 14px rgba(0,0,0,.12); border: 1.5px solid rgba(255,255,255,.7);
  transition: transform .08s;
}
.ww-hud__btn:active, .ww-coins:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(120,53,15,.35); }
.ww-hud__btn svg { width: 22px; height: 22px; }
.ww-hud__title { flex: 1; min-width: 0; text-align: center; line-height: 1.1; color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,.35); }
.ww-hud__pack { display: block; font-family: var(--font-label); font-size: var(--text-xs); letter-spacing: .04em; text-transform: uppercase; opacity: .95; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ww-hud__level { display: block; font-weight: 800; font-size: var(--text-md); }
.ww-coins { padding: 0 12px 0 8px; font-family: var(--font-label); font-weight: 800; font-size: var(--text-sm); }
.ww-coin { width: 20px; height: 20px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, #FFF1B8, #FBBF24 45%, #D97706 100%); box-shadow: inset 0 0 0 2px rgba(146,64,14,.55), 0 1px 2px rgba(0,0,0,.3); position: relative; }
.ww-coin::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; border: 1.5px solid rgba(146,64,14,.45); }
.ww-coins.is-bump { animation: bump .35s; }
@keyframes bump { 40% { transform: scale(1.15); } }

/* ---------- crossword board ---------- */
.ww-board { position: relative; flex: 1 1 auto; min-height: 140px; display: flex; align-items: center; justify-content: center; padding: 6px 12px; }
.ww-board__plank {
  position: relative; padding: 12px; border-radius: 16px;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,0) 0 54px, rgba(0,0,0,.14) 54px 56px),
    repeating-linear-gradient(0deg, rgba(255,255,255,.05) 0 3px, rgba(0,0,0,.04) 3px 6px),
    linear-gradient(180deg, var(--walnut-3), var(--walnut-2) 60%, var(--walnut-1));
  border: 3px solid var(--walnut-1);
  box-shadow: 0 10px 0 rgba(58, 30, 10, .55), 0 18px 30px rgba(0,0,0,.28), inset 0 2px 0 rgba(255,255,255,.18);
  max-width: 100%;
}
.ww-board__plank::before, .ww-board__plank::after {
  content: ""; position: absolute; width: 10px; height: 10px; border-radius: 50%; top: 5px;
  background: radial-gradient(circle at 35% 35%, #d9b98a, #7a4a22 70%); box-shadow: 0 1px 1px rgba(0,0,0,.5);
}
.ww-board__plank::before { left: 5px; } .ww-board__plank::after { right: 5px; }
.ww-grid { display: grid; grid-template-columns: repeat(var(--cols), var(--cell)); grid-auto-rows: var(--cell); gap: var(--gap); }
.ww-cell {
  position: relative; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-label); font-weight: 800; font-size: calc(var(--cell) * 0.56); color: var(--ink);
  background: rgba(30, 14, 4, .42); box-shadow: inset 0 2px 4px rgba(0,0,0,.45), inset 0 -1px 0 rgba(255,255,255,.08);
  user-select: none; -webkit-user-select: none;
}
.ww-cell--void { background: none; box-shadow: none; pointer-events: none; }
.ww-cell__letter { opacity: 0; transform: scale(.4) rotateX(80deg); }
.ww-cell.is-shown { background: linear-gradient(180deg, #FFFDF4, var(--cream-2)); box-shadow: 0 2px 0 var(--amber-700), inset 0 1px 0 #fff; }
.ww-cell.is-shown .ww-cell__letter { opacity: 1; transform: none; }
.ww-cell.is-pop .ww-cell__letter { animation: flipIn .45s cubic-bezier(.2, 1.4, .4, 1) both; animation-delay: var(--delay, 0ms); }
.ww-cell.is-pop { animation: cellIn .45s both; animation-delay: var(--delay, 0ms); }
@keyframes flipIn { from { opacity: 0; transform: scale(.4) rotateX(80deg); } to { opacity: 1; transform: none; } }
@keyframes cellIn { 0% { background: var(--amber-400); } 100% { background: linear-gradient(180deg, #FFFDF4, var(--cream-2)); } }
.ww-cell.is-hint::after { content: ""; position: absolute; top: 2px; right: 2px; width: 7px; height: 7px; border-radius: 50%; background: var(--amber-500); box-shadow: 0 0 6px var(--amber-400); }
.ww-cell.is-shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.ww-cell.is-defined { cursor: pointer; }
.ww-grid--target .ww-cell:not(.is-shown):not(.ww-cell--void) { cursor: pointer; animation: pulseCell 1s infinite alternate; }
@keyframes pulseCell { to { background: rgba(245, 158, 11, .55); box-shadow: 0 0 0 3px rgba(251,191,36,.6); } }

/* praise pops over the board */
.ww-praise {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-weight: 900; font-size: clamp(1.6rem, 8vw, 2.4rem); color: #fff; letter-spacing: .02em;
  text-shadow: 0 2px 0 var(--amber-700), 0 6px 14px rgba(0,0,0,.35); pointer-events: none; opacity: 0;
  -webkit-text-stroke: 1px var(--amber-800); z-index: 3; white-space: nowrap;
}
.ww-praise.is-on { animation: praise 1.1s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes praise { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.5) rotate(-6deg); } 25% { opacity: 1; transform: translate(-50%, -50%) scale(1.1) rotate(2deg); } 75% { opacity: 1; transform: translate(-50%, -55%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -80%) scale(1.05); } }
.ww-praise small { display: block; font-size: .5em; -webkit-text-stroke: 0; text-shadow: 0 2px 4px rgba(0,0,0,.4); }

/* ---------- ribbon preview ---------- */
.ww-ribbon { display: flex; justify-content: center; align-items: center; min-height: 40px; padding: 2px 24px; }
.ww-ribbon__text {
  position: relative; min-width: 0; padding: 6px 18px; border-radius: 6px;
  font-family: var(--font-label); font-weight: 800; font-size: var(--text-lg); letter-spacing: .28em; text-indent: .28em;
  color: #fff; background: linear-gradient(180deg, var(--amber-400), var(--amber-600));
  box-shadow: 0 3px 0 var(--amber-800), 0 6px 12px rgba(0,0,0,.2); opacity: 0; transform: scale(.85); transition: opacity .12s, transform .12s;
}
.ww-ribbon__text::before, .ww-ribbon__text::after {
  content: ""; position: absolute; top: 6px; width: 18px; height: 100%; background: var(--amber-700); z-index: -1;
}
.ww-ribbon__text::before { left: -12px; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 40% 50%); }
.ww-ribbon__text::after { right: -12px; clip-path: polygon(0 0, 100% 0, 60% 50%, 100% 100%, 0 100%); }
.ww-ribbon__text.is-on { opacity: 1; transform: none; }
.ww-ribbon__text.is-bad { background: linear-gradient(180deg, #F87171, var(--bad)); box-shadow: 0 3px 0 #7F1D1D; animation: shake .4s; }
.ww-ribbon__text.is-bad::before, .ww-ribbon__text.is-bad::after { background: #7F1D1D; }
.ww-ribbon__text.is-good { background: linear-gradient(180deg, #4ADE80, var(--good)); box-shadow: 0 3px 0 #14532D; }
.ww-ribbon__text.is-good::before, .ww-ribbon__text.is-good::after { background: #14532D; }
.ww-ribbon__text.is-bonus { background: linear-gradient(180deg, #A78BFA, var(--bonus)); box-shadow: 0 3px 0 #4C1D95; }
.ww-ribbon__text.is-bonus::before, .ww-ribbon__text.is-bonus::after { background: #4C1D95; }

/* ---------- wheel + tools ---------- */
.ww-play { position: relative; display: flex; justify-content: center; align-items: center; padding: 4px 0 16px; }
/* tools sit in the wheel's shoulders: absolutely placed so a 320px phone never clips them */
.ww-side { position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.ww-side--left { left: max(6px, calc(50% - var(--wheel) / 2 - 64px)); }
.ww-side--right { right: max(6px, calc(50% - var(--wheel) / 2 - 64px)); }
.ww-tool {
  position: relative; width: 56px; min-height: 56px; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #FFFDF4, var(--cream-2)); color: var(--amber-900);
  box-shadow: 0 4px 0 var(--amber-700), 0 8px 14px rgba(0,0,0,.18); transition: transform .08s, box-shadow .08s;
}
.ww-tool:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--amber-700); }
.ww-tool svg { width: 28px; height: 28px; }
.ww-tool[aria-disabled="true"] { filter: grayscale(.7); opacity: .75; }
.ww-tool__price {
  position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 999px;
  background: var(--amber-950); color: #fff; font-family: var(--font-label); font-weight: 700; font-size: 11px; white-space: nowrap; box-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.ww-tool__price .ww-coin { width: 11px; height: 11px; }
.ww-tool__price .ww-coin::after { inset: 3px; }
.ww-tool__price.is-free { background: var(--good); }
.ww-tool.is-active { background: linear-gradient(180deg, var(--amber-300), var(--amber-500)); }
.ww-tool.is-timer { animation: none; }
.ww-jar__glass { position: relative; width: 26px; height: 32px; border: 2.5px solid var(--amber-900); border-top-width: 0; border-radius: 4px 4px 9px 9px; overflow: hidden; background: rgba(255,255,255,.55); }
.ww-jar__glass::before { content: ""; position: absolute; left: -2.5px; right: -2.5px; top: 0; height: 4px; background: var(--amber-900); border-radius: 2px; }
.ww-jar__fill { position: absolute; left: 0; right: 0; bottom: 0; height: var(--fill, 0%); background: linear-gradient(180deg, #C4B5FD, var(--bonus)); transition: height .4s cubic-bezier(.2, 1.2, .4, 1); }
.ww-jar__count { font-family: var(--font-label); font-size: 11px; font-weight: 800; color: var(--amber-900); margin-top: 2px; }
.ww-tool.is-jar-pop { animation: bump .4s; }

.ww-wheel-wrap { position: relative; width: var(--wheel); height: var(--wheel); touch-action: none; }
.ww-wheel {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, rgba(255,255,255,.62), rgba(255,255,255,.28) 55%, rgba(255,255,255,.14) 100%);
  border: 3px solid rgba(255,255,255,.75);
  box-shadow: 0 12px 30px rgba(0,0,0,.28), inset 0 0 0 7px rgba(255,255,255,.14), inset 0 -8px 20px rgba(120,53,15,.12);
}
.ww-wheel::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; border: 3px dashed rgba(120, 53, 15, .38); }
.ww-wheel__svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 1; }
.ww-letter {
  position: absolute; width: var(--letter); height: var(--letter); margin: calc(var(--letter) / -2) 0 0 calc(var(--letter) / -2);
  left: var(--x); top: var(--y); border-radius: 50%; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-label); font-weight: 800; font-size: calc(var(--letter) * 0.5); color: var(--amber-950);
  background: linear-gradient(180deg, #FFFDF4, var(--cream-2)); box-shadow: 0 4px 0 var(--amber-700), 0 6px 10px rgba(0,0,0,.2);
  transition: transform .12s, background .12s, color .12s, left .3s cubic-bezier(.2, 1.2, .4, 1), top .3s cubic-bezier(.2, 1.2, .4, 1);
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.ww-letter.is-on { background: linear-gradient(180deg, var(--amber-400), var(--amber-600)); color: #fff; transform: scale(1.12); box-shadow: 0 3px 0 var(--amber-800), 0 0 0 4px rgba(251,191,36,.45); }
.ww-wheel-wrap.is-drawing .ww-letter:not(.is-on) { opacity: .48; }
.ww-wheel-wrap.is-found .ww-wheel { box-shadow: 0 12px 30px rgba(0,0,0,.28), 0 0 0 6px rgba(74, 222, 128, .55), inset 0 0 0 7px rgba(255,255,255,.14); }
.ww-wheel-wrap.is-miss { animation: shake .4s; }
.ww-wheel__shuffle {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; z-index: 2; border-radius: 50%;
  background: rgba(255,255,255,.55); color: var(--amber-900); box-shadow: inset 0 0 0 2px rgba(255,255,255,.8), 0 2px 6px rgba(0,0,0,.15);
  display: flex; align-items: center; justify-content: center;
}
.ww-wheel__shuffle svg { width: 24px; height: 24px; }
.ww-wheel__shuffle.is-spin svg { animation: spin .4s; }
@keyframes spin { to { transform: rotate(360deg); } }
.ww-wheel__enter {
  position: absolute; left: 50%; bottom: -8px; transform: translate(-50%, 100%); z-index: 3; min-height: 40px; padding: 6px 18px; border-radius: 999px;
  background: var(--amber-950); color: #fff; font-weight: 800; font-size: var(--text-sm); box-shadow: 0 3px 0 #1a0c02;
}
.ww-wheel__enter[hidden] { display: none; }

/* onboarding hand */
.ww-onboard { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
.ww-onboard[hidden] { display: none; }
.ww-hand { position: absolute; width: 40px; height: 40px; left: 0; top: 0; transform: translate(-30%, -10%); filter: drop-shadow(0 4px 6px rgba(0,0,0,.4)); z-index: 30; }
.ww-onboard__tip {
  position: absolute; left: 50%; bottom: calc(var(--wheel) + 24px); transform: translateX(-50%); width: max-content; max-width: 90%;
  background: rgba(69,26,3,.92); color: #fff; padding: 10px 14px; border-radius: 14px; font-size: var(--text-sm); font-weight: 600; text-align: center; pointer-events: auto;
  box-shadow: 0 8px 20px rgba(0,0,0,.3);
}
.ww-onboard__tip b { font-family: var(--font-label); letter-spacing: .2em; color: var(--amber-300); }
.ww-onboard__skip { margin-top: 6px; display: inline-block; color: var(--amber-200); text-decoration: underline; font-size: var(--text-xs); min-height: 32px; }

/* ---------- toast ---------- */
.ww-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 250;
  background: rgba(42,21,6,.94); color: #fff; padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: var(--text-sm);
  box-shadow: 0 8px 22px rgba(0,0,0,.35); animation: toastIn .25s; max-width: 90vw; text-align: center;
}
.ww-toast[hidden] { display: none; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------- sheets ---------- */
.overlay { position: fixed; inset: 0; background: rgba(69, 26, 3, .62); backdrop-filter: blur(5px); display: flex; align-items: flex-end; justify-content: center; z-index: 200; padding: 12px; }
.overlay[hidden] { display: none !important; }
.sheet {
  background: var(--amber-50); width: 100%; max-width: 440px; max-height: 88vh; border-radius: 24px; padding: 18px;
  display: flex; flex-direction: column; gap: 12px; box-shadow: 0 -8px 32px rgba(69, 26, 3, .3); overflow-y: auto;
  animation: slideUp .3s cubic-bezier(.16, 1, .3, 1); border: 1px solid var(--amber-300);
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } }
.sheet-kicker { font-family: var(--font-label); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--amber-700); text-align: center; }
.sheet-title { text-align: center; font-weight: 900; font-size: var(--text-xl); color: var(--amber-950); }
.sheet-banner {
  align-self: center; position: relative; padding: 8px 22px; border-radius: 6px; color: #fff; font-weight: 900; font-size: var(--text-lg); letter-spacing: .04em;
  background: linear-gradient(180deg, var(--amber-400), var(--amber-600)); box-shadow: 0 3px 0 var(--amber-800); text-align: center;
}
.sheet-banner::before, .sheet-banner::after { content: ""; position: absolute; top: 7px; width: 20px; height: 100%; background: var(--amber-700); z-index: -1; }
.sheet-banner::before { left: -14px; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 40% 50%); }
.sheet-banner::after { right: -14px; clip-path: polygon(0 0, 100% 0, 60% 50%, 100% 100%, 0 100%); }
.sheet-stars { display: flex; justify-content: center; gap: 6px; }
.sheet-stars span { width: 34px; height: 34px; clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); background: var(--amber-400); box-shadow: 0 0 8px var(--amber-300); animation: starIn .5s both; }
.sheet-stars span:nth-child(2) { width: 42px; height: 42px; animation-delay: .15s; }
.sheet-stars span:nth-child(3) { animation-delay: .3s; }
@keyframes starIn { from { transform: scale(0) rotate(-40deg); } 70% { transform: scale(1.2); } }
.sheet-rows { display: flex; flex-direction: column; gap: 6px; }
.sheet-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: #fff; border: 1px solid var(--amber-200); border-radius: 12px; font-size: var(--text-sm); }
.sheet-row b { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-label); color: var(--amber-800); }
.sheet-total { display: flex; justify-content: center; align-items: center; gap: 8px; font-family: var(--font-label); font-weight: 800; font-size: var(--text-xl); color: var(--amber-900); }
.sheet-total .ww-coin { width: 26px; height: 26px; }
.sheet-words { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.sheet-words span { padding: 4px 9px; border-radius: 999px; background: #EDE9FE; color: var(--bonus); font-family: var(--font-label); font-size: var(--text-xs); font-weight: 700; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; }
.btn {
  min-height: 48px; padding: 10px 18px; border-radius: 16px; font-weight: 800; font-size: var(--text-md); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(3px); box-shadow: none !important; }
.btn-primary { background: linear-gradient(180deg, var(--amber-400), var(--amber-600)); color: #fff; box-shadow: 0 4px 0 var(--amber-800); text-shadow: 0 1px 0 rgba(0,0,0,.2); }
.btn-secondary { background: #fff; color: var(--amber-900); border: 2px solid var(--amber-300); box-shadow: 0 3px 0 var(--amber-300); }
.btn-soft { background: transparent; color: var(--amber-800); min-height: 40px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* chest */
.ww-chest { position: relative; width: 150px; height: 120px; margin: 10px auto; cursor: pointer; }
.ww-chest__base { position: absolute; left: 0; right: 0; bottom: 0; height: 74px; border-radius: 8px 8px 12px 12px; background: linear-gradient(180deg, var(--walnut-4), var(--walnut-2)); border: 3px solid var(--walnut-1); box-shadow: 0 8px 0 rgba(58,30,10,.5); }
.ww-chest__base::before { content: ""; position: absolute; left: 50%; top: -3px; width: 30px; height: 30px; transform: translateX(-50%); background: linear-gradient(180deg, #FDE68A, #D97706); border: 3px solid #78350F; border-radius: 6px; }
.ww-chest__base::after { content: ""; position: absolute; left: 12px; right: 12px; top: 26px; height: 6px; background: rgba(0,0,0,.18); border-radius: 3px; }
.ww-chest__lid { position: absolute; left: 0; right: 0; top: 0; height: 56px; border-radius: 40px 40px 6px 6px; background: linear-gradient(180deg, var(--walnut-4), var(--walnut-3)); border: 3px solid var(--walnut-1); transform-origin: 50% 100%; transition: transform .5s cubic-bezier(.2, 1.4, .4, 1); box-shadow: inset 0 -6px 0 rgba(0,0,0,.15); }
.ww-chest__lid::before { content: ""; position: absolute; left: 18px; right: 18px; top: 18px; height: 8px; background: #FBBF24; border: 2px solid #78350F; border-radius: 4px; }
.ww-chest__glow { position: absolute; left: 50%; top: 40px; width: 120px; height: 60px; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(ellipse, #FDE68A, rgba(253,230,138,0) 70%); opacity: 0; transition: opacity .4s; }
.ww-chest.is-open .ww-chest__lid { transform: rotateX(-110deg) translateY(-4px); }
.ww-chest.is-open .ww-chest__glow { opacity: 1; }
.ww-chest.is-shake { animation: chestShake .5s; }
@keyframes chestShake { 20%, 60% { transform: rotate(-4deg); } 40%, 80% { transform: rotate(4deg); } }
.ww-crown { width: 120px; height: 84px; margin: 6px auto; background: linear-gradient(180deg, #FDE68A, #F59E0B 70%, #B45309); clip-path: polygon(0 100%, 0 30%, 24% 62%, 50% 8%, 76% 62%, 100% 30%, 100% 100%); position: relative; animation: crownIn .6s cubic-bezier(.2, 1.4, .4, 1) both; }
.ww-crown::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 16px; background: #92400E; }
@keyframes crownIn { from { transform: scale(0) rotate(-20deg); } }

/* level select */
.ww-packs { display: flex; flex-direction: column; gap: 8px; }
.ww-pack { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 16px; background: #fff; border: 1px solid var(--amber-200); text-align: left; min-height: 60px; }
.ww-pack__swatch { width: 52px; height: 44px; border-radius: 12px; flex: none; background: linear-gradient(180deg, var(--sky1, #FFE9A8), var(--sky2, #FFB765)); position: relative; overflow: hidden; }
.ww-pack__swatch::after { content: ""; position: absolute; left: -10%; right: -10%; bottom: 0; height: 40%; border-radius: 50% 50% 0 0; background: var(--hill2, #4E8A45); }
.ww-pack__name { font-weight: 800; color: var(--amber-950); }
.ww-pack__meta { font-family: var(--font-label); font-size: var(--text-xs); color: var(--amber-800); }
.ww-pack__bar { height: 6px; border-radius: 3px; background: var(--amber-100); margin-top: 4px; overflow: hidden; }
.ww-pack__bar i { display: block; height: 100%; width: var(--p, 0%); background: var(--amber-500); }
.ww-pack.is-locked { opacity: .55; }
.ww-pack.is-current { border-color: var(--amber-500); box-shadow: 0 0 0 2px var(--amber-300); }
.ww-levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.ww-lvl { min-height: 48px; border-radius: 12px; background: #fff; border: 2px solid var(--amber-200); font-family: var(--font-label); font-weight: 800; color: var(--amber-900); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ww-lvl.is-done { background: var(--amber-100); border-color: var(--amber-400); }
.ww-lvl.is-done::after { content: "✓"; font-size: 11px; color: var(--good); }
.ww-lvl.is-current { background: linear-gradient(180deg, var(--amber-400), var(--amber-600)); color: #fff; border-color: var(--amber-700); }
.ww-lvl.is-locked { opacity: .45; }
.ww-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.ww-stat { background: #fff; border: 1px solid var(--amber-200); border-radius: 12px; padding: 8px 6px; text-align: center; }
.ww-stat b { display: block; font-family: var(--font-label); font-size: var(--text-lg); color: var(--amber-900); }
.ww-stat span { font-size: 11px; color: var(--amber-800); text-transform: uppercase; letter-spacing: .04em; }

/* calendar */
.ww-cal__head { display: flex; align-items: center; justify-content: space-between; }
.ww-cal__head b { font-weight: 800; color: var(--amber-950); }
.ww-cal__nav { min-width: 44px; min-height: 44px; border-radius: 12px; background: #fff; border: 1px solid var(--amber-200); font-size: var(--text-lg); }
.ww-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.ww-cal__dow { text-align: center; font-family: var(--font-label); font-size: 10px; color: var(--amber-800); text-transform: uppercase; }
.ww-cal__day { min-height: 44px; border-radius: 10px; background: #fff; border: 1.5px solid var(--amber-200); font-family: var(--font-label); font-weight: 700; color: var(--amber-900); display: flex; align-items: center; justify-content: center; position: relative; }
.ww-cal__day.is-blank { visibility: hidden; }
.ww-cal__day.is-future { opacity: .35; pointer-events: none; }
.ww-cal__day.is-done { background: var(--amber-400); border-color: var(--amber-600); color: #fff; }
.ww-cal__day.is-done::after { content: "✓"; position: absolute; right: 3px; top: 1px; font-size: 10px; }
.ww-cal__day.is-today { box-shadow: 0 0 0 2px var(--amber-600); }
.ww-cal__day.is-picked { background: var(--amber-950); color: #fff; border-color: var(--amber-950); }
.ww-streak { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px 12px; font-family: var(--font-label); font-size: var(--text-sm); color: var(--amber-900); }
.ww-freeze {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px;
  background: #FFF7ED; border: 1.5px solid var(--amber-300); font-weight: 800; font-size: 12px; color: var(--amber-950);
}
.ww-freeze img { width: 18px; height: 18px; }
.ww-freeze.is-empty { opacity: .55; filter: grayscale(.35); }
.ww-freeze.is-cover { background: #FEF3C7; border-color: var(--amber-500); box-shadow: 0 0 0 2px rgba(245, 158, 11, .25); }

.ww-fly { position: fixed; inset: 0; pointer-events: none; z-index: 180; }
.ww-fly__chip {
  position: fixed; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-label); font-weight: 800; font-size: 18px; color: #fff;
  background: linear-gradient(180deg, var(--amber-400), var(--amber-600));
  box-shadow: 0 4px 0 var(--amber-800), 0 8px 16px rgba(0,0,0,.28);
  animation: ww-fly var(--dur, 420ms) cubic-bezier(.2, .75, .25, 1) var(--delay, 0ms) both;
}
@keyframes ww-fly {
  0% { transform: scale(.85); opacity: 1; }
  72% { transform: translate(var(--dx), var(--dy)) scale(1.12); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.35); opacity: 0; }
}

/* settings toggles */
.ww-toggle { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 6px 12px; background: #fff; border: 1px solid var(--amber-200); border-radius: 14px; width: 100%; text-align: left; font-weight: 700; color: var(--amber-950); }
.ww-toggle i { width: 48px; height: 28px; border-radius: 999px; background: #D6D3D1; position: relative; transition: background .2s; flex: none; }
.ww-toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: left .2s; }
.ww-toggle[aria-checked="true"] i { background: var(--amber-500); }
.ww-toggle[aria-checked="true"] i::after { left: 23px; }
.ww-howto { font-size: var(--text-sm); line-height: 1.55; color: var(--amber-900); padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.ww-define { font-size: var(--text-sm); line-height: 1.5; color: var(--amber-950); }
.ww-define h3 { font-family: var(--font-label); letter-spacing: .1em; color: var(--amber-800); margin-bottom: 4px; }
.ww-define p { margin: 4px 0; }
.ww-define em { color: var(--amber-700); font-style: normal; font-family: var(--font-label); font-size: var(--text-xs); }

/* ---------- article ---------- */
.article-section { width: 100%; max-width: 600px; margin: 16px auto; padding: 16px; background: #fff; border: 1px solid var(--amber-200); border-radius: var(--radius-card); display: flex; flex-direction: column; gap: 10px; font-size: var(--text-sm); color: var(--amber-900); line-height: 1.6; }
.article-section h2 { font-size: 1.15rem; font-weight: 800; color: var(--amber-950); }
.article-section h3 { font-size: 1rem; font-weight: 800; color: var(--amber-950); margin-top: 4px; }
.article-section a { color: var(--amber-700); font-weight: 600; }
.article-section ul { padding-left: 18px; }

#fx-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 300; }

/* ---------- mastery: stars, bonus hunt, idle nudge (2026-09-28) ---------- */
.ww-hud__progress { display: block; font-family: var(--font-label); font-size: 11px; font-weight: 700; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ww-hud__progress:empty { display: none; }
.sheet-stars span.is-dim { background: rgba(120, 53, 15, .18); box-shadow: none; }
.ww-lvl__stars { font-size: 10px; line-height: 1; letter-spacing: 1px; color: var(--amber-500); }
.ww-lvl.is-done.has-stars::after { content: none; }
.ww-lvl.is-current .ww-lvl__stars { color: #FFF8E6; }
.ww-lvl.is-master { border-color: var(--bonus); box-shadow: inset 0 0 0 1px var(--bonus); }
.ww-hunt { margin-left: 10px; min-height: 36px; padding: 6px 14px; border-radius: 999px; background: linear-gradient(180deg, #A78BFA, var(--bonus)); color: #fff; font-weight: 800; font-size: var(--text-xs); box-shadow: 0 3px 0 #4C1D95; white-space: nowrap; }
.ww-hunt:active { transform: translateY(2px); box-shadow: 0 1px 0 #4C1D95; }
.ww-hunt[hidden], .sheet-actions .btn[hidden] { display: none; }
.ww-jarline { display: flex; justify-content: space-between; gap: 8px; font-family: var(--font-label); font-size: var(--text-xs); font-weight: 700; color: var(--amber-900); }
.ww-bonus { max-height: 44vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.ww-bonus__len { font-family: var(--font-label); font-size: var(--text-xs); font-weight: 700; color: var(--bonus); margin: 0 0 4px; text-align: left; }
.ww-bonus .sheet-words { justify-content: flex-start; }
.sheet-words span.is-blank { background: #F5F3FF; color: #C4B5FD; letter-spacing: 2px; }
.ww-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; padding: 0 !important; }
.is-nudge { animation: nudge 1.4s ease-in-out 3; }
@keyframes nudge { 0%, 100% { transform: none; } 15% { transform: rotate(-9deg) scale(1.08); } 30% { transform: rotate(8deg) scale(1.08); } 45% { transform: none; } }

/* ---------- layout breakpoints ---------- */
@media (max-width: 359px) {
  :root { --wheel: min(70vw, 250px, 44vh); }
  .ww-tool { width: 48px; min-height: 48px; border-radius: 14px; }
  .ww-side--left { left: 3px; } .ww-side--right { right: 3px; }
}
@media (min-width: 560px) {
  .ww { min-height: 720px; margin-top: 8px; }
  .overlay { align-items: center; }
  .sheet { border-radius: 24px; }
}
@media (orientation: landscape) and (max-height: 560px) {
  :root { --wheel: min(46vh, 240px); }
  .ww { display: grid; grid-template-columns: 1.1fr 1fr; grid-template-rows: auto 1fr auto; grid-template-areas: "hud hud" "board play" "board ribbon"; min-height: calc(100vh - 100px); max-width: 800px; }
  .ww-hud { grid-area: hud; }
  .ww-board { grid-area: board; }
  .ww-ribbon { grid-area: ribbon; }
  .ww-play { grid-area: play; }
  .ww-onboard__tip { bottom: auto; top: 60px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
