:root {
  --ink: #1f2a2c; --ink2: #3b4a4c; --paper: #f3efe4; --paper2: #e9e2cf; --line: #cbbf9f;
  --azurite: #2d6a8a; --malachite: #3f8f6f; --ochre: #b7793f; --cinnabar: #b8412f; --gold: #d9a441;
  --good: #2f7d4f; --bad: #b8412f;
  --serif: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #dfe5d8; color: var(--ink); font-family: var(--sans); -webkit-tap-highlight-color: transparent; }
body { touch-action: none; user-select: none; -webkit-user-select: none; }
button { font: inherit; cursor: pointer; color: inherit; }
[hidden] { display: none !important; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
kbd { display: inline-block; min-width: 1.5em; padding: 0 .35em; border: 1px solid currentColor; border-radius: 4px; font-family: var(--sans); font-size: .82em; line-height: 1.45; text-align: center; opacity: .85; }

.btn { border: 1.5px solid var(--ink); background: var(--paper); border-radius: 10px; padding: 9px 16px; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:hover { background: #fffaf0; }
.btn.pri { background: var(--cinnabar); border-color: var(--cinnabar); color: #fff8ee; }
.btn.pri:hover { background: #a3382a; }
.btn.big { font-size: 1.12rem; padding: 12px 24px; font-family: var(--serif); letter-spacing: .08em; }
.btn.danger { color: var(--cinnabar); border-color: var(--cinnabar); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* 標題 */
#title { position: fixed; inset: 0; display: flex; align-items: center; padding: 24px clamp(16px, 6vw, 80px); background: linear-gradient(90deg, rgba(243,239,228,.9) 0%, rgba(243,239,228,.55) 40%, rgba(243,239,228,0) 70%); z-index: 20; }
.title-card { max-width: 440px; }
.kicker { font-size: .85rem; letter-spacing: .12em; color: var(--azurite); font-weight: 700; margin: 0 0 6px; }
#title h1 { font-family: var(--serif); font-weight: 900; font-size: clamp(2.6rem, 7vw, 4.4rem); line-height: 1.08; margin: 0 0 14px; color: var(--ink); letter-spacing: .06em; }
#title h1 span { display: block; }
#title h1 span:last-child { color: var(--cinnabar); padding-left: 1.2em; }
.lead { font-family: var(--serif); font-size: 1.08rem; line-height: 1.85; margin: 0 0 18px; color: var(--ink2); }
.avatars { display: flex; gap: 10px; margin-bottom: 12px; }
.avatar { flex: 1; display: flex; align-items: center; gap: 8px; justify-content: center; border: 1.5px solid var(--ink); background: rgba(255,255,255,.6); border-radius: 12px; padding: 10px; font-weight: 700; font-size: 1.02rem; }
.avatar i { font-style: normal; font-family: var(--serif); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--azurite); color: #fff; font-size: .9rem; }
.avatar[data-female="1"] i { background: var(--malachite); }
.avatar[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.name { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 700; color: var(--ink2); margin-bottom: 16px; }
.name input { font: inherit; font-size: 1rem; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.75); color: var(--ink); user-select: text; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.meta { font-size: .8rem; color: var(--ink2); margin-top: 14px; }
.back { position: absolute; right: 18px; top: 16px; color: var(--ink); font-weight: 700; text-decoration: none; background: rgba(243,239,228,.85); padding: 6px 12px; border-radius: 999px; font-size: .88rem; }

/* HUD */
#hud { position: fixed; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: 12px 14px; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
body:not(.playing) #hud, body:not(.playing) #joy { display: none; }
#hud-sect { background: rgba(243,239,228,.92); border: 1.5px solid var(--ink); border-radius: 12px; padding: 8px 12px; min-width: 190px; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
#hud-sect b { font-family: var(--serif); font-size: 1.15rem; display: block; }
#hud-sect small { font-size: .78rem; color: var(--ink2); display: block; margin-bottom: 4px; }
#hud-sect.hub .qi, #hud-sect.hub .pages { display: none; }
.qi, .pages { display: flex; gap: 4px; align-items: center; font-size: .75rem; color: var(--ink2); margin-top: 3px; }
.qi i { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--azurite); }
.qi i.on { background: var(--azurite); }
.pages i { width: 11px; height: 14px; border: 1.5px solid var(--ochre); border-radius: 2px; }
.pages i.on { background: var(--gold); border-color: var(--ochre); }
.qi span, .pages span { margin-left: 4px; }
.hud-btns { display: flex; gap: 8px; }
.hbtn { background: rgba(243,239,228,.92); border: 1.5px solid var(--ink); border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: .85rem; }

#timer { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 11; font-family: var(--serif); font-weight: 900; font-size: 1.8rem; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); border: 2px solid var(--ink); }
#timer.low { color: #fff; background: var(--cinnabar); border-color: var(--cinnabar); }

#task { position: fixed; right: 14px; top: 64px; width: min(380px, calc(100vw - 28px)); z-index: 10; background: rgba(243,239,228,.95); border: 1.5px solid var(--ink); border-left: 6px solid var(--cinnabar); border-radius: 12px; padding: 10px 14px 12px; box-shadow: 0 6px 18px rgba(0,0,0,.14); }
#task h3 { margin: 0 0 4px; font-family: var(--serif); font-size: 1.02rem; }
#task .body { font-size: .95rem; line-height: 1.65; }
#task .body .big { font-family: var(--serif); font-size: 1.3rem; color: var(--cinnabar); }
#task .body small { color: var(--ink2); }
#task .record { margin: 6px 0; padding: 8px 10px; border-radius: 8px; background: #fff; border: 1px dashed var(--line); font-weight: 700; }
#task .btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
#task .btns:empty { display: none; }
.chip { border: 1.5px solid var(--ink); background: #fff; border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: .9rem; display: inline-flex; gap: 6px; align-items: center; }
.chip:hover { background: var(--ink); color: var(--paper); }
.chip kbd { font-size: .72em; }

#prompt { position: fixed; left: 50%; bottom: calc(26px + var(--safe-b)); transform: translateX(-50%); z-index: 10; display: flex; gap: 8px; align-items: center; padding: 11px 20px; border-radius: 999px; background: var(--ink); color: var(--paper); border: 2px solid var(--gold); font-weight: 700; font-size: 1rem; box-shadow: 0 6px 16px rgba(0,0,0,.25); animation: pop .25s ease; }
#prompt kbd { border-color: var(--gold); color: var(--gold); }
@keyframes pop { from { transform: translateX(-50%) scale(.85); opacity: 0; } }

#joy { position: fixed; left: 26px; bottom: calc(26px + var(--safe-b)); width: 120px; height: 120px; border-radius: 50%; background: rgba(243,239,228,.35); border: 2px solid rgba(31,42,44,.35); z-index: 9; touch-action: none; }
#joy .knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px; border-radius: 50%; background: rgba(31,42,44,.65); border: 2px solid var(--paper); }
@media (hover: hover) and (pointer: fine) { #joy { display: none; } }

#toasts { position: fixed; left: 50%; top: 92px; transform: translateX(-50%); z-index: 30; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(560px, calc(100vw - 28px)); pointer-events: none; }
.toast { background: var(--paper); border: 1.5px solid var(--ink); border-radius: 10px; padding: 9px 14px; font-weight: 500; line-height: 1.55; box-shadow: 0 6px 16px rgba(0,0,0,.16); animation: drop .25s ease; transition: opacity .35s, transform .35s; }
.toast.good { border-color: var(--good); border-left: 6px solid var(--good); }
.toast.bad { border-color: var(--bad); border-left: 6px solid var(--bad); }
.toast.out { opacity: 0; transform: translateY(-6px); }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }

#banner { position: fixed; left: 0; right: 0; top: 34%; z-index: 25; text-align: center; pointer-events: none; opacity: 0; }
#banner b { display: inline-block; font-family: var(--serif); font-weight: 900; font-size: clamp(2.2rem, 7vw, 3.6rem); color: var(--paper); background: var(--cinnabar); padding: 6px 28px; letter-spacing: .2em; border: 3px double var(--paper); }
#banner small { display: block; margin-top: 8px; font-weight: 700; color: var(--ink); text-shadow: 0 0 8px var(--paper); }
#banner.show { animation: banner 2.8s ease forwards; }
@keyframes banner { 0% { opacity: 0; transform: scale(1.4); } 12% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }

#dialog { position: fixed; left: 50%; bottom: calc(20px + var(--safe-b)); transform: translateX(-50%); width: min(720px, calc(100vw - 24px)); z-index: 15; background: rgba(243,239,228,.97); border: 2px solid var(--ink); border-radius: 14px; padding: 16px 18px 12px; box-shadow: 0 10px 28px rgba(0,0,0,.22); }
#dialog .who { position: absolute; top: -15px; left: 16px; background: var(--ink); color: var(--paper); font-family: var(--serif); font-weight: 900; padding: 3px 14px; border-radius: 999px; font-size: .95rem; }
#dialog .text { font-size: 1.06rem; line-height: 1.8; min-height: 3.6em; padding-top: 4px; }
#dialog .next { float: right; margin-top: 4px; border: 0; background: var(--cinnabar); color: #fff; border-radius: 999px; padding: 7px 16px; font-weight: 700; }

#modal { position: fixed; inset: 0; z-index: 40; background: rgba(31,42,44,.45); display: grid; place-items: center; padding: 16px; touch-action: auto; }
#modal .inner { width: min(680px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--paper); border: 2px solid var(--ink); border-radius: 16px; padding: 18px 20px 20px; box-shadow: 0 16px 40px rgba(0,0,0,.3); user-select: text; }
.mh { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.mh .tag { background: var(--cinnabar); color: #fff; font-family: var(--serif); font-weight: 900; padding: 3px 12px; border-radius: 6px; }
.mh .prog { font-size: .86rem; color: var(--ink2); font-weight: 700; }
.src { font-size: .8rem; color: var(--ink2); margin: 0 0 4px; }
h3.q { font-size: 1.08rem; line-height: 1.7; margin: 0 0 12px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; gap: 10px; align-items: flex-start; text-align: left; border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; line-height: 1.6; }
.opt b { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--ink2); display: grid; place-items: center; font-size: .82rem; }
.opt:hover:not([disabled]) { border-color: var(--ink); background: #fffaf0; }
.opt[disabled] { cursor: default; }
.opt.right { border-color: var(--good); background: #e6f2ea; }
.opt.right b { background: var(--good); color: #fff; border-color: var(--good); }
.opt.wrong { border-color: var(--bad); background: #f7e4df; }
.opt.wrong b { background: var(--bad); color: #fff; border-color: var(--bad); }
.exp { margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--paper2); line-height: 1.7; }
.exp p { margin: 0 0 10px; }
.exp b.ok { color: var(--good); margin-right: 8px; }
.exp b.ng { color: var(--bad); margin-right: 8px; }
.result { text-align: center; padding: 10px 0; }
.result .seal { display: inline-grid; place-items: center; width: 92px; height: 92px; border: 4px double var(--cinnabar); color: var(--cinnabar); font-family: var(--serif); font-weight: 900; font-size: 1.6rem; border-radius: 10px; transform: rotate(-8deg); margin-bottom: 8px; }
.result.fail .seal { color: var(--ink2); border-color: var(--ink2); }
.result h3 { font-family: var(--serif); font-size: 1.5rem; margin: 4px 0; }

.hint { color: var(--ink2); line-height: 1.7; margin: 0 0 12px; }
.verse { font-family: var(--serif); font-size: 1.2rem; line-height: 2.3; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; }
.verse p { margin: 0; }
.slot { display: inline-block; min-width: 2.2em; border-bottom: 2.5px solid var(--ink2); text-align: center; padding: 0 4px; margin: 0 2px; color: var(--cinnabar); font-weight: 900; }
.slot.cur { border-color: var(--cinnabar); background: #fbeee6; }
.slot.filled { border-color: var(--good); }
.tokens { display: flex; flex-wrap: wrap; gap: 8px; }
.token { border: 1.5px solid var(--ink); background: var(--paper2); border-radius: 8px; padding: 8px 14px; font-family: var(--serif); font-weight: 900; font-size: 1.05rem; }
.token:disabled { opacity: .25; cursor: default; }
.token.shake { animation: shake .35s; border-color: var(--bad); }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.fin { margin-top: 14px; text-align: center; }
.fin p { font-family: var(--serif); font-weight: 900; font-size: 1.2rem; color: var(--good); margin: 0 0 8px; }

.ledger { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-bottom: 12px; }
.field { position: relative; text-align: left; border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 12px; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.field .k { font-size: .78rem; color: var(--ink2); font-weight: 700; }
.field .v { font-weight: 700; }
.field .stamp { position: absolute; right: 8px; top: 50%; transform: translateY(-50%) rotate(-12deg) scale(.4); opacity: 0; width: 44px; height: 44px; display: grid; place-items: center; border: 3px solid var(--cinnabar); color: var(--cinnabar); font-family: var(--serif); font-weight: 900; font-size: 1.3rem; border-radius: 6px; transition: .18s; background: rgba(255,255,255,.8); }
.field.masked { background: #f4e6df; }
.field.masked .v { filter: blur(4px); }
.field.masked .stamp { opacity: 1; transform: translateY(-50%) rotate(-12deg) scale(1); }
.field.bad { border-color: var(--bad); box-shadow: 0 0 0 2px rgba(184,65,47,.25); }
.feedback .ok { color: var(--good); font-weight: 700; line-height: 1.7; }
.feedback .ng { color: var(--bad); font-weight: 700; margin-bottom: 4px; }
.feedback ul { margin: 0 0 12px; padding-left: 1.2em; line-height: 1.7; }

.sheet { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 45; width: min(320px, calc(100vw - 32px)); background: var(--paper); border: 2px solid var(--ink); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 16px 40px rgba(0,0,0,.3); }
.sheet.wide { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow-y: auto; }
.sheet h3 { margin: 0 0 4px; font-family: var(--serif); font-size: 1.3rem; }
.sheet dl { margin: 0; display: grid; grid-template-columns: 4.5em 1fr; gap: 6px 10px; line-height: 1.65; }
.sheet dt { font-weight: 900; font-family: var(--serif); color: var(--cinnabar); }
.sheet dd { margin: 0; }
.sheet .note { font-size: .82rem; color: var(--ink2); line-height: 1.6; }

#fade { position: fixed; inset: 0; background: var(--paper); opacity: 0; pointer-events: none; transition: opacity .4s; z-index: 50; }
#fade.on { opacity: 1; }
#loading { position: absolute; left: 0; right: 0; top: 50%; text-align: center; font-family: var(--serif); font-weight: 900; font-size: 1.3rem; letter-spacing: .1em; color: var(--ink2); margin: 0; }
body.ready #loading { display: none; }
body:not(.ready) #fade { opacity: 1; }
#nogl { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--paper); z-index: 60; font-size: 1.1rem; text-align: center; }

body.fixedcam #joy { display: none; }
@media (max-width: 720px) { body.fixedcam #task { bottom: calc(10px + var(--safe-b)); max-height: 46vh; } body.fixedcam #task .body { font-size: .9rem; } }
body.shot #hud, body.shot #joy, body.shot #prompt, body.shot #task, body.shot #toasts, body.shot #dialog, body.shot #timer { display: none !important; }

@media (max-width: 720px) {
  #title { align-items: flex-end; background: linear-gradient(0deg, rgba(243,239,228,.95) 0%, rgba(243,239,228,.85) 55%, rgba(243,239,228,0) 85%); padding-bottom: calc(20px + var(--safe-b)); }
  .title-card { max-width: none; width: 100%; }
  .lead { font-size: .98rem; margin-bottom: 12px; }
  #task { top: auto; bottom: calc(162px + var(--safe-b)); right: 10px; left: 10px; width: auto; max-height: 40vh; overflow-y: auto; }
  #hud-sect { min-width: 0; padding: 6px 10px; }
  #hud-sect b { font-size: 1rem; }
  #toasts { top: 70px; }
  #prompt { left: auto; right: 14px; transform: none; bottom: calc(40px + var(--safe-b)); }
  @keyframes pop { from { transform: scale(.85); opacity: 0; } }
  #dialog .text { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01s !important; transition-duration: .01s !important; } }

/* ── v2 介面：深色半透明面板＋金色細邊（參考水墨古風遊戲介面） ── */
:root { --panel: rgba(20, 30, 32, .78); --panel2: rgba(28, 40, 42, .9); --gold: #d4b06a; --gold2: rgba(212, 176, 106, .55); --cream: #f1e9d6; --cream2: #c9c0ab; }
.panel-skin, #hud-sect, #task, #dialog, .hbtn, #prompt { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

#hud-sect { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--gold2); border-radius: 14px; color: var(--cream); padding: 10px 16px 10px 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); min-width: 250px; }
#hud-sect[hidden] { display: none; }
#hud-sect .emblem { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--gold); color: var(--gold); font-family: var(--serif); font-weight: 900; font-size: 1.3rem; background: radial-gradient(circle, rgba(212,176,106,.15), rgba(0,0,0,0) 70%); }
#hud-sect .txt { min-width: 0; }
#hud-sect b { color: var(--cream); font-size: 1.05rem; letter-spacing: .06em; }
#hud-sect small { color: var(--cream2); }
.qi, .pages { color: var(--cream2); }
.qi i { border-color: var(--gold); }
.qi i.on { background: var(--gold); }
.pages i { border-color: var(--gold2); }
.pages i.on { background: #e8cf8f; border-color: var(--gold); }

.hbtn { background: var(--panel); color: var(--cream); border: 1px solid var(--gold2); }
.hbtn:hover { border-color: var(--gold); }

#task { background: var(--panel); color: var(--cream); border: 1px solid var(--gold2); border-left: 1px solid var(--gold2); border-radius: 14px; box-shadow: 0 10px 28px rgba(0,0,0,.28); }
#task h3 { color: var(--gold); font-size: .95rem; letter-spacing: .08em; }
#task .body small { color: var(--cream2); }
#task .body .big { color: #f0c987; }
#task .record { background: rgba(255,255,255,.06); border: 1px dashed var(--gold2); color: var(--cream); }
#task kbd { color: var(--gold); }
.chip { background: rgba(255,255,255,.06); color: var(--cream); border: 1px solid var(--gold2); }
.chip:hover { background: var(--gold); color: #1c2526; border-color: var(--gold); }

#prompt { background: var(--panel2); color: var(--cream); border: 1px solid var(--gold); }

#timer { background: var(--panel2); color: var(--cream); border: 1.5px solid var(--gold); }

.toast { background: var(--panel2); color: var(--cream); border: 1px solid var(--gold2); }
.toast.good { border-left: 4px solid #8fc6a0; border-color: var(--gold2); }
.toast.bad { border-left: 4px solid #e08a76; border-color: var(--gold2); }

#dialog { display: grid; grid-template-columns: auto 1fr; column-gap: 18px; align-items: end; background: var(--panel); color: var(--cream); border: 1px solid var(--gold2); border-radius: 16px; padding: 18px 22px 14px; width: min(860px, calc(100vw - 24px)); box-shadow: 0 14px 36px rgba(0,0,0,.32); }
#dialog[hidden] { display: none; }
#dialog .portrait { grid-row: 1 / span 3; width: 132px; height: 150px; object-fit: cover; object-position: 50% 0; border-radius: 12px; border: 1px solid var(--gold2); background: #efe6d2; margin-top: -54px; box-shadow: 0 8px 20px rgba(0,0,0,.3); }
#dialog .portrait[hidden] { display: none; }
#dialog .who { position: static; grid-column: 2; justify-self: start; background: none; color: var(--gold); padding: 0; font-size: 1rem; letter-spacing: .1em; border-bottom: 1px solid var(--gold2); padding-bottom: 2px; margin-bottom: 6px; }
#dialog .text { grid-column: 2; color: var(--cream); min-height: 3.2em; }
#dialog .next { grid-column: 2; justify-self: end; background: transparent; color: var(--gold); border: 1px solid var(--gold); }
#dialog .next:hover { background: var(--gold); color: #1c2526; }
#dialog:not(:has(.portrait:not([hidden]))) { grid-template-columns: 1fr; }
#dialog:not(:has(.portrait:not([hidden]))) .who, #dialog:not(:has(.portrait:not([hidden]))) .text, #dialog:not(:has(.portrait:not([hidden]))) .next { grid-column: 1; }

/* 標題畫面：角色立繪卡 */
.avatars { gap: 12px; }
.avatar { flex-direction: column; gap: 2px; padding: 8px 8px 10px; background: rgba(255,255,255,.55); border: 1px solid var(--line); border-radius: 14px; }
.avatar img { width: 100%; max-width: 120px; aspect-ratio: 3 / 4; object-fit: cover; object-position: 50% 0; margin: 0 auto; }
.avatar span { font-family: var(--serif); font-weight: 900; font-size: 1.05rem; }
.avatar small { font-size: .74rem; color: var(--ink2); font-weight: 500; }
.avatar[aria-pressed="true"] { background: rgba(255,255,255,.85); color: var(--ink); border: 2px solid var(--cinnabar); box-shadow: 0 6px 18px rgba(184,65,47,.18); }

/* 彈窗：紙面＋深藍標頭 */
#modal .inner { padding: 0; overflow: hidden auto; border: 1px solid #b9a67a; }
#modal .inner > :not(.mh):not(.result) { margin-left: 22px; margin-right: 22px; }
#modal .inner .mh { background: linear-gradient(90deg, #1f3b52, #2a5068); color: var(--cream); padding: 12px 22px; margin: 0 0 14px; }
#modal .inner .mh .tag { background: none; padding: 0; font-size: 1.15rem; letter-spacing: .1em; color: #fff7e6; }
#modal .inner .mh .prog { color: #d8e2e6; }
#modal .inner > :last-child { margin-bottom: 22px; }
#modal .inner .result { padding: 18px 22px 22px; }

@media (max-width: 720px) {
  #dialog .portrait { width: 84px; height: 100px; margin-top: -40px; }
  #hud-sect { min-width: 0; padding: 6px 10px 6px 6px; gap: 8px; }
  #hud-sect .emblem { width: 34px; height: 34px; font-size: 1rem; }
  .avatar img { max-width: 76px; }
}
