/* A game frame shared by the lobby and the out-of-match screens. */
:root {
  --bg: #10151e;
  --panel: #19212d;
  --panel-raised: #232e3d;
  --line: #354152;
  --muted: #adb8c8;
  --text: #f1eee6;
  --gold: #e7b977;
  --gold-light: #f4d6a4;
  --teal: #92c3ec;
  --danger: #f19d99;
  --sidebar: 0px;
}

body { background: #10151e; }
.game-mobile-nav, .game-more, .lobby-mobile-deck, .lobby-mobile-lineages, .lobby-deck-preview { display: none; }
.game-shell { min-height: 100svh; background: radial-gradient(ellipse at 80% 15%, #24314555, transparent 55%), #10151e; }
.game-header { position: relative; z-index: 5; height: 78px; display: flex; align-items: stretch; gap: 40px; padding: 0 40px; background: #0c111be8; border-bottom: 1px solid #a3b0c324; box-shadow: 0 5px 25px #0002; }
.game-wordmark { display: flex; align-items: center; gap: 10px; flex-shrink: 0; font-size: 22px; font-weight: 600; letter-spacing: 5px; }
.game-mark { font-family: Georgia, serif; font-size: 43px; color: #edc388; line-height: 1; text-shadow: 0 0 24px #e8ba7450; }
.game-nav { display: flex; align-items: stretch; gap: 8px; }
.game-shell .game-nav .nav-item { width: auto; min-height: 0; border-radius: 0; padding: 0 16px; gap: 9px; color: #aab6c8; font-size: 12px; font-weight: 550; white-space: nowrap; }
.game-shell .game-nav .nav-item > span { display: inline; }
.game-shell .game-nav .nav-item > small { display: none; }
.game-shell .game-nav .nav-item .icon { width: 17px; height: 17px; }
.game-shell .game-nav .nav-item.active { color: #f3d2a1; background: linear-gradient(0deg, #edc38812, transparent 75%); }
.game-shell .game-nav .nav-item.active::before { display: block; top: auto; left: 12px; right: 12px; bottom: -1px; width: auto; height: 2px; border-radius: 0; background: #e7b977; box-shadow: 0 0 15px #e7b97770; }
.game-shell .game-nav .nav-item:hover { background: #ffffff08; color: #fff5e3; }
.game-player { display: flex; align-items: center; gap: 23px; margin-left: auto; }
.game-local { display: flex; align-items: center; gap: 8px; color: #acb9ca; font-size: 8px; letter-spacing: 1.3px; white-space: nowrap; }
.game-local i { width: 5px; height: 5px; border-radius: 50%; background: #9fc8ea; box-shadow: 0 0 9px #b0d8fb90; }
.game-settings { display: grid; place-items: center; background: transparent; width: 42px; height: 42px; color: #b9c3d3; border: 1px solid #8e9aaa25; border-radius: 50%; }
.game-settings:hover { color: #f4d6a4; border-color: #c8a26d; }
.game-main { padding: 38px 42px 55px; min-height: calc(100svh - 78px); max-width: 1530px; }
.game-shell.is-lobby .game-main { max-width: none; padding: 0; }
.game-lobby { min-height: calc(100svh - 78px); position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; }
.lobby-scenery { position: absolute; inset: 0; z-index: -2; background: url('/public/art/citadel.png') 60% 40% / cover; filter: saturate(.42) hue-rotate(12deg) brightness(.83); }
.game-lobby::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, #0b121ded 0%, #101622a6 38%, #0e142252 70%, #0c121cb8), linear-gradient(0deg, #0b111cf5 0%, #0c13275e 25%, transparent 65%); }
.game-lobby::after { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse at 65% 37%, #a9d9ff12, transparent 45%); }
.lobby-core { width: 100%; max-width: 1330px; flex: 1; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 55px; padding: 58px 48px 35px; min-height: 560px; }
.lobby-command { max-width: 500px; padding-bottom: 12px; }
.lobby-kicker { font-size: 9px; letter-spacing: 2.5px; font-weight: 600; color: #ddc9a9; display: flex; align-items: center; gap: 11px; }
.lobby-kicker > span { width: 25px; height: 1px; background: #d9b276; box-shadow: 0 0 10px #e4bf8244; }
.lobby-command h1 { font-family: Georgia, 'Times New Roman', serif; font-weight: 400; font-size: clamp(44px, 4.7vw, 66px); letter-spacing: -1.8px; line-height: 1.06; margin-top: 23px; color: #f6f0e3; text-shadow: 0 3px 22px #0005; }
.lobby-command > p { color: #bcc9da; font-size: 14px; line-height: 1.75; margin-top: 24px; }
.lobby-mode { display: flex; align-items: center; gap: 20px; margin-top: 37px; color: #aebccd; font-size: 9px; letter-spacing: 1px; }
.lobby-mode > span:first-child { color: #ecd0a7; display: flex; align-items: center; gap: 8px; }
.lobby-mode .icon { width: 14px; height: 14px; }
.lobby-mode i, .lobby-deck-info i { margin: 0 5px; font-style: normal; opacity: .6; }
.lobby-play { width: min(100%, 377px); min-height: 65px; display: flex; align-items: center; gap: 18px; padding: 0 25px; margin-top: 14px; background: linear-gradient(110deg, #f0cc95, #dab078); border: 1px solid #ffe3b8; color: #242029; text-transform: uppercase; font-size: 14px; font-weight: 750; letter-spacing: 1.4px; box-shadow: 0 8px 32px #0005, inset 0 0 0 4px #482f1510; clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
.lobby-play > .icon:first-child { width: 25px; height: 25px; }
.lobby-play > .icon:last-child { margin-left: auto; width: 18px; }
.lobby-play:hover { background: #f6d9ae; transform: translateY(-2px); }
.lobby-play:focus-visible { outline-offset: -7px; outline-color: #473520; }
.lobby-secondary-actions { display: flex; align-items: center; justify-content: space-between; max-width: 377px; gap: 12px; min-height: 54px; font-size: 10px; color: #a4b1c3; }
.lobby-secondary-actions button { background: none; min-height: 44px; padding: 0; display: inline-flex; align-items: center; gap: 7px; color: #c5d0df; font-size: 11px; }
.lobby-secondary-actions .icon { width: 14px; height: 14px; }
.lobby-secondary-actions button:hover { color: #f4d6a4; }
.lobby-arsenal { width: 100%; max-width: 510px; justify-self: end; padding-top: 20px; }
.lobby-card-fan { height: 347px; position: relative; max-width: 480px; margin: 0 auto 30px; perspective: 900px; }
.lobby-display-card { position: absolute; width: 174px; height: 263px; border: 1px solid #aa9171; border-radius: 10px 10px 6px 6px; overflow: hidden; background: #1a2334; box-shadow: 0 15px 25px #0009, inset 0 0 0 4px #bd926230; }
.lobby-display-card::after { content: ''; position: absolute; inset: 4px; border: 1px solid #e5ca902e; border-radius: 7px 7px 3px 3px; pointer-events: none; }
.lobby-display-card .portrait { filter: saturate(.7) brightness(.9); background-size: 500% 100%; }
.lobby-display-card-0 { left: 6%; top: 51px; transform: rotate(-13deg); }
.lobby-display-card-1 { z-index: 2; left: calc(50% - 97px); top: 13px; width: 194px; height: 293px; border-color: #e2bd7d; box-shadow: 0 18px 40px #000b, 0 0 30px #ffc17812; }
.lobby-display-card-1 .portrait { filter: saturate(.78) brightness(1.02); }
.lobby-display-card-2 { right: 6%; top: 51px; transform: rotate(13deg); }
.lobby-card-stars { position: absolute; top: 12px; right: 12px; color: #ffe1a3; font-size: 13px; letter-spacing: 2px; text-shadow: 0 1px 7px #000; }
.lobby-card-name { position: absolute; inset: auto 0 0; padding: 44px 16px 18px; background: linear-gradient(transparent, #0e1625ec 47%, #0e1422); }
.lobby-card-name small { display: block; margin-bottom: 5px; text-transform: uppercase; font-size: 8px; letter-spacing: 1.5px; color: #dab883; }
.lobby-card-name strong { display: block; font-family: Georgia, serif; font-size: 18px; line-height: 1.22; font-weight: 400; color: #f2eadd; }
.lobby-display-card-1 .lobby-card-name strong { font-size: 21px; }
.lobby-fan-glow { width: 330px; height: 35px; position: absolute; bottom: 0; left: calc(50% - 165px); border-radius: 50%; background: #a5d0fc18; filter: blur(15px); z-index: -1; }
.lobby-deck { display: flex; gap: 17px; align-items: center; text-align: left; width: 100%; min-height: 92px; padding: 16px 19px; border: 1px solid #b4c5dc30; border-top-color: #c0d8f95c; background: linear-gradient(115deg, #182536ed, #131c2bc9); box-shadow: 0 12px 30px #0002; color: #e9e6dd; }
.lobby-deck:hover { background: #243347e8; border-color: #95bcdf78; }
.lobby-deck-seal { font-size: 32px; color: #c7b698; width: 34px; flex-shrink: 0; text-align: center; }
.lobby-deck-info { flex: 1; min-width: 0; }
.lobby-deck-info > small { font-size: 8px; letter-spacing: 1.6px; color: #9fc4e6; }
.lobby-deck-info > strong { display: block; font-family: Georgia, serif; font-size: 21px; font-weight: 400; margin: 6px 0; }
.lobby-deck-info > span { color: #acb9cc; font-size: 10px; }
.lobby-deck-edit { color: #b4c4d9; font-size: 8px; letter-spacing: 1px; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.lobby-deck-edit .icon { width: 14px; height: 14px; }
.lobby-lineages { width: calc(100% - 96px); max-width: 1234px; margin: 0 auto; padding: 19px 0 33px; border-top: 1px solid #b5c7de28; }
.lobby-lineages-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.lobby-lineages-label > span { font-size: 8px; letter-spacing: 2px; color: #9caac0; }
.lobby-lineages-label button { min-height: 30px; padding: 0; background: none; color: #bfcadd; display: inline-flex; align-items: center; gap: 9px; font-size: 10px; }
.lobby-lineages-label button .icon { width: 13px; height: 13px; }
.lobby-race-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; }
.lobby-race { display: flex; align-items: center; text-align: left; gap: 11px; background: transparent; padding: 0; min-width: 0; min-height: 56px; }
.lobby-race-portrait { width: 46px; height: 54px; position: relative; flex-shrink: 0; overflow: hidden; border: 1px solid #b7c5d549; border-radius: 3px; }
.lobby-race-portrait .portrait { filter: saturate(.6); }
.lobby-race > span:nth-child(2) { min-width: 0; flex: 1; }
.lobby-race strong { display: block; color: #dbdfe8; font-size: 12px; font-weight: 500; }
.lobby-race small { display: block; color: #9faec1; font-size: 9px; line-height: 1.45; margin-top: 5px; }
.lobby-race > .icon { width: 12px; height: 12px; color: #8c9bb0; flex-shrink: 0; }
.lobby-race:hover strong { color: #f4d6a4; }
.lobby-race:hover .lobby-race-portrait { border-color: #e7b977; }

/* Existing collection, deck editor and guide adopt the same readable slate palette. */
.game-shell .page-heading h1 { font-size: 34px; color: #f1eee6; }
.game-shell .page-heading p { font-size: 13px; color: #acb9cb; }
.game-shell .eyebrow { color: #dbb983; }
.game-shell :is(.tool-card, .monster-card, .field-card, .guide-feature, .deck-summary, .deck-presets, .history-stats, .history-row) { background: #1a2330; border-color: #394658; }
.game-shell :is(.tool-card, .monster-card, .field-card):hover { border-color: #b3cce6; }
.game-shell :is(.tool-card.selected, .monster-card.selected) { border-color: #aed1f3; background: #243447; box-shadow: 0 0 0 2px #afd5ff28; }
.game-shell .selected-check { color: #172333; background: #add1f1; }
.game-shell .card-art::after { background: linear-gradient(0deg, #1a2330, transparent 45%, #090e1940); }
.game-shell .card-race { background: #111926db; color: #e6dfd3; border-color: #8799b04a; }
.game-shell :is(.card-body p, .tool-card p, .field-card p, .guide-feature > p) { color: #bdc9d9; }
.game-shell .card-body p { font-size: 11px; line-height: 1.6; }
.game-shell .card-body h3 { color: #f0eadf; font-size: 18px; }
.game-shell .card-stats { border-color: #9fb3cf26; }
.game-shell .card-stats small { color: #b7c7db; font-size: 7px; }
.game-shell :is(.tool-card .eyebrow, .field-card small, .fine-print, .history-row small, .guide-races span) { color: #a9b9ce; }
.game-shell .tool-card h3 { font-size: 14px; }
.game-shell .tool-card p { font-size: 12px; }
.game-shell .tool-symbol { color: #c3d9ef; background: #253448; border-color: #637c98; }
.game-shell .tool-pick { color: #a8c8e6; border-color: #607790; }
.game-shell :is(.search-box, .text-input, .filter, .preset-button, .button.secondary) { background: #182331; border-color: #45566d; color: #cad5e4; }
.game-shell .search-box input { color: #f1eee6; }
.game-shell :is(.filter.active, .preset-button.active) { border-color: #a5caec; background: #293d53; color: #e3f0ff; }
.game-shell .tab { color: #adbed2; }
.game-shell .tab.active { color: #dfecfa; border-color: #afd4f5; }
.game-shell .tab > span { color: #cad9eb; background: #293a4f; border-color: #455a73; }
.game-shell :is(.button.secondary:hover, .filter:hover, .preset-button:hover) { border-color: #bdd3ed; background: #2b3b50; }
.game-shell .button.primary { background: linear-gradient(110deg, #efce9a, #d8b07b); border-color: #f1cf9d; color: #25212a; }
.game-shell .text-button { color: #d5c8b4; }
.game-shell .text-input { color: #f2ecdf; }
.game-shell :is(.budget-row, .summary-list, .guide-races > div) { border-color: #39495d; }
.game-shell :is(.budget-row > span, .summary-list > div, .summary-list small, .history-date, .history-stats span) { color: #bac7d9; }
.game-shell .budget-meter { background: #324258; }
.game-shell .budget-meter i { background: #b0cde8; }
.game-shell .validation { background: #322e35; border-color: #8e7d70; color: #edd1ae; }
.game-shell .validation.valid { background: #25364a; border-color: #617e9b; color: #cae3fb; }
.game-shell :is(.guide-tip, .formula-example) { background: #223044; border-color: #475c76; color: #d6e2f1; }
.game-shell .guide-races b { color: #ded5c5; }
.game-shell .formula-example i { color: #a9bdd5; }
.game-shell .history-result.player { color: #b2d7f8; }
.game-shell .history-result.opponent { color: #eda9a4; }
.game-shell .history-row:hover { border-color: #8aa8c9; }
.game-shell .history-row > .icon { color: #a8bfd9; }
.game-shell .deck-summary { top: 20px; }
#toast { left: 50%; bottom: 25px; }

/* Dialogs live outside either game frame and therefore need a global palette. */
.dialog-backdrop { background: #060b16d6; }
.dialog { color: #f1eee6; background: #192333; border-color: #677c96; border-radius: 8px; box-shadow: 0 24px 100px #000a, 0 0 0 5px #9bbed610; }
.dialog > header { background: #192333; border-color: #4a5d75; }
.dialog header h2 { color: #f1eadf; }
.dialog .icon-button { color: #c8d5e5; }
.dialog .icon-button:hover { background: #2a3a50; border-color: #8da4be; }
.dialog-body > p { color: #c2cfdf; }
.dialog-body > h3 { color: #ebc68e; }
.dialog-body > p b { color: #f1eee6; }
.dialog .button.primary { background: linear-gradient(110deg, #efce9a, #d8b07b); color: #25212a; border-color: #f1cf9d; }
.dialog .button.secondary { color: #d8e3f0; background: #233248; border-color: #7389a3; }
.dialog .button.secondary:hover { background: #314760; border-color: #bed5ed; }
.dialog .guide-tip { background: #23354d; border-color: #557090; color: #c9d9eb; font-size: 12px; }
.dialog .guide-tip > .icon { color: #b0d6f5; }
.dialog .inspect-art { border-color: #667f9c; }
.dialog .inspect-stats { color: #becce0; border-color: #4a5f79; font-size: 12px; flex-wrap: wrap; }
.dialog .inspect-stats b { color: #edd2a8; }
.dialog .inspect-tool { background: radial-gradient(circle, #425c7c, #1c293d); color: #efcc93; border-color: #8da3bb; }
.dialog .setting-row { border-color: #425870; }
.dialog .setting-row strong { color: #eef0f3; font-size: 14px; }
.dialog .setting-row small { color: #bacbe0; font-size: 12px; line-height: 1.65; }
.dialog .setting-row input { accent-color: #b3d6f5; }
.dialog .log-details { background: #152031; border-color: #506784; }
.dialog .log-details > summary { color: #dfebf8; font-size: 13px; }
.dialog .log-details > summary > .icon { color: #b7d4ed; }
.dialog .log-details > summary > span { color: #b8cce1; }
.dialog .combat-log { border-color: #465e7a; }
.dialog .combat-log > div { color: #c6d5e7; font-size: 12px; line-height: 1.65; padding: 7px 0; }
.dialog .combat-log .icon { color: #a7cdeb; margin-top: 4px; }
.dialog .warning { color: #f0c990 !important; font-size: 12px; }
.dialog .fine-print { color: #b3c3d7; }

@media (min-width: 1500px) {
  .lobby-core { max-width: 1460px; gap: 100px; }
  .lobby-lineages { max-width: 1364px; }
  .lobby-arsenal { max-width: 540px; }
}
@media (max-width: 1150px) {
  .game-header { padding: 0 25px; gap: 28px; }
  .game-shell .game-nav .nav-item { padding: 0 11px; gap: 7px; }
  .game-local { display: none; }
  .game-player { gap: 0; }
  .lobby-core { gap: 25px; padding: 45px 36px 26px; }
  .lobby-command h1 { font-size: 51px; }
  .lobby-lineages { width: calc(100% - 72px); }
  .lobby-race-list { gap: 12px; }
  .lobby-race { gap: 8px; }
  .lobby-race small { font-size: 8px; }
  .lobby-race > .icon { display: none; }
  .lobby-display-card-0 { left: 0; }
  .lobby-display-card-2 { right: 0; }
}
@media (max-width: 850px) {
  .game-header { gap: 15px; height: 70px; padding: 0 20px; }
  .game-wordmark { font-size: 18px; letter-spacing: 3px; gap: 6px; }
  .game-mark { font-size: 34px; }
  .game-shell .game-nav .nav-item { font-size: 11px; padding: 0 10px; }
  .game-shell .game-nav .nav-item > .icon { display: none; }
  .game-nav { gap: 1px; }
  .game-settings { width: 34px; height: 34px; }
  .game-settings .icon { width: 18px; height: 18px; }
  .game-main { min-height: calc(100svh - 70px); padding: 28px 26px 40px; }
  .game-lobby { min-height: calc(100svh - 70px); }
  .lobby-core { padding: 38px 30px 30px; gap: 24px; min-height: 510px; }
  .lobby-command h1 { font-size: 44px; }
  .lobby-command > p { font-size: 12px; }
  .lobby-kicker { font-size: 7px; letter-spacing: 1.6px; }
  .lobby-mode { flex-wrap: wrap; gap: 10px; font-size: 8px; margin-top: 25px; }
  .lobby-play { font-size: 12px; min-height: 58px; padding: 0 18px; gap: 11px; }
  .lobby-secondary-actions { font-size: 9px; gap: 8px; }
  .lobby-secondary-actions button { font-size: 10px; }
  .lobby-card-fan { height: 285px; margin-bottom: 13px; }
  .lobby-display-card { width: 137px; height: 215px; }
  .lobby-display-card-1 { width: 158px; height: 249px; left: calc(50% - 79px); }
  .lobby-card-name { padding: 40px 12px 15px; }
  .lobby-card-name strong { font-size: 16px; }
  .lobby-display-card-1 .lobby-card-name strong { font-size: 18px; }
  .lobby-deck { padding: 13px 12px; gap: 12px; }
  .lobby-deck-info > strong { font-size: 18px; }
  .lobby-deck-info > span { font-size: 8px; }
  .lobby-deck-edit { font-size: 0; gap: 0; }
  .lobby-lineages { width: calc(100% - 60px); padding-bottom: 24px; }
  .lobby-race-portrait { width: 34px; height: 45px; }
  .lobby-race small { display: none; }
  .lobby-race strong { font-size: 10px; }
}
@media (max-width: 700px) {
  .game-header { display: grid; grid-template-columns: 1fr auto; height: auto; gap: 0; padding: 0 17px; }
  .game-wordmark { height: 58px; font-size: 20px; letter-spacing: 4px; }
  .game-player { grid-column: 2; grid-row: 1; }
  .game-settings { width: 37px; height: 37px; }
  .game-nav { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; margin: 0 -8px; height: 44px; }
  .game-shell .game-nav .nav-item { display: flex; flex-direction: row; padding: 0 8px; font-size: 10px; min-height: 44px; }
  .game-shell .game-nav .nav-item.active::before { left: 8px; right: 8px; }
  .game-main { min-height: calc(100svh - 102px); padding: 26px 18px 35px; }
  .game-shell .page-heading h1 { font-size: 29px; }
  .game-shell .page-heading p { font-size: 12px; }
  .game-lobby { min-height: calc(100svh - 102px); }
  .lobby-scenery { background-position: 63% 10%; background-size: auto 680px; background-repeat: no-repeat; filter: saturate(.42) brightness(.7); }
  .game-lobby::before { background: linear-gradient(0deg, #0d1421 2%, #111b2b36 55%, #10172488), linear-gradient(90deg, #0c1423aa, #0f182236); }
  .lobby-core { display: flex; flex-direction: column; gap: 13px; padding: 34px 23px 25px; min-height: 0; }
  .lobby-command { max-width: none; width: 100%; padding-bottom: 0; }
  .lobby-kicker { font-size: 8px; letter-spacing: 1.8px; }
  .lobby-command h1 { margin-top: 18px; font-size: 42px; line-height: 1.06; letter-spacing: -1.1px; }
  .lobby-command h1 br { display: none; }
  .lobby-command > p { font-size: 12px; margin-top: 15px; }
  .lobby-command > p br { display: none; }
  .lobby-mode { margin-top: 23px; font-size: 8px; gap: 18px; }
  .lobby-play { max-width: none; width: 100%; margin-top: 12px; min-height: 60px; padding: 0 22px; font-size: 13px; }
  .lobby-secondary-actions { max-width: none; font-size: 10px; }
  .lobby-arsenal { padding-top: 0; max-width: none; }
  .lobby-card-fan { display: none; }
  .lobby-deck { min-height: 87px; padding: 14px; gap: 13px; }
  .lobby-deck-seal { width: 31px; font-size: 32px; }
  .lobby-deck-info > strong { font-size: 20px; margin: 5px 0; }
  .lobby-deck-info > span { font-size: 9px; }
  .lobby-deck-info > small { font-size: 8px; }
  .lobby-deck-edit .icon { width: 17px; height: 17px; }
  .lobby-lineages { width: calc(100% - 46px); padding: 12px 0 23px; }
  .lobby-lineages-label { margin-bottom: 12px; }
  .lobby-lineages-label > span { font-size: 7px; letter-spacing: 1.4px; }
  .lobby-lineages-label button { font-size: 9px; min-height: 40px; }
  .lobby-race-list { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
  .lobby-race { flex-direction: column; gap: 8px; justify-content: flex-start; text-align: center; min-height: 83px; }
  .lobby-race-portrait { width: 100%; height: 64px; }
  .lobby-race strong { font-size: 9px; }
  .lobby-race > span:nth-child(2) { flex: none; width: 100%; }
  .game-shell .card-body h3 { font-size: 17px; }
  .game-shell .card-body p { font-size: 11px; }
  .game-shell .card-stats small { font-size: 6px; }
  .game-shell .deck-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .game-shell .deck-card-grid .card-art { height: 170px; }
  .game-shell .deck-card-grid .card-body h3 { font-size: 16px; min-height: 40px; }
  .game-shell .deck-card-grid .card-body p { font-size: 10px; }
  .game-shell .deck-card-grid .card-stats b { font-size: 17px; }
  .game-shell .deck-card-grid .card-race { font-size: 8px; }
  #toast { bottom: 20px; }
}
@media (max-width: 370px) {
  .lobby-core { padding-left: 18px; padding-right: 18px; }
  .lobby-command h1 { font-size: 38px; }
  .lobby-lineages { width: calc(100% - 36px); }
  .lobby-race-list { gap: 6px; }
  .lobby-race strong { font-size: 8px; }
}

/* Phone navigation stays within thumb reach; desktop keeps its existing header.
   The editor can position its save bar above --mobile-nav-height. */
@media (max-width: 700px) {
  .game-shell { --mobile-nav-height:calc(64px + env(safe-area-inset-bottom,0px)); min-height:100dvh; }
  .game-shell .game-header {
    display:flex; align-items:center; justify-content:space-between; gap:12px;
    height:auto; min-height:calc(56px + env(safe-area-inset-top,0px));
    padding:env(safe-area-inset-top,0px) max(16px,env(safe-area-inset-right,0px)) 0 max(16px,env(safe-area-inset-left,0px));
  }
  .game-shell .game-wordmark { min-height:44px; height:56px; font-size:18px; letter-spacing:3px; gap:7px; }
  .game-shell .game-wordmark .game-mark { font-size:33px; }
  .game-shell .game-header>.game-nav { display:none; }
  .game-shell .game-player { gap:6px; margin-left:auto; }
  .game-shell .game-settings { width:44px; height:44px; flex:none; border-radius:8px; }
  .game-shell .game-settings .icon { width:19px; height:19px; }
  .game-shell .game-main { min-height:calc(100dvh - 56px); padding-bottom:calc(var(--mobile-nav-height) + 24px); }
  .game-shell.is-lobby .game-main { padding-bottom:calc(var(--mobile-nav-height) + 12px); }
  .game-more { display:block; position:relative; }
  .game-more>summary { list-style:none; min-width:56px; min-height:44px; display:flex; align-items:center; justify-content:center; gap:6px; padding:0 7px; color:#bccadb; border:1px solid transparent; border-radius:8px; cursor:pointer; font-size:11px; }
  .game-more>summary::-webkit-details-marker { display:none; }
  .game-more>summary>span { font-size:13px; letter-spacing:1px; }
  .game-more[open]>summary, .game-more.has-current-page>summary { color:#f2d2a1; border-color:#c8aa703f; background:#283247; }
  .game-more-menu { position:absolute; top:calc(100% + 8px); right:0; min-width:204px; z-index:40; padding:7px; border:1px solid #536079; border-radius:10px; background:#172335; box-shadow:0 14px 34px #0008; }
  .game-shell .game-more-menu .nav-item { display:flex; flex-direction:row; justify-content:flex-start; width:100%; min-height:48px; padding:0 13px; gap:12px; color:#d6e1ed; font-size:13px; border-radius:6px; }
  .game-shell .game-more-menu .nav-item>.icon { width:19px; height:19px; }
  .game-shell .game-more-menu .nav-item>span { display:inline; }
  .game-shell .game-more-menu .nav-item.active { color:#f2d2a1; background:#334157; }
  .game-shell .game-more-menu .nav-item::before { display:none; }
  .game-shell .game-mobile-nav {
    display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:4px;
    position:fixed; z-index:30; left:0; right:0; bottom:0; height:var(--mobile-nav-height);
    padding:5px max(8px,env(safe-area-inset-right,0px)) calc(5px + env(safe-area-inset-bottom,0px)) max(8px,env(safe-area-inset-left,0px));
    background:#101a2afc; border-top:1px solid #8395ad38; box-shadow:0 -8px 24px #05091155;
  }
  .game-shell .game-mobile-nav .nav-item { position:relative; width:100%; min-width:0; min-height:44px; padding:5px 2px; display:flex; flex-direction:column; justify-content:center; align-items:center; gap:4px; border:0; border-radius:7px; background:transparent; color:#b0bed0; font-size:11px; line-height:1.2; white-space:nowrap; }
  .game-shell .game-mobile-nav .nav-item>span { display:block; }
  .game-shell .game-mobile-nav .nav-item>small { display:none; }
  .game-shell .game-mobile-nav .nav-item>.icon { display:block; width:20px; height:20px; flex:none; }
  .game-shell .game-mobile-nav .nav-item.active { color:#f0d3a4; background:#f0d3a410; }
  .game-shell .game-mobile-nav .nav-item.active::before { display:block; position:absolute; top:-5px; bottom:auto; left:calc(50% - 14px); right:auto; width:28px; height:2px; border-radius:0 0 2px 2px; background:#eac58a; }
  .game-shell .game-mobile-nav .nav-item:focus-visible, .game-more>summary:focus-visible { outline:2px solid #f3d5a7; outline-offset:-3px; }

  .game-shell .game-lobby { min-height:calc(100dvh - 56px - var(--mobile-nav-height) - 12px); overflow:visible; }
  .game-shell .lobby-core { display:block; flex:0; padding:24px max(20px,env(safe-area-inset-right,0px)) 4px max(20px,env(safe-area-inset-left,0px)); }
  .game-shell .lobby-kicker { font-size:8px; letter-spacing:1.5px; gap:8px; }
  .game-shell .lobby-kicker>span { width:19px; }
  .game-shell .lobby-command h1 { font-size:clamp(31px,8.2vw,36px); line-height:1.08; letter-spacing:-.8px; margin-top:12px; max-width:390px; }
  .game-shell .lobby-command>p { margin-top:10px; font-size:12px; line-height:1.55; max-width:350px; }
  .game-shell .lobby-command>p br, .game-shell .lobby-command h1 br { display:none; }
  .game-shell .lobby-mobile-deck { display:block; margin-top:19px; }
  .game-shell .lobby-arsenal { display:none; }
  .game-shell .lobby-mobile-deck .lobby-deck { min-height:78px; padding:12px 14px; gap:11px; border-radius:8px; }
  .game-shell .lobby-mobile-deck .lobby-deck-info>small { font-size:9px; letter-spacing:1.1px; }
  .game-shell .lobby-mobile-deck .lobby-deck-info>strong { font-size:20px; line-height:1.15; margin:5px 0; overflow-wrap:anywhere; }
  .game-shell .lobby-mobile-deck .lobby-deck-info>span { font-size:10px; line-height:1.5; }
  .game-shell .lobby-mobile-deck .lobby-deck-info i { margin:0 3px; }
  .game-shell .lobby-mobile-deck .lobby-deck-seal { display:none; }
  .game-shell .lobby-mobile-deck .lobby-deck-preview { display:block; position:relative; width:72px; height:52px; flex:none; }
  .game-shell .lobby-deck-preview-card { position:absolute; top:4px; left:0; width:32px; height:46px; overflow:hidden; border:1px solid var(--race-color,#bbcddd); border-radius:4px; background:#172438; box-shadow:0 3px 7px #0008; transform:rotate(-9deg); }
  .game-shell .lobby-deck-preview-card:nth-child(2) { top:0; left:20px; height:50px; z-index:2; transform:none; }
  .game-shell .lobby-deck-preview-card:nth-child(3) { left:40px; transform:rotate(9deg); }
  .game-shell .lobby-deck-preview-card .portrait { object-position:center 22%; }
  .game-shell .lobby-mobile-deck .lobby-deck-edit { min-width:44px; min-height:44px; flex:none; justify-content:flex-end; font-size:9px; letter-spacing:.5px; gap:4px; }
  .game-shell .lobby-mode { margin-top:19px; gap:8px 15px; font-size:9px; letter-spacing:.7px; }
  .game-shell .lobby-play { margin-top:10px; min-height:58px; padding:0 19px; font-size:13px; }
  .game-shell .lobby-friends { margin-top:10px; padding:12px 15px; min-height:65px; border-radius:6px; }
  .game-shell .lobby-friends strong { font-size:13px; }
  .game-shell .lobby-friends small { font-size:11px; line-height:1.4; }
  .game-shell .lobby-friends>.icon { width:20px; height:20px; flex:none; }
  .game-shell .lobby-secondary-actions { display:none; }
  .game-shell .lobby-secondary-actions.has-resume { display:flex; min-height:44px; justify-content:flex-end; }
  .game-shell .lobby-secondary-actions.has-resume button { font-size:12px; min-height:44px; padding:0 8px; }
  .game-shell .lobby-secondary-actions button[data-nav="guide"] { display:none; }
  .game-shell .lobby-training { margin-top:10px; padding:10px 1px; min-height:52px; font-size:12px; gap:4px 9px; color:#ded5c1; }
  .game-shell .lobby-training>small { font-size:10px; line-height:1.5; }
  .game-shell .lobby-lineages { display:none; }
  .game-shell .lobby-mobile-lineages { display:block; margin:8px max(20px,env(safe-area-inset-right,0px)) 0 max(20px,env(safe-area-inset-left,0px)); border-top:1px solid #9daec12b; }
  .lobby-mobile-lineages>summary { display:flex; align-items:center; justify-content:space-between; gap:12px; list-style:none; cursor:pointer; min-height:50px; padding:8px 0; color:#d2dce7; font-size:12px; }
  .lobby-mobile-lineages>summary::-webkit-details-marker { display:none; }
  .lobby-mobile-lineages>summary>span { display:flex; gap:9px; align-items:center; }
  .lobby-mobile-lineages>summary .icon { width:17px; height:17px; flex:none; }
  .lobby-mobile-lineages>summary>.icon { transform:rotate(90deg); }
  .lobby-mobile-lineages[open]>summary>.icon { transform:rotate(-90deg); }
  .game-shell .lobby-mobile-lineages .lobby-race-list { display:grid; grid-template-columns:1fr; gap:8px; }
  .game-shell .lobby-mobile-lineages .lobby-race { flex-direction:row; align-items:center; gap:12px; padding:8px 10px; min-height:64px; border:1px solid #61738e3b; border-radius:7px; background:#182437dd; text-align:left; }
  .game-shell .lobby-mobile-lineages .lobby-race-portrait { width:39px; height:46px; }
  .game-shell .lobby-mobile-lineages .lobby-race>span:nth-child(2) { flex:1; }
  .game-shell .lobby-mobile-lineages .lobby-race .race-badge { font-size:12px; }
  .game-shell .lobby-mobile-lineages .lobby-race small { display:block; font-size:11px; line-height:1.4; margin-top:5px; }
  .game-shell .lobby-mobile-lineages .lobby-race>.icon { display:block; width:14px; }
  .lobby-explore-collection { min-height:48px; width:100%; display:flex; align-items:center; justify-content:space-between; gap:12px; background:transparent; color:#f0d1a0; font-size:12px; padding:8px 3px; }
  .lobby-explore-collection .icon { width:17px; }
}
@media (max-width:700px) and (max-height:760px) {
  .game-shell .lobby-core { padding-top:17px; }
  .game-shell .lobby-command h1 { font-size:31px; margin-top:10px; }
  .game-shell .lobby-command>p { margin-top:8px; }
  .game-shell .lobby-mobile-deck { margin-top:14px; }
  .game-shell .lobby-mode { margin-top:14px; }
  .game-shell .lobby-play { min-height:54px; }
}

/* Account navigation remains within the existing desktop/mobile shell. */
.game-wallet { display:flex; align-items:center; justify-content:center; gap:5px; min-width:52px; min-height:44px; padding:7px; border:1px solid #c8aa703f; border-radius:8px; background:#e8c78d0b; color:#ecd1a1; font-size:12px; }
.game-wallet .icon { width:17px; height:17px; }
@media(min-width:701px) {
  .game-player { gap:9px; }
  .game-more { display:block; position:relative; }
  .game-more>summary { display:flex; align-items:center; min-height:44px; padding:0 10px; cursor:pointer; list-style:none; color:#bccadb; }
  .game-more>summary::-webkit-details-marker { display:none; }
  .game-more>summary>span { margin-right:6px; }
  .game-more-menu { position:absolute; right:0; top:100%; min-width:200px; padding:8px; background:#172335; border:1px solid #536079; border-radius:10px; box-shadow:0 14px 34px #0008; z-index:40; }
  .game-more-menu .nav-item { width:100%; min-height:48px; padding:10px; justify-content:flex-start; gap:12px; }
}
@media(max-width:700px) {
  .game-shell .game-mobile-nav { grid-template-columns:repeat(5,minmax(0,1fr)); }
  .game-shell .game-mobile-nav .nav-item { font-size:10px; }
  .game-shell .game-wordmark { font-size:16px; gap:6px; }
  .game-wallet { min-width:44px; }
  .game-wallet .icon { width:14px; }
  .game-more>summary { min-width:44px; padding:0 5px; }
}
