/* 淡墨青简：手机优先的操作尺度，桌面继续使用各场景原布局。 */
:root { --sans:var(--body); }
.touch-hint { display:none; }
.landscape-combat-menu { display:none; }
.landscape-city-menu { display:none; }
.hand-scroller:focus-visible { outline:2px solid var(--focus); outline-offset:2px; }
@media (max-width:1000px) {
  .touch-hint { display:inline; }
  .key-hint { display:none; }
  body { padding-left:env(safe-area-inset-left); padding-right:env(safe-area-inset-right); }
  :where(main,section,aside,form,fieldset) { min-width:0; }
  :where(input:not([type=checkbox]):not([type=radio]),select,textarea) { font-size:16px; max-width:100%; }
  :is(button:not(.battle-card):not(.item-slot),summary,select,input:not([type=checkbox]):not([type=radio]),a.primary,a.secondary,
    .items-back,.arena-back,.quiet-link,.recipe-link,.quest-header a,.rp-header a,.sect-header a) { min-height:44px; }
  :where(.items-back,.arena-back,.rp-header a,.sect-header a,.quest-header a,.recipe-link) { display:inline-flex; align-items:center; }
  :where(.actions,.basic-actions,.coop-phases,.event-phases) { flex-wrap:wrap; }
  :where(.rp-prose,.rp-outcome,.event-dossier,.item-description,.story-reading) { overflow-wrap:anywhere; }
  dialog { max-height:calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overscroll-behavior:contain; }
  dialog:not(:has(.dialog-content)) { overflow-y:auto; }
  .dialog-content { overscroll-behavior:contain; }
  .arena-header-controls .quiet-button { min-height:44px; }
  .bottom-nav { padding-bottom:env(safe-area-inset-bottom); }
  .life-header a,.journey-header a,.life-footer a { display:inline-flex; align-items:center; min-height:44px; }
  .mountain-back,.quest-paper>a,.sect-panel a,.sect-footer a,.hall-selection>p>a { display:inline-flex; align-items:center; min-height:44px; }
  .rp-field textarea { scroll-margin-block:24px; }
  label:has(>input[type=checkbox]) { min-height:44px; }
  .rp-layout,.story-layout,.life-layout { padding-bottom:calc(24px + env(safe-area-inset-bottom)); }
  .rp-header nav { width:100%; }
  .rp-tabs { gap:4px 12px; }
  .rp-scene { height:clamp(200px,30svh,320px); }
  .rp-scene-caption { font-size:14px; padding:10px 14px; }
  .rp-scene-title h2 { margin:8px 0; }
  .coop-compose,.coop-encounter,.coop-staff { padding:16px; }
  .coop-fields { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .journey-header nav,.life-header nav { flex-wrap:wrap; }
}
@media (max-width:700px) {
  .game { height:100dvh; min-height:500px; grid-template-rows:calc(100px + env(safe-area-inset-top)) minmax(0,1fr) calc(68px + env(safe-area-inset-bottom)); }
  .topbar { padding:12px 16px; padding-top:calc(12px + env(safe-area-inset-top)); }
  .brand h1 { font-size:26px; }
  .profile-button { min-height:44px; }
  .profile-button strong { max-width:7em; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .bottom-nav { padding-bottom:env(safe-area-inset-bottom); }
  .bottom-nav>button { font-size:14px; letter-spacing:0; padding-inline:2px; }
  .bottom-nav>button span { white-space:nowrap; }
  .scene-toggle { min-width:44px; }
  .items-header { gap:8px; flex-wrap:wrap; }
  .items-header-right { gap:12px; }
  .item-categories { gap:4px 8px; }
  .inventory-footnote { align-items:flex-start; gap:16px; }
  .inventory-footnote>span { flex-shrink:0; }
  .market-tabs { flex-wrap:wrap; gap:4px 18px; }
  .market-tabs button { min-height:44px; }
  .combat-screen { height:auto; min-height:100dvh; grid-template-rows:56px clamp(250px,33svh,310px) auto; }
  .arena-header { height:56px; }
  .fighter-stats { top:8px; padding:8px; }
  .fighter-stats h2 { font-size:19px; }
  .fighter { height:48%; bottom:28px; }
  .round-indicator { top:auto; bottom:58px; }
  .battle-controls { padding:10px 12px calc(12px + env(safe-area-inset-bottom)); }
  .battle-turn-line { margin-bottom:4px; }
  .battle-turn-line p { font-size:13px; line-height:1.6; }
  .hand { grid-template-columns:repeat(5,145px); gap:10px; min-height:190px; }
  .hand-scroller { scroll-snap-type:x proximity; overscroll-behavior-x:contain; scroll-padding-inline:4px; }
  .battle-card { min-height:252px; height:auto; scroll-snap-align:start; }
  .battle-card-name { min-height:50px; }
  .card-illustration { height:60px; flex-shrink:0; }
  .spell-painting { width:80px; height:80px; }
  .battle-card p { font-size:13px; line-height:1.65; }
  .command-pane { gap:6px; padding-top:10px; }
  .command-pane p { margin-block:4px; line-height:1.65; }
  .command-pane .main-action { min-height:48px; }
  .basic-actions { gap:8px; }
  .basic-actions button { min-width:64px; padding-inline:12px; }
  .controls-bottom { font-size:12px; line-height:1.7; }
  .controls-bottom>div { display:flex; flex-wrap:wrap; gap:8px; }
  .hall { padding:20px 16px; }
  .hall-intro h2 { font-size:32px; margin-top:0; }
  .hall-intro .lead { font-size:20px; }
  .hall-selection { margin-top:18px; padding:18px 16px; }
  .hall-tabs { gap:16px; }
  .hall-tabs button { font-size:18px; }
  .hall-footer { gap:12px; }
  .auth-scene { min-height:180px; padding:16px; }
  .auth-reading { padding:20px 24px; }
}
@media (max-width:700px) and (max-height:700px) {
  .game { min-height:500px; grid-template-rows:calc(92px + env(safe-area-inset-top)) minmax(0,1fr) calc(60px + env(safe-area-inset-bottom)); }
  .side-nav { left:12px; right:12px; top:auto; bottom:0; width:auto; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); padding:4px 0; background:var(--paper-glass); }
  .nav-button { min-height:44px; flex-direction:row; font-size:14px; gap:4px; }
  .nav-button .icon { width:18px; height:18px; }
  .city-heading { top:8px; }
  .city-heading p,.city-heading>div { display:none; }
  .city-heading h2 { font-size:23px; }
  .place-plaque { font-size:17px; letter-spacing:2px; padding:12px 10px; }
  .place { min-width:48px; min-height:64px; }
  .place-gate { --x:20%!important; --y:22%!important; }
  .place-room { --x:50%!important; --y:22%!important; }
  .place-mountain { --x:82%!important; --y:18%!important; }
  .place-market { --x:20%!important; --y:49%!important; }
  .place-arena { --x:50%!important; --y:49%!important; }
  .place-outskirts { --x:82%!important; --y:49%!important; }
  .quest-tracker { display:none; }
  .scene-toggle { right:8px; bottom:100px; font-size:13px; padding:4px; }
  .bottom-nav .icon { width:20px; height:20px; }
}
@media (min-width:701px) and (max-width:1000px) {
  .combat-screen { height:auto; min-height:100dvh; grid-template-rows:58px clamp(280px,35svh,420px) auto; }
  .battle-controls { display:block; }
  .hand-action-layout { align-items:start; }
  .hand { grid-template-columns:repeat(5,152px); justify-content:start; min-height:252px; }
  .battle-card { height:auto; min-height:252px; }
  .battle-card-name { min-height:50px; }
  .card-illustration { height:60px; flex-shrink:0; }
  .spell-painting { width:80px; height:80px; }
  .command-pane { grid-template-rows:auto auto; overflow:visible; }
  .command-reading { overflow:visible; }
}
@media (max-width:1000px) and (orientation:landscape) and (max-height:500px) {
  .game { height:100dvh; min-height:300px; grid-template-rows:48px minmax(0,1fr) calc(52px + env(safe-area-inset-bottom)); }
  .topbar { padding:4px 12px; align-items:center; }
  .brand h1 { font-size:24px; }
  .header-right { display:flex; align-items:center; gap:16px; }
  .resources { position:static; font-size:14px; gap:12px; }
  .profile-button small { display:none; }
  .profile-button .portrait { width:32px; height:32px; }
  .side-nav { display:none; }
  .landscape-city-menu { display:block; position:absolute; top:4px; left:8px; z-index:6; color:var(--teal); background:var(--paper-solid); }
  .landscape-city-menu summary { min-width:56px; min-height:44px; padding:8px; cursor:pointer; font:18px var(--serif); }
  .landscape-city-menu>div { display:grid; grid-template-columns:repeat(2,88px); max-height:calc(100dvh - 160px); overflow-y:auto; background:var(--paper-solid); box-shadow:var(--shadow); }
  .landscape-city-menu:not([open])>div { display:none; }
  .landscape-city-menu .nav-button { flex-direction:row; min-height:44px; font-size:15px; gap:6px; }
  .landscape-city-menu .icon { width:20px; height:20px; }
  .city-heading { top:4px; }
  .city-heading h2 { font-size:22px; margin:0; }
  .city-heading p,.city-heading>div,.quest-tracker,.scene-toggle { display:none; }
  .place-plaque { font-size:17px; padding:10px; letter-spacing:2px; }
  .place { min-height:64px; min-width:48px; }
  .place-gate { --x:25%!important; --y:24%!important; }
  .place-room { --x:50%!important; --y:24%!important; }
  .place-mountain { --x:82%!important; --y:14%!important; }
  .place-market { --x:25%!important; --y:62%!important; }
  .place-arena { --x:50%!important; --y:62%!important; }
  .place-outskirts { --x:82%!important; --y:62%!important; }
  .bottom-nav>button { font-size:15px; gap:6px; }
  .bottom-nav .icon { width:20px; height:20px; }
  .rp-scene,.story-scene,.life-scene { height:220px; min-height:0; }
  .combat-screen { height:100dvh; min-height:320px; grid-template-rows:44px minmax(100px,1fr) 200px; }
  .battle-stage { min-height:0; overflow:hidden; }
  .battle-stage::after { height:40px; }
  .combat-screen .arena-header { height:44px; z-index:6; padding-inline:12px; }
  .combat-screen .arena-header h1 { font-size:20px; letter-spacing:1px; white-space:nowrap; }
  .landscape-combat-menu { display:block; position:relative; font:16px var(--serif); }
  .landscape-combat-menu summary { cursor:pointer; min-width:48px; display:flex; align-items:center; justify-content:center; }
  .landscape-combat-menu>div { position:absolute; top:100%; right:0; min-width:150px; background:var(--paper-solid); box-shadow:var(--shadow); padding:8px; }
  .landscape-combat-menu button { display:block; width:100%; text-align:left; padding:8px; }
  .battle-controls { display:block; padding:4px 12px 8px; }
  .battle-turn-line { margin-bottom:0; min-height:24px; }
  .battle-turn-line h2 { font-size:16px; }
  .battle-turn-line p { font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .hand-action-layout { display:grid; grid-template-columns:minmax(0,1fr) 235px; gap:12px; height:164px; align-items:stretch; }
  .hand-scroller { height:164px; padding:8px 4px 4px; }
  .hand { grid-template-columns:repeat(5,116px); min-height:148px; gap:8px; }
  .battle-card { height:148px; min-height:148px; padding:8px; }
  .battle-card-name { font-size:16px; min-height:44px; line-height:1.4; padding-right:20px; }
  .card-cost { top:8px; right:6px; }
  .card-cost b { font-size:18px; }
  .card-illustration { height:44px; margin:0; }
  .spell-painting { width:60px; height:60px; }
  .battle-card p,.battle-card .card-error { display:none; }
  .card-bottom { font-size:11px; padding-top:4px; }
  .command-pane { border-top:0; border-left:1px solid var(--line); padding:0 0 0 12px; overflow:hidden; grid-template-rows:minmax(0,1fr) auto; gap:4px; }
  .command-reading { overflow-y:auto; padding-right:4px; }
  .selected-title { font-size:18px; }
  .command-pane p { font-size:13px; margin:4px 0; }
  .command-dock { gap:0; }
  .command-dock .main-action { min-height:44px; padding:8px; }
  .command-dock .card-detail-hint { min-height:32px; font-size:13px; }
  .basic-actions { gap:4px; }
  .basic-actions button { padding:4px 8px; min-width:44px; font-size:15px; }
  .controls-bottom { display:none; }
  .fighter-stats { top:4px; width:210px; padding:4px 8px; z-index:5; }
  .fighter-stats h2 { font-size:17px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .fighter-heading .attribute-toggle { display:none; }
  .fighter-stats .fighter-meta,.fighter-stats .combat-numbers,.fighter-stats .quota { display:none; }
  .fighter-stats .vital { margin-top:4px; }
  .path-readout { margin-top:4px; font-size:13px; }
  .path-readout>span:first-child { padding:2px 6px; }
  .status-list { gap:2px; margin-top:4px; }
  .status-tag { padding:2px 4px; font-size:12px; }
  .fighter { height:85%; bottom:12px; width:28%; }
  .fighter.player { left:25%; }
  .fighter.enemy { right:24%; }
  .fighter.enemy.creature { height:78%; width:30%; right:22%; }
  .round-indicator { top:6px; bottom:auto; font-size:15px; }
  .round-indicator small { font-size:11px; }
  .event-caption { bottom:0; font-size:12px; width:36%; max-width:none; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
}
@media (max-width:1000px) and (orientation:landscape) and (max-height:350px) {
  .combat-screen { min-height:380px; }
}
