* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #0a0a0f;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Courier New', monospace;
    overflow: hidden;
}

:root {
    --button-radius-sm: 8px;
    --button-radius-lg: 10px;
    --panel-radius: 10px;
    --modal-width: min(84%, 760px);
    --modal-height: min(78%, 520px);
    --game-scale: 1;
    --accent-inventory: #ffd166;
    --accent-journal: #4ecca3;
    --accent-map: #6fd3ff;
    --accent-settings: #8db7d9;
}

button {
    font: inherit;
}

#game-container {
    position: relative;
    width: 900px;
    height: 600px;
    border: 3px solid #333;
    box-shadow: 0 0 30px rgba(233, 69, 96, 0.3);
    transform: scale(var(--game-scale));
    transform-origin: top left;
}

#game-shell {
    width: calc(900px * var(--game-scale));
    height: calc(600px * var(--game-scale));
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

#gameCanvas {
    display: block;
    background: #0f0f1a;
}

#timer-bar {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 420px;
    height: 30px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #e94560;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(233, 69, 96, 0.2);
}

#timer-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #4ecca3, #e94560);
    transition: width 0.1s linear;
}

#timer-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    letter-spacing: 1px;
}

#loop-counter {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #eaeaea;
    font-size: 14px;
}

#objective-panel {
    position: absolute;
    bottom: 52px;
    left: 10px;
    width: 250px;
    min-height: 0;
    padding: 10px 12px;
    background: rgba(10, 10, 20, 0.72);
    border: 1px solid rgba(78, 204, 163, 0.45);
    border-radius: 8px;
    color: #eaeaea;
    box-shadow: 0 0 14px rgba(78, 204, 163, 0.08);
    pointer-events: none;
}

#objective-label {
    color: #4ecca3;
    font-size: 10px;
    margin-bottom: 4px;
    letter-spacing: 1px;
    opacity: 0.8;
}

#objective-text {
    font-size: 13px;
    line-height: 1.4;
}

#run-panel {
    position: absolute;
    top: 146px;
    left: 10px;
    width: 320px;
    min-height: 86px;
    padding: 12px 14px;
    background: rgba(10, 10, 20, 0.9);
    border: 2px solid rgba(255, 209, 102, 0.6);
    border-radius: 10px;
    color: #eaeaea;
    box-shadow: 0 0 20px rgba(255, 209, 102, 0.12);
}

#run-label {
    color: #ffd166;
    font-size: 12px;
    margin-bottom: 6px;
    letter-spacing: 1px;
}

#run-text {
    font-size: 14px;
    line-height: 1.55;
}


#status-panel {
    position: absolute;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    max-width: 420px;
    min-height: 0;
    padding: 8px 12px;
    background: rgba(10, 10, 20, 0.82);
    border: 1px solid rgba(78, 204, 163, 0.38);
    border-radius: 999px;
    color: #eaeaea;
    box-shadow: 0 0 12px rgba(233, 69, 96, 0.08);
    pointer-events: none;
    z-index: 6;
}

#status-panel[data-stage="stable"] {
    border-color: rgba(78, 204, 163, 0.45);
}

#status-panel[data-stage="drift"] {
    border-color: rgba(255, 204, 102, 0.6);
}

#status-panel[data-stage="unstable"] {
    border-color: rgba(233, 69, 96, 0.7);
}

#status-panel[data-stage="rollback"] {
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 22px rgba(255, 255, 255, 0.16);
}

#status-label {
    color: #e94560;
    display: none;
}

#status-text {
    font-size: 12px;
    line-height: 1.3;
    white-space: nowrap;
}

#dialog-box {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 85%;
    max-width: 700px;
    max-height: calc(100% - 120px);
    background: rgba(10, 10, 20, 0.98);
    border: 3px solid #4ecca3;
    border-radius: 12px;
    padding: 25px;
    color: #eaeaea;
    display: none;
    box-sizing: border-box;
    overflow: hidden;
    flex-direction: column;
    box-shadow: 0 0 30px rgba(78, 204, 163, 0.3);
}

#dialog-speaker {
    color: #4ecca3;
    font-weight: bold;
    margin-bottom: 12px;
    font-size: 20px;
}

#dialog-text {
    line-height: 1.8;
    font-size: 18px;
    white-space: pre-line;
    max-height: min(38vh, 320px);
    overflow-y: auto;
    padding-right: 6px;
}

