/* Pocket Grove — accessible garden-toy UI and progressive board system. */
:root {
  --ink: #342849;
  --muted: #675971;
  --purple: #6c499d;
  --purple-dark: #4e3276;
  --lavender: #eee8f7;
  --mint: #8cd7b4;
  --mint-ink: #38664b;
  --rose-ink: #854c67;
  --gold-ink: #75541e;
  --line: #ded5e9;
  --surface: #fff;
  --shadow: 0 16px 45px #4f3a8010;
  --tile-gap: 4px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 16px;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; background: #f9f7fd; overflow-x: clip; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .5; }
button, svg { flex-shrink: 0; }
svg { display: block; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid #5d368f; outline-offset: 4px; }
button:active:not(:disabled) { filter: brightness(.96); }
a { color: #5f3c8b; text-underline-offset: 3px; }
p { line-height: 1.55; }
.sr-only, .board-message { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.skip-link { position: fixed; z-index: 300; left: 16px; top: -90px; padding: 14px 20px; background: var(--purple-dark); color: #fff; border-radius: 12px; }
.skip-link:focus { top: 12px; }
.ambient { position: fixed; pointer-events: none; z-index: -1; border-radius: 50%; filter: blur(90px); }
.ambient-one { width: 600px; height: 600px; background: #e4dcf455; top: 0; left: -300px; }
.ambient-two { width: 550px; height: 550px; background: #dcf0e566; bottom: -280px; right: -120px; }
.header { min-height: 86px; max-width: 1460px; margin: auto; padding: max(12px,env(safe-area-inset-top)) max(40px,env(safe-area-inset-right)) 12px max(40px,env(safe-area-inset-left)); display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0; text-align: left; font-family: Outfit, system-ui, sans-serif; font-size: 28px; font-weight: 700; line-height: 1; letter-spacing: -.8px; min-height: 48px; }
.brand-name { display: block; }
.brand-light { color: #6e5688; font-weight: 400; }
.brand small { display: block; font-family: 'DM Sans', sans-serif; font-size: 11px; letter-spacing: 2px; margin-top: 8px; color: #675471; font-weight: 600; }
.brand-mark { width: 44px; height: 44px; transform: rotate(-12deg); }
.brand-mark svg { width: 100%; height: 100%; }
.nav { display: flex; gap: 6px; align-items: center; }
.nav-button { display: flex; gap: 7px; align-items: center; padding: 13px 16px; font-size: 14px; font-weight: 600; min-height: 46px; border-radius: 14px; color: #65566f; }
.nav-button svg { width: 19px; height: 19px; }
.nav-button.active { color: var(--purple-dark); background: #ece4f7; }
.nav-button:hover { color: var(--purple-dark); background: #f0eaf7; }
.wallet { display: flex; align-items: center; gap: 8px; }
.wallet-pill { min-height: 44px; min-width: 73px; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 12px; background: #fff; border: 1px solid var(--line); border-radius: 30px; position: relative; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wallet-pill svg { width: 21px; height: 21px; }
.wallet-pill.lives svg { color: #a94062; fill: #d7648124; }
.wallet-pill.coins svg { color: #8c611d; }
.wallet-pill.essence svg { color: #74509e; }
.wallet-plus { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: #685077; background: #f1eaf8; font-size: 14px; }
.wallet-pill small { position: absolute; top: 40px; font-size: 12px; font-weight: 500; white-space: nowrap; color: var(--muted); }
.round-button { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; background: #fff; color: #665278; }
.round-button svg { width: 20px; height: 20px; }
.round-button:hover { background: var(--lavender); }
main { max-width: 1360px; margin: auto; padding: 28px max(32px,env(safe-area-inset-right)) 0 max(32px,env(safe-area-inset-left)); }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 27px; }
.eyebrow, .section-eyebrow { font-size: 12px; font-weight: 700; color: #6a587c; letter-spacing: 1.2px; line-height: 1.5; }
.eyebrow { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.tiny-flower { font-size: 19px; color: #8562b2; }
h1 { font-family: Outfit, system-ui, sans-serif; font-size: clamp(28px, 3.2vw, 38px); font-weight: 600; margin: 0; line-height: 1.15; letter-spacing: -1px; }
h1 span { color: #755197; }
.page-heading p { font-size: 14px; color: var(--muted); margin: 9px 0 0; }
.soft-button { display: flex; align-items: center; gap: 12px; padding: 14px 17px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.daily-button { min-width: 250px; text-align: left; font-size: 14px; font-weight: 600; }
.daily-button > span:first-child { width: 38px; height: 38px; background: #f1e6fa; color: #79509a; border-radius: 12px; display: grid; place-items: center; }
.daily-button small { display: block; font-size: 12px; color: var(--muted); margin-top: 5px; font-weight: 400; }
.gift-dot { width: 8px; height: 8px; margin-left: auto; border-radius: 50%; background: #bf7036; box-shadow: 0 0 0 4px #fbeddc; }
.game-layout { display: grid; grid-template-columns: minmax(170px,200px) minmax(420px,620px) minmax(240px,290px); gap: 24px; justify-content: center; align-items: start; }
.game-layout > * { min-width: 0; }
.left-rail, .right-rail { padding-top: 58px; }
.trail-card { position: relative; background: #f0edf7; border: 1px solid var(--line); border-radius: 22px; padding: 22px 18px 16px; }
.trail-card h2 { font-family: Outfit, sans-serif; font-size: 25px; font-weight: 500; line-height: 1.15; margin: 10px 0; letter-spacing: -.5px; }
.meadow-mark { position: absolute; top: 58px; right: 14px; color: #9f94bb; font-size: 37px; transform: rotate(15deg); font-weight: 400; }
.trail-card > p { color: var(--muted); font-size: 14px; margin: 10px 0 24px; }
.trail-preview { padding-left: 3px; }
.trail-stop { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 50px; margin-bottom: 13px; padding: 0; text-align: left; position: relative; }
.trail-stop:not(:last-child):after { content: ''; position: absolute; left: 18px; top: 43px; height: 25px; width: 1px; background: #d4c8e2; }
.trail-circle { width: 38px; height: 38px; border-radius: 50%; border: 2px solid #f8f4fe; display: grid; place-items: center; background: #e3daee; color: #625071; font-size: 14px; font-weight: 700; }
.trail-circle svg { width: 15px; height: 15px; }
.trail-stop.current .trail-circle { background: #76549f; color: #fff; box-shadow: 0 0 0 4px #e1d5ef; }
.trail-stop.completed .trail-circle { background: #cee8d8; color: #376b4c; }
.trail-name { min-width: 0; color: #695676; font-size: 12px; line-height: 1.4; }
.trail-name b { display: block; font-size: 15px; font-weight: 500; margin-bottom: 3px; }
.trail-stop.current .trail-name b { color: #4e3565; font-weight: 700; }
.text-button { min-height: 44px; display: flex; align-items: center; gap: 6px; padding: 6px 0; color: #62417f; font-size: 14px; font-weight: 600; }
.text-button svg { width: 16px; height: 16px; }
.trail-card > .text-button { width: 100%; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 12px; }
.ownership-card { padding: 24px 8px; text-align: center; }
.ownership-orbit { width: 140px; height: 90px; position: relative; margin: 0 auto 8px; }
.ownership-orbit:before { content: ''; position: absolute; inset: 10px -2px; border: 1px dashed #c7b6d8; border-radius: 50%; transform: rotate(-20deg); }
.ownership-orbit .mini-gem { position: absolute; width: 70px; left: 34px; top: 6px; transform: rotate(-10deg); }
.orbit-spark { position: absolute; right: 5px; top: 7px; font-size: 20px; color: #9b752f; }
.ownership-card h3 { font-family: Outfit, sans-serif; font-size: 21px; font-weight: 500; line-height: 1.25; margin: 6px 0 10px; }
.ownership-card p { font-size: 14px; color: var(--muted); margin: 0; }
.owned-coverage { color: #6b567b; font-size: 13px; margin-top: 13px; line-height: 1.5; }
.owned-coverage b { display: block; color: #684485; }
.level-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; margin: 0 3px 12px; }
.world-label { color: #69527d; font-size: 12px; font-weight: 700; letter-spacing: 1.4px; }
.level-heading h2 { font-family: Outfit, sans-serif; font-size: 22px; font-weight: 600; line-height: 1.2; margin: 4px 0 0; }
.level-heading h2 span { display: inline-block; margin-left: 9px; padding-left: 9px; border-left: 1px solid #c7b8d7; font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 400; color: #6c5b79; }
.game-card { min-width: 0; padding: 20px 20px 16px; background: #fff; border: 1px solid #e5ddec; border-radius: 27px; box-shadow: var(--shadow); position: relative; }
.game-stats { display: grid; grid-template-columns: 72px minmax(0,1fr) 104px; gap: 16px; align-items: center; margin-bottom: 14px; }
.moves-stat { text-align: center; border-right: 1px solid var(--line); padding-right: 12px; }
.moves-stat strong { display: block; font-family: Outfit, sans-serif; font-size: 34px; line-height: 1; font-weight: 600; color: #513677; font-variant-numeric: tabular-nums; }
.moves-stat span { display: block; margin-top: 6px; color: #65536f; font-size: 12px; font-weight: 700; line-height: 1.2; }
.score-stat > div:first-child { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.score-stat > div > span { font-size: 12px; letter-spacing: .7px; font-weight: 700; color: #685473; }
.score-stat strong { font-size: 16px; line-height: 1.3; font-weight: 700; color: #5c4179; font-variant-numeric: tabular-nums; }
.score-stat small { font-size: 13px; font-weight: 400; color: #6e5f7c; }
.score-track { position: relative; height: 8px; border-radius: 12px; background: #eee6f6; }
.score-track > div { height: 100%; width: 0; border-radius: 12px; background: linear-gradient(90deg,#8562b2,#b184c4); transition: width .45s ease; }
.track-star { position: absolute; top: -7px; width: 20px; right: auto; transform: translateX(-50%); text-align: center; line-height: 20px; font-size: 18px; color: #b9a6cd; text-shadow: 0 1px #fff; }
.track-star.lit { color: #b27b21; }
.star-one { left: 33%; }.star-two { left: 66%; }.star-three { left: 100%; right: auto; }
.goal-stat { display: grid; grid-template-columns: 28px auto; align-items: center; gap: 3px; text-align: center; }
.goal-stat #goal-icon { width: 29px; height: 29px; }
.goal-stat strong { color: #75551f; font-size: 15px; font-weight: 700; white-space: nowrap; }
.goal-stat > span { grid-column: 1/-1; color: #685672; font-size: 12px; line-height: 1.25; font-weight: 700; letter-spacing: .2px; }
.obstacle-goals { display: flex; justify-content: center; align-items: stretch; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.obstacle-goals:empty, .level-briefing:empty { display: none; }
.obstacle-goal { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px; min-width: 0; max-width: 100%; border: 1px solid #cdbbdc; border-radius: 12px; padding: 7px 11px; background: #f6f0fb; color: #614476; font-size: 14px; line-height: 1.3; min-height: 42px; font-variant-numeric: tabular-nums; }
.obstacle-goal > svg, .obstacle-goal .icon { width: 25px; height: 25px; }
.obstacle-goal strong, .obstacle-goal b { color: #4c315f; font-weight: 700; }
.obstacle-goal.complete, .obstacle-goal.completed { background: #ebf6ee; border-color: #a9c6b0; color: #396447; }
.obstacle-goal.crate { background: #fbf0e2; border-color: #d8b88e; color: #71491e; }
.obstacle-goal.frost { background: #eaf5fc; border-color: #a5c4d5; color: #315d78; }
.obstacle-goal.spirit-goal { background: #fff5dc; border-color: #d7b879; color: #70501c; }
.obstacle-goal.special-goal { background: #f4eafa; border-color: #cdb2dd; color: #68417f; }
.obstacle-goal.complete { background: #ebf6ee; border-color: #a9c6b0; color: #396447; }
.level-briefing { color: #655272; font-size: 14px; line-height: 1.5; text-align: center; margin: 0 0 13px; padding: 8px 10px; background: #f8f4fc; border: 1px solid #e2d6ed; border-radius: 11px; }
.level-briefing strong { color: #4e3867; }
.board-wrap { position: relative; width: 100%; max-width: 560px; margin-inline: auto; padding: 7px; border: 1px solid #d6c8e4; border-radius: 21px; background: #e7deef; box-shadow: inset 0 3px 8px #70558d12; }
.board { --board-size: 7; position: relative; display: grid; grid-template-columns: repeat(var(--board-size),minmax(0,1fr)); grid-template-rows: repeat(var(--board-size),minmax(0,1fr)); gap: var(--tile-gap); aspect-ratio: 1; user-select: none; -webkit-user-select: none; touch-action: none; outline: none; }
.board.size-7 { --board-size: 7; }.board.size-8 { --board-size: 8; }.board.size-9 { --board-size: 9; }
.board-row { grid-column: 1/-1; display: grid; grid-template-columns: repeat(var(--board-size),minmax(0,1fr)); gap: var(--tile-gap); min-height: 0; min-width: 0; }
.tile { position: relative; display: grid; place-items: center; width: 100%; height: 100%; aspect-ratio: 1; min-width: 0; min-height: 0; padding: 2px; background: #f7f2fc; border: 1px solid #fff9; border-radius: 12px; box-shadow: 0 2px 1px #a38ab92a; overflow: visible; touch-action: none; transition: background .18s, box-shadow .18s, transform .18s; }
.board-row:nth-child(2n) .tile:nth-child(2n), .board-row:nth-child(2n+1) .tile:nth-child(2n+1) { background: #f0e8f8; }
.tile svg { width: 100%; height: 100%; pointer-events: none; }
.tile:hover:not(:disabled) { background: #fff; z-index: 1; }
.tile:focus-visible { outline: 3px solid #4e2e7d; outline-offset: 1px; z-index: 7; }
.tile.selected { box-shadow: 0 0 0 3px #76509f, 0 0 0 5px #dfcaef; transform: scale(.96); z-index: 6; }
.tile.personal { background: #fff5d9 !important; border: 1.5px solid #bd8e34; box-shadow: inset 0 0 0 2px #fff9e9, 0 2px 3px #ab783020; }
.tile.personal:after { content: '✦'; position: absolute; right: -1px; top: -4px; display: grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; background: #fff2c8; color: #8c621d; font-size: 11px; line-height: 1; z-index: 4; }
.tile.hint { animation: hint-pulse 1.5s ease infinite; z-index: 5; }
.tile.special-row:before, .tile.special-column:before { content: ''; position: absolute; inset: 7px 3px; border-top: 2px solid #fff; border-bottom: 2px solid #fff; box-shadow: 0 0 0 1px #77519433; opacity: .9; pointer-events: none; z-index: 2; }
.tile.special-column:before { transform: rotate(90deg); }
.tile.special-nova { box-shadow: inset 0 0 0 2px #fff, 0 0 0 1px #9b69be, 0 0 13px #b780d8; }
.tile.special-nova .gem-art { filter: drop-shadow(0 0 3px #caa2ea); }
.tile.special-burst { background: #fff0e4; box-shadow: inset 0 0 0 2px #fff, 0 0 0 1px #b77b4c; }
.tile.special-burst:before { content: ''; position: absolute; inset: 7px; border: 2px dashed #fff; border-radius: 30%; box-shadow: 0 0 0 1px #a46a4080; transform: rotate(45deg); pointer-events: none; z-index: 2; }
.tile.clearing { animation: pop-out .25s ease forwards; }
.tile.empty { opacity: 0; pointer-events: none; }
.tile.drop { animation: drop-in .32s cubic-bezier(.25,.8,.5,1.2) backwards; }
.tile.invalid { animation: wiggle .3s; }
.tile.void, .tile.void:disabled { opacity: 0; visibility: hidden; pointer-events: none; border: 0; background: transparent !important; box-shadow: none; }
.tile.crate, .tile.crate:disabled { cursor: default; opacity: 1; background: #ecd0ab !important; border-color: #bd8c5c; box-shadow: inset 0 0 0 2px #ffebce, 0 2px 2px #8e5c3020; padding: 1px; }
.tile.crate.targetable { cursor: pointer; }
.tile.crate.targetable:hover { outline: 2px solid #805029; outline-offset: 1px; }
.tile.frost { background: #e5f4fd; border-color: #7faac1; }
.frost-overlay { position: absolute; inset: -1px; z-index: 4; pointer-events: none; border-radius: inherit; }
.frost-overlay svg { width: 100%; height: 100%; }
.tile.frost[data-layers]:after { content: attr(data-layers); position: absolute; display: grid; place-items: center; bottom: -1px; right: -1px; top: auto; width: 16px; height: 16px; border-radius: 50%; background: #286687; color: #fff; border: 1px solid #e1f7ff; font-family: 'DM Sans',sans-serif; font-size: 11px; font-weight: 700; z-index: 5; }
.tile.effect-source { z-index: 8; outline: 3px solid #d6a234; outline-offset: 1px; box-shadow: 0 0 0 5px #ffe9a0aa, 0 0 18px #dfb45566; }
.tile.effect-target { z-index: 5; background: #e4d0f7 !important; box-shadow: inset 0 0 0 2px #9c65bd; }
.tile.effect-target.personal, .tile.effect-target.kind-personal, .tile.effect-target.effect-personal, .tile.effect-target.effect-kind-personal { background: #fff0b7 !important; box-shadow: inset 0 0 0 2px #c18a22; }
.tile.effect-target.effect-row, .tile.effect-target.effect-column { background: #e1eefc !important; box-shadow: inset 0 0 0 2px #5689bc; }
.tile.effect-target.effect-nova, .tile.effect-target.kind-nova { background: #f4d8f2 !important; box-shadow: inset 0 0 0 2px #ad60a5; }
.combo-label { position: absolute; left: -8px; right: -8px; top: 35%; z-index: 10; pointer-events: none; opacity: 0; color: #fff; font-family: Outfit,sans-serif; font-size: clamp(25px,3vw,38px); font-weight: 700; text-align: center; text-shadow: 0 2px 0 #4b2c68, 0 0 8px #4b2c6888; }
.combo-label.show { animation: combo-pop .95s ease forwards; }
.board-feedback { display: flex; justify-content: center; padding-top: 12px; min-height: 42px; position: relative; }
.stardust-readout { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; color: #604179; font-size: 14px; font-weight: 500; line-height: 1.35; text-align: center; font-variant-numeric: tabular-nums; }
.stardust-readout > svg, .stardust-readout .icon { width: 18px; height: 18px; color: #79549d; }
.stardust-readout strong, .stardust-readout b { color: #4f3168; font-weight: 700; }
.stardust-gain { display: none; position: static; max-width: 100%; padding: 4px 8px; border: 1px solid #d2b4e6; border-radius: 16px; background: #fff8fe; color: #63367c; font-size: 13px; font-weight: 700; text-align: center; pointer-events: none; opacity: 0; visibility: hidden; }
.stardust-gain.show:not(:empty) { display: inline-flex; align-items: center; justify-content: center; opacity: 1; visibility: visible; animation: resource-pop 1.25s ease forwards; }
.stardust-gain:empty { display: none; }
.stardust-gain svg { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; }
.game-note { display: flex; align-items: center; justify-content: center; gap: 7px; color: #665373; font-size: 14px; line-height: 1.45; min-height: 46px; padding: 8px 0; text-align: center; }
.game-note b { color: #513665; font-weight: 700; }
.game-note > svg, .note-sparkle svg { width: 18px; height: 18px; flex-shrink: 0; color: #916626; }
.boosters { display: flex; align-items: flex-start; justify-content: center; gap: 18px; padding-top: 15px; border-top: 1px solid var(--line); }
.booster { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-width: 88px; min-height: 76px; padding: 0 2px; color: #604e6f; font-size: 14px; line-height: 1.2; text-align: center; }
.booster-art { width: 48px; height: 46px; display: grid; place-items: center; border-radius: 13px; border: 1px solid #c9b6dc; border-bottom: 3px solid #bda6d4; background: linear-gradient(#fff,#f1e9f9); position: relative; transition: transform .18s,background .18s; }
.booster:hover .booster-art { transform: translateY(-2px); }
.booster.active .booster-art { background: #e4d5f4; border-color: #8057aa; box-shadow: 0 0 0 3px #e5d7f2; }
.booster-art > svg { width: 26px; height: 26px; color: #74509c; }
.booster:nth-child(2) .booster-art > svg { color: #3d7454; }
.booster:nth-child(3) .booster-art > svg { color: #8b6427; }
.booster-count { display: grid; place-items: center; position: absolute; top: -8px; right: -8px; min-width: 22px; height: 22px; padding-inline: 3px; border: 2px solid #fff; border-radius: 50%; background: #725298; color: #fff; font-size: 12px; font-weight: 700; }
.below-game { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 4px; margin-top: 10px; color: #6a5979; font-size: 13px; }
.below-game > span { display: flex; align-items: center; gap: 5px; }
.below-game > span svg { width: 15px; height: 15px; color: #87688f; }
.below-game .text-button { font-size: 14px; }
.collection-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.collection-heading h2 { font-family: Outfit,sans-serif; font-size: 24px; font-weight: 500; margin: 5px 0 0; line-height: 1.15; letter-spacing: -.4px; }
.collection-heading > span { border-radius: 8px; background: #e9dff3; padding: 6px 8px; color: #624277; font-size: 14px; font-weight: 700; white-space: nowrap; }
.collection-heading .section-eyebrow { font-size: 11px; letter-spacing: .8px; }
.rail-description { color: #675773; font-size: 14px; line-height: 1.6; margin: 12px 0 20px; }
.spirit-card { display: block; width: 100%; position: relative; margin: 0 0 14px; padding: 16px 14px 13px; border: 1px solid #cddfc8; border-radius: 19px; background: linear-gradient(115deg,#edf7e9,#f7fbf4); text-align: left; overflow: hidden; transition: transform .18s,box-shadow .18s; }
.spirit-card:hover { transform: translateY(-2px); box-shadow: 0 8px 18px #6a486d10; }
.spirit-card.type-2 { border-color: #e7cdd7; background: linear-gradient(115deg,#fceaf0,#fff6f8); }
.spirit-card-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.spirit-portrait { width: 73px; height: 73px; flex-shrink: 0; }
.spirit-portrait svg { width: 100%; height: 100%; transform: rotate(-5deg); }
.spirit-info { min-width: 0; }
.spirit-info h3 { font-family: Outfit,sans-serif; font-size: 23px; font-weight: 500; margin: 0 0 5px; }
.owned-label { display: flex; align-items: center; gap: 4px; color: #45663a; font-size: 11px; line-height: 1.35; letter-spacing: .6px; font-weight: 700; }
.owned-label svg { width: 12px; height: 12px; }
.type-2 .owned-label { color: #8a4f66; }
.piece-level { position: absolute; top: 13px; right: 11px; padding: 4px 6px; border: 1px solid #cbd7c1; border-radius: 7px; background: #fffffff0; color: #5b5945; font-size: 12px; font-weight: 700; }
.type-2 .piece-level { border-color: #e5c8d4; color: #824d63; }
.spirit-skill { display: flex; align-items: center; gap: 6px; color: #48643c; font-size: 13px; line-height: 1.5; margin-top: 10px; }
.spirit-skill svg { width: 15px; height: 15px; color: #69733e; }
.type-2 .spirit-skill { color: #854f68; }
.spirit-card-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-top: 11px; margin-top: 11px; border-top: 1px solid #cfdfc7; color: #4d6742; font-size: 12px; line-height: 1.4; }
.type-2 .spirit-card-bottom { border-color: #ecd5df; color: #86556b; }
.upgrade-small { display: inline-flex; align-items: center; gap: 5px; padding: 7px 9px; border: 1px solid #d3dec9; border-radius: 7px; background: #fff; color: #586242; font-size: 13px; font-weight: 600; }
.upgrade-small svg { width: 13px; height: 13px; }
.locked-card { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; margin: 14px 0; background: #f1ecf7; border: 1px dashed #c7b7d6; border-radius: 16px; color: #715a82; text-align: left; }
.locked-gem { width: 46px; height: 46px; opacity: .65; filter: grayscale(.15); }
.locked-gem svg { width: 100%; height: 100%; }
.locked-card strong { display: block; color: #645075; font-size: 14px; font-weight: 600; }
.locked-card p { font-size: 13px; margin: 5px 0 0; color: #715e7e; }
.locked-card > svg { width: 17px; height: 17px; margin-left: auto; color: #745981; }
.collection-link { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 46px; padding: 12px; border: 1px solid #cebddc; border-radius: 12px; background: #fff; color: #62437a; font-size: 14px; font-weight: 600; }
.collection-link svg { width: 18px; height: 18px; }
.collection-link > svg:last-child { margin-left: auto; width: 14px; }
.tip-card { display: flex; gap: 10px; padding: 20px 3px 0; color: #7b548f; }
.tip-card > svg { width: 24px; height: 24px; }
.tip-card strong { color: #675271; font-size: 14px; font-weight: 600; }
.tip-card p { color: #6d5a7c; font-size: 14px; line-height: 1.55; margin-top: 6px; }
footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px; padding: 30px 0 24px; color: #70617e; font-size: 12px; letter-spacing: 1px; }
.footer-flower { color: #896aa5; font-size: 19px; }
.mobile-nav { display: none; }
#particles { position: fixed; inset: 0; width: 100vw; height: 100dvh; pointer-events: none; z-index: 100; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%,20px); max-width: min(560px,90vw); padding: 14px 20px; border-radius: 25px; color: #fff; background: #4d365f; box-shadow: 0 8px 30px #4e38552a; font-size: 14px; line-height: 1.45; text-align: center; z-index: 200; opacity: 0; pointer-events: none; transition: opacity .2s,transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.modal-backdrop { position: fixed; inset: 0; padding: max(20px,env(safe-area-inset-top)) max(20px,env(safe-area-inset-right)) max(20px,env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left)); z-index: 60; background: #38244f88; backdrop-filter: blur(7px); display: flex; align-items: center; justify-content: center; animation: fade-in .15s ease; }
.modal { width: 100%; max-width: 540px; max-height: calc(100dvh - 40px); overflow-y: auto; overscroll-behavior: contain; position: relative; padding: 32px; border-radius: 28px; background: #fbfaff; border: 1px solid #fff; box-shadow: 0 25px 100px #36234933; animation: modal-in .25s ease; }
.modal.wide { max-width: 800px; }
.modal-close { position: absolute; top: 16px; right: 16px; z-index: 4; }
.modal-eyebrow { margin: 0 44px 9px 0; color: #705084; font-size: 12px; font-weight: 700; letter-spacing: 1.5px; line-height: 1.5; text-transform: uppercase; }
.modal h2 { font-family: Outfit,sans-serif; font-size: 30px; font-weight: 500; line-height: 1.15; letter-spacing: -.6px; margin: 0 0 12px; text-wrap: balance; }
.modal h3 { font-family: Outfit,sans-serif; font-size: 21px; font-weight: 500; }
.modal p { font-size: 15px; color: #665273; line-height: 1.6; }
.modal .subcopy { margin: 10px 0 22px; font-size: 14px; }
.primary-button { min-height: 48px; padding: 14px 22px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 13px; background: #6c499d; box-shadow: 0 4px 0 #4d3176; color: #fff; font-size: 15px; font-weight: 600; line-height: 1.35; transition: background .18s,transform .18s; }
.primary-button:hover:not(:disabled) { background: #5e3b8e; transform: translateY(-1px); }
.primary-button svg { width: 18px; height: 18px; }
.primary-button.coral { background: #a94e65; box-shadow: 0 4px 0 #82384d; }
.secondary-button { min-height: 46px; padding: 12px 17px; display: flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid #c9b5d9; border-radius: 12px; background: #fff; color: #65477c; font-size: 14px; line-height: 1.4; font-weight: 500; }
.secondary-button:hover:not(:disabled) { background: #f0e7f8; }
.secondary-button svg { width: 17px; height: 17px; }
.button-row { display: flex; gap: 10px; margin-top: 20px; }
.button-row > * { flex: 1; min-width: 0; }
.full-width { width: 100%; }
.modal-hero-gem { width: 130px; height: 130px; margin: 4px auto 10px; filter: drop-shadow(0 12px 10px #9d84bc22); animation: bob 3s ease-in-out infinite; }
.modal-hero-gem svg { width: 100%; height: 100%; }
.detail-top { text-align: center; }
.rarity { font-size: 12px; color: #745782; letter-spacing: 1px; line-height: 1.5; }
.level-pips { display: flex; justify-content: center; gap: 6px; margin: 14px 0 20px; }
.level-pips i { width: 24px; height: 6px; border-radius: 4px; background: #ddd1eb; }
.level-pips i.filled { background: #7e54a8; }
.ability-box { margin: 18px 0; padding: 17px; border-radius: 17px; background: #eee6f6; }
.ability-box strong { display: flex; align-items: center; gap: 6px; color: #5e3d77; font-size: 14px; line-height: 1.45; }
.ability-box strong svg { width: 17px; height: 17px; }
.ability-box p { color: #614b73; font-size: 14px; line-height: 1.6; margin: 7px 0 0; }
.ability-box .next-ability { margin-top: 10px; padding-top: 10px; border-top: 1px solid #cbb6de; }
.cost-line { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 17px; margin: 12px 0; color: #624677; font-size: 14px; line-height: 1.5; }
.cost-line span { display: flex; align-items: center; gap: 5px; }
.cost-line svg { width: 17px; height: 17px; }
.upgrade-preview { --preview-size: 5; display: grid; grid-template-columns: repeat(var(--preview-size),minmax(0,1fr)); gap: 3px; width: 125px; aspect-ratio: 1; padding: 5px; margin: 12px auto; border: 1px solid #d0bfdf; border-radius: 11px; background: #fbf8ff; }
.preview-cell { min-width: 0; min-height: 0; border-radius: 3px; background: #e9e1f2; border: 1px solid #ddd0e9; }
.preview-cell.active { background: #cfb0e5; border-color: #8c5ab1; }
.preview-cell.source, .preview-cell.effect-source { background: #f3d47d; border-color: #a47b27; box-shadow: inset 0 0 0 1px #fff3c7; }
.upgrade-preview-label { text-align: center; color: #624875; font-size: 14px; line-height: 1.4; }
.upgrade-comparison { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: 18px 0 12px; }
.upgrade-comparison > div { min-width: 0; padding: 12px; background: #f6f0fc; border: 1px solid #d8c8e6; border-radius: 14px; text-align: center; }
.upgrade-comparison > div > strong { display: block; color: #5d3e76; font-size: 14px; line-height: 1.4; }
.upgrade-comparison .upgrade-preview { width: min(100%,144px); margin: 12px auto 0; }
.skin-options { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); align-items: stretch; gap: 9px; margin-top: 10px; }
.skin-option { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; padding: 12px 8px; border: 1px solid #d6c7e2; border-radius: 14px; background: #fff; color: #654979; font-size: 14px; text-align: center; }
.skin-option > svg { width: 58px; height: 58px; margin: 0 auto 7px; }
.skin-option > span { display: block; font-weight: 600; line-height: 1.4; }
.skin-option > .secondary-button { width: 100%; min-width: 0; min-height: 44px; margin-top: 8px; padding: 9px 6px; font-size: 14px; white-space: normal; overflow-wrap: anywhere; }
.skin-option > .secondary-button svg { width: 16px; height: 16px; margin: 0; }
.skin-option.selected { border-color: #9569b7; background: #eee3f7; }
.skin-option small { display: block; font-size: 13px; margin-top: 6px; color: #6c527b; }
.collection-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-top: 24px; }
.collection-item { min-width: 0; position: relative; padding: 18px 9px 14px; border: 1px solid #d9cae5; border-radius: 19px; background: #fff; text-align: center; }
.collection-item .gem { width: 105px; max-width: 100%; margin: auto; }
.collection-item strong { display: block; margin: 7px 0 5px; font-family: Outfit,sans-serif; font-size: 20px; font-weight: 500; }
.collection-item small { font-size: 13px; line-height: 1.5; color: #6b517c; }
.collection-item.locked { background: #f0eaf6; }
.collection-item.locked .gem { opacity: .5; filter: grayscale(.7); }
.collection-item.locked:after { content: '✦'; position: absolute; top: 12px; right: 12px; color: #806495; font-size: 15px; }
.collection-progress { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 13px 15px; border-radius: 12px; background: #ece2f5; color: #5f3f78; font-size: 14px; line-height: 1.5; }
.collection-progress svg { width: 22px; height: 22px; }
.trail-list { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-top: 24px; }
.trail-level { min-width: 0; min-height: 110px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 9px; padding: 12px 8px; border: 1px solid #d4c3e1; border-radius: 18px; background: #fff; color: #65487a; font-size: 14px; line-height: 1.35; text-align: center; }
.trail-level b { font-family: Outfit,sans-serif; font-size: 30px; font-weight: 500; }
.trail-level b svg { width: 27px; height: 27px; }
.trail-level.current { background: #eae0f5; border-color: #9468b6; }
.trail-level.completed { background: #e7f2e6; border-color: #adc8a7; color: #3e6b35; }
.trail-level small { font-size: 14px; }
.trail-level > span { display: block; min-width: 0; width: 100%; line-height: 1.4; overflow-wrap: anywhere; }
.trail-level > span > small { display: block; margin-top: 6px; color: #6c527d; font-size: 12px; line-height: 1.4; }
.shop-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 11px; margin: 20px 0; }
.shop-item { min-width: 0; padding: 18px 12px; border: 1px solid #d5c6e3; border-radius: 17px; background: #fff; text-align: center; }
.shop-item > svg { width: 38px; height: 38px; margin: 0 auto 13px; color: #79519c; }
.shop-item b { display: block; font-size: 15px; margin-bottom: 7px; line-height: 1.4; }
.shop-item small { font-size: 14px; line-height: 1.5; color: #6e527e; }
.shop-item button, .shop-item > .secondary-button { min-height: 44px; margin: 14px auto 0; padding: 9px 8px; width: 100%; font-size: 14px; }
.shop-item button svg { width: 15px; height: 15px; }
.shop-section { margin-top: 24px; font-family: Outfit,sans-serif; font-size: 21px; font-weight: 500; }
.shop-banner { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 15px 0; padding: 17px; border: 1px solid #d4bfe4; border-radius: 17px; background: #eee4f8; }
.shop-banner > svg { width: 30px; height: 30px; color: #7a4f97; }
.shop-banner strong { font-size: 15px; }
.shop-banner p { font-size: 14px; margin: 5px 0 0; color: #654a76; }
.shop-banner button { min-height: 44px; margin-left: auto; padding: 11px 13px; font-size: 14px; }
.purchase-note, .modal .purchase-note { font-size: 14px !important; line-height: 1.55; color: #6d537c !important; text-align: center; }
.results { text-align: center; }
.results-art { width: 135px; height: 125px; position: relative; margin: 0 auto; }
.results-art svg { width: 100%; height: 100%; }
.result-stars { margin: 15px 0; font-size: 42px; letter-spacing: 8px; color: #a46a14; }
.reward-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin: 23px 0; }
.reward-pill { display: flex; align-items: center; gap: 8px; padding: 12px 19px; border: 1px solid #d3bfdf; border-radius: 13px; background: #eee5f6; color: #65427d; font-size: 16px; font-weight: 600; }
.reward-pill svg { width: 21px; height: 21px; }
.unlock-callout { padding: 14px; border: 1px solid #b7d0aa; border-radius: 15px; background: #ebf5e5; color: #476b37; font-size: 14px; line-height: 1.5; }
.result-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 18px 28px; margin: 20px 0; }
.result-stats strong { display: block; color: #60417d; font-family: Outfit,sans-serif; font-size: 24px; font-weight: 500; }
.result-stats span { font-size: 12px; color: #70567f; line-height: 1.5; }
.settings-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.toggle { width: 48px; height: 44px; padding: 10px 3px; border-radius: 25px; background: transparent; position: relative; }
.toggle:before { content: ''; position: absolute; inset: 9px 0; border-radius: 25px; border: 1px solid #9885ac; background: #d9cce5; transition: background .18s; }
.toggle:after { content: ''; display: block; position: relative; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #3d24474d; transition: transform .18s; }
.toggle.on:before { background: #73509b; border-color: #73509b; }
.toggle.on:after { transform: translateX(20px); }
.help-row { display: flex; align-items: center; gap: 15px; margin: 23px 0; }
.help-art { width: 62px; flex-shrink: 0; }
.help-art svg { width: 62px; height: 62px; }
.help-row strong { font-size: 15px; font-weight: 600; }
.help-row p { margin: 6px 0 0; font-size: 14px; }
.tutorial-bubble { margin-top: 18px; padding: 14px 17px; border: 1px solid #cfb2df; border-radius: 15px; background: #f1e5f9; color: #634178; font-size: 14px; line-height: 1.5; }
.audio-previews { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 12px; }
.audio-previews button { flex: 1; min-width: 100px; padding: 12px 8px; font-size: 14px; }
.audio-credit { color: #6c527c !important; font-size: 14px !important; line-height: 1.7 !important; text-align: center; margin: 16px 0 21px; }
.audio-credit a { color: #603d83; }
.shake { animation: board-shake .3s; }
.no-scroll { overflow: hidden; }
.empty-view { padding: 25px; color: #69517e; text-align: center; }
.empty-view svg { width: 50px; height: 50px; margin: 0 auto 15px; }
.loading-fallback { padding: 70px 25px; color: #6e5083; text-align: center; }
@keyframes pop-out { 50% { transform: scale(1.15); filter: brightness(1.18); } 100% { transform: scale(.1); opacity: 0; } }
@keyframes drop-in { from { transform: translateY(-25px) scale(.8); opacity: .2; } to { transform: none; opacity: 1; } }
@keyframes hint-pulse { 50% { box-shadow: 0 0 0 3px #9a70c1,0 0 14px #9e73c448; transform: translateY(-1px); } }
@keyframes wiggle { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes combo-pop { 0% { opacity: 0; transform: scale(.7) rotate(-4deg); } 22%,65% { opacity: 1; transform: scale(1) rotate(-4deg); } 100% { opacity: 0; transform: translateY(-25px) scale(1.05) rotate(-4deg); } }
@keyframes resource-pop { 0% { opacity: 0; transform: translateY(4px); } 18%,72% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-4px); } }
@keyframes board-shake { 20%,60% { transform: translate(-2px,1px); } 40%,80% { transform: translate(2px,-1px); } 100% { transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes bob { 50% { transform: translateY(-4px) rotate(2deg); } }
@media (max-width: 1220px) {
  .header { padding-left: max(24px,env(safe-area-inset-left)); padding-right: max(24px,env(safe-area-inset-right)); gap: 18px; }
  main { padding-left: max(24px,env(safe-area-inset-left)); padding-right: max(24px,env(safe-area-inset-right)); }
  .game-layout { grid-template-columns: minmax(160px,180px) minmax(400px,580px) minmax(220px,270px); gap: 20px; }
  .nav-button { padding-inline: 12px; }
  .left-rail { display: none; }
  .game-layout { grid-template-columns: minmax(390px,620px) minmax(230px,290px); gap: 28px; }
}
@media (max-width: 1100px) { .nav { display: none; } }
@media (max-width: 900px) {
  .header { min-height: 76px; padding: max(10px,env(safe-area-inset-top)) max(20px,env(safe-area-inset-right)) 10px max(20px,env(safe-area-inset-left)); gap: 14px; }
  main { padding: 20px max(18px,env(safe-area-inset-right)) calc(94px + env(safe-area-inset-bottom)) max(18px,env(safe-area-inset-left)); }
  .page-heading { display: none; }
  .game-layout { display: flex; flex-direction: column; width: 100%; max-width: 620px; gap: 24px; margin: auto; }
  .play-area, .right-rail { width: 100%; }
  .right-rail { padding-top: 0; }
  #personal-cards { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  #personal-cards > * { margin: 0; }
  .spirit-card { height: 100%; }
  .collection-heading { margin-top: 4px; }
  .rail-description br { display: none; }
  .spirit-portrait { width: 68px; height: 68px; }
  .piece-level { top: 10px; right: 9px; }
  .game-card { padding: 18px 16px 15px; border-radius: 24px; }
  .level-heading { margin-bottom: 12px; }
  .board-wrap { width: 100%; max-width: 560px; padding: 6px; }
  .tile { border-radius: 10px; padding: 1px; }
  .game-note { min-height: 44px; }
  .below-game { margin-top: 8px; }
  .mobile-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; display: flex; align-items: stretch; justify-content: space-around; min-height: calc(68px + env(safe-area-inset-bottom)); padding: 5px max(6px,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(6px,env(safe-area-inset-left)); background: #fffffff2; backdrop-filter: blur(15px); border-top: 1px solid #cdbedc; }
  .mobile-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-width: 64px; min-height: 60px; padding: 4px 6px 6px; color: #6c517f; font-size: 13px; line-height: 1.2; }
  .mobile-nav button > span { display: grid; place-items: center; padding: 3px 13px; border-radius: 10px; }
  .mobile-nav svg { width: 22px; height: 22px; }
  .mobile-nav .active { color: #533276; font-weight: 700; }
  .mobile-nav .active > span { background: #e9def4; }
  .toast { bottom: calc(82px + env(safe-area-inset-bottom)); }
  footer { margin-top: 8px; padding-bottom: 8px; font-size: 11px; gap: 10px; letter-spacing: .5px; }
  .modal-backdrop { padding: max(14px,env(safe-area-inset-top)) max(14px,env(safe-area-inset-right)) max(14px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left)); }
  .modal { max-height: calc(100dvh - 28px); padding: 28px 24px; border-radius: 25px; }
}
@media (max-width: 700px) {
  .wallet-pill.essence, .wallet > .round-button { display: none; }
  .header { padding-left: max(14px,env(safe-area-inset-left)); padding-right: max(14px,env(safe-area-inset-right)); }
  .brand { font-size: 26px; gap: 7px; }
  .brand small { font-size: 10px; letter-spacing: 1.7px; }
  .brand-mark { width: 37px; height: 37px; }
  .wallet { gap: 6px; }
  .wallet-pill { padding: 8px 9px; min-width: 58px; gap: 5px; }
  .wallet-pill svg { width: 18px; height: 18px; }
  .wallet-plus { width: 16px; height: 16px; font-size: 12px; }
  .level-heading h2 { font-size: 21px; }
  .level-heading h2 span { font-size: 14px; margin-left: 7px; padding-left: 7px; }
}
@media (max-width: 520px) {
  :root { --tile-gap: 3px; }
  .header { min-height: 70px; }
  main { padding-top: 15px; padding-left: max(12px,env(safe-area-inset-left)); padding-right: max(12px,env(safe-area-inset-right)); }
  .game-card { padding: 15px 10px 13px; }
  .game-stats { grid-template-columns: 61px minmax(0,1fr) 93px; gap: 10px; margin-bottom: 12px; }
  .moves-stat { padding-right: 9px; }
  .moves-stat strong { font-size: 30px; }
  .moves-stat span { font-size: 11px; }
  .score-stat strong { font-size: 15px; }
  .score-stat small { font-size: 12px; }
  .goal-stat > span { font-size: 11px; }
  .goal-stat strong { font-size: 14px; }
  .board-wrap { padding: 5px; border-radius: 16px; }
  .board.size-8, .board.size-9 { --tile-gap: 2px; }
  .tile { border-radius: 8px; }
  .tile.personal:after { width: 12px; height: 12px; font-size: 9px; top: -3px; }
  .level-heading { gap: 8px; }
  .world-label { font-size: 11px; letter-spacing: 1px; }
  .level-heading h2 span { display: block; border-left: 0; margin: 4px 0 0; padding: 0; }
  .obstacle-goal { padding: 7px 9px; font-size: 13px; }
  .level-briefing { padding: 8px; font-size: 14px; }
  .game-note { font-size: 14px; padding-block: 8px; }
  .boosters { gap: 12px; padding-top: 13px; }
  .booster { min-width: 78px; font-size: 13px; padding-inline: 0; }
  .booster-art { width: 46px; height: 44px; }
  .below-game { font-size: 12px; }
  .below-game .text-button { font-size: 13px; }
  .below-game > span { max-width: 50%; }
  .collection-heading h2 { font-size: 25px; }
  #personal-cards { display: block; }
  #personal-cards > * { margin-bottom: 14px; }
  .spirit-portrait { width: 82px; height: 78px; }
  .spirit-info h3 { font-size: 24px; }
  .owned-label { font-size: 12px; }
  .spirit-skill { font-size: 14px; }
  .spirit-card-bottom { font-size: 14px; }
  .upgrade-small { font-size: 14px; }
  .modal { padding: 28px 20px; }
  .modal h2 { font-size: 28px; }
  .collection-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .collection-item { padding: 15px 8px; }
  .collection-item .gem { width: 100px; }
  .collection-item small { font-size: 13px; }
  .trail-list { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
  .trail-level { min-height: 108px; font-size: 13px; padding-inline: 5px; }
  .trail-level b { font-size: 27px; }
  .shop-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .shop-item { padding: 16px 9px; }
  .shop-item small, .shop-item button { font-size: 14px; }
  .shop-banner { padding: 14px; }
  .shop-banner button { margin: 4px 0 0; width: 100%; }
  .button-row { flex-wrap: wrap; }
  .button-row > * { flex-basis: 120px; }
  .skin-options { grid-template-columns: minmax(0,1fr); }
  .skin-option { display: grid; grid-template-columns: 58px minmax(0,1fr); column-gap: 10px; align-items: center; padding: 12px; font-size: 14px; text-align: left; }
  .skin-option > svg { grid-column: 1; grid-row: 1 / span 3; width: 54px; height: 54px; margin: 0; }
  .skin-option > span, .skin-option > small, .skin-option > .secondary-button { grid-column: 2; }
  .skin-option > .secondary-button { margin-top: 7px; padding-inline: 8px; }
  .skin-option small { font-size: 12px; }
  .cost-line { gap: 7px 12px; }
}
@media (max-width: 350px) {
  .header { padding-left: max(10px,env(safe-area-inset-left)); padding-right: max(10px,env(safe-area-inset-right)); gap: 8px; }
  .brand { font-size: 24px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand small { font-size: 9px; letter-spacing: 1.2px; }
  .wallet-pill { padding-inline: 7px; gap: 4px; min-width: 53px; }
  .wallet-plus { display: none; }
  main { padding-left: max(8px,env(safe-area-inset-left)); padding-right: max(8px,env(safe-area-inset-right)); }
  .game-card { padding-inline: 8px; }
  .game-stats { gap: 8px; grid-template-columns: 54px minmax(0,1fr) 88px; }
  .score-stat strong { font-size: 14px; }
  .score-stat small { font-size: 12px; }
  .boosters { gap: 8px; }
  .booster { min-width: 76px; font-size: 12px; }
}
@media (max-width: 400px) {
  .upgrade-comparison { grid-template-columns: minmax(0,1fr); gap: 10px; }
}
@media (max-width: 900px) and (orientation: landscape) and (max-height: 540px) {
  .header { min-height: 60px; padding-top: max(8px,env(safe-area-inset-top)); padding-bottom: 8px; }
  main { padding-top: 12px; padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
  .game-layout { max-width: 680px; }
  .level-heading { margin-bottom: 10px; }
  .game-card { padding-block: 14px; }
  .board-wrap { max-width: clamp(300px,calc(100dvh - 90px),440px); }
  .mobile-nav { min-height: calc(56px + env(safe-area-inset-bottom)); padding-top: 0; }
  .mobile-nav button { min-height: 54px; flex-direction: row; gap: 6px; font-size: 13px; }
  .mobile-nav button > span { padding: 3px 6px; }
  .toast { bottom: calc(66px + env(safe-area-inset-bottom)); }
}
/* A play screen, rather than a hero page, on short desktop displays. */
@media (min-width: 901px) and (max-height: 900px) {
  .header { min-height: 64px; padding-top: max(8px,env(safe-area-inset-top)); padding-bottom: 8px; }
  main { padding-top: 10px; }
  .page-heading, .left-rail { display: none; }
  .game-layout { grid-template-columns: minmax(360px,540px) minmax(240px,290px); gap: 28px; max-width: 858px; margin-inline: auto; }
  .right-rail { padding-top: 50px; }
  .level-heading { min-height: 40px; margin-bottom: 8px; }
  .world-label { font-size: 11px; line-height: 1.35; letter-spacing: 1px; }
  .level-heading h2 { font-size: 20px; line-height: 1.15; margin-top: 2px; }
  .level-heading h2 span { font-size: 13px; }
  .level-heading .round-button { width: 44px; height: 44px; }
  .game-card { padding: 12px 14px; }
  .game-stats { grid-template-columns: 68px minmax(0,1fr) 104px; gap: 12px; margin-bottom: 8px; }
  .moves-stat { padding-right: 10px; }
  .moves-stat strong { font-size: 28px; }
  .moves-stat span { margin-top: 3px; font-size: 11px; line-height: 1.2; white-space: nowrap; }
  .score-stat > div:first-child { margin-bottom: 8px; }
  .score-stat > div > span { font-size: 11px; }
  .score-stat strong { font-size: 15px; }
  .score-stat small { font-size: 12px; }
  .goal-stat { grid-template-columns: 24px auto; gap: 2px; }
  .goal-stat #goal-icon { width: 24px; height: 24px; }
  .goal-stat strong { font-size: 14px; }
  .goal-stat > span { font-size: 11px; line-height: 1.2; white-space: nowrap; }
  .obstacle-goals { gap: 6px; margin-bottom: 8px; }
  .obstacle-goal { min-height: 28px; gap: 5px; padding: 4px 7px; font-size: 12px; line-height: 1.2; }
  .obstacle-goal > svg, .obstacle-goal .icon { width: 18px; height: 18px; }
  .level-briefing { display: none; }
  .board-wrap { max-width: clamp(320px,calc(100dvh - 410px),380px); }
  .game-card:has(.obstacle-goal:nth-child(4)) .board-wrap { max-width: clamp(300px,calc(100dvh - 450px),360px); }
  .board-feedback { min-height: 36px; padding-top: 7px; }
  .stardust-readout { font-size: 13px; }
  .game-note { min-height: 34px; padding-block: 5px; font-size: 13px; line-height: 1.35; }
  .game-note > svg { width: 17px; height: 17px; }
  .boosters { padding-top: 9px; gap: 18px; }
  .booster { min-height: 62px; gap: 4px; font-size: 13px; }
  .booster-art { width: 44px; height: 40px; }
  .booster-art > svg { width: 24px; height: 24px; }
  .below-game { margin-top: 5px; }
  .below-game .text-button { min-height: 36px; font-size: 13px; }
  footer { padding-top: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .tile.hint { outline: 3px solid #7e51a6; outline-offset: 1px; }
  .modal-hero-gem, .shake { animation: none !important; }
  .tile.effect-source { outline: 3px solid #9b6b18; }
  .tile.clearing { animation: none !important; opacity: 1 !important; transform: none !important; filter: none !important; }
  .stardust-gain.show:not(:empty) { animation: none !important; opacity: 1; visibility: visible; transform: none; }
}
@media (forced-colors: active) {
  .tile { border: 1px solid ButtonText; }
  .tile.personal { outline: 2px solid Highlight; outline-offset: -2px; }
  .tile.selected, .tile.effect-source, .tile.effect-target { outline: 3px solid Highlight; }
  .primary-button, .secondary-button, .round-button { border: 1px solid ButtonText; }
  .tile.void { border: none; }
}
