/* Shared interface geometry; no level-specific selectors. */
.inventory-item-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.guide-bubble { position: fixed; z-index: 20; width: max-content; max-width: min(270px, calc(100vw - 16px)); padding: 10px 14px; border: 2px solid #e9d6a9; border-radius: 10px; background: #24374b; color: #fff3d8; box-shadow: 0 4px 18px #07121e80; font-size: 16px; line-height: 1.35; pointer-events: none; }
.guide-bubble[hidden] { display: none; }
.guide-bubble::after { content: ''; position: absolute; left: var(--arrow-x); top: 100%; transform: translateX(-50%); border: 11px solid transparent; border-top-color: #e9d6a9; border-bottom: 0; }
.guide-bubble.points-up::after { top: auto; bottom: 100%; border-top: 0; border-bottom: 11px solid #e9d6a9; }
@media (max-height: 600px) { .guide-bubble { font-size: 13px; max-width: 220px; padding: 7px 10px; } }
.interface-host { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.interface-overlays { position: relative; z-index: 10; }
.interface-host [hidden], .interface-overlays [hidden], .interface-host[hidden] { display: none !important; }
.game-hud { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.hud-task { position: absolute; top: max(20px, env(safe-area-inset-top)); left: max(24px, env(safe-area-inset-left)); padding: 14px 18px; background: #1d3043df; border: 1px solid #c6dad14d; border-left: 3px solid var(--amber); border-radius: 4px 12px 12px 4px; box-shadow: 0 5px 20px #10203030; }
.hud-task h1 { font-size: clamp(18px, 1.8vw, 25px); font-weight: 500; }
.task-progress { display: flex; gap: 14px; margin-top: 5px; font-size: .85rem; color: var(--muted); }
.task-progress strong { color: var(--paper); font-weight: 500; }
.hud-tools { position: absolute; bottom: max(22px, env(safe-area-inset-bottom)); right: max(24px, env(safe-area-inset-right)); display: flex; align-items: end; gap: 10px; pointer-events: auto; }
.hud-tools button { width: 66px; height: 68px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px; padding: 8px; background: #203449ed; border: 1px solid #a8c0bf8c; border-radius: 12px; box-shadow: 0 4px 12px #0f223b40; font-size: .9rem; }
.hud-tools button svg { width: 24px; height: 24px; }
.hud-tools .bag-button { position: relative; width: 80px; height: 84px; border-color: var(--amber); background: #2b4555f5; }
.hud-tools .bag-button svg { width: 30px; height: 30px; }
.bag-count { position: absolute; top: -9px; right: -7px; color: var(--navy); background: var(--amber); padding: 2px 7px; border-radius: 8px; font-size: .8rem; font-weight: 600; }
.bench-actions { position: absolute; left: 47%; top: 72%; transform: translateX(-50%); display: flex; justify-content: center; gap: 10px; align-items: center; pointer-events: auto; }
.bench-actions button { box-shadow: 0 4px 15px #132b3b40; white-space: nowrap; }
.deliver { display: flex; align-items: center; gap: 8px; }
.hud-feedback { position: absolute; left: max(24px, env(safe-area-inset-left)); bottom: max(22px, env(safe-area-inset-bottom)); width: fit-content; max-width: min(570px, calc(100% - 300px)); }
.scene-message { color: #edf3ee; font-size: 1rem; margin: 0; padding: 12px 16px; border-radius: 9px; background: #1d3043e8; border: 1px solid #b1c5c44d; box-shadow: 0 4px 16px #0f223b24; }
.selection { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 7px; padding: 6px 10px; border-radius: 9px; background: #1d3043f5; border: 1px solid var(--amber); width: fit-content; }
.selection-art { display: block; flex: 0 0 40px; width: 40px; height: 48px; }
.selection-art > .item-visual { width: 100%; height: 100%; }
.selection .symbol { font-size: 20px; }
.selection > span:not(.selection-art) { display: flex; flex-direction: column; font-size: .9rem; }
.selection small { color: var(--teal); }
.selection strong { font-weight: 500; }
.selection button { font-size: .85rem; padding: 5px 10px; pointer-events: auto; }
.portrait-note { display: none; }
.modal-shade, .dialogue-shade { position: fixed; inset: 0; z-index: 10; background: #10223599; display: grid; place-items: center; padding: 20px; }
.modal { width: min(520px, 100%); max-height: calc(100svh - 40px); overflow: auto; padding: clamp(20px, 3vw, 36px); border-radius: 12px; border: 1px solid #849fa67a; background: #253449; box-shadow: 0 25px 100px #07121e70; }
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.modal-header h2 { font-size: 1.5rem; font-weight: 500; }
.close-button { padding: 6px 12px; font-size: .9rem; background: #1f3042; }
.modal p { font-size: 1.1rem; color: #dae4df; }
.inspection-art { position: relative; height: 190px; margin: 24px auto 12px; text-align: center; }
.item-visual.large { height: 180px; width: 180px; }
.large > .symbol { font-size: 50px; }
.inspection-art > .art { height: 100%; }
.inspection-art > .symbol { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: var(--navy); font-size: 50px; }
.check-modal { display: flex; flex-direction: column; overflow: hidden; }
.check-modal .modal-header { flex: none; }
.check-modal .modal-content { display: flex; flex-direction: column; min-height: 0; }
.check-details { min-height: 0; overflow: auto; }
.check-modal .check-actions { flex: none; margin-top: 0; padding-top: 12px; border-top: 1px solid var(--line); }
.inventory-modal { width: min(840px, 100%); }
.modal-intro { margin: 16px 0 20px; }
.inventory-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.inventory-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.inventory-slot { min-height: 145px; padding: 12px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; background: #192b3c; border: 1px solid var(--line); border-radius: 8px; text-align: center; }
.inventory-slot .symbol { font-size: 30px; }
.inventory-slot > span:last-child { font-size: .9rem; }
.inventory-slot.chosen { border-color: var(--amber); background: #3a4b53; }
.inventory-slot.empty { border-style: dashed; color: #b8c6c9; font-size: .85rem; }
.capacity { color: var(--muted); font-size: .85rem !important; }
.inventory-details { border-left: 1px solid var(--line); padding-left: 30px; display: flex; align-items: center; flex-direction: column; justify-content: center; text-align: center; }
.inventory-details h3 { font-size: 1.35rem; font-weight: 500; }
.inventory-details p { font-size: 1rem; }
.choose-icon svg, .hint-icon svg { width: 55px; height: 55px; color: var(--teal); margin: 15px; }
.hint-icon { text-align: center; }
.hint-text { text-align: center; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 25px; }
.dialogue-shade { background: #14253765; align-items: end; padding: 0; }
.dialogue { position: relative; display: flex; align-items: end; gap: 15px; width: min(1100px, 100%); padding: 0 30px 28px; }
.mentor-portrait { max-height: 72svh; object-fit: contain; object-position: bottom; filter: drop-shadow(0 0 20px #13293b33); align-self: end; }
.portrait-slot { width: 30%; flex: 0 0 30%; align-self: end; }
.portrait-slot > .mentor-portrait { width: 100%; display: block; }
.slot-art { width: 75px; height: 85px; }
.slot-art:empty { display: none; }
.inventory-slot:disabled { opacity: 1; cursor: default; }
.last-check { pointer-events: auto; font-size: 13px; min-height: 36px; margin-top: 6px; padding: 5px 10px; }
.selection-message { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); padding: 0; border: 0; white-space: nowrap; }
/* One common skin for both levels, including the shared windows. */
.interface-host button, .interface-overlays button { border-radius: 3px; border: 1px solid #99aeb2; background: linear-gradient(#42586b, #2b3d50); box-shadow: inset 0 1px #c0d1d329, 0 3px 0 #142231; font-weight: 600; }
.interface-host button.primary, .interface-overlays button.primary { border-color: #f1dcae; color: #253449; background: linear-gradient(#e9d6a9, #c4ad7c); }
.hud-task, .scene-message, .selection { border-radius: 3px; background: #24374bf5; border-color: #8da2a5; }
.hud-tools button, .hud-tools .bag-button, .bag-count { border-radius: 3px; }
.modal { background: #24374b; border: 2px solid #90a6ab; border-radius: 4px; box-shadow: inset 0 0 0 3px #192a3d, 0 15px 50px #0d172b88; }
.inventory-slot { border-radius: 3px; }
.speech { background: #253449fa; padding: clamp(22px, 3vw, 38px); border: 1px solid #8ca6ac94; border-radius: 10px; flex: 1; min-width: 0; box-shadow: 0 8px 45px #10223560; }
.speech h2 { color: var(--amber); font-size: 1.6rem; margin-top: 5px; }
.speech p { font-size: clamp(17px, 1.7vw, 22px); line-height: 1.5; min-height: 5em; }
.dialogue-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.dialogue-pages { display: flex; gap: 6px; margin-right: auto; }
.dialogue-pages i { width: 6px; height: 6px; border-radius: 50%; background: var(--slate); }
.dialogue-pages .current { background: var(--amber); }
.text-button { border-color: transparent; background: transparent; color: #ccdbd9; }
@media (max-width: 900px) {
.hud-task { top: max(14px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); padding: 10px 14px; }
.task-progress { font-size: .8rem; }
.hud-tools { bottom: max(14px, env(safe-area-inset-bottom)); right: max(14px, env(safe-area-inset-right)); gap: 8px; }
.hud-feedback { left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); max-width: calc(100% - 260px); }
.scene-message { font-size: .9rem; padding: 9px 12px; }
.selection-art { flex-basis: 30px; width: 30px; height: 38px; }
.selection small { display: none; }
.selection { gap: 6px; }

}
@media (max-height: 600px) and (orientation: landscape) {
.hud-task { padding: 8px 12px; }
.hud-task h1 { font-size: 18px; }
.task-progress { gap: 9px; font-size: 12px; }
.hud-tools button { width: 58px; height: 58px; font-size: 13px; gap: 3px; }
.hud-tools .bag-button { width: 68px; height: 70px; }
.hud-feedback { max-width: min(500px, calc(100% - 235px)); }
.scene-message { font-size: 14px; line-height: 1.3; }
.selection { padding: 2px 8px; }
.selection button { min-height: 40px; }
.bench-actions { gap: 8px; top: 70%; bottom: auto; left: 43%; max-width: calc(100% - 250px); }
.bench-actions button { font-size: 14px; padding: 8px 12px; }
.slot-art { width: 50px; height: 45px; }
.selection-art { flex-basis: 24px; width: 24px; height: 30px; }
.portrait-slot { width: 23%; flex-basis: 23%; }
.modal-shade { padding: 12px; }
.modal { max-height: calc(100svh - 24px); padding: 18px 24px; }
.modal-header { padding-bottom: 10px; }
.modal-header h2 { font-size: 1.2rem; }
.modal-intro { font-size: 14px !important; margin: 10px 0; }
.inventory-slot { min-height: 84px; padding: 5px; gap: 2px; }
.inventory-slot > span:last-child { font-size: 13px; }
.inventory-grid { gap: 8px; }
.inventory-slot .symbol { font-size: 24px; }
.inventory-details .large { width: 100px; height: 75px; }
.inventory-details p { font-size: 14px; margin: 8px 0; }
.inventory-details h3 { font-size: 18px; }
.inventory-details button { min-height: 36px; padding: 5px 18px; }
.inventory-details .large > .symbol { font-size: 26px; }
.inspection-art { height: 90px; margin: 14px 0; }
.inspection-art .large { height: 90px; width: 100px; }
.inspection-art .large > .symbol { font-size: 30px; }
.modal p { font-size: 16px; margin: 12px 0; }
.dialogue { padding: 0 22px 15px; width: min(920px, 100%); }
.mentor-portrait { max-height: 86svh; }
.speech { padding: 18px 24px; }
.speech .eyebrow { display: none; }
.speech h2 { font-size: 20px; }
.speech p { font-size: 16px; min-height: 4.5em; margin: 12px 0; }
.dialogue-actions button { min-height: 36px; padding: 6px 12px; font-size: 14px; }

}
@media (orientation: portrait) and (max-width: 650px) {
.hud-task { right: 14px; width: fit-content; }
.hud-feedback { max-width: calc(100% - 28px); bottom: 114px; }
.hud-tools { gap: 10px; }
.bench-actions { top: 70%; left: 50%; flex-wrap: wrap; width: 90%; }
.portrait-note { position: absolute; top: 11%; left: 14px; width: 42%; display: block; padding: 6px 10px; margin: 0; font-size: 12px; border-radius: 7px; background: #1d3043e8; color: var(--amber); pointer-events: none; }
.dialogue { padding: 0 12px 18px; }
.mentor-portrait { display: none; }
.portrait-slot { display: none; }
.speech p { font-size: 17px; }
.dialogue-actions { flex-wrap: wrap; }
.inventory-layout { gap: 14px; }
.inventory-details { padding-left: 14px; }
.inventory-slot { min-height: 110px; padding: 6px; }
.inventory-details .large { width: 110px; height: 110px; }
.inventory-details p { font-size: 15px; }

}

.book-tabs { display: flex; gap: 8px; margin: 14px 0; }
.book-tabs button { flex: 1; }
.book-tabs [aria-pressed="true"] { border-color: var(--amber); color: var(--amber); }
.book-entry { border-bottom: 1px solid var(--line); padding: 12px 0; }
.book-entry h3 { color: var(--amber); font-size: 1.15rem; }
.book-entry p { margin: 8px 0; }
.book-context { font-size: .95rem !important; color: var(--muted) !important; }

.modal.book-modal { width: min(940px, 100%); }
.book-modal .book-entry { padding: 6px 0; }
.book-modal .book-tabs { margin: 10px 0; }
.book-modal .modal-content > p { margin: 12px 0; }
@media (min-height: 601px) {
  .modal.book-modal { padding: 24px; }
}