#dialog-continue {
    margin-top: 15px;
    color: #4ecca3;
    animation: blink 1s infinite;
    min-width: 52px;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-left: auto;
    margin-right: auto;
}

#dialog-continue .dialog-continue-icon,
#loop-transition-continue .dialog-continue-icon {
    width: 24px;
    height: 24px;
    display: block;
}

#dialog-continue .dialog-continue-label,
#loop-transition-continue .dialog-continue-label {
    display: none;
}

#dialog-box.dialog-needs-scroll #dialog-text {
    box-shadow: inset 0 -24px 18px -18px rgba(78, 204, 163, 0.32);
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.5; }
}

#inventory-btn,
#journal-btn,
#map-btn {
    position: absolute;
    bottom: 10px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 2px solid transparent;
    box-sizing: border-box;
    background: rgba(10, 10, 20, 0.95);
    border-radius: var(--button-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    appearance: none;
    -webkit-appearance: none;
    line-height: 0;
    font-size: 0;
}

#audio-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 38px;
    height: 38px;
    padding: 0;
    background: rgba(10, 10, 20, 0.95);
    border: 2px solid var(--accent-settings);
    border-radius: var(--button-radius-sm);
    color: var(--accent-settings);
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

#inventory-btn svg,
#journal-btn svg,
#map-btn svg,
#audio-btn svg {
    width: 22px;
    height: 22px;
    display: block;
    flex: 0 0 22px;
    margin: 0 auto;
    pointer-events: none;
}

#inventory-btn {
    right: 10px;
    border: 2px solid var(--accent-inventory);
    color: var(--accent-inventory);
}

#inventory-btn.has-unread::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ff5b6e;
    box-shadow: 0 0 0 2px rgba(10, 10, 20, 0.95);
}

#journal-btn.has-unread::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #6be7b5;
    box-shadow: 0 0 0 2px rgba(10, 10, 20, 0.95);
}

#journal-btn {
    right: 60px;
    border: 2px solid var(--accent-journal);
    color: var(--accent-journal);
}

#map-btn {
    right: 110px;
    border: 2px solid var(--accent-map);
    color: var(--accent-map);
}

#start-screen {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top, rgba(233, 69, 96, 0.12), transparent 34%),
        linear-gradient(180deg, rgba(8, 10, 16, 0.98), rgba(10, 10, 15, 0.98));
    display: flex;
    justify-content: center;
    align-items: center;
    color: #eaeaea;
    z-index: 100;
}

#start-screen.is-busy {
    pointer-events: none;
}

.start-shell {
    width: min(760px, 92%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
}

.start-card,
.start-help-card {
    width: 100%;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    box-sizing: border-box;
}

.start-card {
    padding: 10px 0 0;
}

.start-help-card {
    padding: 0;
    opacity: 0.86;
}

#start-landing,
#start-picker {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

#start-picker {
    min-height: 420px;
    justify-content: space-between;
}

.start-heading,
.picker-heading {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.start-kicker {
    margin-bottom: 12px;
    color: #8db7d9;
    font-size: 12px;
    letter-spacing: 1.6px;
    text-transform: uppercase;
}

#start-screen h1 {
    font-size: 56px;
    color: #e94560;
    text-shadow: 0 0 20px #e94560;
    margin-bottom: 16px;
}

#start-screen p {
    color: #4ecca3;
    margin-bottom: 14px;
    font-size: 18px;
}

.start-summary {
    width: min(520px, 100%);
    color: #98a9b7;
    font-size: 15px;
    line-height: 1.8;
    margin-bottom: 34px;
    text-align: center;
}

#start-picker h2 {
    color: #d9e6ef;
    font-size: 28px;
    margin-bottom: 10px;
}

#save-slots {
    width: 100%;
    display: block;
    min-height: 248px;
    margin: 26px 0 28px;
}

