/* =========================================================
   神与我之符文秘境 — UI stylesheet
   Three-column docked layout: sidebar | stage | sidebar
   ========================================================= */

:root {
    --bg-0: #f4f0e7;
    --bg-1: #fbfaf4;
    --bg-2: #eef5f1;
    --bg-3: #dde8e3;
    --ink-0: #241d15;
    --ink-1: rgba(36, 29, 21, 0.78);
    --ink-2: rgba(36, 29, 21, 0.56);
    --ink-3: rgba(36, 29, 21, 0.34);

    --gold: #a86f19;
    --gold-soft: #563911;
    --accent: #a86f19;
    --ally: #1c7898;
    --enemy: #b84b44;

    --line: rgba(74, 56, 34, 0.13);
    --line-strong: rgba(74, 56, 34, 0.24);
    --line-gold: rgba(168, 111, 25, 0.34);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --shadow-sm: 0 2px 10px rgba(65, 48, 28, 0.12);
    --shadow-md: 0 14px 34px rgba(65, 48, 28, 0.16);

    color: var(--ink-0);
    background: var(--bg-0);
    font-family: "Avenir Next", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

html, body, #root, #app { height: 100%; }

body {
    margin: 0;
    min-width: 320px;
    overflow: hidden;
    background: var(--bg-0);
}

button { font: inherit; }

/* ---------- Layout shell (3 columns) ---------- */

.shell {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr) 340px;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 0%, rgba(168, 111, 25, 0.1), transparent 42%),
        linear-gradient(180deg, var(--bg-1), var(--bg-0) 60%);
}

.sidebar {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    padding: 14px;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(255, 253, 247, 0.96), rgba(244, 240, 231, 0.98));
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

.sidebar-left { border-right: 1px solid var(--line); }
.sidebar-right { border-left: 1px solid var(--line); }

/* ---------- Brand / header ---------- */

.brand {
    padding: 6px 4px 12px;
    border-bottom: 1px solid var(--line);
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--gold);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.brand h1 {
    margin: 0;
    font-family: "Songti SC", "Noto Serif SC", Georgia, serif;
    font-size: 30px;
    font-weight: 600;
    line-height: 1.1;
    color: var(--gold-soft);
    letter-spacing: 0.04em;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
}

.subhead {
    margin: 8px 0 0;
    color: var(--ink-2);
    font-size: 12px;
    line-height: 1.55;
}

/* ---------- Typography primitives ---------- */

h1, h2, p, ol, ul { margin: 0; }

h2 {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold);
}

p, small, li { line-height: 1.55; }

/* ---------- Metrics ---------- */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.metric {
    position: relative;
    padding: 10px 12px 10px 46px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(249, 245, 235, 0.62));
    overflow: hidden;
}

.metric .metric-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: inherit;
    font-size: 20px;
    line-height: 1;
    letter-spacing: 0;
    text-transform: none;
    transform: translateY(-50%);
}

.metric span {
    display: block;
    color: var(--ink-2);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.metric strong {
    display: block;
    margin-top: 4px;
    font-size: 22px;
    line-height: 1;
    font-weight: 700;
    color: var(--ink-0);
    font-variant-numeric: tabular-nums;
}
.metric strong i {
    font-style: normal;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-3);
    margin-left: 2px;
}

.metric.accent {
    border-color: var(--line-gold);
    background:
        linear-gradient(135deg, rgba(168, 111, 25, 0.16), transparent 70%),
        rgba(255, 249, 226, 0.78);
}
.metric.accent strong { color: var(--gold-soft); }

/* ---------- Panels (shared card) ---------- */

.panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(249, 246, 238, 0.54));
    background-color: rgba(255, 252, 244, 0.82);
}

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

