:root {
  color-scheme: light;
  --ink: #193e35;
  --forest: #234c40;
  --deep: #183b34;
  --moss: #607666;
  --paper: #fffdf3;
  --line: #c6cbb8;
  --gold: #f4c875;
  --serif: "Noto Serif CJK SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --sans: "Instrument Sans", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  font-family: var(--sans);
  color: var(--ink);
  background: #f5f3e8;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; background: #f5f3e8 url('art/ui/paper-map.webp') center / cover fixed; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:focus-visible, a:focus-visible { outline: 3px solid #bd692c; outline-offset: 3px; }
button, img { -webkit-user-drag: none; }
button { user-select: none; }
img { display: block; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
#readout { position: fixed; top: 0; left: 0; }
.shell { position: relative; max-width: 1248px; margin: 0 auto; padding: clamp(22px,4.5vh,54px) clamp(24px,3vw,48px) 40px; }
.mast, .brand, .tools, .tool, .field-head, .clock, .inspect, .field-hud, .hp-tag, .hp-line, .wave-tag, .order-bar, .board-head, .board-heading, .raised-count, .instruction, .army-key, .key-item, .ledger-head, .ledger-head h2, .ledger-tabs, .dialog-heading, .actions { display: flex; align-items: center; }
.mast { justify-content: space-between; gap: 12px; padding: 0 1px 19px; border-bottom: 1px solid #b5bca4; margin-bottom: 24px; }
.brand { gap: 10px; }
.brand-mark { width: 63px; height: 63px; object-fit: contain; transform: rotate(-8deg); }
.brand-type { display: grid; justify-items: start; }
h1 { font-family: var(--serif); font-weight: 900; font-size: clamp(30px,3.4vw,43px); line-height: 1.12; letter-spacing: .075em; }
.wordmark { font: 700 11px/1.3 Georgia, 'Times New Roman', serif; text-transform: uppercase; letter-spacing: .31em; color: #736139; margin: 3px 0 0 2px; }
.tools { gap: 8px; }
.tool, .close-button, .secondary { background: #fffdf2; border: 1px solid #b5c1ac; border-radius: 8px; }
.tool { height: 42px; padding: 0 13px; gap: 6px; font-weight: 750; font-size: 14px; color: #365247; }
.tool img { width: 21px; height: 21px; }
.tool.sound { width: 42px; padding: 0; justify-content: center; }
.tool:hover, .secondary:hover, .close-button:hover { background: #eaf0df; border-color: #839f88; }
.tool:active, .primary:active, .secondary:active { transform: translateY(1px); }
.console { display: grid; grid-template-columns: minmax(0,1.42fr) minmax(0,1fr); grid-template-areas: 'field board' 'ledger board'; align-items: start; grid-template-rows: min-content 1fr; gap: 16px 22px; }
.paper-card { min-width: 0; background: var(--paper); border: 1px solid #b0b9a3; border-radius: 13px; box-shadow: 0 3px 0 #cbd0bc, 0 10px 25px #3c513211; }
.field-card { grid-area: field; overflow: hidden; }
.field-head { gap: 12px; min-height: 77px; padding: 9px 19px 10px 17px; background: linear-gradient(100deg,#f5f5e5,#fffdf3 68%); }
.chapter-flag { flex: none; min-width: 44px; padding: 5px 5px 9px; text-align: center; color: #fff6d8; background: #2b5748; clip-path: polygon(0 0,100% 0,100% 84%,50% 100%,0 84%); }
.chapter-flag span { display: block; color: #e6e7c7; font-size: 10px; font-weight: 700; letter-spacing: .09em; }
.chapter-flag b { display: block; font: 700 24px/1 Georgia,serif; font-variant-numeric: tabular-nums; }
.location { flex: 1; min-width: 0; }
.location h2 { font-family: var(--serif); font-size: clamp(22px,2.25vw,31px); font-weight: 900; line-height: 1.23; letter-spacing: .06em; }
.inspect { gap: 4px; padding: 0 1px; min-height: 20px; font-size: 12px; font-weight: 650; color: #596950; background: none; border: 0; }
.inspect img { width: 13px; height: 13px; }
.inspect:hover { color: #244f3b; text-decoration: underline; }
.clock { gap: 6px; padding: 6px 9px; color: #3d554b; background: #eeefdf; border: 1px solid #d3d8c3; border-radius: 5px; font: 700 15px/1.15 'IBM Plex Mono', ui-monospace, 'Courier New', monospace; font-variant-numeric: tabular-nums; }
.clock img { width: 17px; height: 17px; }
.theatre { position: relative; aspect-ratio: 2.28; isolation: isolate; overflow: hidden; border-block: 1px solid #8da58b; background: #bcd7ba; }
.terrain, .theatre canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.terrain { object-fit: cover; object-position: 9% 70%; }
.theatre canvas { display: block; }
.field-hud { position: absolute; inset: 9px 11px auto; justify-content: space-between; align-items: flex-start; pointer-events: none; }
.hp-tag, .wave-tag { color: #fff8e6; background: #193e36eb; border: 1px solid #e0e9ca89; box-shadow: 0 1px 3px #172c2736; border-radius: 6px; }
.hp-tag { gap: 4px; padding: 4px 7px 5px 5px; }
.hp-tag > img { width: 18px; height: 18px; }
.hp-track { min-width: 57px; }
.hp-line { justify-content: space-between; gap: 7px; font-size: 11px; line-height: 1.2; }
.hp-line span { font: 700 11px/1 'Courier New', monospace; }
.meter { height: 3px; margin-top: 3px; overflow: hidden; background: #5d7263; border-radius: 3px; }
.meter i { display: block; width: 100%; height: 100%; background: #addca7; transition: width .12s ease; }
.wave-tag { gap: 5px; min-height: 24px; padding: 2px 7px; font-size: 12px; font-weight: 750; }
.wave-tag i { width: 8px; height: 10px; background: #f4cc79; clip-path: polygon(0 0,100% 0,75% 32%,100% 62%,22% 62%,22% 100%,0 100%); }
.field-message { pointer-events: none; position: absolute; left: 50%; top: 23%; white-space: nowrap; transform: translate(-50%,4px); opacity: 0; transition: opacity .15s, transform .15s; padding: 3px 11px 4px; border: 1px solid #ceddb7; background: #234a3ee8; border-radius: 999px; color: #fff2c7; font-weight: 750; font-size: 13px; }
.field-message.show { opacity: 1; transform: translate(-50%,0); }
.order-bar { padding: 10px 16px; min-height: 68px; gap: 11px; background: #f5f3e3; }
.order-symbol { display: grid; width: 37px; height: 37px; place-items: center; flex: none; border: 1px solid #d6c7a1; border-radius: 50%; background: #f8ebc9; }
.order-symbol img { width: 24px; height: 24px; }
.order-copy { min-width: 0; flex: 1; }
.order-copy strong { display: block; font: 900 19px/1.3 var(--serif); }
.order-copy span { display: block; color: #526455; margin-top: 2px; font-size: 13px; line-height: 1.4; }
.primary { white-space: nowrap; font-size: 15px; font-weight: 850; padding: 9px 18px; border: 1px solid #936f38; border-radius: 7px; background: #f4ca7e; color: #3c3820; box-shadow: inset 0 1px #fff1c2,0 2px #977848; }
.primary:hover { background: #ffda93; }
.remaining { font-size: 13px; color: #345d4a; white-space: nowrap; font-variant-numeric: tabular-nums; }
.board-card { grid-area: board; min-width: 0; padding: 0 13px 5px; color: #f6f2d8; background: #23483d; background: linear-gradient(115deg,#315346,#204539 65%,#1c3d34); border-radius: 13px; border: 1px solid #183d32; box-shadow: 0 4px 0 #96a58d,0 12px 26px #3548311c; }
.board-head { justify-content: space-between; min-height: 62px; gap: 8px; padding: 4px 6px; }
.board-heading { gap: 8px; }
.board-heading img { width: 24px; height: 24px; }
.board-heading h2 { color: #fff5d8; font: 850 23px/1.25 var(--serif); letter-spacing: .06em; }
.raised-count { gap: 6px; font-size: 12px; font-weight: 650; white-space: nowrap; color: #dfebd7; }
.raised-count img { width: 18px; height: 18px; }
.raised-count b { color: #ffdd92; font: 700 18px/1.1 Georgia,serif; font-variant-numeric: tabular-nums; }
.board-space { min-height: 0; display: grid; place-items: center; }
.board-bezel { width: 100%; aspect-ratio: 1; padding: 5px; border-radius: 10px; border: 1px solid #8d9e7a; background: #17382e; box-shadow: inset 0 0 0 1px #0f2f24; }
.board-bezel:has(.warning) { border-color: #edb465; }
#board { --cell-gap: clamp(3px,.3vw,5px); width: 100%; height: 100%; aspect-ratio: 1; display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); grid-template-rows: repeat(6,minmax(0,1fr)); gap: var(--cell-gap); border-radius: 5px; position: relative; overflow: clip; touch-action: none; user-select: none; }
.tile { position: relative; display: grid; place-items: stretch; min-width: 0; min-height: 0; padding: 0; background: transparent; border: 0; border-radius: 9px; touch-action: none; }
.tile:focus-visible { outline: 3px solid #fff7ab; outline-offset: -3px; z-index: 3; }
.face { position: relative; display: grid; width: 100%; height: 100%; place-items: center; border-radius: clamp(6px,.7vw,10px); background: linear-gradient(150deg,var(--high),var(--low)); border: 1px solid var(--edge); box-shadow: inset 0 -2px 0 var(--base),inset 0 1px 0 #fffbe899; pointer-events: none; }
.face::before { content: ''; position: absolute; inset: 3px; border: 1px solid #fff9dc55; border-radius: inherit; pointer-events: none; }
.face img { position: relative; width: 79%; height: 79%; object-fit: contain; }
.t0 { --high:#f6d7bf; --low:#edb79e; --edge:#edc3ad; --base:#c89076; }
.t1 { --high:#d8eaf1; --low:#a6cde0; --edge:#c1dce7; --base:#82aaba; }
.t2 { --high:#deebc9; --low:#b1d39d; --edge:#d1e4b9; --base:#8dab80; }
.t3 { --high:#f0e2f4; --low:#d2bbdf; --edge:#e3d0eb; --base:#ad94bc; }
@media(hover:hover) { .tile:hover .face { filter: brightness(1.045); } }
.tile.chosen { z-index: 4; }
.tile.chosen .face { outline: 3px solid #fff4a3; outline-offset: -3px; filter: brightness(1.08); box-shadow: inset 0 0 0 5px #897237; }
.tile.hinted .face::after { content: ''; position: absolute; inset: 3px; border: 2px dashed #3b5d38; border-radius: inherit; animation: hint-glow 1.15s ease-in-out infinite alternate; pointer-events: none; }
.tile.warning::after { content: '›'; position: absolute; inset: 0; text-align: right; padding-right: 3px; line-height: 1; font-size: 18px; color: #6b2b22; font-weight: 950; border-block: 3px solid #d66e49; border-radius: 4px; background: linear-gradient(0deg,#e68d4d20 0,transparent 35%); animation: alert-glow .45s ease-in-out infinite alternate; pointer-events: none; }
.instruction { min-height: 38px; gap: 6px; justify-content: center; color: #e2ecd8; padding: 6px 3px; text-align: center; font-size: 13px; font-weight: 600; line-height: 1.3; }
.instruction img { width: 17px; height: 17px; flex: none; }
.instruction.combo { color: #ffe49d; }
.instruction.alert { color: #ffd49c; }
.army-key { justify-content: space-around; margin: 0 1px; padding: 4px 0 5px; border-top: 1px solid #78917b80; }
.key-item { min-height: 32px; gap: 2px; padding: 0 4px; border: 0; border-radius: 5px; background: transparent; color: #e8ecdb; font-weight: 650; font-size: 13px; }
.key-item img { width: 23px; height: 23px; }
.key-item:hover { background: #416656; }
.ledger { grid-area: ledger; padding: 14px 15px 15px; }
.ledger-head { justify-content: space-between; gap: 5px; margin-bottom: 12px; }
.ledger-head h2 { gap: 6px; font: 850 20px/1.25 var(--serif); }
.ledger-head h2 img { width: 24px; height: 24px; }
.ledger-tabs { background: #eeefdf; border: 1px solid #ccd2b9; border-radius: 6px; padding: 2px; }
.ledger-tabs button { background: transparent; border: 0; border-radius: 4px; padding: 4px 8px; font-weight: 700; font-size: 12px; color: #516858; }
.ledger-tabs button[aria-pressed="true"] { color: #faf5df; background: #3d6350; }
.roster-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; }
.roster-grid.foes { grid-template-columns: repeat(auto-fit,minmax(100px,1fr)); }
.unit-card { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(44px,.87fr) minmax(0,1fr); align-items: center; width: 100%; min-width: 0; min-height: 79px; gap: 2px; text-align: left; border: 1px solid var(--card-line,#d3c8b7); background: linear-gradient(110deg,var(--wash,#f0e9de),#fffaf0); border-radius: 7px; padding: 3px 4px; }
.unit-card:hover { border-color: #83a080; }
.unit-card img { width: 100%; height: 69px; object-fit: contain; }
.unit-card strong, .unit-card small { display: block; }
.unit-card strong { font-weight: 850; font-size: 15px; line-height: 1.3; }
.unit-card small { color: #526656; font-size: 11px; line-height: 1.45; margin-top: 2px; }
.unit-card[data-kind="blade"],.unit-visual[data-kind="blade"] { --wash:#f4dfcf; --card-line:#e2c5ac; }
.unit-card[data-kind="guard"],.unit-visual[data-kind="guard"] { --wash:#dcebf0; --card-line:#c2d8da; }
.unit-card[data-kind="bow"],.unit-visual[data-kind="bow"] { --wash:#e3ecce; --card-line:#c9d4b5; }
.unit-card[data-kind="spark"],.unit-visual[data-kind="spark"] { --wash:#eee1ed; --card-line:#d9cadd; }
.roster-grid.foes .unit-card { grid-template-columns: minmax(52px,.65fr) minmax(0,1fr); }
.roster-grid.foes .unit-card small { font-size: 12px; }
.battle-tip { margin: 8px 0 0; font-size: 13px; color: #546354; line-height: 1.5; }
.fly { width: 23px; height: 23px; position: fixed; z-index: 8; pointer-events: none; }
.dialog-layer { position: fixed; inset: 0; z-index: 20; background: #172f2892; display: grid; place-items: center; padding: max(13px,env(safe-area-inset-top)) max(13px,env(safe-area-inset-right)) max(13px,env(safe-area-inset-bottom)) max(13px,env(safe-area-inset-left)); backdrop-filter: blur(3px); }
.dialog { background: #fffdf3; border: 1px solid #8ea58d; border-radius: 13px; box-shadow: 0 6px 0 #526b53,0 15px 55px #182b253e; width: min(440px,100%); max-height: min(90dvh,880px); overflow: auto; overscroll-behavior: contain; padding: 19px; scrollbar-color: #9daf96 #f4f2e5; }
.dialog:focus { outline: none; }
.dialog-heading { justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.dialog-heading h2 { color: var(--forest); font: 900 24px/1.3 var(--serif); }
.close-button { flex: none; width: 36px; height: 36px; padding: 0; display: grid; place-content: center; font-size: 27px; line-height: 1; font-weight: 400; }
.map-choices { display: grid; gap: 8px; }
.map-choice { width: 100%; display: flex; align-items: center; gap: 10px; padding: 5px 9px 5px 5px; background: #f3f3e6; border: 1px solid #ccd1bd; border-radius: 7px; text-align: left; }
.map-choice.current, .map-choice:hover { background: #e8efdf; border-color: #83a187; }
.map-thumb { width: 78px; height: 52px; flex: none; object-fit: cover; object-position: 9% center; border-radius: 4px; }
.map-choice span:nth-child(2) { flex: 1; }
.map-choice strong,.map-choice small { display: block; }
.map-choice strong { font-size: 16px; margin-bottom: 2px; }
.map-choice small,.dialog-note { font-size: 13px; color: #536756; }
.map-badge { font-size: 11px; color: #3c6a4d; font-weight: 750; }
.dialog-note { margin: 10px 0 0; line-height: 1.6; }
.actions { gap: 10px; justify-content: center; }
.secondary { font-size: 14px; font-weight: 750; padding: 8px 13px; }
.result-hero { height: 78px; display: grid; place-content: center; }
.result-hero img { width: 75px; height: 75px; object-fit: contain; }
.result-line { font-size: 15px; line-height: 1.6; text-align: center; }
.stats { display: grid; grid-template-columns: repeat(3,1fr); text-align: center; gap: 5px; margin: 16px 0 18px; padding: 12px 0; border-block: 1px solid #cbd1b9; }
.stats span { display: grid; gap: 4px; color: #596b59; font-size: 13px; }
.stats b { color: var(--forest); font: 700 22px/1.2 Georgia,serif; }
.unit-dossier { display: grid; grid-template-columns: minmax(94px,.85fr) minmax(0,1.2fr); align-items: center; gap: 12px; }
.unit-visual { background: radial-gradient(ellipse at 50% 67%,var(--wash,#e9e3d8) 34%,#fbf7e900 74%); }
.unit-visual img { width: 100%; max-height: 170px; object-fit: contain; }
.unit-copy strong { display: block; margin-bottom: 5px; color: #8b6337; font-size: 14px; }
.unit-copy p { font-size: 15px; line-height: 1.7; }
.manual-picker { width: fit-content; margin-bottom: 12px; }
.dialog .roster-grid:not(.foes) { grid-template-columns: repeat(2,minmax(0,1fr)); }
.dialog .roster-grid.foes { grid-template-columns: repeat(auto-fit,minmax(94px,1fr)); }
.dialog .roster-grid.foes .unit-card { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 5px; }
.dialog .roster-grid.foes .unit-card img { height: 67px; }
.dialog[data-mode="folio"],.dialog[data-mode="study"] { width: min(970px,100%); }
.folio-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; }
.folio-card { text-align: left; padding: 0; border: 1px solid #c5cbb3; border-radius: 7px; background: #f9f7eb; overflow: hidden; }
.folio-card:hover { border-color: #749477; background: #f1f2e2; }
.folio-card img { width: 100%; aspect-ratio: 3/2; object-fit: contain; border-bottom: 1px solid #d3d5c3; }
.folio-copy { display: block; padding: 10px 10px 12px; }
.folio-copy strong { display: block; font: 850 18px/1.4 var(--serif); }
.folio-copy small { display: block; font-size: 12px; color: #596b5c; margin-top: 3px; line-height: 1.5; }
.reference-list { margin-top: 15px; color: #45624c; font-size: 14px; }
.reference-list summary { cursor: pointer; font-weight: 730; }
.reference-list ul { margin: 7px 0 0; padding-left: 20px; }
.reference-list li { margin: 5px 0; line-height: 1.5; }
.reference-list a { color: #345e4b; text-underline-offset: 2px; }
.study-picture { margin: 0; }
.study-picture img { width: 100%; max-height: 66dvh; object-fit: contain; background: #f0eddf; border-radius: 5px; }
.study-picture figcaption { margin: 8px 0 11px; line-height: 1.6; font-size: 14px; color: #465b4b; }
.study-tools { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.study-tools button[aria-pressed="true"] { background: #315c49; color: #fff9df; }
@keyframes hint-glow { from { opacity: .24; } to { opacity: .9; } }
@keyframes alert-glow { from { opacity: .66; } to { opacity: 1; } }
@media(min-width:1400px) and (min-height:830px) { .shell { padding-top: min(7vh,75px); } }
@media(max-width:1000px) and (orientation:landscape) {
  .shell { padding-inline: 18px; }
  .console { grid-template-columns: minmax(0,1.17fr) minmax(0,1fr); gap: 12px; }
  .unit-card { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .unit-card img { height: 50px; }
  .ledger { padding: 11px; }
}
/* Every portrait display uses the same visual and DOM order: battle, then board. */
@media(orientation:portrait), (max-width:710px) {
  body { background-attachment: scroll; }
  .shell { --gutter: clamp(6px,1.9vw,15px); --usable-width: min(calc(100vw - 2 * var(--gutter)), 660px); --field-height: clamp(104px,min(47vw,29svh),275px); width: 100%; max-width: 690px; height: 100vh; height: 100svh; height: 100dvh; margin-inline: auto; padding: max(3px,env(safe-area-inset-top)) max(var(--gutter),env(safe-area-inset-right)) max(5px,env(safe-area-inset-bottom)) max(var(--gutter),env(safe-area-inset-left)); display: flex; flex-direction: column; }
  .mast { flex: none; min-height: 50px; margin: 0 0 6px; padding: 2px 1px 5px; }
  .brand { gap: 4px; }
  .brand-mark { width: 40px; height: 40px; }
  h1 { font-size: 25px; letter-spacing: .045em; }
  .wordmark { font-size: 8px; line-height: 1.15; margin: 1px 0 0 1px; letter-spacing: .25em; }
  .tools { gap: 4px; }
  .tool { height: 37px; min-width: 42px; padding: 0 7px; gap: 3px; font-size: 13px; border-radius: 6px; }
  .tool img { width: 17px; height: 17px; }
  .tool.sound { min-width: 33px; width: 33px; }
  .console { flex: 1; min-height: 0; align-items: stretch; display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr); grid-template-areas: 'field' 'board'; gap: 7px; }
  .ledger { display: none; }
  .paper-card,.board-card { border-radius: 10px; }
  .field-head { min-height: 45px; padding: 3px 10px 4px; gap: 7px; }
  .chapter-flag { min-width: 32px; padding: 3px 4px 7px; }
  .chapter-flag span { font-size: 8px; }
  .chapter-flag b { font-size: 17px; }
  .location { display: flex; align-items: center; flex-wrap: wrap; column-gap: 7px; }
  .location h2 { font-size: 21px; letter-spacing: .035em; }
  .inspect { font-size: 11px; min-height: 31px; }
  .clock { font-size: 13px; gap: 3px; padding: 4px; }
  .clock img { width: 14px; height: 14px; }
  .theatre { height: var(--field-height); aspect-ratio: auto; }
  .field-hud { inset: 5px 6px auto; }
  .hp-tag { padding: 3px 5px 4px 3px; gap: 3px; }
  .hp-tag > img { width: 14px; height: 14px; }
  .hp-track { min-width: 50px; }
  .hp-line,.hp-line span { font-size: 10px; }
  .wave-tag { min-height: 20px; font-size: 11px; padding: 1px 5px; }
  .meter { margin-top: 2px; }
  .field-message { font-size: 12px; }
  .order-bar { min-height: 44px; padding: 4px 9px; gap: 6px; }
  .order-symbol { width: 29px; height: 29px; }
  .order-symbol img { width: 19px; height: 19px; }
  .order-copy strong { font: 800 15px/1.25 var(--sans); }
  .order-copy span { font-size: 11px; line-height: 1.3; margin-top: 1px; }
  .primary { font-size: 14px; padding: 6px 12px; }
  .remaining { font-size: 12px; }
  .board-card { display: grid; min-height: 0; grid-template-rows: auto minmax(0,1fr) auto auto; align-self: stretch; padding: 0 7px 2px; max-height: calc(var(--usable-width) + 98px); }
  .board-head { min-height: 39px; padding: 2px 4px; }
  .board-heading { gap: 5px; }
  .board-heading h2 { font-size: 19px; }
  .board-heading img { width: 19px; height: 19px; }
  .raised-count { font-size: 12px; gap: 5px; }
  .raised-count b { font-size: 16px; }
  .board-space { min-height: 0; container-type: size; }
  .board-bezel { width: min(100%,calc(100svh - 252px - var(--field-height))); width: min(100cqw,100cqh); max-width: 100%; padding: 4px; border-radius: 7px; }
  #board { --cell-gap: clamp(3px,.9vw,5px); }
  .face { border-radius: clamp(6px,1.85vw,11px); }
  .face img { width: 82%; height: 82%; }
  .instruction { font-size: 12px; min-height: 26px; padding: 3px 1px; }
  .instruction img { width: 15px; height: 15px; }
  .army-key { padding: 1px 0 2px; }
  .key-item { min-height: 29px; font-size: 12px; }
  .key-item img { width: 19px; height: 19px; }
  .folio-grid { grid-template-columns: 1fr; gap: 8px; }
  .folio-card { display: grid; grid-template-columns: 42% 1fr; align-items: center; }
  .folio-card img { border: 0; }
  .folio-copy { padding: 6px 9px; }
  .folio-copy strong { font-size: 17px; }
  .folio-copy small { font-size: 12px; }
  .dialog { padding: 14px; }
  .dialog-heading { margin-bottom: 10px; }
  .dialog-heading h2 { font-size: 21px; }
  .study-tools .secondary { padding-inline: 8px; }
}
@media(orientation:portrait) and (min-width:600px) {
  .shell { padding-top: max(14px,env(safe-area-inset-top)); }
  .mast { min-height: 60px; }
  .brand-mark { width: 47px; height: 47px; }
  h1 { font-size: 29px; }
  .field-head { min-height: 54px; }
  .board-head { min-height: 47px; }
  .key-item { min-height: 36px; font-size: 14px; }
}
@media(max-height:690px) and (max-width:710px) {
  .shell { --field-height: clamp(94px,20.3svh,139px); }
  .mast { min-height: 41px; margin-bottom: 4px; padding: 0 1px 3px; }
  .brand-mark { width: 32px; height: 32px; }
  h1 { font-size: 21px; }
  .wordmark { display: none; }
  .field-head { min-height: 35px; padding-block: 2px; }
  .location h2 { font-size: 18px; }
  .chapter-flag { padding: 2px 4px 6px; min-width: 27px; }
  .chapter-flag span { font-size: 7px; }
  .chapter-flag b { font-size: 14px; }
  .order-bar { min-height: 37px; padding-block: 3px; }
  .order-copy strong { font-size: 14px; }
  .board-head { min-height: 30px; }
  .board-heading h2 { font-size: 17px; }
  .console { gap: 5px; }
  .instruction { min-height: 22px; }
  .key-item { min-height: 25px; }
  .tool { height: 33px; }
}
@media(max-height:570px) and (max-width:710px) {
  .shell { --field-height: clamp(88px,17.4svh,100px); }
  .mast { min-height: 37px; }
  .field-head { min-height: 33px; padding-block: 1px; }
  .order-bar { min-height: 33px; padding-block: 2px; }
  .order-bar .primary { min-height: 30px; padding: 3px 10px; font-size: 13px; }
  .board-head { min-height: 28px; }
  .console { gap: 4px; }
  .army-key { display: none; }
  .order-copy span { display: none; }
  .board-card { grid-template-rows: auto minmax(0,1fr) auto; }
}
@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after { animation-duration: .001s !important; transition-duration: .001s !important; }
  .tile.hinted .face::after { opacity: .85; }
  .fly { display: none; }
}

.atelier-link { display: inline-block; margin: 13px 0 3px; padding: 8px 13px; color: #fff9e5; background: #284b3f; border-radius: 5px; font-weight: 750; text-decoration: none; }
.atelier-link:hover { background: #34614e; }