.start-slot-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.start-slot-button {
    width: 100%;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: #eaeaea;
    cursor: pointer;
    font-size: 15px;
    line-height: 1.4;
    box-sizing: border-box;
    transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.start-slot-main {
    color: #ffffff;
    text-align: left;
}

.start-slot-side {
    color: #a9bac6;
    text-align: right;
    font-size: 13px;
}

.start-slot-button.has-data {
    border-color: rgba(78, 204, 163, 0.38);
}

.start-slot-button:hover {
    background: rgba(255, 255, 255, 0.07);
    transform: translateY(-1px);
}

.start-slot-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.start-slot-button:disabled:hover {
    background: rgba(255, 255, 255, 0.04);
}

.save-slot-detail {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 20px 18px;
    min-height: 248px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-sizing: border-box;
}

.save-slot-detail.ended {
    border-color: rgba(255, 209, 102, 0.42);
    background: rgba(255, 209, 102, 0.05);
}

.save-slot {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    padding: 16px 14px;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
}

.save-slot.has-data {
    border-color: rgba(78, 204, 163, 0.4);
}

.save-slot.empty {
    border-color: rgba(255, 255, 255, 0.1);
}

.save-slot-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.save-slot-title {
    color: #ffffff;
    font-size: 16px;
}

.save-slot-badge {
    font-size: 11px;
    color: #0a0a0f;
    background: #4ecca3;
    border-radius: 999px;
    padding: 3px 8px;
}

.save-slot-badge.empty {
    background: rgba(255,255,255,0.14);
    color: #d9e6ef;
}

.save-slot-detail.ended .save-slot-badge.empty {
    background: rgba(255, 209, 102, 0.88);
    color: #1a1a2e;
}

.save-slot-meta {
    color: #b8c7d2;
    font-size: 14px;
    line-height: 1.7;
    min-height: 88px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.save-slot-line {
    color: #9fb0bc;
}

.save-slot-line.is-key {
    color: #d9e6ef;
}

.save-slot-warning {
    color: #f1c27d;
    font-size: 13px;
    line-height: 1.5;
}

.save-slot-detail.ended .save-slot-warning {
    color: #ffd166;
}

.save-slot-actions {
    display: flex;
    gap: 12px;
    margin-top: 2px;
}

.save-slot-actions button {
    flex: 1;
    min-height: 48px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--button-radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: #101521;
    color: #eaeaea;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    box-sizing: border-box;
}

.save-slot-actions button.primary {
    border-color: rgba(78, 204, 163, 0.55);
    color: #4ecca3;
}

.save-slot-actions button.warning {
    border-color: rgba(233, 69, 96, 0.58);
    color: #f29ab0;
}

.save-slot-detail.ended .save-slot-actions button.primary {
    border-color: rgba(255, 209, 102, 0.62);
    color: #ffd166;
}

.save-slot-actions button.ghost {
    color: #b8c7d2;
}

.save-slot-actions button:hover {
    background: #162031;
}

.start-actions {
    display: none;
    gap: 12px;
}

.start-actions.visible {
    display: flex;
}

.start-actions-stack {
    width: min(320px, 100%);
    flex-direction: column;
    align-items: stretch;
}

.picker-actions {
    display: flex;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    margin-top: auto;
    padding-top: 8px;
}

#start-btn,
#continue-btn,
#back-to-landing {
    width: 100%;
    min-width: 0;
    min-height: 52px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 2px solid #e94560;
    border-radius: var(--button-radius-lg);
    color: #e94560;
    cursor: pointer;
    box-sizing: border-box;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

#continue-btn {
    border-color: #4ecca3;
    color: #4ecca3;
}

#back-to-landing {
    border-color: #8db7d9;
    color: #d9e6ef;
    max-width: 200px;
}

#start-btn:hover,
#continue-btn:hover,
#back-to-landing:hover,
#inventory-btn:hover,
#journal-btn:hover,
#map-btn:hover,
#audio-btn:hover,
#close-inventory:hover {
    filter: brightness(1.1);
}

#start-btn:hover {
    background: #e94560;
    color: #0a0a0f;
}

#continue-btn:hover {
    background: #4ecca3;
    color: #0a0a0f;
}

#back-to-landing:hover {
    background: rgba(141, 183, 217, 0.16);
    color: #ffffff;
}

#start-btn:hover,
#continue-btn:hover,
#back-to-landing:hover {
    transform: translateY(-1px);
}

#hint-text {
    font-size: 13px;
    line-height: 1.7;
    color: #91a0ad;
    font-family: Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    text-align: center;
}

#save-note {
    width: min(440px, 100%);
    margin: 0;
    padding: 0;
    font-size: 12px;
    line-height: 1.6;
    color: #5b7280;
    text-align: center;
}