.panel-title {
    display: block;
    color: var(--gold-soft);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.panel p {
    color: var(--ink-1);
    font-size: 13px;
}

.accent-panel {
    border-color: var(--line-gold);
    background:
        linear-gradient(135deg, rgba(168, 111, 25, 0.14), transparent 60%),
        rgba(255, 248, 224, 0.86);
}

/* ---------- Tags ---------- */

.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--ink-2);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    white-space: nowrap;
}
.tag-accent { border-color: var(--line-gold); color: var(--gold); background: rgba(168, 111, 25, 0.09); }
.tag-ally   { border-color: rgba(28, 120, 152, 0.34); color: var(--ally); background: rgba(28, 120, 152, 0.08); }
.tag-enemy  { border-color: rgba(184, 75, 68, 0.34); color: var(--enemy); background: rgba(184, 75, 68, 0.08); }

/* ---------- Follower composition ---------- */

.composition {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.composition > div {
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(238, 245, 241, 0.72);
    text-align: center;
}
.composition span {
    display: block;
    color: var(--ink-2);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.composition strong {
    display: block;
    margin-top: 3px;
    color: var(--ink-0);
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ---------- Log panel ---------- */

.log-panel {
    flex: 1 1 auto;
    min-height: 160px;
}
.log-panel ol {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: log;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    max-height: 280px;
}
.log-panel li {
    counter-increment: log;
    position: relative;
    padding: 4px 6px 4px 22px;
    color: var(--ink-1);
    font-size: 12px;
    line-height: 1.5;
    border-left: 1px solid var(--line);
}
.log-panel li::before {
    content: counter(log, decimal-leading-zero);
    position: absolute;
    left: 4px;
    top: 4px;
    color: var(--ink-3);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
}
.log-panel li.muted { color: var(--ink-3); font-style: italic; }

/* ---------- Stage (center) ---------- */

.stage {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-width: 0;
    min-height: 0;
    padding: 14px;
    gap: 12px;
    background:
        radial-gradient(circle at 50% 42%, rgba(168, 111, 25, 0.1), transparent 40%),
        var(--bg-0);
}

.stage-frame {
    position: relative;
    order: 1;
    min-height: 0;
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line-strong);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.74), var(--shadow-md);
    background: #efe7d6;
}
.stage-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    box-shadow: inset 0 0 46px rgba(105, 75, 34, 0.12);
}

#game-container { width: 100%; height: 100%; overflow: hidden; }
#game-container canvas {
    display: block;
}

.stage-topbar {
    order: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.phase-indicator {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border: 1px solid var(--line-gold);
    border-radius: 999px;
    background: rgba(255, 250, 236, 0.9);
    color: var(--gold-soft);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
}
.phase-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 10px rgba(168, 111, 25, 0.34);
    animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.6; transform: scale(0.8); }
}

.stage-bottom {
    order: 2;
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 12px;
}

/* ---------- Buttons ---------- */

.icon-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 253, 247, 0.9);
    color: var(--ink-1);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
    backdrop-filter: blur(10px);
}
.icon-button:hover {
    border-color: var(--gold);
    color: var(--gold-soft);
    transform: translateY(-1px);
}
.button-icon {
    display: inline-flex;
    width: 18px;
    justify-content: center;
    line-height: 1;
}

