/* The live play surface has its own viewport budget; level select stays scrollable. */
body.in-level { overflow: hidden; }
.in-level #forge-announcer { position: fixed; left: 0; top: 0; }
.in-level #forge-app { height: 100dvh; max-width: 1180px; padding: max(4px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); display: flex; flex-direction: column; }
.gameplay-nav { height: 64px; flex: 0 0 64px; display: grid; grid-template-columns: 1fr 144px 1fr; gap: 8px; padding: 0; }
.gameplay-nav .collection-link { width: fit-content; min-height: 44px; font-size: 12px; }
.nav-logo .forge-logo { width: 124px; padding: 5px 9px 17px; filter: drop-shadow(0 3px #120e1dc7); }
.nav-logo .logo-rune { font-size: 24px; -webkit-text-stroke-width: .7px; text-shadow: 0 2px #506780, 2px 3px #111321; }
.nav-logo .logo-forge { font-size: 30px; -webkit-text-stroke-width: .7px; margin-top: 2px; text-shadow: 0 2px #ce6615, 2px 3px #251324; }
.nav-logo .forge-logo > svg { width: 35px; height: 23px; }
.nav-logo .forge-logo:before { inset: 2px 0 12px; }
.nav-logo .forge-logo:after { inset: 6px 5px 16px; }
.utility-toggle { justify-self: end; width: 44px; height: 44px; border: 2px solid #b6a0b4; border-radius: 10px; background: linear-gradient(#67536f, #33263e); color: #ffe7ab; box-shadow: inset 0 1px #fff5c655, 0 3px #160e20; font-size: 24px; line-height: 1; }
.utility-toggle:disabled { opacity: .5; }
.in-level .game-view { flex: 1; min-height: 0; width: 100%; max-width: 840px; padding: 8px 0 0; margin: 0 auto; }
.in-level .play-area { height: 100%; min-height: 0; display: block; }
.in-level .game-main { height: 100%; width: 100%; max-width: none; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 82px minmax(0, 1fr) 58px; grid-template-areas: 'hud' 'board' 'companion'; gap: 8px; }
.in-level .game-main.has-charge { grid-template-columns: minmax(0, 1fr) 96px; grid-template-areas: 'hud hud' 'board weapon' 'companion companion'; column-gap: 16px; }
.in-level .game-hud { grid-area: hud; grid-template-columns: 60px minmax(0, 1fr) 72px; gap: 10px; margin: 0; }
.in-level .metal-panel { border-width: 3px; border-radius: 10px; }
.in-level .metal-panel > span { font-size: 12px; }
.in-level .metal-panel > strong { font-size: 32px; line-height: 1; }
.in-level .level-plaque, .in-level .moves-plaque { padding: 8px 2px; }
.in-level .moves-plaque > strong { font-size: 36px; }
.in-level .objective-plaque { padding: 7px 12px; border-width: 3px; border-radius: 12px; }
.in-level .objective-plaque > h2 { position: static; translate: none; border: 0; box-shadow: none; border-radius: 5px; min-width: 0; width: 100%; font-size: 15px; line-height: 1.2; padding: 3px 8px; margin-bottom: 3px; }
.in-level .objective-content, .in-level .charge-objective .objective-content { min-height: 0; margin: 0; gap: 7px; }
.in-level .objective-icon { width: 36px; height: 36px; }
.in-level .objective-info > h3 { font-size: 14px; line-height: 1.2; letter-spacing: -.15px; margin: 0 0 3px; white-space: normal; }
.in-level .objective-meter { height: 21px; border-width: 2px; }
.in-level .objective-meter > strong { font-size: 16px; }
.in-level .combined-counters { margin: 0; gap: 5px; flex-wrap: nowrap; }
.in-level .combined-counters > span { padding: 2px 5px; font-size: 11px; gap: 6px; }
.in-level .board-stage { grid-area: board; min-width: 0; min-height: 0; padding: 12px; container-type: size; display: grid; place-items: center; }
.in-level .board-stage:has(.has-exits) { padding-bottom: 38px; }
.in-level .board-stage .board-wrap { width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); aspect-ratio: 1; margin: 0; }
.in-level .forge-exit { height: 30px; }
.in-level .forge-exit .rune-art { width: 23px; height: 23px; }
.in-level .forge-exit > span { font-size: 20px; }
.in-level .weapon-slot { grid-area: weapon; position: static; top: auto; left: auto; transform: none; width: 96px; align-self: center; margin: 0; }
.in-level .weapon { width: 96px; height: auto; display: block; margin: 0; padding: 0; }
.in-level .sword-frame { width: 100%; aspect-ratio: 120 / 440; position: relative; }
.in-level .sword-frame .sword { position: static; display: block; width: 100%; height: auto; max-height: none; rotate: none; transform: none; }
.in-level .weapon-caption { width: 96px; min-width: 0; padding: 6px 3px; }
.in-level .weapon-caption > span:first-child { font-size: 8px; }
.in-level .weapon-caption > strong { font-size: 25px; }
.in-level .weapon-caption > strong small { font-size: 15px; }
.in-level .weapon-state { display: none; }

/* One texture atlas supplies every expression, with a tighter head/shoulders crop in play. */
.knight-portrait { display: block; position: relative; flex: 0 0 auto; overflow: hidden; isolation: isolate; }
.knight-art { display: block; width: 100%; height: 100%; background-image: url('./assets/rune-knight-reactions-v1.png'); background-size: 400% 200%; background-position: var(--knight-x) var(--knight-y); background-repeat: no-repeat; filter: drop-shadow(0 1px 3px #061a30aa); }
.knight-compact { width: 66px; height: 56px; align-self: end; }
.knight-compact .knight-art { position: absolute; width: 78px; height: 78px; top: -1px; left: -6px; }
.knight-large { width: 180px; height: 180px; }
.knight-companion { grid-area: companion; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 0 12px 0 6px; background: linear-gradient(110deg, #3a2b45e8, #241b30e8); border: 2px solid #9c859a; border-radius: 11px; box-shadow: inset 0 1px #d9c0a555, 0 3px #120d1c; }
.knight-companion .board-status { flex: 1; min-width: 0; margin: 0; font-size: 13px; line-height: 1.15; text-align: left; color: #ffdf91; min-height: 0; }
.knight-companion .star-guide { font-size: 9px; line-height: 1.4; flex-basis: auto; order: 0; flex-shrink: 0; text-align: right; }
.knight-companion .star-guide b { font-size: 11px; }
.knight-idle .knight-art { animation: knight-breathe 4s ease-in-out infinite; }
.knight-progress .knight-art, .knight-objective .knight-art { animation: knight-nod .55s ease-out; }
.knight-big-play .knight-art, .knight-complete .knight-art { animation: knight-cheer .65s ease-out; }
.knight-hint .knight-art { filter: drop-shadow(0 0 4px #66d7ff99); }
@keyframes knight-breathe { 50% { transform: translateY(-1px); filter: drop-shadow(0 0 4px #54bfff66); } }
@keyframes knight-nod { 35% { transform: translateY(2px) rotate(-3deg); } }
@keyframes knight-cheer { 35% { transform: translateY(-4px) rotate(3deg); } }

/* Native dialogs keep the board inert and focus contained while utilities are open. */
.utility-menu { position: fixed; inset: max(58px, calc(env(safe-area-inset-top) + 52px)) max(12px, calc((100vw - 1152px) / 2)) auto auto; margin: 0; width: min(280px, calc(100vw - 24px)); padding: 16px; border-radius: 12px; text-align: left; }
.utility-menu::backdrop { background: #0d0b174d; backdrop-filter: none; }
.utility-menu header { display: flex; align-items: center; gap: 5px; margin-bottom: 10px; }
.utility-menu header > div { flex: 1; min-width: 0; }
.utility-menu .eyebrow { line-height: 1.4; font-size: 8px; letter-spacing: .8px; }
.utility-menu h2 { font-size: 21px; margin: 3px 0; }
.menu-close { width: 44px; min-width: 44px; font-size: 28px; padding: 0; }
.menu-item { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 48px; padding: 9px 12px; border: 1px solid #94778d; border-radius: 8px; margin-top: 8px; background: linear-gradient(#614b65, #3d2d49); text-align: left; font-size: 14px; font-weight: 900; box-shadow: 0 2px #160f20; }
.menu-item span { color: #ffd987; font-size: 21px; width: 23px; text-align: center; }
.menu-item:hover { border-color: #ffd884; }
.knight-dialog { width: min(560px, calc(100vw - 28px)); padding: 0 22px 20px; border: 5px solid #9b859d; border-radius: 17px; background: linear-gradient(135deg, #49384f, #261e33); box-shadow: 0 0 0 3px #1c1525, inset 0 0 0 2px #d0b4bb88, 0 15px 80px #080710b3; }
.panel-ribbon { margin: 0 -12px 12px; padding: 9px 8px; font-family: 'Fredoka', sans-serif; font-size: 23px; color: #fff1c3; background: linear-gradient(#bd492c, #782b2a); border: 2px solid #e2a253; border-top: 0; border-radius: 0 0 12px 12px; text-shadow: 0 2px #421c24; }
.panel-intro { display: flex; align-items: center; gap: 10px; text-align: left; }
.panel-copy { flex: 1; min-width: 0; }
.knight-dialog .panel-copy .eyebrow { font-size: 9px; line-height: 1.4; letter-spacing: .8px; color: #e8bd77; }
.knight-dialog .panel-copy h2 { font-size: 25px; margin: 6px 0 8px; color: #ffebba; }
.knight-dialog .panel-copy p:not(.eyebrow) { font-size: 13px; line-height: 1.45; margin: 0; }
.panel-goals { padding: 8px 12px; margin: 10px 0; list-style: none; background: linear-gradient(115deg, #f1ce91, #ffe4ad); color: #392026; border: 3px solid #bd8a55; border-radius: 10px; box-shadow: inset 0 0 0 1px #fff3c6; }
.panel-goals li { display: flex; align-items: center; gap: 10px; font-size: 13px; line-height: 1.3; font-weight: 900; }
.panel-goals li + li { margin-top: 5px; padding-top: 5px; border-top: 1px solid #a9764c55; }
.panel-goals .rune-art { width: 29px; height: 29px; flex-shrink: 0; }
.panel-goals li span { flex: 1; text-align: left; }
.panel-goals strong { padding: 3px 10px; background: #54303d; color: #fff5d7; border-radius: 18px; min-width: 67px; font-size: 17px; }
.knight-dialog .dialog-detail { margin: 10px 0 0; font-size: 11px !important; line-height: 1.5; }
.knight-dialog > .forge-button { margin-top: 16px; }
.knight-dialog .forge-button { min-height: 46px; font-size: 15px; padding: 9px 12px; border-radius: 10px; }
.knight-dialog .forge-button.primary { background: linear-gradient(#dcff65, #83d522 52%, #449715); border-color: #e8ff96; color: #203b13; text-shadow: 0 1px #eeffb2; box-shadow: 0 3px #1e4c19, inset 0 2px #f6ffce; }
.knight-dialog .dialog-actions { margin-top: 15px; gap: 9px; }
.knight-dialog > .stars { display: flex; justify-content: center; margin: 4px 0; font-size: 43px; }
.result-stats { display: flex; justify-content: space-between; gap: 10px; background: #17131f66; padding: 8px 10px; border: 1px solid #a58476; border-radius: 8px; font-weight: 900; margin: 0 !important; font-size: 12px !important; }
.result-stats b { color: #ffe24e; font-size: 18px; }
.result-actions { grid-template-columns: 1fr 1fr; }
.result-actions .next-button { grid-column: 1 / -1; }
.result-actions .replay-button:not(.primary) { background: linear-gradient(#70d8ff, #197cb5); border-color: #a7eaff; }
.result-actions .select-button { background: linear-gradient(#867097, #55416b); }
.fail-panel .panel-ribbon { background: linear-gradient(#d94934, #8d2328); }
.knight-dialog .final-note { font-size: 12px; margin: 8px 0 0; }
.master-result { border-color: #e5c477; }

@media (max-width: 760px) {
  .in-level #forge-app { padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .gameplay-nav { flex-basis: 48px; height: 48px; grid-template-columns: 1fr 104px 1fr; }
  .gameplay-nav .collection-link { font-size: 10px; gap: 3px; white-space: nowrap; }
  .gameplay-nav .collection-link > span { font-size: 23px; }
  .nav-logo .forge-logo { width: 98px; padding: 3px 6px 12px; }
  .nav-logo .logo-rune { font-size: 18px; }
  .nav-logo .logo-forge { font-size: 23px; }
  .nav-logo .forge-logo > svg { width: 27px; height: 17px; }
  .nav-logo .forge-logo:before { inset: 1px 0 9px; }
  .nav-logo .forge-logo:after { inset: 4px 4px 12px; }
  .utility-toggle { width: 44px; height: 40px; }
  .in-level .game-view { padding-top: 4px; }
  .in-level .game-main { height: min(100%, calc(100vw + 150px)); grid-template-rows: 78px minmax(0, 1fr) 48px; gap: 6px; }
  .in-level .game-main.has-charge { height: min(100%, calc(100vw + 200px)); grid-template-columns: minmax(0, 1fr); grid-template-rows: 78px 44px minmax(0, 1fr) 48px; grid-template-areas: 'hud' 'weapon' 'board' 'companion'; }
  .in-level .game-hud { grid-template-columns: 44px minmax(0, 1fr) 51px; gap: 7px; }
  .in-level .objective-plaque { padding: 6px 7px; }
  .in-level .objective-plaque > h2 { font-size: 14px; padding: 3px 5px; margin-bottom: 3px; }
  .in-level .objective-info > h3 { font-size: 12px; }
  .in-level .objective-icon { width: 28px; height: 30px; }
  .in-level .metal-panel > span { font-size: 10px; }
  .in-level .metal-panel > strong { font-size: 27px; }
  .in-level .moves-plaque > strong { font-size: 31px; }
  .in-level .combined-counters > span { font-size: 10px; gap: 4px; padding: 2px 4px; }
  .in-level .master-forge .objective-info > h3 { font-size: 11px; }
  .in-level .board-stage { padding: 10px; }
  .in-level .board-stage:has(.has-exits) { padding-bottom: 34px; }
  .in-level .weapon-slot { width: 100%; height: 44px; display: flex; justify-content: center; align-items: center; }
  .in-level .weapon-slot .weapon { display: grid; grid-template-columns: minmax(0, 1fr) 86px; gap: 10px; align-items: center; width: min(310px, 100%); height: 44px; padding: 0; }
  .in-level .weapon-slot .sword-frame { width: 100%; height: auto; aspect-ratio: 440 / 120; }
  .in-level .weapon-slot .sword-frame .sword { position: absolute; width: 27.272727%; height: auto; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-90deg); }
  .in-level .weapon-slot .weapon-caption { width: 86px; padding: 3px; }
  .in-level .weapon-caption > span:first-child { font-size: 7px; }
  .in-level .weapon-caption > strong { font-size: 21px; line-height: 1.1; }
  .in-level .weapon-caption > strong small { font-size: 13px; }
  .knight-companion { padding-right: 8px; gap: 8px; border-radius: 9px; }
  .knight-compact { width: 57px; height: 46px; }
  .knight-compact .knight-art { width: 67px; height: 67px; left: -5px; }
  .knight-companion .board-status { font-size: 11px; }
  .knight-companion .star-guide { font-size: 8px; }
  .knight-companion .star-guide b { font-size: 9px; }
  .utility-menu { top: max(54px, calc(env(safe-area-inset-top) + 52px)); right: 8px; }
  .knight-dialog { padding: 0 14px 15px; border-width: 4px; max-height: calc(100dvh - 24px); }
  .panel-ribbon { font-size: 20px; padding: 7px; margin: 0 -6px 9px; }
  .knight-large { width: 130px; height: 130px; }
  .panel-intro { gap: 7px; }
  .knight-dialog .panel-copy h2 { font-size: 21px; margin: 5px 0 7px; }
  .knight-dialog .panel-copy p:not(.eyebrow) { font-size: 12px; line-height: 1.4; }
  .knight-dialog .panel-copy .eyebrow { font-size: 8px; }
  .panel-goals { padding: 6px 9px; margin: 8px 0; }
  .panel-goals li { font-size: 12px; gap: 7px; }
  .panel-goals .rune-art { width: 24px; height: 24px; }
  .panel-goals strong { font-size: 16px; min-width: 61px; padding: 2px 7px; }
  .knight-dialog .dialog-detail { font-size: 10px !important; line-height: 1.4; }
  .knight-dialog > .stars { font-size: 36px; }
  .knight-dialog .forge-button { font-size: 13px; min-height: 44px; }
  .knight-dialog .dialog-actions { margin-top: 12px; }
  .result-stats { font-size: 11px !important; padding: 6px 8px; }
}
@media (max-width: 350px), (max-height: 620px) and (max-width: 760px) {
  .gameplay-nav { height: 44px; flex-basis: 44px; }
  .in-level .game-main { grid-template-rows: 70px minmax(0, 1fr) 44px; gap: 4px; }
  .in-level .game-main.has-charge { grid-template-rows: 70px 40px minmax(0, 1fr) 44px; }
  .in-level .objective-plaque > h2 { font-size: 12px; }
  .in-level .objective-info > h3 { font-size: 11px; }
  .in-level .objective-icon { width: 24px; height: 27px; }
  .in-level .combined-counters { gap: 3px; }
  .in-level .combined-counters > span { font-size: 9px; gap: 3px; padding: 2px 3px; }
  .in-level .weapon-slot, .in-level .weapon-slot .weapon { height: 40px; }
  .knight-compact { width: 50px; height: 42px; }
  .knight-compact .knight-art { width: 61px; height: 61px; }
  .knight-companion .board-status { font-size: 10px; }
  .knight-large { width: 105px; height: 105px; }
  .knight-dialog .panel-copy h2 { font-size: 18px; }
  .knight-dialog .panel-copy p:not(.eyebrow) { font-size: 11px; }
  .knight-dialog .panel-copy .eyebrow { font-size: 7px; }
  .knight-dialog .panel-goals { margin: 6px 0; }
}
@media (prefers-reduced-motion: reduce) { *, *:before, *:after { animation: none !important; transition: none !important; } }
.reshuffle-dialog { width: min(360px, calc(100vw - 28px)); padding: 14px; }
.reshuffle-dialog::backdrop { background: #100d1b70; backdrop-filter: blur(1px); }
.reshuffle-dialog .knight-large { width: 104px; height: 104px; }
.reshuffle-dialog .panel-copy h2 { font-size: 22px; margin: 0 0 8px; }
.reshuffle-dialog .panel-copy p { font-size: 16px !important; line-height: 1.4 !important; margin: 0; }
.expansion-chapters { margin-top: 18px; }
.expansion-chapters .level-copy strong { white-space: normal; }
.expansion-chapters .level-emblem { color: #f3c677; }
.in-level .order-forge .objective-icon { display: none; }
.order-counters { display: grid; grid-template-columns: repeat(var(--orders), minmax(0, 1fr)); gap: 4px; }
.order-counter { min-width: 0; display: flex; align-items: center; justify-content: center; gap: 3px; border: 1px solid #a87952; border-radius: 6px; background: #7d4c2a18; padding: 2px; white-space: nowrap; }
.order-counter .rune-art { width: 19px; height: 21px; flex-shrink: 0; }
.order-counter b { font-size: 12px; font-variant-numeric: tabular-nums; }
.order-counter.order-complete { background: #fff3ab99; border-color: #ad8025; }
.imprint-cell { position: relative; isolation: isolate; background: radial-gradient(ellipse, #41547644, #211b32 78%); }
.imprint-cell:before { content: ''; position: absolute; inset: 3px; border: 2px solid #a6c7e2; border-radius: 6px; box-shadow: inset 0 0 6px #a2d6fa55; pointer-events: none; }
.imprint-engraving { position: absolute; inset: 12%; display: block; opacity: .14; color: #c2e6ff; pointer-events: none; }
.imprint-cell .cell { z-index: 1; }
.imprint-badge { position: absolute; z-index: 2; top: 2px; right: 2px; width: 17px; height: 17px; display: grid; place-items: center; background: #20152c; border: 1px solid #b9a5bc; border-radius: 4px; font-size: 14px; line-height: 1; color: #d5f1ff; box-shadow: 0 1px 3px #080610; pointer-events: none; }
.imprint-badge .rune-art { width: 15px; height: 15px; }
.universal-imprint .imprint-badge { border-radius: 50%; border-color: #c5eaff; }
.imprint-active { background: radial-gradient(ellipse, #ffcd5540, #33243e 85%); }
.imprint-active:before { border-color: #ffe47b; box-shadow: inset 0 0 7px #ffc44a66, 0 0 4px #ffcd5d77; }
.imprint-active .imprint-engraving { opacity: .28; color: #ffdf6c; }
.imprint-check { position: absolute; bottom: 2px; right: 3px; z-index: 2; color: #fff2a6; font-size: 13px; font-weight: 1000; text-shadow: 0 1px 3px #251520; pointer-events: none; }
.imprint-charging:before { animation: imprint-charge .18s ease-out; }
@keyframes imprint-charge { 50% { background: #fff1a355; box-shadow: inset 0 0 13px #fff2a8, 0 0 9px #ffde68; } }
@media (max-width: 350px) { .order-counter .rune-art { width: 15px; height: 18px; } .order-counter b { font-size: 10px; } .imprint-badge { width: 14px; height: 14px; font-size: 12px; } .imprint-badge .rune-art { width: 12px; height: 12px; } }

/* The entry cards share the forge's stone, metal, runes and Knight artwork. */
body.in-mode-select { overflow: hidden; }
.in-mode-select #forge-announcer { position: fixed; left: 0; top: 0; }
.in-mode-select #forge-app { height: 100dvh; display: flex; flex-direction: column; padding: max(8px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); }
.in-mode-select .forge-nav { height: 52px; flex: 0 0 52px; }
.mode-select { flex: 1; min-height: 0; width: 100%; max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; padding: 12px 0 6px; }
.mode-heading { text-align: center; flex: 0 0 auto; }
.mode-heading .forge-logo { width: 225px; padding: 10px 15px 31px; margin: 0 auto 12px; }
.mode-heading .logo-rune { font-size: 48px; }
.mode-heading .logo-forge { font-size: 57px; }
.mode-heading .forge-logo > svg { width: 65px; height: 43px; }
.mode-heading h1 { width: fit-content; max-width: 100%; margin: 0 auto; padding: 9px 30px; border: 3px solid #d4b087; border-radius: 30px; background: linear-gradient(#604454, #2e203b); box-shadow: 0 0 0 3px #251626, inset 0 1px #ffe6b077, 0 5px 10px #150c1f; color: #ffedbd; font-size: 28px; }
.mode-cards { flex: 1; min-height: 0; max-height: 400px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; padding: 4px; }
.mode-card { min-width: 0; min-height: 0; position: relative; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: center; padding: 24px; text-align: left; border: 4px solid #ad919f; border-radius: 18px; background: radial-gradient(ellipse at 90% 85%, #5d3d7055, transparent 70%), linear-gradient(130deg, #49354f, #241c33); box-shadow: 0 0 0 3px #241725, inset 0 0 0 2px #d8bca58c, 0 7px 20px #10091b99; color: #ffedc0; }
.mode-card:hover, .mode-card:focus-visible { border-color: #ffe69a; outline: 2px solid #f9b735; outline-offset: 3px; }
.mode-free { background: radial-gradient(ellipse at 80% 80%, #1668a155, transparent 70%), linear-gradient(130deg, #49354f, #241c33); }
.mode-copy { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.mode-name { font-family: 'Fredoka', sans-serif; font-size: 32px; font-weight: 900; line-height: 1.1; text-shadow: 0 3px #180f25; }
.mode-description { font-size: 16px; line-height: 1.4; font-weight: 700; }
.mode-cta { display: flex; justify-content: center; align-items: center; gap: 14px; width: min(170px, 100%); min-height: 48px; border: 3px solid #fff0ab; border-radius: 24px; background: linear-gradient(#fff88a, #ffc62b 65%, #e99712); color: #392344; font-family: 'Fredoka', sans-serif; font-size: 24px; font-weight: 900; box-shadow: 0 3px #9f4a19, inset 0 2px #fffcca; }
.mode-cta > span { font-size: 17px; }
.mode-preview { position: relative; min-width: 0; transform: rotate(-4deg); }
.challenge-preview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.challenge-preview > span { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; padding: 7px 2px; border: 2px solid #c9b4c3; border-radius: 10px; background: linear-gradient(135deg, #796781, #35263e); box-shadow: 0 3px #100c1a, inset 0 0 0 2px #ffffff14; }
.challenge-preview b { font-size: 28px; line-height: 1; }
.challenge-preview i { font-size: 15px; font-style: normal; color: #ffda62; white-space: nowrap; }
.mini-rune-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 3px solid #af97b1; border-radius: 10px; padding: 4px; gap: 2px; background: #181224; box-shadow: 0 4px #100b18; }
.mini-rune-board > span { aspect-ratio: 1; min-width: 0; display: grid; place-items: center; background: #2a2037; border: 1px solid #79637e; border-radius: 4px; }
.mini-rune-board .rune-art { width: 84%; height: 84%; }
.free-preview .knight-large { position: absolute; bottom: -35px; left: -30px; width: 115px; height: 115px; transform: rotate(4deg); }
.preview-infinity { position: absolute; top: -24px; right: 0; font-size: 46px; line-height: 1; color: #ffe66b; text-shadow: 0 2px #412137; }
.choose-mode-link { display: block; width: fit-content; min-height: 44px; margin: 8px 0; }
.in-level .game-main.free-play-main { height: 100%; grid-template-rows: 64px minmax(0, 1fr) 58px; }
.free-play-hud { grid-area: hud; display: flex; justify-content: center; align-items: center; gap: 22px; margin: 0; padding: 6px 14px; background: linear-gradient(#604454, #30213c); }
.free-play-hud h1 { margin: 0; font-size: 28px; }
.free-play-hud p { margin: 0; font-size: 16px; font-weight: 900; color: #ffdf86; }
.free-play-hud p > span { font-size: 32px; vertical-align: middle; margin-right: 5px; }
.free-play .knight-companion { position: relative; }
.free-play .knight-progress .knight-art { filter: drop-shadow(0 0 4px #6ad9ff); }
.free-play .knight-companion[data-reaction="big-play"]:after { content: '✦  ✧'; position: absolute; left: 62px; bottom: 34px; font-size: 20px; color: #82eaff; pointer-events: none; animation: knight-sparkle .6s ease-out both; }
@keyframes knight-sparkle { from { opacity: 0; transform: translateY(4px) scale(.6); } 40% { opacity: 1; } to { opacity: 0; transform: translateY(-10px) scale(1.1); } }
.knight-dialog .panel-copy .free-help-note { margin-top: 10px; color: #ffe38c; }
@media (max-width: 760px) {
  .in-mode-select #forge-app { padding: max(4px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .in-mode-select .forge-nav { height: 44px; flex-basis: 44px; }
  .in-mode-select .nav-note { display: none; }
  .in-mode-select .collection-link { font-size: 11px; }
  .mode-select { gap: 14px; padding-top: 5px; }
  .mode-heading .forge-logo { width: 170px; padding: 6px 10px 24px; margin-bottom: 8px; }
  .mode-heading .logo-rune { font-size: 35px; }
  .mode-heading .logo-forge { font-size: 42px; }
  .mode-heading .forge-logo > svg { width: 48px; height: 32px; }
  .mode-heading h1 { font-size: 22px; padding: 7px 24px; }
  .mode-cards { max-height: 540px; grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .mode-card { padding: 16px; border-width: 3px; gap: 16px; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  .mode-copy { gap: 9px; }
  .mode-name { font-size: 29px; }
  .mode-description { font-size: 14px; }
  .mode-cta { min-height: 42px; width: 155px; font-size: 22px; }
  .challenge-preview { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .challenge-preview b { font-size: 26px; }
  .challenge-preview i { font-size: 11px; }
  .challenge-preview > span { padding: 7px 0; }
  .free-preview .knight-large { width: 90px; height: 90px; bottom: -20px; left: -20px; }
  .preview-infinity { font-size: 34px; top: -17px; }
  .in-level .game-main.free-play-main { grid-template-rows: 60px minmax(0, 1fr) 48px; }
  .free-play-hud { gap: 14px; padding: 5px 10px; }
  .free-play-hud h1 { font-size: 24px; }
  .free-play-hud p { font-size: 13px; }
  .free-play-hud p > span { font-size: 27px; }
}
@media (max-width: 350px), (max-height: 650px) and (max-width: 760px) {
  .mode-heading .forge-logo { width: 142px; padding: 4px 8px 20px; margin-bottom: 5px; }
  .mode-heading .logo-rune { font-size: 29px; }
  .mode-heading .logo-forge { font-size: 34px; }
  .mode-heading .forge-logo > svg { width: 38px; height: 25px; }
  .mode-heading h1 { font-size: 19px; padding: 6px 19px; }
  .mode-select { gap: 10px; }
  .mode-cards { gap: 10px; }
  .mode-card { padding: 12px; gap: 11px; }
  .mode-name { font-size: 25px; }
  .mode-description { font-size: 14px; line-height: 1.3; }
  .mode-copy { gap: 8px; }
  .mode-cta { min-height: 36px; font-size: 20px; border-width: 2px; }
  .challenge-preview i { font-size: 9px; }
  .challenge-preview b { font-size: 22px; }
  .challenge-preview > span { padding: 4px 0; }
  .free-preview .knight-large { width: 73px; height: 73px; bottom: -10px; left: -12px; }
  .in-level .game-main.free-play-main { grid-template-rows: 56px minmax(0, 1fr) 44px; }
}
@media (min-width: 761px) and (max-height: 500px) {
  .in-level .game-main.free-play-main { grid-template-columns: minmax(0, 1fr) 190px; grid-template-rows: minmax(0, 1fr) 64px; grid-template-areas: 'board hud' 'board companion'; gap: 12px; }
  .free-play-hud { flex-direction: column; gap: 12px; text-align: center; }
  .in-mode-select .forge-nav { height: 44px; flex-basis: 44px; }
  .mode-select { gap: 12px; padding-top: 0; }
  .mode-heading { display: flex; align-items: center; justify-content: center; gap: 18px; }
  .mode-heading .forge-logo { width: 105px; padding: 3px 5px 14px; margin: 0; }
  .mode-heading .logo-rune { font-size: 22px; }
  .mode-heading .logo-forge { font-size: 27px; }
  .mode-heading .forge-logo > svg { width: 32px; height: 21px; }
  .mode-heading h1 { margin: 0; font-size: 22px; }
  .mode-card { padding: 16px; gap: 12px; }
  .mode-copy { gap: 10px; }
  .mode-name { font-size: 25px; }
  .mode-description { font-size: 14px; }
  .mode-cta { min-height: 40px; font-size: 21px; }
  .challenge-preview { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .challenge-preview i { font-size: 11px; }
  .free-preview .knight-large { width: 85px; height: 85px; bottom: -16px; left: -16px; }
}