.start-help-title {
    margin-bottom: 8px;
    color: #d9e6ef;
    font-size: 12px;
    letter-spacing: 1.2px;
    text-align: center;
}

#loading-screen {
    position: absolute;
    inset: 0;
    background: rgba(6, 6, 12, 0.94);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 120;
}

#loading-card {
    width: min(420px, 82%);
    padding: 26px 24px;
    border-radius: 14px;
    background: rgba(15, 15, 26, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 0 28px rgba(255, 255, 255, 0.08);
}

#loading-title {
    color: #ffffff;
    font-size: 24px;
    margin-bottom: 10px;
}

#loading-text {
    color: #b8c7d2;
    font-size: 14px;
    margin-bottom: 16px;
}

#loading-bar {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255,255,255,0.08);
}

#loading-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #6fd3ff, #4ecca3);
    transition: width 180ms ease;
}

#inventory-modal {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 50;
}

#journal-modal {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 50;
}

#map-modal {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 50;
}

#settings-modal {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 50;
}

#inventory-content {
    background: #1a1a2e;
    border: 2px solid var(--accent-inventory);
    padding: 24px 26px;
    border-radius: var(--panel-radius);
    width: var(--modal-width);
    height: var(--modal-height);
    max-width: 760px;
    max-height: 520px;
    overflow-y: auto;
    color: #eaeaea;
    box-sizing: border-box;
}

#journal-content {
    background: #1a1a2e;
    border: 2px solid var(--accent-journal);
    padding: 24px 26px;
    border-radius: var(--panel-radius);
    width: var(--modal-width);
    height: var(--modal-height);
    max-width: 760px;
    max-height: 520px;
    overflow-y: auto;
    color: #eaeaea;
    box-sizing: border-box;
}

#map-content {
    background: #1a1a2e;
    border: 2px solid var(--accent-map);
    padding: 24px 26px;
    border-radius: var(--panel-radius);
    width: var(--modal-width);
    height: var(--modal-height);
    max-width: 760px;
    max-height: 520px;
    overflow-y: auto;
    color: #eaeaea;
    box-sizing: border-box;
}

#settings-content {
    background: linear-gradient(180deg, rgba(24, 28, 40, 0.98), rgba(16, 21, 33, 0.98));
    border: 1px solid rgba(141, 183, 217, 0.42);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.36), 0 0 0 1px rgba(141, 183, 217, 0.08) inset;
    padding: 24px 24px 22px;
    border-radius: var(--panel-radius);
    width: min(460px, 88%);
    min-height: 0;
    max-width: 460px;
    max-height: min(78%, 520px);
    overflow-y: auto;
    color: #eaeaea;
    box-sizing: border-box;
}

#dialog-text,
#inventory-content,
#journal-content,
#settings-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 247, 250, 0.28) rgba(255, 255, 255, 0.04);
}

#dialog-text::-webkit-scrollbar,
#inventory-content::-webkit-scrollbar,
#journal-content::-webkit-scrollbar,
#settings-content::-webkit-scrollbar {
    width: 10px;
}

#dialog-text::-webkit-scrollbar-track,
#inventory-content::-webkit-scrollbar-track,
#journal-content::-webkit-scrollbar-track,
#settings-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 999px;
}

#dialog-text::-webkit-scrollbar-thumb,
#inventory-content::-webkit-scrollbar-thumb,
#journal-content::-webkit-scrollbar-thumb,
#settings-content::-webkit-scrollbar-thumb {
    background: rgba(245, 247, 250, 0.28);
    border-radius: 999px;
    border: 2px solid rgba(26, 26, 46, 0.95);
}

#dialog-text::-webkit-scrollbar-thumb:hover,
#inventory-content::-webkit-scrollbar-thumb:hover,
#journal-content::-webkit-scrollbar-thumb:hover,
#settings-content::-webkit-scrollbar-thumb:hover {
    background: rgba(245, 247, 250, 0.42);
}

#inventory-content h2 {
    color: var(--accent-inventory);
    margin-bottom: 20px;
}

.inventory-card {
    padding: 12px 14px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 209, 102, 0.18);
    border-radius: 10px;
}

.inventory-card.unread {
    border-color: rgba(255, 91, 110, 0.42);
    box-shadow: inset 0 0 0 1px rgba(255, 91, 110, 0.12);
}

.inventory-card-title {
    margin: 0 0 6px;
    color: #fff4cc;
    font-weight: 700;
}