.primary-button,
.secondary-button,
.choice-button {
    border-radius: var(--radius-md);
    border: 1px solid var(--line-strong);
    color: var(--ink-0);
    background: rgba(255, 253, 247, 0.92);
    cursor: pointer;
    transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.primary-button {
    min-width: 220px;
    min-height: 52px;
    padding: 0 24px;
    border-color: var(--gold);
    background: linear-gradient(180deg, #ffd966, var(--gold));
    color: #241d15;
    font-weight: 800;
    letter-spacing: 0.08em;
    box-shadow: 0 10px 28px rgba(168, 111, 25, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.58);
}
.primary-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(168, 111, 25, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.68);
}
.primary-button:disabled {
    cursor: wait;
    opacity: 0.55;
    background: linear-gradient(180deg, #e6e0d4, #d8d1c4);
    color: var(--ink-2);
    border-color: var(--line-strong);
    box-shadow: none;
}

.secondary-button {
    width: 100%;
    min-height: 34px;
    margin-top: 10px;
    color: var(--ink-1);
    background: rgba(238, 245, 241, 0.72);
    border-color: var(--line);
    font-size: 12px;
}
.secondary-button:hover {
    border-color: var(--ally);
    color: var(--ally);
}

/* ---------- Choice list (3 cards) ---------- */

.choice-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    width: min(900px, 100%);
}

.choice-button {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    min-height: 110px;
    padding: 14px 16px 14px 50px;
    text-align: left;
    position: relative;
    overflow: hidden;
}
.choice-rune {
    position: absolute;
    left: 16px;
    top: 18px;
    width: 22px;
    line-height: 1;
    font-size: 22px;
    text-align: center;
}
.choice-button::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    background: var(--gold);
    transform: scaleX(0.25);
    transform-origin: left;
    transition: transform 220ms ease;
}
.choice-button:hover:not(:disabled) {
    border-color: var(--gold);
    background: rgba(255, 247, 222, 0.96);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.choice-button:hover:not(:disabled)::before { transform: scaleX(1); }

.choice-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.choice-button strong {
    color: var(--gold-soft);
    font-size: 15px;
    font-weight: 700;
}
.choice-button small {
    color: var(--ink-1);
    font-size: 12px;
    line-height: 1.5;
}
.choice-button em {
    flex-shrink: 0;
    padding: 3px 8px;
    border: 1px solid var(--line-gold);
    border-radius: 999px;
    color: var(--gold);
    font-size: 11px;
    font-style: normal;
    font-weight: 600;
    white-space: nowrap;
}
.choice-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    filter: grayscale(0.4);
}

/* ---------- Battle summary ---------- */

.battle-summary {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px 18px;
    border: 1px solid var(--line-gold);
    border-radius: var(--radius-md);
    background:
        linear-gradient(135deg, rgba(168, 111, 25, 0.11), transparent 70%),
        rgba(255, 250, 236, 0.92);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-md);
    width: min(720px, 100%);
}
.battle-summary-text { flex: 1; min-width: 0; }
.battle-summary h2 { margin-bottom: 4px; }
.battle-summary p {
    color: var(--ink-1);
    font-size: 13px;
}

/* ---------- Status inspector ---------- */

.status-panel {
    border-color: rgba(28, 120, 152, 0.24);
    background:
        linear-gradient(135deg, rgba(28, 120, 152, 0.1), transparent 55%),
        rgba(243, 250, 250, 0.86);
}
.status-panel h2 { color: var(--ally); }

.status-source {
    margin: -2px 0 6px;
    color: var(--ally);
    font-size: 11px;
    letter-spacing: 0.04em;
    opacity: 0.85;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin: 4px 0 8px;
}
.status-grid span {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 8px;
    border: 1px solid rgba(28, 120, 152, 0.14);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.72);
}
.status-grid i {
    font-style: normal;
    color: var(--ink-3);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.status-grid b {
    color: var(--ink-0);
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.empty-hint {
    padding: 14px 6px;
    text-align: center;
    font-size: 12px;
    line-height: 1.6;
}

/* ---------- Artifacts ---------- */

.artifact-grid {
    display: grid;
    gap: 8px;
}
.artifact-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line-gold);
    border-radius: var(--radius-sm);
    background:
        linear-gradient(135deg, rgba(168, 111, 25, 0.08), transparent 70%),
        rgba(255, 250, 236, 0.78);
}
.artifact-emoji {
    flex: 0 0 auto;
    width: 24px;
    margin-top: 1px;
    font-size: 20px;
    line-height: 1;
    text-align: center;
}
.artifact-card strong {
    display: block;
    color: var(--gold-soft);
    font-size: 13px;
    font-weight: 700;
}
.artifact-card p {
    margin: 4px 0 6px;
    color: var(--ink-1);
    font-size: 11px;
    line-height: 1.5;
}
.artifact-card small {
    display: block;
    color: var(--ink-3);
    font-size: 11px;
    letter-spacing: 0.02em;
}
.rune-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.rune-badge,
.rune-empty {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-height: 22px;
    padding: 2px 8px;
    border: 1px solid rgba(168, 111, 25, 0.42);
    border-radius: 999px;
    background:
        linear-gradient(180deg, rgba(255, 247, 220, 0.96), rgba(226, 195, 126, 0.3)),
        rgba(255, 251, 239, 0.92);
    color: #6b4511;
    font-family: "Songti SC", "Noto Serif SC", Georgia, serif;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.rune-empty {
    color: var(--ink-3);
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.46);
    font-family: inherit;
    font-weight: 600;
}

