/* Mobile island composition: one compact HUD, one playfield, a standalone task letter and a separate chat dock.
   This file owns the <=700px layout after the feature stylesheets. */
@media (max-width:700px){
  .game-shell{--mobile-gutter:12px;--mobile-top:max(12px,env(safe-area-inset-top));--mobile-floor:max(12px,env(safe-area-inset-bottom));}
  .topbar{inset:var(--mobile-top) var(--mobile-gutter) auto;height:44px;gap:8px;align-items:center;}
  .brand{width:120px;min-width:0;}.brand-cn{font-size:16px;letter-spacing:0;}.brand-spark{font-size:12px;margin-left:2px;}.brand-en{font-size:6px;letter-spacing:.25px;margin-top:7px;gap:0;}.brand-en i{display:none;}
  .top-controls{gap:6px;min-width:0;}.theme-switch{padding:3px;gap:1px;border-radius:6px;box-shadow:1px 2px var(--shadow);}.theme-switch button{width:27px;height:28px;}.theme-switch svg{width:15px;height:15px;}
  .settings-button{width:36px;height:36px;padding:8px;box-shadow:1px 2px var(--shadow);}.settings-button svg{width:18px;height:18px;}
  .emc-acct .px-btn{min-height:36px;padding:6px 7px;font-size:10px;white-space:nowrap;box-shadow:1px 2px var(--shadow);}
  .player-card{top:calc(var(--mobile-top) + 56px);left:var(--mobile-gutter);right:var(--mobile-gutter);width:auto;height:60px;grid-template-columns:32px minmax(0,1fr) minmax(74px,26%);gap:10px;padding:8px 10px;align-items:center;border-top-width:3px;box-shadow:2px 3px var(--shadow);}
  .player-avatar{height:32px;}.player-avatar svg{width:22px;height:22px;}.player-avatar span{font-size:7px;bottom:-5px;right:-4px;}
  .player-identity{min-width:0;}.player-identity h1{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:0 0 5px;}.player-identity p{font-size:9px;}.player-identity p>span{display:none;}
  .experience{min-width:0;padding-left:10px;border-left:1px solid #7e91ad40;}.experience p{font-size:8px;margin:0 0 7px;gap:3px;white-space:nowrap;}.xp-track{height:6px;}
  .shop-journal{top:calc(var(--mobile-top) + 126px);left:var(--mobile-gutter);right:auto;width:84px;padding:0;transform:none;}
  .shop-journal>button{height:36px;width:84px;min-height:36px;padding:0 8px;margin:0;gap:5px;font-size:10px;box-shadow:2px 2px var(--shadow);}
  .shortcuts{top:calc(var(--mobile-top) + 126px);left:calc(var(--mobile-gutter) + 92px);right:auto;gap:8px;}
  .shortcut{color:var(--ink);height:36px;min-width:70px;padding:0 8px;flex-direction:row;gap:5px;font-size:10px;border:1.5px solid var(--line);border-radius:2px;background:var(--surface);box-shadow:2px 2px var(--shadow);}
  .shortcut svg{width:20px;height:20px;padding:0;border:0;background:transparent;box-shadow:none;}.shortcut b{right:-3px;top:-4px;}
  .scene-framing{top:calc(var(--mobile-top) + 172px);bottom:calc(var(--mobile-floor) + 244px);left:50%;width:100%;height:auto;max-height:none;transform:translateX(-50%);}
  .scene-framing-content{inset:0 -3%;}
  /* The letter is the primary action, never a boxed shortcut beside a card. */
  /* Spread HUD weight: compact status above, field notes and letter below. */
  .player-card{right:auto;width:calc(50% - 16px);grid-template-columns:28px minmax(0,1fr);gap:7px;padding:8px;}.player-avatar{height:28px;}.player-avatar svg{width:20px;height:20px;}.player-identity h1{font-size:11px;}.experience{grid-column:1/-1;border-left:0;padding:0;}.experience p{display:none;}.xp-track{height:4px;}
  .shop-journal{top:auto;bottom:calc(var(--mobile-floor) + 80px);left:var(--mobile-gutter);width:calc(50% - 16px);height:144px;padding:10px;border:1px solid var(--line);border-left:4px solid #449c9f;background:var(--surface);box-shadow:3px 4px 0 var(--button-shadow);transform:none;}
  .shop-journal>.journal-heading{display:flex;font-size:11px;line-height:16px;}.journal-heading small{display:none;}
  .shop-journal>.journal-now{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;font-size:9px;line-height:14px;margin:7px 0;height:42px;}.journal-now b{font-size:9px;line-height:14px;margin:0;}
  .shop-journal>.journal-counts{display:flex;gap:8px;padding-top:6px;font-size:9px;line-height:16px;white-space:nowrap;}.journal-counts strong{font-size:12px;margin-right:3px;}
  .shop-journal>button{width:100%;height:28px;min-height:28px;justify-content:space-between;margin:5px 0 0;padding:5px 0 0;background:transparent;border:0;border-top:1px solid #8a9aa730;box-shadow:none;font-size:10px;}
  .shortcuts{top:calc(var(--mobile-top) + 126px);left:var(--mobile-gutter);right:auto;width:calc(50% - 16px);gap:8px;}.shortcut{width:calc(50% - 4px);min-width:0;height:40px;padding:0 4px;font-size:9px;gap:4px;}.shortcut svg{width:17px;height:17px;}
  .quest-peek{top:calc(var(--mobile-top) + 56px);left:auto;right:var(--mobile-gutter);bottom:auto;width:calc(50% - 16px);height:96px;min-height:96px;padding:9px;gap:6px;justify-content:flex-start;text-align:left;border:1px solid var(--line);border-left:4px solid #ff654d;background:var(--surface);box-shadow:3px 4px 0 var(--button-shadow);}
  .quest-peek>span:not(.peek-icon){min-width:0;display:block;}.quest-peek small{display:block;font-size:9px;margin:0 0 5px;color:var(--muted);}.quest-peek b{display:block;font-size:11px;line-height:1.5;white-space:normal;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;}.quest-peek em{display:block;font-size:8px;text-wrap:balance;line-height:1.4;margin-top:5px;color:var(--muted);font-style:normal;}.quest-peek .peek-icon{display:block;flex-shrink:0;}.quest-peek .peek-icon svg{width:20px;height:24px;}.quest-peek .peek-arrow{margin-left:auto;width:12px;height:12px;flex-shrink:0;}
  .main-actions.mail-actions{top:auto;left:75%;right:auto;bottom:calc(var(--mobile-floor) + 118px);width:min(152px,calc(50vw - 20px));height:90px;transform:translateX(-50%);display:block;}
  .mail-actions .mail-button{position:relative;width:100%;height:90px;padding:10px 26px 6px;gap:10px;border:0;border-radius:0;background:transparent;box-shadow:none;filter:drop-shadow(0 4px 0 #20294c24);justify-content:center;}
  .mail-actions .mail-button:before{content:'';position:absolute;inset:0;z-index:-1;pointer-events:none;background:radial-gradient(ellipse,#ffe68155,transparent 68%);}
  .mail-actions .mail-button:after{content:'拆开任务来信';font-size:10px;font-weight:800;letter-spacing:2px;line-height:14px;color:var(--ink);text-shadow:0 1px 3px var(--surface);}
  .mail-actions .mail-envelope{width:86px;height:56px;flex-shrink:0;border-width:2px;border-radius:4px;box-shadow:3px 4px 0 #263355;animation:mail-nudge 3s ease-in-out infinite;}
  .mail-actions .mail-envelope:after{left:31px;top:17px;width:20px;height:20px;font-size:13px;line-height:18px;}.mail-actions .mail-spark{font-size:24px;right:-13px;top:-14px;}
  [data-theme="night"] .shortcut{color:var(--ink);}[data-theme="night"] .quest-peek{color:var(--ink);}[data-theme="night"] .mail-actions .mail-button:after{color:#fff0b5;text-shadow:0 2px 3px #111b46;}
  .mail-actions .mail-button:active .mail-envelope{filter:brightness(1.12);}
  .copilot-dock{left:var(--mobile-gutter);right:var(--mobile-gutter);top:auto;bottom:calc(var(--mobile-floor) + var(--keyboard-offset,0px));width:auto;transform:none;grid-template-columns:minmax(0,1fr) 44px;gap:5px 8px;}
  .copilot-dock .copilot-status{min-height:12px;font-size:9px;margin:0 2px;line-height:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  .copilot-dock form{height:48px;min-height:48px;padding:5px 6px 5px 10px;gap:7px;box-shadow:2px 3px var(--shadow);border-radius:3px;}.copilot-dock form>svg{width:16px;height:16px;}.copilot-dock input{font-size:16px;padding:5px 0;}.copilot-dock input::placeholder{font-size:12px;}.copilot-dock #copilotSend{width:34px;height:34px;}.copilot-dock button.copilot-history{width:44px;height:48px;border-radius:3px;box-shadow:2px 3px var(--shadow);}
  .npc-bubble{bottom:28px;width:min(242px,calc(100vw - 28px));padding:24px 24px 22px;}.npc-bubble header{min-height:24px;gap:6px;}.npc-bubble header b{font-size:11px;}.npc-bubble header small{font-size:8px;}.npc-bubble header button{width:28px;height:28px;font-size:19px;}.npc-bubble p{font-size:12px;line-height:20px;max-height:var(--npc-text-max,60px);margin:4px 0 6px;padding-right:2px;}.npc-bubble .companion-bubble-actions{display:none;}.npc-bubble-actions{min-height:28px;}.npc-bubble-actions>small{font-size:9px;}.npc-continue{min-height:28px;font-size:11px;padding:3px 7px;}
  .drawer.centered-panel,.drawer.journey-card{width:calc(100vw - 24px);height:calc(100svh - var(--keyboard-offset,0px) - 24px);max-height:calc(100svh - var(--keyboard-offset,0px) - 24px);top:calc((100svh - var(--keyboard-offset,0px))/2);left:50%;right:auto;bottom:auto;transform:translate(-50%,-50%);}
  .drawer.companion-panel.centered-panel{top:calc((100svh - var(--keyboard-offset,0px))/2)!important;left:50%!important;right:auto!important;bottom:auto!important;width:calc(100vw - 24px)!important;}
  .drawer-header{padding:14px 16px 12px;}.drawer-header h2{font-size:19px;}.drawer-header .icon-button{width:36px;height:36px;}.drawer-body,.centered-panel .drawer-body{padding:16px;}
  .backpack{left:12px;right:12px;top:auto;bottom:var(--mobile-floor);width:auto;height:min(286px,46svh);max-height:min(286px,46svh);}.backpack:has(.bag-decor-grid){height:min(320px,48svh);max-height:min(320px,48svh);}.backpack .drawer-header{padding:10px 12px;}.backpack .drawer-body{padding:10px 12px 12px;}.backpack .bag-tabs button{min-height:34px;}
  body:has(.backpack:not([hidden])) .quest-peek,body:has(.backpack:not([hidden])) .main-actions,body:has(.backpack:not([hidden])) .copilot-dock{visibility:hidden;pointer-events:none;}
  body:has(.backpack:not([hidden])) .player-card,body:has(.backpack:not([hidden])) .shortcuts,body:has(.backpack:not([hidden])) .shop-journal{visibility:hidden;pointer-events:none;}
  body:has(.backpack:not([hidden])) .scene-framing{top:calc(var(--mobile-top) + 52px);bottom:calc(var(--mobile-floor) + min(286px,46svh) + 8px);}
  body:has(.backpack .bag-decor-grid) .scene-framing{bottom:calc(var(--mobile-floor) + min(320px,48svh) + 8px);}
  .copilot-dock.mobile-chat-open{left:12px;right:12px;bottom:calc(var(--mobile-floor) + var(--keyboard-offset,0px));height:min(620px,72svh);max-height:calc(100svh - var(--keyboard-offset,0px) - 84px);grid-template-columns:minmax(0,1fr);gap:0;padding:12px;border-radius:5px;}
  .mobile-chat-open .social-heading{grid-template-columns:44px minmax(0,1fr) 36px;}.mobile-chat-open .social-heading button.social-close{width:36px;height:36px;}.mobile-chat-open .copilot-status{white-space:normal;min-height:30px;padding:8px 0;}.mobile-chat-open .social-messages{min-height:0;}.mobile-chat-open form{box-shadow:none;}
  .keyboard-open .player-card,.keyboard-open .shortcuts,.keyboard-open .shop-journal,.keyboard-open .quest-peek,.keyboard-open .main-actions{visibility:hidden;}.keyboard-open .scene-framing{top:calc(var(--mobile-top) + 55px);bottom:calc(var(--mobile-floor) + var(--keyboard-offset,0px) + 90px);height:auto;}
  .toast{bottom:calc(var(--mobile-floor) + 165px);max-width:calc(100vw - 32px);}
}
@media(max-width:370px){
  .brand{width:106px;}.brand-cn{font-size:14px;}.brand-spark{font-size:10px;}.brand-en{font-size:6px;letter-spacing:0;}.top-controls{gap:5px;}.theme-switch button{width:23px;}.emc-acct .px-btn{font-size:9px;padding-inline:5px;}.settings-button{width:34px;}
  .player-card{grid-template-columns:28px minmax(0,1fr);gap:5px;}.player-avatar{height:30px;}.player-identity h1{font-size:11px;}.experience{padding-left:8px;}.quest-peek b{font-size:11px;}.npc-bubble{width:224px;}
}
@media(max-width:700px) and (max-height:650px){
  .game-shell{--mobile-top:8px;--mobile-floor:8px;}.player-card{top:60px;height:54px;}.shop-journal{top:auto;bottom:80px;height:116px;}.shop-journal>.journal-now{height:14px;-webkit-line-clamp:1;}.shortcuts{top:124px;}.scene-framing{top:166px;bottom:214px;}.quest-peek{top:60px;bottom:auto;}.main-actions.mail-actions{bottom:104px;height:78px;}.mail-actions .mail-button{height:78px;padding-block:5px;gap:7px;}.mail-actions .mail-envelope{width:78px;height:50px;}.mail-actions .mail-envelope:after{left:27px;top:14px;}.copilot-dock form,.copilot-dock button.copilot-history{height:44px;min-height:44px;}.npc-bubble{bottom:0;padding:12px 20px 10px;}.npc-bubble header{height:0;min-height:0;}.npc-bubble header b,.npc-bubble header small{display:none;}.npc-bubble header button{position:absolute;right:14px;top:2px;width:24px;height:24px;}.npc-bubble p{margin:0;padding-right:18px;max-height:20px;}.npc-bubble-actions,.npc-continue{min-height:24px;}
}

@media(max-width:700px) and (prefers-reduced-motion:reduce){.mail-actions .mail-envelope,.mail-actions .mail-spark{animation:none;}}

/* 手机竖屏：品牌与操作分行，岛屿优先，阅读入口保持轻量。 */
@media(max-width:700px){
  .topbar{height:80px;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:28px 40px;gap:8px;align-items:center;}
  .brand{width:auto;max-width:100%;justify-self:start;}.brand-cn{font-size:18px;}.brand-en{display:none;}
  .top-controls{width:100%;display:flex;justify-content:flex-end;gap:8px;}.theme-switch{margin-right:auto;}.theme-switch button{width:30px;height:32px;}
  .emc-acct .px-btn{min-height:38px;font-size:11px;padding:7px 10px;}.settings-button{width:38px;height:38px;flex-shrink:0;}
  .player-card{top:calc(var(--mobile-top) + 92px);width:calc(50% - 18px);height:60px;}
  .shortcuts{top:calc(var(--mobile-top) + 162px);width:calc(50% - 18px);gap:6px;}.shortcut{width:calc(50% - 3px);height:36px;font-size:10px;}
  .quest-peek{top:calc(var(--mobile-top) + 92px);width:calc(50% - 18px);height:106px;min-height:106px;padding:8px;gap:5px;}
  .quest-peek .peek-icon{display:none;}.quest-peek>span:not(.peek-icon){flex:1;min-width:0;}.quest-peek b{font-size:12px;line-height:1.55;-webkit-line-clamp:2;overflow-wrap:anywhere;}.quest-peek small{font-size:10px;}.quest-peek em{font-size:9px;line-height:1.5;margin-top:6px;}.quest-peek .peek-arrow{width:10px;}
  .scene-framing{top:calc(var(--mobile-top) + 204px);bottom:calc(var(--mobile-floor) + 204px);}
  .shop-journal{height:126px;bottom:calc(var(--mobile-floor) + 76px);width:calc(58% - 18px);padding:9px 10px;}.shop-journal>.journal-now{height:28px;-webkit-line-clamp:2;margin:5px 0;font-size:10px;line-height:14px;}.shop-journal>.journal-counts{padding-top:4px;}.shop-journal>button{height:26px;min-height:26px;margin-top:3px;}
  .main-actions.mail-actions{left:80%;bottom:calc(var(--mobile-floor) + 90px);width:calc(40vw - 16px);height:86px;}.mail-actions .mail-button{height:86px;padding:5px 10px;gap:8px;}.mail-actions .mail-envelope{width:82px;height:52px;}.mail-actions .mail-envelope:after{left:29px;top:15px;}
  .npc-bubble{width:min(230px,calc(100vw - 36px));padding:20px 22px 17px;bottom:32px;}.npc-bubble p{max-height:40px!important;font-size:12px;line-height:20px;scrollbar-width:none;}.npc-bubble p::-webkit-scrollbar{display:none;}.npc-bubble header small{display:none;}.npc-bubble header button{width:32px;height:32px;}.npc-bubble-actions>small{font-size:9px;}
}
@media(max-width:700px) and (max-height:650px){
  .game-shell{--mobile-gutter:10px;}.topbar{height:74px;gap:5px;}.brand-cn{font-size:16px;}.top-controls{gap:6px;}.theme-switch button{width:26px;height:29px;}.emc-acct .px-btn{min-height:34px;}.settings-button{width:34px;height:34px;}
  .player-card{top:96px;height:54px;}.shortcuts{top:158px;}.quest-peek{top:96px;height:98px;min-height:98px;}.quest-peek b{font-size:11px;}.quest-peek em{font-size:8px;}
  .scene-framing{top:204px;bottom:176px;}.shop-journal{height:94px;bottom:72px;padding:6px 8px;}.shop-journal>.journal-now{display:none;}.shop-journal>.journal-heading{font-size:10px;}.main-actions.mail-actions{bottom:78px;height:78px;}.mail-actions .mail-button{height:78px;}
  .npc-bubble{padding:14px 20px 12px;}.npc-bubble p{max-height:20px!important;}.npc-bubble header button{top:0;}
}

/* 顶部工具统一一行，窄屏按可用宽度缩放品牌与按钮间距。 */
@media(max-width:700px){
 .topbar{height:40px;display:flex;flex-wrap:nowrap;gap:6px;justify-content:space-between;}
 .brand{width:auto;min-width:0;flex:1 1 auto;}.brand-cn{font-size:clamp(12px,3.65vw,18px);white-space:nowrap;}.brand-spark{font-size:10px;margin-left:1px;}
 .top-controls{width:auto;flex:0 0 auto;gap:5px;}.theme-switch{margin:0;padding:2px;gap:0;}.theme-switch button{width:24px;height:30px;}.theme-switch svg{width:14px;height:14px;}
 .emc-acct .px-btn{min-height:36px;font-size:10px;padding:6px 7px;}.settings-button{width:34px;height:36px;padding:7px;}
}
@media(max-width:370px){
 .topbar{gap:4px;}.brand-cn{font-size:12px;}.brand-spark{font-size:9px;}.top-controls{gap:4px;}.theme-switch button{width:21px;}.emc-acct .px-btn{font-size:9px;padding-inline:5px;}.settings-button{width:30px;padding:6px;}
}

@media(max-width:700px){
 .player-card,.quest-peek{top:calc(var(--mobile-top) + 54px);}
 .shortcuts{top:calc(var(--mobile-top) + 124px);}
 .scene-framing{top:calc(var(--mobile-top) + 168px);}
}
@media(max-width:700px) and (max-height:650px){
 .shortcuts{top:calc(var(--mobile-top) + 116px);}
 .scene-framing{top:calc(var(--mobile-top) + 158px);}
}
.npc-bubble #npcSpeech{font-size:12px;line-height:1.8;max-height:132px;margin:8px 0 10px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:none;overflow-wrap:anywhere}
.npc-bubble #npcSpeech :is(p,ul,ol,blockquote){max-height:none!important;overflow:visible;margin:0 0 .5em;padding:0;font:inherit}
.npc-bubble #npcSpeech>:last-child{margin-bottom:0}.npc-bubble-actions{gap:12px}.npc-bubble-actions .npc-continue{margin-left:auto;white-space:nowrap}
@media(max-width:700px){.npc-bubble{width:min(278px,calc(100vw - 32px));padding:32px 30px 28px}.npc-bubble header{height:auto;min-height:28px;display:flex;align-items:center;gap:8px}.npc-bubble header b{display:block;font-size:12px}.npc-bubble header small{display:none}.npc-bubble header button{position:static;width:28px;height:28px;min-height:28px;margin-left:auto}.npc-bubble #npcSpeech{max-height:60px!important;font-size:12px;line-height:20px;margin:6px 0 10px;padding:0}.npc-bubble-actions{min-height:30px;align-items:center}.npc-bubble-actions>small{font-size:9px;line-height:1.5}.npc-bubble .npc-continue{min-height:30px;padding:4px 0;font-size:11px}}
@media(max-width:700px) and (max-height:650px){.npc-bubble{padding:28px 28px 24px}.npc-bubble #npcSpeech{max-height:40px!important}}