.inventory-card-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(255, 91, 110, 0.16);
    color: #ff8b98;
    font-size: 11px;
    font-weight: 700;
    vertical-align: middle;
}

.inventory-card-note {
    margin: 0 0 8px;
    color: #90a4b2;
    line-height: 1.55;
}

.inventory-card-detail {
    margin: 0 0 8px;
    color: #d8e1e8;
    line-height: 1.65;
}

.inventory-card-meta {
    margin: 6px 0 0;
    color: #aebfca;
    font-size: 13px;
    line-height: 1.5;
}

.inventory-card-meta span {
    color: #ffd166;
}

#journal-content h2 {
    color: var(--accent-journal);
    margin-bottom: 20px;
}

.journal-fragment {
    padding: 10px 12px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(78, 204, 163, 0.16);
    border-radius: 10px;
}

.journal-fragment.unread {
    border-color: rgba(107, 231, 181, 0.42);
    box-shadow: inset 0 0 0 1px rgba(107, 231, 181, 0.1);
}

.journal-fragment-title {
    margin: 0 0 6px;
    color: #d8fff0;
    font-weight: 700;
}

.journal-fragment-body {
    margin: 0;
    color: #c7d8df;
    line-height: 1.65;
}

.journal-fragment-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(107, 231, 181, 0.16);
    color: #9af0cd;
    font-size: 11px;
    font-weight: 700;
    vertical-align: middle;
}

.journal-memory-card {
    padding: 12px 14px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(78, 204, 163, 0.12);
    border-radius: 10px;
}

.journal-memory-title {
    margin: 0 0 8px;
    color: #dcfff2;
    font-weight: 700;
    line-height: 1.45;
}

.journal-memory-body {
    margin: 0;
    color: #c7d8df;
    line-height: 1.78;
    letter-spacing: 0.01em;
}

#map-content h2 {
    color: var(--accent-map);
    margin-bottom: 16px;
}

#settings-content h2 {
    display: none;
}

#map-canvas {
    display: block;
    width: 100%;
    max-width: 560px;
    height: auto;
    margin: 0 auto;
    background: #101521;
    border: 1px solid rgba(111, 211, 255, 0.35);
}

#map-legend {
    margin-top: 14px;
    color: #d7e8f2;
    font-size: 14px;
    line-height: 1.6;
    display: grid;
    gap: 8px;
}

.map-legend-row {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 12px;
    align-items: start;
}

.map-legend-key {
    color: #8db7d9;
    text-align: left;
}

.map-legend-value {
    color: #d7e8f2;
    text-align: left;
}

#inventory-list p {
    margin: 10px 0;
}

#close-inventory,
#close-journal,
#close-map,
#close-settings {
    min-height: 44px;
    padding: 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(141, 183, 217, 0.52);
    border-radius: var(--button-radius-lg);
    color: #d9e6ef;
    cursor: pointer;
    box-sizing: border-box;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

#close-inventory,
#close-journal {
    margin-top: 20px;
}

#close-map {
    margin-top: 18px;
    margin-left: auto;
}

#close-inventory:hover,
#close-journal:hover,
#close-map:hover,
#close-settings:hover {
    background: rgba(141, 183, 217, 0.16);
    color: #ffffff;
    transform: translateY(-1px);
}

#settings-body {
    display: grid;
    gap: 12px;
    font-size: 14px;
    line-height: 1.6;
}

.settings-header-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 6px;
}

.settings-kicker {
    color: #ffffff;
    font-size: 24px;
    line-height: 1.2;
    font-weight: 600;
}

.settings-slot-line {
    color: #95a8b8;
    font-size: 13px;
}

.settings-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.settings-footer-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.settings-main-button {
    min-height: 48px;
    padding: 0 18px;
    border-radius: var(--button-radius-lg);
    border: 1px solid rgba(141, 183, 217, 0.4);
    background: rgba(255, 255, 255, 0.03);
    color: #e4eef5;
    cursor: pointer;
    font-size: 15px;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.settings-resume-button {
    background: rgba(78, 204, 163, 0.24);
    border-color: rgba(78, 204, 163, 0.92);
    color: #e9fff7;
    box-shadow: inset 0 0 0 1px rgba(78, 204, 163, 0.3);
}

.settings-main-button:hover {
    background: rgba(141, 183, 217, 0.12);
    border-color: rgba(141, 183, 217, 0.62);
}

.settings-resume-button:hover {
    background: rgba(78, 204, 163, 0.34);
    border-color: rgba(78, 204, 163, 1);
    color: #ffffff;
}

.settings-exit-button {
    border-color: rgba(233, 69, 96, 0.45);
    color: #f1b2c0;
}

.settings-audio-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 14px 12px;
    border-radius: var(--button-radius-lg);
    border: 1px solid rgba(141, 183, 217, 0.22);
    background: rgba(255, 255, 255, 0.025);
}