/* ---------- Keyword pills ---------- */

.keyword-cloud,
.unit-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.keyword-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 24px;
    padding: 4px 10px 4px 7px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(237, 228, 209, 0.4)),
        rgba(255, 255, 255, 0.68);
    color: var(--ink-1);
    font-family: "Songti SC", "Noto Serif SC", Georgia, serif;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    cursor: default;
    position: relative;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.82),
        0 1px 4px rgba(65, 48, 28, 0.08);
    transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
.keyword-emoji {
    display: inline-flex;
    width: 16px;
    justify-content: center;
    font-size: 13px;
    line-height: 1;
}
.keyword-pill b {
    font-weight: 800;
    color: var(--ink-0);
    font-variant-numeric: tabular-nums;
}
.keyword-pill:hover {
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 6px 14px rgba(65, 48, 28, 0.13);
}
.keyword-inline-wrap {
    display: inline-flex;
    align-items: center;
    position: relative;
    top: -0.06em;
    margin: 0 4px;
    vertical-align: middle;
}
.keyword-inline {
    display: inline-flex;
    gap: 2px;
    min-height: 0;
    height: 1.18em;
    padding: 0 5px 0 4px;
    font-size: 0.86em;
    line-height: 1;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.78),
        0 1px 3px rgba(65, 48, 28, 0.06);
}
.keyword-inline:hover {
    transform: none;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.86),
        0 2px 5px rgba(65, 48, 28, 0.08);
}
.keyword-inline .keyword-emoji {
    width: 1em;
    font-size: 0.9em;
}

