#load-state { margin-top: 11px; color: var(--muted); font-size: .75rem; }
#import-panel { display: grid; gap: 8px; margin-block: 12px; max-width: 36rem; }
#import-panel label { display: grid; gap: 4px; }
#import-panel :is(input, textarea) { min-height: 44px; min-width: 0; font: inherit; color: var(--paper); background: var(--ink); border: 1px solid var(--line); padding: 8px; }
.operation-modes, #stage-list, :is(#agent-list,#recruit-list) { display: grid; gap: 8px; align-content: start; }
.operation-modes > button, .operation-modes summary { text-align: left; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); background: var(--button); cursor: pointer; }
#stage-list { margin-top: 8px; }
.lobby-open .masthead { position: relative; z-index: 2; }
.lobby-radio { grid-column: 1 / -1; grid-row: 1; margin: 0; max-width: min(100%, 360px); justify-self: start; }
.lobby-radio p { background: #0f1923e8; }
.lobby-face { flex: 0 0 44px; height: 44px; background: url('../../../assets/sprites/echo-portraits.png') top left / 200% 200%; }
#lobby-canvas { display: block; width: min(54vw, 53svh, 460px); height: auto; filter: drop-shadow(0 20px 18px #000a); }
#lobby-callsign { padding: 5px 12px; background: #0f1923dd; color: var(--teal); font: 700 .72rem system-ui; letter-spacing: .08em; }
#lobby-launch { justify-items: stretch; justify-self: end; width: min(100%, 340px); }
#lobby-status { background: #0f1923; color: var(--gold); overflow-wrap: anywhere; }
.lobby #start { min-height: 68px; font-size: clamp(1.05rem, 3.5vw, 2rem); letter-spacing: .12em; clip-path: polygon(0 0,100% 0,100% 68%,93% 100%,0 100%); }
.lobby-dialog { width: min(660px, calc(100% - 24px)); max-height: calc(100svh - 28px); overflow: auto; background: var(--ink); color: var(--paper); border: 1px solid var(--line); }
.lobby-dialog::backdrop { background: #0f1923d9; }
.lobby-dialog button { border: 1px solid var(--line); padding-inline: 10px; }
.lobby-dialog :is(input, textarea), #duel-results input { max-width: 100%; min-width: 0; }
#mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
#mode-grid button { min-height: 100px; text-align: left; font-weight: 850; background: linear-gradient(0deg,#0f1923ef,#0f192333), var(--cover) center / cover; }
#mode-grid small { display: block; color: var(--teal); }
[data-map="yahai"] { --cover: url('../../../assets/maps/yahai-battle.jpg'); }
[data-map="yuangong"] { --cover: url('../../../assets/maps/yuangong-battle.jpg'); }
[data-map="yinshi"] { --cover: url('../../../assets/maps/yinshi-battle.jpg'); }
[data-map="nihong"] { --cover: url('../../../assets/maps/nihong-battle.jpg'); }
#mode-extra, #mode-dialog details { margin-block: 8px; }
#gold-bar { height: 3px; background: #273139; margin-top: 3px; overflow: hidden; }
#intro.lobby { display:grid; grid-template-columns:minmax(0,42fr) minmax(0,55fr); grid-template-rows:auto; gap:clamp(10px,2vw,34px); position:relative; min-height:0; padding:12px; isolation:isolate; }
#intro .lobby-radio { position:relative; inset:auto; grid-column:1/-1; margin:0; width:fit-content; max-width:100%; grid-row:1; }
.m6-poster { position:relative; min-height:clamp(430px,65vh,750px); background:linear-gradient(113deg,rgba(20,20,25,.88) 14%,var(--m6-orange) 14% 28%,rgba(30,31,39,.72) 28%); backdrop-filter:blur(6px); overflow:hidden; border:2px solid #353844; border-radius:16px; }
#intro #lobby-agent { --faction:#66e0e4; position:absolute; inset:0; transform:none; width:100%; height:100%; text-align:left; background:linear-gradient(111deg,transparent 23%,color-mix(in srgb,var(--faction),transparent 45%) 23% 68%,transparent 68%); border:0; }
#intro #lobby-agent canvas,.m6-hero-art { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; }
#intro #lobby-agent canvas.m6-art-fallback { visibility:hidden; }
.m6-code { position:absolute; inset:13% 0 auto; font-family:var(--m6-display); font-size:clamp(46px,8vw,135px); font-weight:900; opacity:.22; text-align:center; letter-spacing:-.04em; transform:skewX(-12deg); white-space:nowrap; }
.m6-rank,.m6-passive { position:absolute; left:5%; z-index:1; display:block; max-width:92%; }
.m6-rank { bottom:62px; font-family:var(--m6-display); background:var(--m6-lime); color:#111; padding:5px 15px; transform:skewX(-9deg); font-size:clamp(21px,3vw,42px); font-weight:900; box-shadow:4px 4px #090a0d; }
.m6-passive { bottom:30px; background:rgba(15,16,22,.9); border-left:3px solid var(--m6-lime); padding:4px 10px; font-weight:700; }
.m6-hero-switch { position:absolute; top:10px; right:10px; display:flex; gap:6px; z-index:2; }
.m6-hero-switch button { font-size:1.5rem; min-width:44px; min-height:44px; border-radius:999px; background:rgba(20,21,28,.85); border:2px solid #3e414f; color:#fff; }
.m6-hero-switch button:hover { border-color:var(--m6-lime); color:var(--m6-lime); }
.m6-lobby-right { min-width:0; display:grid; gap:12px; align-content:center; }
#intro #lobby-launch { position:static; grid-row:auto; grid-column:1/-1; justify-self:stretch; width:auto; display:flex; flex-direction:column-reverse; gap:7px; }
.m6-lobby-right > * { grid-column:1/-1; }
#intro #start { min-height:clamp(112px,22vh,235px); display:flex; align-items:center; justify-content:space-between; text-align:left; gap:8px; padding:clamp(10px,3vw,36px); font-size:clamp(24px,4vw,54px); font-weight:900; color:#fff; text-shadow:0 3px 8px #0a0b0e; background:linear-gradient(90deg,rgba(18,19,25,.92),rgba(18,19,25,.35)),url('../../../assets/maps/yahai-battle.jpg') center/cover; border:3px solid var(--m6-orange); clip-path:polygon(0 0,100% 0,100% 83%,95% 100%,0 100%); }
.m6-mastery { display:grid; grid-template-columns:1fr; place-items:center; text-align:center; font-family:var(--m6-display); font-size:clamp(16px,2vw,32px); flex:none; }
.m6-launch-label small { display:block; color:var(--m6-lime); font-size:clamp(12px,1.5vw,18px); letter-spacing:.04em; font-weight:800; }
#intro #start[data-mode=range] { background-image:linear-gradient(90deg,rgba(18,19,25,.92),rgba(18,19,25,.35)),url('../../../assets/maps/yuangong-battle.jpg'); }
#intro #start[data-mode=expedition] { background-image:linear-gradient(90deg,rgba(18,19,25,.92),rgba(18,19,25,.35)),url('../../../assets/maps/yinshi-battle.jpg'); }
#intro #start[data-mode=survival] { background-image:linear-gradient(90deg,rgba(18,19,25,.92),rgba(18,19,25,.35)),url('../../../assets/maps/nihong-battle.jpg'); }
.m6-mastery svg,.m6-mastery b { grid-area:1/1; }
#intro #start .m6-mastery b { color:var(--m6-lime); }
.m6-mastery small { font-family:var(--m6-font); font-size:11px; color:white; }
.m6-mastery svg { width:clamp(50px,8vw,105px); fill:none; stroke:#3d404c; stroke-width:4; transform:rotate(-90deg); }
.m6-mastery .m6-progress { stroke:var(--m6-lime); stroke-dasharray:0 100; }
.m6-tiles { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.m6-tiles button { display:grid; justify-items:center; align-content:center; gap:3px; min-width:0; min-height:102px; padding:8px; background:rgba(28,30,38,.84); backdrop-filter:blur(8px); border:2px solid #3c3f4d; color:#f4f6fa; font-weight:900; clip-path:polygon(8% 0,100% 0,100% 84%,92% 100%,0 100%,0 16%); transition:transform .14s ease, border-color .15s ease, background .15s ease; }
.m6-tiles button:hover { transform:translateY(-2px); border-color:var(--m6-lime); background:rgba(38,41,52,.92); }
.m6-tiles img { width:clamp(36px,5vw,64px); }
.m6-tiles small,.m6-strip small { display:block; font-size:.72rem; color:var(--m6-lime); font-weight:800; }
#intro #start, .m6-tiles button { border-radius: 0; }
.m6-strip,.m6-dock { display:flex; gap:8px; }
.m6-strip button,.m6-dock button { flex:1; min-width:0; padding:10px 6px; background:rgba(26,28,36,.88); border:2px solid #383b48; color:#f2f4f8; font-weight:900; border-radius:10px; }
.m6-strip button:hover,.m6-dock button:hover { border-color:var(--m6-lime); }
.m6-dock button { transform:skewX(-10deg); }
.m6-dock button:first-child { color:#15151a; background:var(--m6-orange); border-color:#0b0c10; font-weight:900; }
#lobby-status:not(:empty) { display:block; color:#ffad9d; grid-column:1/-1; }
@media(max-width:700px) and (orientation:portrait) {
  #intro.lobby { grid-template-columns:minmax(0,1fr); padding:8px; }
  .m6-poster { min-height:clamp(260px,42vh,480px); }
  #intro #start { min-height:clamp(100px,15vh,145px); }
  .m6-tiles button { min-height:78px; }
  .m6-dock { overflow-x:auto; }
  .m6-dock button { transform:none; }
}

.lobby .lobby-radio { position: fixed; inset: auto 12px 12px auto; z-index: 5; background: #17191f; padding: 6px; border: 1px solid #353844; border-radius: 12px; box-shadow: 0 4px 20px #0009; }
#echo-close { background: #23262e; border: 0; border-radius: 50%; }
#daily-goals { display: grid; gap: 10px; padding: 14px 16px; background: rgba(21,22,28,.88); border: 2px solid #353844; border-radius: 14px; font-family: var(--m6-font); }
#daily-goals h2 { font-size: 1rem; font-weight: 900; letter-spacing: .03em; margin: 0 0 2px; color: #fff; }
#daily-goals > div { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(72px, 1fr) 96px; align-items: center; gap: 12px; font-size: .86rem; font-weight: 700; color: #e4e8f0; }
#daily-goals button { width: 96px; min-height: 34px; height: 34px; padding: 0 10px; border: 2px solid #0b0c10; border-radius: 8px; background: var(--m6-lime); color: #111216; font-size: .8rem; font-weight: 900; white-space: nowrap; }
#daily-goals button:disabled { background: #1e212a; border-color: #353844; color: #8c93a3; }
#daily-goals game-bar { height: 8px; width: 100%; }
.book-stages { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.book-stages button { padding: 7px 14px; font-weight: 900; font-size: .88rem; }
.book-stages button[aria-pressed="true"] { background: var(--m6-lime); color: #111216; border-color: #0b0c10; }
.book-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(126px, 1fr)); gap: 8px; padding: 4px; }
.book-cards button { min-width: 0; min-height: 82px; border-radius: 12px; font-weight: 800; }
.book-cards :is(game-bar,small) { display: block; width: 100%; }
.book-units { margin: 10px 0 8px; padding: 10px; border-radius: 12px; background: rgba(15,16,20,.65); border: 1px solid #2b2e38; }
.book-units:empty { display: none; }
.book-units-title { font-size: .8rem; font-weight: 800; color: var(--m6-lime); margin-bottom: 8px; }
.book-units-grid { display: flex; flex-wrap: wrap; gap: 6px; max-height: 132px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #454958 transparent; }
.book-units-grid button { padding: 5px 11px; font-size: .78rem; font-weight: 800; border-radius: 8px; }
.book-units-grid button[aria-pressed="true"] { background: var(--m6-lime); color: #111216; border-color: #0b0c10; }
#book-segments fieldset { border: 0; padding: 4px; margin: 0; }
#book-segments button { margin: 3px; }
#import-panel[open] { display: grid; gap: 12px; width: min(560px, calc(100vw - 24px)); max-width: none; margin: auto; padding: 18px 20px; border-radius: 16px; border: 2px solid #353844; background: #15161c; color: #f5f6f8; box-shadow: 0 20px 60px #000c; }
#import-panel::backdrop { background: #08090cdb; }
#import-drop { padding: 18px; text-align: center; border: 2px dashed var(--m6-lime); border-radius: 12px; background: rgba(200,255,0,.05); font-weight: 700; }
#import-panel :is(input, textarea) { border-radius: 10px; border: 2px solid #353844; background: #0f1014; padding: 10px 12px; }
#import-panel #import-save:not(:disabled) { background: var(--m6-lime); color: #111216; border-color: #0b0c10; font-weight: 900; }
#import-sample { border-collapse: collapse; text-align: left; }
#import-sample td { border: 1px solid #353844; padding: 4px 8px; overflow-wrap: anywhere; }
#mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
#mode-grid button { border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; font-family: var(--m6-font); font-size: 1.12rem; font-weight: 900; line-height: 1.3; letter-spacing: .01em; color: #fff; background-size: cover; background-position: center; background-image: linear-gradient(135deg, rgba(15,16,20,.9), rgba(15,16,20,.72)), var(--cover); border: 2px solid #353844; }
#mode-grid button[aria-pressed="true"] { border-color: var(--m6-lime); box-shadow: 0 0 0 1px var(--m6-lime) inset, 0 0 18px rgba(200,255,0,.18); }
#mode-grid button small { display: block; font-family: var(--m6-font); font-size: .84rem; font-weight: 600; line-height: 1.45; color: #d6dce6; }
#mode-grid button small:last-of-type { color: var(--m6-lime); font-weight: 800; font-size: .8rem; }
#mode-extra { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid #2b2e38; font-family: var(--m6-font); }
#mode-extra .operation-modes { width: 100%; margin-bottom: 4px; gap: 10px; }
#mode-extra summary { border-radius: 10px; font-weight: 900; font-size: .95rem; letter-spacing: .02em; color: #f5f6f8; border: 2px solid #353844; background: #1c1f27; }
#stage-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
#stage-list button { border-radius: 10px; padding: 10px 12px; font-family: var(--m6-font); font-size: .86rem; font-weight: 800; line-height: 1.35; color: #f2f4f8; background: #1e212a; border: 2px solid #353844; text-align: left; }
#stage-list button:not(:disabled):hover { border-color: var(--m6-lime); background: #262a36; }
#stage-list button:disabled { opacity: .48; color: #9ea5b4; }
#mode-extra #challenge { border-radius: 12px; width: 100%; padding: 12px 16px; font-family: var(--m6-font); font-size: .96rem; font-weight: 900; color: #f5f6f8; border: 2px solid #353844; background: #1e212a; text-align: left; }
#mode-extra #challenge-note { color: #b8bfcc; font-size: .84rem; font-weight: 700; padding-inline: 4px; }
#mode-extra #wrong-drill, #mode-extra #star-drill { padding: 10px 20px; font-family: var(--m6-font); font-size: .92rem; font-weight: 900; border-radius: 999px; }
#mode-extra #wrong-drill:not(:disabled) { background: var(--m6-lime); color: #111216; border-color: #0b0c10; }
#mode-extra #star-drill:not(:disabled) { background: #23262e; color: #f5f6f8; border: 2px solid #454958; }
.m6-launch-label span { display: block; float: none; margin: 0 0 6px; font-size: .75rem; letter-spacing: 0; }
.m6-lobby-right .m6-tiles button { min-height: 80px; }
@media (max-width: 700px) and (orientation: portrait) {
  .lobby .lobby-radio { max-width: min(390px, calc(100vw - 24px)); }
  .m6-lobby-right { min-width: 0; }
  #mode-grid, #stage-list { grid-template-columns: 1fr; }
  #daily-goals > div { grid-template-columns: minmax(0, 2fr) minmax(20px,1fr) auto; }
}