.settings-audio-title {
    color: #b8cad7;
    font-size: 13px;
    line-height: 1.4;
}

.settings-audio-row {
    display: grid;
    grid-template-columns: 44px 1fr 52px;
    gap: 12px;
    align-items: center;
}

.settings-icon-button {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--button-radius-sm);
    border: 1px solid rgba(141, 183, 217, 0.45);
    background: rgba(16, 21, 33, 0.92);
    color: #d9e6ef;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.settings-music-button {
    color: #4ecca3;
    border-color: rgba(78, 204, 163, 0.55);
    background: rgba(78, 204, 163, 0.1);
}

.settings-sfx-button {
    color: #ffd166;
    border-color: rgba(255, 209, 102, 0.55);
    background: rgba(255, 209, 102, 0.1);
}

.settings-icon-button svg {
    width: 20px;
    height: 20px;
    display: block;
}

.settings-icon-button:hover {
    background: rgba(141, 183, 217, 0.12);
}

.settings-music-button:hover {
    background: rgba(78, 204, 163, 0.18);
    border-color: rgba(78, 204, 163, 0.72);
    color: #d6fff0;
}

.settings-sfx-button:hover {
    background: rgba(255, 209, 102, 0.18);
    border-color: rgba(255, 209, 102, 0.72);
    color: #fff2c2;
}

.settings-icon-button.is-muted {
    color: rgba(217, 230, 239, 0.42);
    border-color: rgba(141, 183, 217, 0.24);
}

.settings-music-button.is-muted,
.settings-sfx-button.is-muted {
    background: rgba(255, 255, 255, 0.04);
}

.settings-audio-row span {
    text-align: right;
    color: #d9e6ef;
}

.settings-audio-row input[type="range"] {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    outline: none;
}

.settings-audio-row input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: #d9e6ef;
    border: none;
    box-shadow: 0 0 0 2px rgba(16, 21, 33, 0.95);
}

.settings-audio-row input[type="range"]::-moz-range-track {
    height: 4px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
}

.settings-audio-row input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: #d9e6ef;
    border: none;
    box-shadow: 0 0 0 2px rgba(16, 21, 33, 0.95);
}

#objective-toast {
    position: absolute;
    bottom: 74px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 360px;
    max-width: 640px;
    padding: 12px 18px;
    border-radius: 10px;
    background: rgba(10, 10, 20, 0.95);
    border: 2px solid rgba(78, 204, 163, 0.8);
    color: #ffffff;
    display: none;
    z-index: 70;
    font-size: 15px;
    line-height: 1.5;
    text-align: center;
    box-shadow: 0 0 20px rgba(78, 204, 163, 0.18);
}

#loop-transition {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(4, 4, 10, 0.92);
    z-index: 80;
}

#loop-transition-card {
    width: min(760px, 92%);
    max-height: 82%;
    padding: 28px 30px;
    border-radius: 14px;
    background: rgba(15, 15, 26, 0.98);
    border: 2px solid rgba(255, 255, 255, 0.75);
    color: #ffffff;
    box-sizing: border-box;
    overflow-y: auto;
    box-shadow: 0 0 32px rgba(255, 255, 255, 0.12);
}

#loop-transition-title {
    color: #ffffff;
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 14px;
}

#loop-transition-summary {
    color: #e7e7e7;
    font-size: 16px;
    line-height: 1.7;
    white-space: pre-line;
}

#loop-transition-objective {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    color: #4ecca3;
    font-size: 17px;
    line-height: 1.6;
}

#loop-transition-continue {
    margin-top: 20px;
    color: #ffd166;
    min-width: 52px;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-left: auto;
    margin-right: auto;
    animation: blink 1s infinite;
}

#dialog-continue .dialog-continue-icon svg,
#loop-transition-continue .dialog-continue-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}
