:root {
    --exp-ink: #f4efe4;
    --exp-muted: #b7a992;
    --exp-dim: #8a7b68;
    --exp-moon: #f0d58c;
    --exp-moon-deep: #c9a24a;
    --exp-danger: #d47a6a;
    --exp-ok: #8fbf9a;
    --exp-stone: #1a1620;
    --exp-panel: #241c28;
    --exp-line: #3d3344;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: #09070c;
    color: var(--exp-ink);
    font-family: "Noto Sans TC", "Noto Sans JP", "Microsoft JhengHei", sans-serif;
}

button,
a {
    font-family: inherit;
}

.exp-root {
    min-height: 100vh;
    min-height: 100dvh;
    background:
        linear-gradient(180deg, rgba(8, 6, 12, 0.35) 0%, rgba(8, 6, 12, 0.78) 48%, #09070c 100%),
        url("../images/maps/chapter1-h.webp") center / cover no-repeat;
}

.exp-boot,
.exp-error {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    text-align: center;
    color: var(--exp-muted);
}

.exp-shell {
    width: min(440px, 100%);
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}

.exp-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
}

.exp-kicker {
    margin: 0;
    font-size: 11px;
    letter-spacing: 0.22em;
    color: var(--exp-moon);
    text-transform: none;
}

.exp-date {
    margin: 0;
    font-size: 12px;
    color: var(--exp-dim);
}

.exp-panel {
    background: rgba(24, 18, 28, 0.88);
    border: 1px solid var(--exp-line);
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.exp-title {
    margin: 0 0 8px;
    font-size: 26px;
    line-height: 1.2;
    font-weight: 700;
}

.exp-copy {
    margin: 0 0 12px;
    color: var(--exp-muted);
    line-height: 1.65;
    font-size: 14px;
}

.exp-selene {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.exp-selene img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    object-position: top;
    border: 1px solid var(--exp-line);
    background: #120e16;
}

.exp-facts {
    display: grid;
    gap: 8px;
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
}

.exp-facts li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    border-bottom: 1px solid var(--exp-line);
    padding-bottom: 6px;
}

.exp-facts span {
    color: var(--exp-dim);
}

.exp-facts strong {
    color: var(--exp-moon);
    font-weight: 700;
}

.exp-actions {
    display: grid;
    gap: 8px;
    margin-top: auto;
}

.exp-btn {
    appearance: none;
    border: 1px solid var(--exp-moon-deep);
    background: #2a2114;
    color: var(--exp-moon);
    min-height: 44px;
    padding: 10px 14px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: pointer;
}

.exp-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.exp-btn-ghost {
    border-color: var(--exp-line);
    background: transparent;
    color: var(--exp-muted);
}

.exp-btn-link {
    display: grid;
    place-items: center;
    text-decoration: none;
}

.exp-roster {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
    overflow: auto;
}

.exp-spirit {
    text-align: left;
    border: 1px solid var(--exp-line);
    background: #161018;
    color: inherit;
    padding: 8px;
    min-height: 96px;
    cursor: pointer;
}

.exp-spirit.is-picked {
    border-color: var(--exp-moon);
    background: #2a2318;
}

.exp-spirit img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.exp-spirit-name {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-top: 4px;
}

.exp-spirit-passive {
    display: block;
    font-size: 11px;
    color: var(--exp-muted);
    line-height: 1.4;
}

.exp-picked {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    min-height: 36px;
}

.exp-picked-chip {
    flex: 1;
    border: 1px solid var(--exp-line);
    font-size: 12px;
    text-align: center;
    padding: 8px 4px;
    color: var(--exp-moon);
}

.exp-route {
    display: grid;
    gap: 10px;
    margin: 8px 0 16px;
}

.exp-node {
    border: 1px solid var(--exp-line);
    background: #161018;
    padding: 12px;
}

.exp-node.is-done {
    opacity: 0.55;
}

.exp-node.is-active {
    border-color: var(--exp-moon);
}

.exp-node-label {
    font-size: 11px;
    letter-spacing: 0.16em;
    color: var(--exp-dim);
}

.exp-node-title {
    margin: 4px 0 0;
    font-size: 16px;
    font-weight: 700;
}

.exp-node-desc {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--exp-muted);
    line-height: 1.5;
}

.exp-fork {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.exp-battle-hud {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    margin-bottom: 8px;
    color: var(--exp-muted);
}

.exp-hp {
    height: 8px;
    background: #120e16;
    border: 1px solid var(--exp-line);
    margin: 4px 0 12px;
}

.exp-hp > span {
    display: block;
    height: 100%;
    background: var(--exp-danger);
    width: 0;
}

.exp-hp.is-player > span {
    background: var(--exp-ok);
}

.exp-enemy-wrap {
    display: grid;
    justify-items: center;
    margin-bottom: 8px;
    min-height: 140px;
}

.exp-enemy-wrap img {
    max-height: 140px;
    max-width: 70%;
    object-fit: contain;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55));
}

.exp-enemy-wrap img.is-hit {
    filter: brightness(1.35) saturate(0.6);
}

.exp-enemy-name {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--exp-moon);
}

.exp-rule {
    font-size: 12px;
    color: var(--exp-muted);
    text-align: center;
    margin: 0 0 10px;
}

.exp-question {
    text-align: center;
    margin-bottom: 12px;
}

.exp-ja {
    font-family: "Noto Sans JP", sans-serif;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.7;
}

.exp-ja ruby {
    ruby-position: over;
}

.exp-ja rt {
    font-size: 10px;
    color: var(--exp-dim);
}

.exp-blank {
    display: inline-block;
    min-width: 2.2em;
    border-bottom: 2px solid var(--exp-moon);
    color: var(--exp-moon);
    margin: 0 4px;
}

.exp-zh {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--exp-muted);
}

.exp-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.exp-choice {
    min-height: 52px;
    border: 1px solid var(--exp-line);
    background: #161018;
    color: var(--exp-ink);
    font-size: 22px;
    font-family: "Noto Sans JP", sans-serif;
    font-weight: 700;
    cursor: pointer;
}

.exp-choice.is-correct {
    border-color: var(--exp-ok);
    color: var(--exp-ok);
}

.exp-choice.is-wrong {
    border-color: var(--exp-danger);
    color: var(--exp-danger);
}

.exp-log {
    min-height: 20px;
    margin: 10px 0 0;
    font-size: 13px;
    color: var(--exp-moon);
    text-align: center;
}

.exp-temple {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 12px 0 16px;
}

.exp-stone {
    height: 44px;
    border: 1px solid var(--exp-line);
    background: #120e16;
}

.exp-stone.is-lit {
    border-color: var(--exp-moon);
    background: #3a3018;
}

.exp-party-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 8px;
}

.exp-party-row img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

@media (min-width: 900px) {
    .exp-root {
        display: grid;
        align-items: stretch;
    }

    .exp-shell {
        width: min(480px, 100%);
        padding-top: 28px;
        padding-bottom: 28px;
    }
}