.keyword-giant     { border-color: rgba(168, 111, 25, 0.44); background: rgba(168, 111, 25, 0.1); color: #6d4712; }
.keyword-flying    { border-color: rgba(28, 120, 152, 0.42); background: rgba(28, 120, 152, 0.1); color: #1a6986; }
.keyword-poison    { border-color: rgba(75, 145, 59, 0.42); background: rgba(75, 145, 59, 0.1); color: #407d31; }
.keyword-fire      { border-color: rgba(190, 83, 42, 0.45); background: rgba(190, 83, 42, 0.11); color: #9f4623; }
.keyword-bloodlust { border-color: rgba(183, 55, 82, 0.45); background: rgba(183, 55, 82, 0.1); color: #9a2f48; }
.keyword-sharp     { border-color: rgba(74, 56, 34, 0.28); background: rgba(238, 245, 241, 0.74); color: var(--ink-0); }
.keyword-ward      { border-color: rgba(81, 105, 190, 0.42); background: rgba(81, 105, 190, 0.1); color: #3f56a6; }
.keyword-haste     { border-color: rgba(24, 142, 123, 0.42); background: rgba(24, 142, 123, 0.1); color: #167d6d; }
.keyword-echo      { border-color: rgba(129, 82, 180, 0.42); background: rgba(129, 82, 180, 0.1); color: #734aa0; }
.keyword-frost     { border-color: rgba(35, 140, 178, 0.42); background: rgba(35, 140, 178, 0.1); color: #217696; }
.keyword-lightning { border-color: rgba(182, 142, 22, 0.45); background: rgba(182, 142, 22, 0.12); color: #8f6c10; }
.keyword-holy      { border-color: rgba(196, 155, 51, 0.42); background: rgba(255, 232, 156, 0.2); color: #8a6819; }
.keyword-shadow    { border-color: rgba(89, 72, 154, 0.45); background: rgba(89, 72, 154, 0.12); color: #53438f; }
.keyword-thorn     { border-color: rgba(55, 142, 62, 0.42); background: rgba(55, 142, 62, 0.1); color: #347b39; }
.keyword-regen     { border-color: rgba(40, 153, 82, 0.42); background: rgba(40, 153, 82, 0.1); color: #24783e; }
.keyword-armor     { border-color: rgba(101, 109, 117, 0.42); background: rgba(101, 109, 117, 0.12); color: #535b62; }
.keyword-frenzy    { border-color: rgba(196, 47, 47, 0.45); background: rgba(196, 47, 47, 0.1); color: #a33131; }
.keyword-martyr    { border-color: rgba(174, 78, 78, 0.42); background: rgba(174, 78, 78, 0.1); color: #904040; }
.keyword-curse     { border-color: rgba(126, 58, 190, 0.45); background: rgba(126, 58, 190, 0.1); color: #7134a9; }
.keyword-blessing  { border-color: rgba(203, 151, 35, 0.44); background: rgba(203, 151, 35, 0.12); color: #8a6415; }
.keyword-split     { border-color: rgba(178, 72, 104, 0.42); background: rgba(178, 72, 104, 0.1); color: #954062; }
.keyword-banner    { border-color: rgba(194, 116, 29, 0.44); background: rgba(194, 116, 29, 0.12); color: #8b5314; }
.keyword-devour    { border-color: rgba(103, 139, 28, 0.45); background: rgba(103, 139, 28, 0.12); color: #587418; }
.keyword-doom      { border-color: rgba(55, 57, 82, 0.42); background: rgba(55, 57, 82, 0.12); color: #373952; }

/* ---------- Tooltip ---------- */

.has-tooltip { position: relative; }
.floating-tooltip {
    position: fixed;
    z-index: 10000;
    width: max-content;
    max-width: 260px;
    padding: 8px 10px;
    border: 1px solid var(--line-gold);
    border-radius: var(--radius-sm);
    background: rgba(255, 253, 247, 0.98);
    color: var(--ink-0);
    font-size: 12px;
    line-height: 1.5;
    letter-spacing: normal;
    text-align: left;
    white-space: normal;
    pointer-events: none;
    box-shadow: var(--shadow-md);
}

.floating-tooltip-above {
    transform: translateY(-100%);
}

.floating-tooltip-below {
    transform: none;
}

.muted { color: var(--ink-3); }

/* ---------- Utility ---------- */

.panel .muted { font-size: 12px; }

/* ---------- Responsive ---------- */

@media (max-width: 1280px) {
    .shell {
        grid-template-columns: 280px minmax(0, 1fr) 300px;
    }
    .brand h1 { font-size: 26px; }
}

@media (max-width: 1024px) {
    body { overflow: auto; }
    .shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        height: auto;
        min-height: 100svh;
    }
    .stage {
        order: -1;
        min-height: 100svh;
        padding: 10px;
        gap: 10px;
    }
    .stage-frame { min-height: 0; }
    .sidebar { max-height: none; border: none; border-bottom: 1px solid var(--line); }
    .sidebar-right { border-bottom: none; border-top: 1px solid var(--line); }
    .battle-summary { flex-direction: column; align-items: stretch; }
    .primary-button { width: 100%; }
}

@media (max-width: 640px) {
    .stage {
        padding: 8px;
        gap: 8px;
    }
    .stage-topbar {
        gap: 8px;
    }
    .phase-indicator {
        flex: 1;
        min-width: 0;
        padding: 7px 10px;
        font-size: 11px;
        letter-spacing: 0.02em;
    }
    .icon-button {
        flex: 0 0 auto;
        height: 34px;
        padding: 0 10px;
        font-size: 12px;
    }
    .stage-bottom {
        justify-content: flex-start;
        min-width: 0;
        overflow: hidden;
    }
    .choice-list {
        grid-auto-flow: column;
        grid-auto-columns: minmax(260px, 84vw);
        grid-template-columns: none;
        gap: 8px;
        width: 100%;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        scrollbar-width: thin;
        padding-bottom: 2px;
    }
    .choice-button {
        min-height: 118px;
        padding: 12px 14px 12px 46px;
        scroll-snap-align: start;
    }
    .choice-rune {
        left: 14px;
        top: 16px;
    }
    .battle-summary {
        gap: 10px;
        padding: 12px;
    }
    .primary-button {
        min-height: 46px;
    }
    .sidebar {
        padding: 10px;
    }
}
