/* ============================================================
   AIVentures — Design System & Styles
   ============================================================ */

/* ===== 1. Design Tokens ===== */
:root {
    /* Backgrounds */
    --bg-deepest: #0a0e1a;
    --bg-dark: #0d1321;
    --bg-medium: #151d2e;
    --bg-light: #1e2a3f;
    --bg-lighter: #263245;

    /* Brand */
    --gold: #daa520;
    --gold-light: #f0c850;
    --gold-dim: rgba(218, 165, 32, 0.35);
    --leather: #8b4513;
    --leather-light: #a0522d;

    /* Text */
    --text: #e8e8e8;
    --text-muted: #8b95a5;
    --text-dim: #5a6577;

    /* Semantic */
    --success: #2e7d32;
    --success-light: #66bb6a;
    --danger: #c62828;
    --danger-light: #ef5350;
    --warning: #f9a825;
    --info: #1565c0;
    --info-light: #42a5f5;

    /* Glass */
    --glass-bg: rgba(21, 29, 46, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: 12px;

    /* Spacing */
    --sp-xs: 0.25rem;
    --sp-sm: 0.5rem;
    --sp-md: 1rem;
    --sp-lg: 1.5rem;
    --sp-xl: 2rem;
    --sp-2xl: 3rem;
    --sp-3xl: 4rem;

    /* Radii */
    --r-sm: 4px;
    --r-md: 8px;
    --r-lg: 12px;
    --r-xl: 16px;
    --r-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    --shadow-glow-gold: 0 0 20px rgba(218, 165, 32, 0.2);
    --shadow-glow-green: 0 0 20px rgba(46, 125, 50, 0.2);
    --shadow-glow-red: 0 0 20px rgba(198, 40, 40, 0.2);

    /* Transitions */
    --tr-fast: 0.15s ease;
    --tr-normal: 0.25s ease;
    --tr-slow: 0.4s ease;

    /* Fonts */
    --font-heading: 'Cinzel', Georgia, serif;
    --font-body: 'Georgia', 'Times New Roman', serif;
    --font-mono: 'Courier New', monospace;
}


/* ===== 2. Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-body);
    background: var(--bg-deepest);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); }

img { max-width: 100%; display: block; }
ul, ol { list-style: none; }


/* ===== 3. Typography ===== */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
    line-height: 1.2;
    color: var(--gold);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }

.page-title {
    text-align: center;
    margin-bottom: var(--sp-sm);
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.page-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: var(--sp-xl);
    font-style: italic;
}


/* ===== 4. Layout ===== */
header {
    background: var(--bg-medium);
    border-bottom: 1px solid var(--gold-dim);
    padding: 0 var(--sp-xl);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

main {
    flex: 1;
    max-width: 1000px;
    margin: 0 auto;
    padding: var(--sp-xl);
    width: 100%;
    animation: pageEnter 0.35s ease-out;
}

body.battle-page main {
    max-width: none;
    padding: 0;
    margin: 0;
    animation: none;
}

footer {
    background: var(--bg-medium);
    border-top: 1px solid rgba(255,255,255,0.05);
    padding: var(--sp-sm) var(--sp-md);
    text-align: center;
    color: var(--text-dim);
    font-size: 0.8rem;
}


/* ===== 5. Navigation ===== */
nav {
    display: flex;
    align-items: center;
    max-width: 1000px;
    margin: 0 auto;
    height: 56px;
    gap: var(--sp-lg);
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--gold);
    text-decoration: none;
    white-space: nowrap;
    text-shadow: 0 0 12px rgba(218, 165, 32, 0.3);
}
.logo:hover { color: var(--gold-light); }

.nav-links {
    display: flex;
    gap: var(--sp-xs);
}

.nav-links a {
    color: var(--text-muted);
    padding: var(--sp-xs) var(--sp-sm);
    border-radius: var(--r-sm);
    font-size: 0.85rem;
    font-family: var(--font-heading);
    letter-spacing: 0.03em;
    transition: color var(--tr-fast), background var(--tr-fast);
}
.nav-links a:hover,
.nav-links a.active {
    color: var(--gold);
    background: rgba(218, 165, 32, 0.1);
}

.nav-spacer { flex: 1; }

.nav-status {
    display: flex;
    align-items: center;
    gap: var(--sp-md);
    font-size: 0.85rem;
}

.nav-name {
    color: var(--gold);
    font-weight: bold;
    font-family: var(--font-heading);
}

.nav-hp-wrap {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
}

.nav-hp-bar {
    width: 70px;
    height: 8px;
    background: rgba(0,0,0,0.4);
    border-radius: var(--r-full);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}

.nav-hp-fill {
    height: 100%;
    border-radius: var(--r-full);
    background: linear-gradient(90deg, var(--danger) 0%, var(--warning) 50%, var(--success-light) 100%);
    transition: width var(--tr-normal);
}

.nav-hp-text {
    color: var(--success-light);
    font-size: 0.8rem;
    white-space: nowrap;
}

.nav-pp {
    color: var(--info-light);
    font-size: 0.85rem;
    white-space: nowrap;
}

.nav-gold {
    color: var(--warning);
    font-size: 0.85rem;
    white-space: nowrap;
}

.nav-level {
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}


/* ===== 6. Glass Panel ===== */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--r-lg);
    padding: var(--sp-lg);
}

.glass-bordered {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--gold-dim);
    border-radius: var(--r-lg);
    padding: var(--sp-lg);
    box-shadow: var(--shadow-glow-gold);
}

.panel {
    background: var(--bg-medium);
    border: 1px solid var(--bg-light);
    border-radius: var(--r-lg);
    padding: var(--sp-lg);
    margin-bottom: var(--sp-lg);
}

.panel-title {
    color: var(--gold);
    font-size: 1.15rem;
    margin-bottom: var(--sp-md);
    padding-bottom: var(--sp-sm);
    border-bottom: 1px solid var(--bg-light);
    font-family: var(--font-heading);
}


/* ===== 7. Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: var(--r-md);
    font-size: 0.95rem;
    font-family: var(--font-heading);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--tr-normal);
    letter-spacing: 0.02em;
    white-space: nowrap;
    gap: var(--sp-sm);
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    background: linear-gradient(135deg, var(--leather), var(--leather-light));
    color: var(--text);
    border: 1px solid var(--gold-dim);
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--leather-light), var(--gold));
    color: var(--bg-dark);
    box-shadow: 0 6px 18px rgba(139, 69, 19, 0.5);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text);
    border: 1px solid var(--bg-lighter);
}
.btn-secondary:hover {
    border-color: var(--gold-dim);
    background: var(--bg-lighter);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), var(--success-light));
    color: #fff;
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}
.btn-success:hover {
    box-shadow: 0 6px 18px rgba(46, 125, 50, 0.5);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), var(--danger-light));
    color: #fff;
    box-shadow: 0 4px 12px rgba(198, 40, 40, 0.3);
}
.btn-danger:hover {
    box-shadow: 0 6px 18px rgba(198, 40, 40, 0.5);
    transform: translateY(-2px);
}

.btn-attack {
    background: linear-gradient(135deg, #c62828, #e53935);
    color: #fff;
    font-weight: bold;
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-height: 48px;
    min-width: 130px;
    box-shadow: 0 4px 15px rgba(198, 40, 40, 0.4);
}
.btn-attack:hover {
    background: linear-gradient(135deg, #e53935, #ff5252);
    box-shadow: 0 6px 20px rgba(198, 40, 40, 0.6);
    transform: translateY(-2px);
}

.btn-defend {
    background: linear-gradient(135deg, #1565c0, #1e88e5);
    color: #fff;
    font-weight: bold;
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-height: 48px;
    min-width: 130px;
    box-shadow: 0 4px 15px rgba(21, 101, 192, 0.4);
}
.btn-defend:hover {
    background: linear-gradient(135deg, #1e88e5, #42a5f5);
    box-shadow: 0 6px 20px rgba(21, 101, 192, 0.6);
    transform: translateY(-2px);
}

.btn-item {
    background: linear-gradient(135deg, #2e7d32, #43a047);
    color: #fff;
    font-weight: bold;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-height: 40px;
    min-width: 100px;
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}
.btn-item:hover {
    background: linear-gradient(135deg, #43a047, #66bb6a);
    box-shadow: 0 6px 16px rgba(46, 125, 50, 0.5);
    transform: translateY(-2px);
}

.btn-small {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
}

.btn:disabled, .btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-sm);
    justify-content: center;
}

.inline-form { display: inline; }


/* ===== 8. Forms ===== */
.form-group {
    margin-bottom: var(--sp-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--sp-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--bg-light);
    border-radius: var(--r-md);
    background: var(--bg-dark);
    color: var(--text);
    font-size: 1rem;
    font-family: var(--font-body);
    transition: border-color var(--tr-fast);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px var(--gold-dim);
}

.form-section {
    background: var(--bg-medium);
    padding: var(--sp-lg);
    border-radius: var(--r-lg);
    margin-bottom: var(--sp-lg);
    border: 1px solid var(--bg-light);
}

.form-section h2 {
    font-size: 1.15rem;
    margin-bottom: var(--sp-md);
}

.hint {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--sp-md);
}


/* ===== 9. Health Bars ===== */
.health-bar {
    background: rgba(0, 0, 0, 0.5);
    height: 22px;
    border-radius: var(--r-full);
    overflow: hidden;
    position: relative;
}

.health-bar-fill {
    height: 100%;
    border-radius: var(--r-full);
    background: linear-gradient(90deg, var(--danger) 0%, var(--warning) 50%, var(--success-light) 100%);
    transition: width 0.5s ease;
    box-shadow: 0 0 8px rgba(46, 125, 50, 0.6);
}

.health-bar-sm {
    height: 16px;
}

.hp-text {
    font-weight: bold;
    font-size: 1.1rem;
}


/* ===== 10. Alerts & Toasts ===== */
.alert {
    padding: var(--sp-md);
    border-radius: var(--r-md);
    margin-bottom: var(--sp-md);
    text-align: center;
    font-size: 0.9rem;
    animation: slideDown 0.3s ease-out;
}

.alert-success {
    background: rgba(46, 125, 50, 0.15);
    border: 1px solid var(--success);
    color: var(--success-light);
}

.alert-error {
    background: rgba(198, 40, 40, 0.15);
    border: 1px solid var(--danger);
    color: var(--danger-light);
}

.alert-info {
    background: rgba(21, 101, 192, 0.15);
    border: 1px solid var(--info);
    color: var(--info-light);
}

/* Toast container */
.toast-container {
    position: fixed;
    top: 72px;
    right: var(--sp-xl);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: var(--sp-sm);
    pointer-events: none;
}

.toast {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--r-lg);
    padding: var(--sp-md) var(--sp-lg);
    color: var(--text);
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.35s ease-out forwards;
    pointer-events: auto;
    max-width: 360px;
}

.toast.toast-success { border-left: 3px solid var(--success-light); }
.toast.toast-error { border-left: 3px solid var(--danger-light); }
.toast.toast-info { border-left: 3px solid var(--info-light); }
.toast.toast-warning { border-left: 3px solid var(--warning); }

.toast.toast-out {
    animation: toastOut 0.3s ease-in forwards;
}


/* ===== 11. Step Indicator ===== */
.steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: var(--sp-2xl);
}

.step {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    font-size: 0.85rem;
    color: var(--text-dim);
    font-family: var(--font-heading);
}

.step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85rem;
    background: var(--bg-light);
    border: 2px solid var(--bg-lighter);
    transition: all var(--tr-normal);
}

.step.completed .step-num {
    background: var(--success);
    border-color: var(--success-light);
    color: #fff;
}

.step.active .step-num {
    background: var(--gold);
    border-color: var(--gold-light);
    color: var(--bg-dark);
}

.step.active .step-label {
    color: var(--gold);
}

.step.completed .step-label {
    color: var(--success-light);
}

.step-line {
    width: 40px;
    height: 2px;
    background: var(--bg-lighter);
    margin: 0 var(--sp-xs);
}

.step.completed + .step-line,
.step-line.done {
    background: var(--success);
}


/* ===== 12. Selection Grid ===== */
.selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--sp-md);
    margin-bottom: var(--sp-xl);
}

.selection-card {
    background: var(--bg-medium);
    border: 2px solid var(--bg-light);
    border-radius: var(--r-lg);
    padding: var(--sp-lg);
    cursor: pointer;
    transition: all var(--tr-normal);
    position: relative;
}

.selection-card:hover {
    border-color: var(--gold-dim);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.selection-card.selected {
    border-color: var(--gold);
    background: var(--bg-light);
    box-shadow: var(--shadow-glow-gold);
}

.selection-card h3 {
    margin-bottom: var(--sp-sm);
    font-size: 1.1rem;
}

.stat-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-xs);
    margin-top: var(--sp-sm);
}

.stat-pill {
    background: var(--bg-dark);
    padding: 0.2rem 0.5rem;
    border-radius: var(--r-sm);
    font-size: 0.78rem;
    color: var(--success-light);
    border: 1px solid rgba(46, 125, 50, 0.2);
}

.class-info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--bg-dark);
}
.class-info-row:last-child { border-bottom: none; }
.class-info-row .label { color: var(--text-muted); }
.class-info-row .value { color: var(--text); }
.class-info-row .value.small { font-size: 0.75rem; }


/* ===== 13. Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-md);
}

.stat-box {
    background: var(--bg-dark);
    padding: var(--sp-md);
    border-radius: var(--r-md);
    text-align: center;
    border: 1px solid var(--bg-light);
}

.stat-box .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: var(--sp-xs);
}

.stat-box .value {
    font-size: 1.4rem;
    color: var(--gold);
    font-weight: bold;
    font-family: var(--font-heading);
    display: block;
}

.stat-box .modifier {
    font-size: 0.85rem;
    color: var(--success-light);
    display: block;
}

.stat-box.large { padding: var(--sp-lg); }
.stat-box.large .value { font-size: 1.8rem; }
.stat-box .value.hp { color: var(--success-light); }
.stat-box .value.gold-val { color: var(--warning); }


/* ===== 14. Home Page ===== */
.home-hero {
    background:
        linear-gradient(rgba(10, 14, 26, 0.8), rgba(10, 14, 26, 0.92)),
        url('/static/images/orc-creature-battle.jpg');
    background-size: cover;
    background-position: center;
    min-height: calc(100vh - 56px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--sp-xl);
    margin: calc(-1 * var(--sp-xl));
    margin-bottom: 0;
}

.home-hero h1 {
    font-size: 3.5rem;
    text-shadow: 0 0 30px rgba(218, 165, 32, 0.4), 0 4px 8px rgba(0,0,0,0.7);
    margin-bottom: var(--sp-sm);
    animation: glowPulse 3s ease-in-out infinite;
}

.home-tagline {
    font-style: italic;
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-bottom: var(--sp-2xl);
    letter-spacing: 0.05em;
}

.home-story {
    max-width: 560px;
    margin-bottom: var(--sp-2xl);
    text-align: center;
    font-size: 1rem;
    line-height: 1.8;
}

.home-hero .btn-primary {
    font-size: 1.15rem;
    padding: 0.85rem 2.5rem;
}


/* ===== 15. Weapon/Armor/Skill Cards ===== */
.equip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--sp-md);
}

.equip-card {
    display: block;
    cursor: pointer;
}

.equip-card input[type="radio"] { display: none; }

.equip-card-inner {
    background: var(--bg-dark);
    border: 2px solid var(--bg-light);
    border-radius: var(--r-lg);
    padding: var(--sp-md);
    transition: all var(--tr-normal);
}

.equip-card input:checked + .equip-card-inner {
    border-color: var(--gold);
    background: var(--bg-light);
    box-shadow: var(--shadow-glow-gold);
}

.equip-card-inner:hover {
    border-color: var(--gold-dim);
}

.equip-card-inner h3 {
    color: var(--text);
    font-size: 0.95rem;
    margin-bottom: var(--sp-sm);
}

.equip-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--sp-xs);
}

.equip-damage { color: var(--danger-light); font-size: 0.88rem; }
.equip-category { color: var(--text-muted); font-size: 0.8rem; }
.equip-props { color: var(--text-dim); font-size: 0.8rem; }

/* Portrait selection grid */
.portrait-grid {
    display: flex;
    gap: var(--sp-lg);
    justify-content: center;
}

.portrait-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.portrait-option input[type="radio"] { display: none; }

.portrait-choice {
    width: 120px;
    height: 120px;
    object-fit: cover;
    object-position: top;
    border-radius: var(--r-lg);
    border: 3px solid var(--bg-light);
    transition: all var(--tr-normal);
    box-shadow: var(--shadow-md);
}

.portrait-option:hover .portrait-choice {
    border-color: var(--gold-dim);
    transform: translateY(-2px);
}

.portrait-option input:checked + .portrait-choice {
    border-color: var(--gold);
    box-shadow: var(--shadow-glow-gold), var(--shadow-md);
}

.portrait-label {
    margin-top: var(--sp-sm);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: color var(--tr-fast);
}

.portrait-option input:checked ~ .portrait-label {
    color: var(--gold-light);
}

/* Player portrait in battle */
.player-portrait {
    width: 100px;
    height: 100px;
    object-fit: cover;
    object-position: top;
    border-radius: var(--r-md);
    border: 2px solid rgba(46, 125, 50, 0.4);
    margin: 0 auto var(--sp-sm);
    display: block;
    box-shadow: var(--shadow-md), 0 0 12px rgba(46, 125, 50, 0.15);
}

/* Summary portrait */
.summary-portrait {
    width: 140px;
    height: 140px;
    object-fit: cover;
    object-position: top;
    border-radius: var(--r-lg);
    border: 3px solid var(--gold-dim);
    margin: 0 auto var(--sp-md);
    display: block;
    box-shadow: var(--shadow-glow-gold), var(--shadow-md);
}

.skill-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--sp-sm);
}

.skill-option {
    display: flex;
    align-items: center;
    padding: var(--sp-sm) var(--sp-md);
    background: var(--bg-dark);
    border-radius: var(--r-md);
    cursor: pointer;
    transition: all var(--tr-fast);
    border: 1px solid transparent;
}
.skill-option:hover { background: var(--bg-light); }

.skill-checkbox {
    margin-right: var(--sp-sm);
    accent-color: var(--gold);
}
.skill-checkbox:checked + .skill-name { color: var(--gold); }

.skill-counter {
    margin-top: var(--sp-md);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.skill-counter strong {
    color: var(--gold);
}


/* ===== 16. Character Summary ===== */
.char-summary {
    max-width: 680px;
    margin: 0 auto;
}

.char-summary .page-title {
    font-size: 2.5rem;
}

.vital-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-md);
}

.equip-info p {
    margin: var(--sp-sm) 0;
    font-size: 0.95rem;
}

.equip-info strong { color: var(--text-muted); }


/* ===== 17. Game Location ===== */
.location-container {
    max-width: 800px;
    margin: 0 auto;
}

.location-header {
    text-align: center;
    margin-bottom: var(--sp-xl);
}

.act-label {
    color: var(--text-dim);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-family: var(--font-heading);
}

.location-header h1 {
    margin: var(--sp-sm) 0;
    font-size: 2rem;
}

.location-sub {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.location-desc {
    background: var(--bg-medium);
    padding: var(--sp-lg);
    border-radius: var(--r-lg);
    margin-bottom: var(--sp-xl);
    border-left: 4px solid var(--gold);
    font-style: italic;
    line-height: 1.7;
}

.area-connections {
    margin-bottom: var(--sp-lg);
}

.area-connections h3 {
    color: var(--text-muted);
    margin-bottom: var(--sp-md);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.conn-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-sm);
}

.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-sm);
}

.action-bar h3 {
    width: 100%;
    color: var(--text-muted);
    margin-bottom: var(--sp-xs);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.danger-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-sm);
    padding: var(--sp-sm) var(--sp-md);
    border-radius: var(--r-full);
    font-size: 0.8rem;
    font-family: var(--font-heading);
    letter-spacing: 0.04em;
    margin-top: var(--sp-md);
}

.danger-low { background: rgba(46,125,50,0.15); color: var(--success-light); border: 1px solid rgba(46,125,50,0.3); }
.danger-med { background: rgba(249,168,37,0.15); color: var(--warning); border: 1px solid rgba(249,168,37,0.3); }
.danger-high { background: rgba(198,40,40,0.15); color: var(--danger-light); border: 1px solid rgba(198,40,40,0.3); animation: dangerPulse 2s ease-in-out infinite; }


/* ===== 18. Travel ===== */
.travel-container {
    max-width: 800px;
    margin: 0 auto;
}

.current-loc {
    text-align: center;
    padding: var(--sp-md);
    margin-bottom: var(--sp-xl);
    color: var(--text-muted);
}
.current-loc strong {
    color: var(--gold);
    margin-left: var(--sp-sm);
}

.loc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--sp-md);
}

.loc-card {
    background: var(--bg-medium);
    border: 2px solid var(--bg-light);
    border-radius: var(--r-lg);
    padding: var(--sp-lg);
    transition: all var(--tr-normal);
}
.loc-card:hover {
    border-color: var(--gold-dim);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.loc-card h3 { margin-bottom: var(--sp-sm); }

.loc-card .desc {
    color: var(--text);
    font-size: 0.9rem;
    margin-bottom: var(--sp-md);
    line-height: 1.5;
}

.level-range {
    color: var(--warning);
    font-size: 0.8rem;
    font-family: var(--font-heading);
    margin-bottom: var(--sp-md);
}


/* ===== 19. Battle Arena ===== */
.battle-wrapper {
    background-image: url('/static/images/orc-creature-battle.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 100vh;
    width: 100%;
}

.battle-overlay {
    background: rgba(0, 0, 0, 0.55);
    min-height: 100vh;
    padding: var(--sp-lg);
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.battle-arena {
    max-width: 960px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.round-badge {
    align-self: center;
    background: rgba(0, 0, 0, 0.6);
    color: var(--gold);
    padding: 0.35rem 1.25rem;
    border-radius: var(--r-full);
    font-size: 0.9rem;
    font-weight: bold;
    font-family: var(--font-heading);
    letter-spacing: 0.05em;
    border: 1px solid var(--gold-dim);
}

.combatants {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: var(--sp-lg);
    align-items: stretch;
}

.combatant {
    padding: var(--sp-lg);
    text-align: center;
    min-width: 0;
}

.combatant.player {
    border: 1px solid rgba(46, 125, 50, 0.5);
    box-shadow: var(--shadow-glow-green);
}

.combatant.monster {
    border: 1px solid rgba(198, 40, 40, 0.5);
    box-shadow: var(--shadow-glow-red);
}

.combatant h2 {
    margin-bottom: 0.4rem;
    font-size: 1.3rem;
}
.combatant.player h2 { color: var(--success-light); }
.combatant.monster h2 { color: var(--danger-light); }

.combatant .info {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: var(--sp-md);
}

.combatant .ac {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.vs-badge {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--gold);
    background: rgba(0, 0, 0, 0.6);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    border: 2px solid var(--gold-dim);
    text-shadow: 0 0 10px rgba(218, 165, 32, 0.5);
    flex-shrink: 0;
    font-family: var(--font-heading);
}

/* Battle Log */
.battle-log {
    padding: var(--sp-md) 1.25rem;
    max-height: 200px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    line-height: 1.5;
}

.battle-log::-webkit-scrollbar { width: 6px; }
.battle-log::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 3px; }
.battle-log::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 3px; }

.log-entry {
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.log-entry:last-child { border-bottom: none; }
.log-entry.damage { color: var(--danger-light); }
.log-entry.heal { color: var(--success-light); }
.log-entry.defend { color: var(--info-light); }
.log-entry.miss { color: var(--text-muted); }

/* Battle Actions */
.battle-actions {
    padding: 1.25rem var(--sp-lg);
    text-align: center;
}

.battle-actions h3 {
    color: var(--gold);
    margin-bottom: var(--sp-md);
    font-size: 1.1rem;
}

.battle-actions .btn-group {
    gap: var(--sp-md);
}

.items-section {
    margin-top: var(--sp-md);
    padding-top: var(--sp-md);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.item-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--sp-sm);
}

.items-section h4 {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-heading);
}

/* Waiting */
.battle-actions.waiting { opacity: 0.85; }

.waiting-dots {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.waiting-dots .dot {
    width: 8px;
    height: 8px;
    background: var(--gold);
    border-radius: 50%;
    animation: pulseDot 1.4s infinite ease-in-out;
}
.waiting-dots .dot:nth-child(2) { animation-delay: 0.2s; }
.waiting-dots .dot:nth-child(3) { animation-delay: 0.4s; }

/* Apply glass to battle panels */
.combatant,
.battle-log,
.battle-actions {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--r-lg);
}

.combatant.player { border-color: rgba(46, 125, 50, 0.5); }
.combatant.monster { border-color: rgba(198, 40, 40, 0.5); }

.monster-portrait {
    width: 100px;
    height: 100px;
    object-fit: cover;
    object-position: top;
    border-radius: var(--r-md);
    border: 2px solid rgba(198, 40, 40, 0.4);
    margin: 0 auto var(--sp-sm);
    display: block;
    box-shadow: var(--shadow-md), 0 0 12px rgba(198, 40, 40, 0.15);
}

.monster-taunt {
    background: var(--bg-dark);
    border: 1px solid rgba(198, 40, 40, 0.3);
    border-radius: var(--r-md);
    padding: var(--sp-sm) var(--sp-md);
    margin-bottom: var(--sp-sm);
    position: relative;
    animation: fadeInUp 0.4s ease;
}

.monster-taunt::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--bg-dark);
}

.monster-taunt-text {
    color: var(--danger-light);
    font-style: italic;
    font-size: 0.85rem;
    text-align: center;
    line-height: 1.4;
}

.log-entry.taunt {
    color: var(--danger-light);
    font-style: italic;
    font-size: 0.88rem;
}


/* ===== 20. Victory & Defeat ===== */
.result-screen {
    text-align: center;
    padding: var(--sp-3xl) var(--sp-xl);
    max-width: 600px;
    margin: 0 auto;
}

.result-screen h1 {
    font-size: 3rem;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    margin-bottom: var(--sp-sm);
}

.result-screen.victory h1 { color: var(--success-light); }
.result-screen.defeat h1 { color: var(--danger-light); }

.rewards-panel {
    background: var(--bg-medium);
    padding: var(--sp-xl);
    border-radius: var(--r-lg);
    margin-bottom: var(--sp-xl);
    border: 2px solid var(--success);
    text-align: left;
}

.rewards-panel h3 {
    margin-bottom: var(--sp-md);
}

.reward-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--bg-light);
    font-size: 0.95rem;
}
.reward-row:last-child { border-bottom: none; }
.reward-row .label { color: var(--text-muted); }
.reward-row .value { font-weight: bold; }
.reward-row.xp .value { color: var(--gold); }
.reward-row.gold-r .value { color: var(--warning); }
.reward-row.loot .value { color: var(--success-light); }
.reward-row.loot-weapon .value { color: #e06c75; }
.reward-row.loot-armor .value { color: var(--info-light); }

.level-up-banner {
    margin-top: var(--sp-lg);
    padding-top: var(--sp-md);
    border-top: 2px solid var(--gold);
    text-align: center;
    animation: levelGlow 1.5s ease-in-out infinite alternate;
}

.level-up-banner h3 {
    font-size: 1.5rem;
    margin-bottom: var(--sp-xs);
}

.text-info { color: var(--info-light); }

.new-abilities {
    margin-top: var(--sp-md);
}

.new-abilities p {
    margin-bottom: var(--sp-sm);
    font-size: 0.9rem;
}

.new-ability-badge {
    display: inline-block;
    background: linear-gradient(135deg, #4a148c, #7b1fa2);
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: var(--r-full);
    font-size: 0.8rem;
    font-family: var(--font-heading);
    margin: 0.2rem;
    box-shadow: 0 2px 8px rgba(74, 20, 140, 0.4);
}

.defeat-msg {
    background: var(--bg-medium);
    padding: var(--sp-xl);
    border-radius: var(--r-lg);
    margin-bottom: var(--sp-xl);
    border: 2px solid var(--danger);
    font-style: italic;
    line-height: 1.7;
}

.char-status-card {
    background: var(--bg-medium);
    padding: var(--sp-lg);
    border-radius: var(--r-lg);
    margin-bottom: var(--sp-xl);
}

.char-status-card h3 { margin-bottom: var(--sp-sm); }
.char-status-card p { margin: var(--sp-xs) 0; color: var(--text-muted); }


/* ===== 21. Shop ===== */
.shop-container {
    max-width: 960px;
    margin: 0 auto;
}

/* -- Shopkeeper Section -- */
.shopkeeper-section {
    display: flex;
    gap: var(--sp-xl);
    margin-bottom: var(--sp-xl);
    background: var(--bg-medium);
    border-radius: var(--r-xl);
    border: 1px solid var(--gold-dim);
    padding: var(--sp-lg);
    box-shadow: var(--shadow-glow-gold);
}

.shopkeeper-portrait-wrap {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-sm);
}

.shopkeeper-portrait {
    width: 160px;
    height: 160px;
    object-fit: cover;
    object-position: top;
    border-radius: var(--r-lg);
    border: 2px solid var(--gold-dim);
    box-shadow: var(--shadow-md), 0 0 15px rgba(218, 165, 32, 0.15);
}

.shopkeeper-nameplate {
    text-align: center;
}

.shopkeeper-name {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--gold-light);
    font-weight: 600;
}

.shopkeeper-title {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

.shopkeeper-dialog-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.dialog-bubble {
    background: var(--bg-dark);
    border: 1px solid var(--bg-lighter);
    border-radius: var(--r-lg);
    padding: var(--sp-md) var(--sp-lg);
    position: relative;
    margin-bottom: var(--sp-md);
}

.dialog-bubble::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 20px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 10px solid var(--bg-lighter);
}

.dialog-bubble::after {
    content: '';
    position: absolute;
    left: -8px;
    top: 21px;
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-right: 9px solid var(--bg-dark);
}

.dialog-text {
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.5;
    font-style: italic;
}

.shop-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-md);
}

.shop-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--gold);
}

.gold-banner {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    padding: var(--sp-sm) var(--sp-md);
    background: var(--bg-dark);
    border-radius: var(--r-full);
    border: 1px solid var(--gold-dim);
}

.gold-icon {
    font-size: 1rem;
}

.gold-banner .amount {
    color: var(--warning);
    font-weight: bold;
    font-size: 1.1rem;
    font-family: var(--font-heading);
}

/* -- Shop Panels -- */
.shop-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-xl);
}

.shop-panel {
    background: var(--bg-medium);
    padding: var(--sp-lg);
    border-radius: var(--r-lg);
    border: 1px solid var(--bg-light);
}

.shop-items {
    display: flex;
    flex-direction: column;
    gap: var(--sp-md);
}

.shop-item {
    background: var(--bg-dark);
    padding: var(--sp-md);
    border-radius: var(--r-md);
    border: 1px solid var(--bg-light);
    transition: border-color var(--tr-fast), box-shadow var(--tr-fast);
}
.shop-item:hover {
    border-color: var(--gold-dim);
    box-shadow: 0 0 8px rgba(218, 165, 32, 0.1);
}
.shop-item.out-of-stock { opacity: 0.45; pointer-events: none; }

.shop-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--sp-xs);
}

.shop-item h3 {
    color: var(--text);
    font-size: 0.95rem;
}

.shop-item .description {
    color: var(--text-muted);
    font-size: 0.83rem;
    margin-bottom: var(--sp-sm);
}

.shop-item .price {
    color: var(--warning);
    font-weight: bold;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    white-space: nowrap;
}

.shop-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.shop-item .stock {
    color: var(--text-dim);
    font-size: 0.8rem;
}

/* -- Sell Section -- */
.sell-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-sm);
}

.sell-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-dark);
    border-radius: var(--r-md);
    border: 1px solid var(--bg-light);
    transition: border-color var(--tr-fast);
}
.sell-item:hover { border-color: var(--gold-dim); }

.sell-item .item-info { display: flex; flex-direction: column; }
.sell-item .item-name { font-weight: bold; }
.sell-item .item-price { color: var(--warning); font-size: 0.83rem; }

.empty-state {
    color: var(--text-dim);
    text-align: center;
    padding: var(--sp-2xl);
    font-style: italic;
}

/* -- Haggle System -- */
.haggle-roll-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--sp-sm) var(--sp-md);
    margin-bottom: var(--sp-md);
    background: var(--bg-dark);
    border-radius: var(--r-md);
    border: 1px solid var(--bg-lighter);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.roll-dice {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.roll-d20 {
    color: var(--text-dim);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.roll-value {
    background: var(--bg-lighter);
    color: var(--text);
    font-weight: bold;
    padding: 0.15rem 0.5rem;
    border-radius: var(--r-sm);
    min-width: 2rem;
    text-align: center;
}

.haggle-nat20 .roll-value,
.haggle-great .roll-value { background: var(--success); color: #fff; }
.haggle-nat1 .roll-value { background: var(--danger); color: #fff; }

.roll-mod { color: var(--text-muted); }
.roll-eq { color: var(--text-dim); }

.roll-total {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--text);
}

.roll-outcome {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
}

.roll-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

.roll-tag {
    padding: 0.2rem 0.6rem;
    border-radius: var(--r-full);
    font-size: 0.75rem;
    font-weight: bold;
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
}

.tag-crit { background: var(--success); color: #fff; }
.tag-success { background: rgba(46, 125, 50, 0.3); color: var(--success-light); border: 1px solid var(--success); }
.tag-fail { background: rgba(90, 101, 119, 0.3); color: var(--text-muted); border: 1px solid var(--text-dim); }
.tag-fumble { background: rgba(198, 40, 40, 0.3); color: var(--danger-light); border: 1px solid var(--danger); }

/* Haggle button */
.btn-haggle {
    background: linear-gradient(135deg, var(--info), #1976d2);
    color: #fff;
    border: 1px solid var(--info-light);
    cursor: pointer;
    transition: all var(--tr-fast);
}
.btn-haggle:hover:not(:disabled) {
    background: linear-gradient(135deg, #1976d2, var(--info));
    box-shadow: 0 0 8px rgba(21, 101, 192, 0.4);
    transform: translateY(-1px);
}
.btn-haggle:disabled { opacity: 0.4; cursor: default; }

.shop-item-actions {
    display: flex;
    gap: var(--sp-sm);
    align-items: center;
}

.inline-form { display: inline; }

/* Price display with haggle */
.price-area {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
}

.price-original {
    color: var(--text-dim);
    font-size: 0.8rem;
    text-decoration: line-through;
    font-family: var(--font-heading);
}

.discount-badge {
    background: var(--success);
    color: #fff;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 0.1rem 0.4rem;
    border-radius: var(--r-full);
}

.markup-badge {
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 0.1rem 0.4rem;
    border-radius: var(--r-full);
}

/* Haggled item visual feedback */
.shop-item.haggled-discount {
    border-color: rgba(46, 125, 50, 0.4);
}
.shop-item.haggled-discount:hover {
    border-color: var(--success);
    box-shadow: var(--shadow-glow-green);
}

.shop-item.haggled-markup {
    border-color: rgba(198, 40, 40, 0.3);
}
.shop-item.haggled-markup:hover {
    border-color: var(--danger);
    box-shadow: var(--shadow-glow-red);
}

/* -- Shop Tabs -- */
.shop-tabs {
    display: flex;
    gap: 0;
    margin-bottom: var(--sp-lg);
    border-bottom: 2px solid var(--bg-light);
}

.shop-tab {
    flex: 1;
    padding: var(--sp-md) var(--sp-lg);
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--tr-fast);
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.shop-tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.03);
}

.shop-tab.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--gold);
    color: var(--bg-deepest);
    font-size: 0.7rem;
    font-weight: bold;
    border-radius: var(--r-full);
    margin-left: var(--sp-xs);
    font-family: var(--font-mono);
}

.shop-tab-panel {
    display: none;
}

.shop-tab-panel.active {
    display: block;
    animation: fadeInUp 0.2s ease;
}

/* -- Quest Board -- */
.quest-section-title {
    color: var(--gold);
    font-family: var(--font-heading);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--sp-md);
    padding-bottom: var(--sp-xs);
    border-bottom: 1px solid var(--bg-lighter);
}

.quest-section-title:not(:first-child) {
    margin-top: var(--sp-xl);
}

.quest-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-md);
}

.quest-card {
    background: var(--bg-dark);
    padding: var(--sp-md) var(--sp-lg);
    border-radius: var(--r-md);
    border: 1px solid var(--bg-light);
    transition: border-color var(--tr-fast), box-shadow var(--tr-fast);
}

.quest-card:hover {
    border-color: var(--gold-dim);
    box-shadow: 0 0 8px rgba(218, 165, 32, 0.1);
}

.quest-card.quest-ready {
    border-color: rgba(46, 125, 50, 0.5);
    box-shadow: var(--shadow-glow-green);
}

.quest-card.quest-available {
    border-color: var(--bg-lighter);
}

.quest-card-header {
    margin-bottom: var(--sp-sm);
}

.quest-name-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sp-xs);
}

.quest-name {
    color: var(--text);
    font-size: 1rem;
    font-family: var(--font-heading);
}

.quest-type-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    border-radius: var(--r-sm);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: var(--font-heading);
    font-weight: bold;
}

.quest-type-kill {
    background: rgba(198, 40, 40, 0.25);
    color: var(--danger-light);
}

.quest-type-gather {
    background: rgba(21, 101, 192, 0.25);
    color: var(--info-light);
}

.quest-description {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.4;
}

.quest-dialog-offer {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.4;
    font-style: italic;
}

.quest-target {
    color: var(--text-dim);
    font-size: 0.83rem;
    margin-bottom: var(--sp-sm);
}

/* Quest progress bar */
.quest-progress-section {
    margin-bottom: var(--sp-sm);
}

.quest-progress-bar {
    height: 8px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: var(--r-full);
    overflow: hidden;
    margin-bottom: var(--sp-xs);
}

.quest-progress-fill {
    height: 100%;
    border-radius: var(--r-full);
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    transition: width 0.4s ease;
    box-shadow: 0 0 6px rgba(218, 165, 32, 0.5);
}

.quest-ready .quest-progress-fill {
    background: linear-gradient(90deg, var(--success), var(--success-light));
    box-shadow: 0 0 6px rgba(46, 125, 50, 0.5);
}

.quest-progress-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.quest-rewards-preview {
    display: flex;
    gap: var(--sp-md);
    margin-bottom: var(--sp-sm);
    font-size: 0.83rem;
}

.quest-reward-gold {
    color: var(--warning);
    font-weight: bold;
    font-family: var(--font-heading);
}

.quest-reward-xp {
    color: var(--gold);
    font-weight: bold;
    font-family: var(--font-heading);
}

.quest-card-actions {
    display: flex;
    gap: var(--sp-sm);
    justify-content: flex-end;
}

/* Quest update in victory screen */
.reward-row.quest-update .value {
    color: var(--gold-light);
}

/* Success and danger buttons */
.btn-success {
    background: linear-gradient(135deg, var(--success), #388e3c);
    color: #fff;
    border: 1px solid var(--success-light);
    cursor: pointer;
    transition: all var(--tr-fast);
}
.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #388e3c, var(--success));
    box-shadow: var(--shadow-glow-green);
    transform: translateY(-1px);
}

.btn-danger {
    background: transparent;
    color: var(--danger-light);
    border: 1px solid rgba(198, 40, 40, 0.4);
    cursor: pointer;
    transition: all var(--tr-fast);
    font-size: 0.8rem;
}
.btn-danger:hover:not(:disabled) {
    background: rgba(198, 40, 40, 0.15);
    border-color: var(--danger);
}

/* -- Shop Responsive -- */
@media (max-width: 768px) {
    .shopkeeper-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .dialog-bubble::before, .dialog-bubble::after { display: none; }
    .shop-header-info { flex-direction: column; }
    .shop-panels { grid-template-columns: 1fr; }
    .shopkeeper-portrait { width: 120px; height: 120px; }
    .haggle-roll-result { flex-direction: column; gap: var(--sp-sm); }
    .shop-item-footer { flex-direction: column; gap: var(--sp-sm); }
    .shop-item-actions { justify-content: flex-end; }
    .shop-tab { padding: var(--sp-sm) var(--sp-md); font-size: 0.85rem; }
    .quest-name-row { flex-direction: column; align-items: flex-start; gap: var(--sp-xs); }
}


/* ===== 22. Inventory ===== */
.inventory-container {
    max-width: 900px;
    margin: 0 auto;
}

.equipped-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-md);
}

.equip-slot {
    background: var(--bg-dark);
    padding: var(--sp-md);
    border-radius: var(--r-lg);
    border: 1px solid var(--bg-light);
}

.equip-slot h3 {
    color: var(--text-dim);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.75rem;
    font-family: var(--font-heading);
}

.equipped-item {
    display: flex;
    flex-direction: column;
    gap: var(--sp-xs);
}

.equipped-item .item-name {
    font-weight: bold;
    color: var(--text);
    font-size: 1.05rem;
}

.equipped-item .item-stat { color: var(--gold); font-size: 0.88rem; }
.equipped-item .item-meta { color: var(--text-muted); font-size: 0.83rem; }
.equipped-item form { margin-top: var(--sp-sm); }

.empty-slot {
    color: var(--text-dim);
    font-style: italic;
}

.backpack-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.backpack-item {
    background: var(--bg-dark);
    padding: var(--sp-md);
    border-radius: var(--r-md);
    border: 1px solid var(--bg-light);
    transition: border-color var(--tr-fast);
}
.backpack-item:hover { border-color: var(--gold-dim); }
.backpack-item.not-proficient { opacity: 0.55; }

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sp-sm);
}

.item-header .item-name { font-weight: bold; }

.type-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: var(--r-sm);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: var(--font-heading);
}

.badge-weapon { background: rgba(198,40,40,0.25); color: var(--danger-light); }
.badge-armor { background: rgba(21,101,192,0.25); color: var(--info-light); }
.badge-potion { background: rgba(46,125,50,0.25); color: var(--success-light); }
.badge-quest_item { background: rgba(218,165,32,0.25); color: var(--gold-light); }

.backpack-item .item-stat { color: var(--gold); font-size: 0.88rem; margin: var(--sp-xs) 0; }
.backpack-item .item-meta { color: var(--text-muted); font-size: 0.83rem; margin: var(--sp-xs) 0; }
.backpack-item form { margin-top: var(--sp-sm); }

/* ===== PP Bar ===== */
.pp-bar-row {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    margin: var(--sp-xs) 0;
}

.pp-text {
    font-size: 0.85rem;
    color: var(--info-light);
    white-space: nowrap;
}

.pp-bar {
    flex: 1;
    height: 8px;
    background: rgba(0,0,0,0.4);
    border-radius: var(--r-full);
    overflow: hidden;
}

.pp-bar-fill {
    height: 100%;
    border-radius: var(--r-full);
    background: linear-gradient(90deg, #1565c0, #42a5f5, #90caf9);
    transition: width 0.4s ease;
    box-shadow: 0 0 6px rgba(66, 165, 245, 0.5);
}

/* ===== Ability Buttons ===== */
.btn-ability {
    background: linear-gradient(135deg, #4a148c, #7b1fa2);
    color: #fff;
    font-weight: bold;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    min-height: 38px;
    padding: 0.4rem 0.85rem;
    border: none;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: all var(--tr-normal);
    box-shadow: 0 3px 10px rgba(74, 20, 140, 0.4);
    display: inline-flex;
    align-items: center;
    gap: var(--sp-xs);
    font-family: var(--font-heading);
}
.btn-ability:hover {
    background: linear-gradient(135deg, #6a1b9a, #9c27b0);
    box-shadow: 0 5px 16px rgba(74, 20, 140, 0.6);
    transform: translateY(-2px);
}
.btn-ability:active { transform: translateY(0); }
.btn-ability:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-ability-free {
    background: linear-gradient(135deg, #1a237e, #283593);
    color: #fff;
    font-weight: bold;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    min-height: 38px;
    padding: 0.4rem 0.85rem;
    border: none;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: all var(--tr-normal);
    box-shadow: 0 3px 10px rgba(26, 35, 126, 0.4);
    display: inline-flex;
    align-items: center;
    gap: var(--sp-xs);
    font-family: var(--font-heading);
}
.btn-ability-free:hover {
    background: linear-gradient(135deg, #283593, #3949ab);
    box-shadow: 0 5px 16px rgba(26, 35, 126, 0.6);
    transform: translateY(-2px);
}
.btn-ability-free:active { transform: translateY(0); }

.ability-cost {
    background: rgba(0,0,0,0.3);
    padding: 0.1rem 0.35rem;
    border-radius: var(--r-sm);
    font-size: 0.7rem;
    margin-left: 0.15rem;
}

/* ===== Effect Badges ===== */
.effect-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: var(--sp-sm);
    justify-content: center;
}

.effect-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: var(--r-sm);
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.effect-buff {
    background: rgba(46, 125, 50, 0.3);
    color: var(--success-light);
    border: 1px solid rgba(46, 125, 50, 0.4);
}

.effect-debuff {
    background: rgba(198, 40, 40, 0.3);
    color: var(--danger-light);
    border: 1px solid rgba(198, 40, 40, 0.4);
}

/* ===== Ability log entry ===== */
.log-entry.ability {
    color: #ce93d8;
}


.proficiency-warn {
    color: var(--danger-light);
    font-size: 0.83rem;
    font-style: italic;
    margin-top: var(--sp-sm);
    display: inline-block;
}


/* ===== 23. Confetti ===== */
.confetti-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -12px;
    width: 10px;
    height: 10px;
    animation: confettiFall linear forwards;
}


/* ===== 24. Animations ===== */
@keyframes pageEnter {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

@keyframes glowPulse {
    0%, 100% { text-shadow: 0 0 30px rgba(218,165,32,0.4), 0 4px 8px rgba(0,0,0,0.7); }
    50% { text-shadow: 0 0 50px rgba(218,165,32,0.6), 0 4px 8px rgba(0,0,0,0.7); }
}

@keyframes pulseDot {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.2); }
}

@keyframes dangerPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(198,40,40,0); }
    50% { box-shadow: 0 0 12px 2px rgba(198,40,40,0.3); }
}

@keyframes levelGlow {
    from { text-shadow: 0 0 10px rgba(218,165,32,0.3); }
    to { text-shadow: 0 0 30px rgba(218,165,32,0.6); }
}

@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

@keyframes screenShake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-6px); }
    20% { transform: translateX(6px); }
    30% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    50% { transform: translateX(-2px); }
    60% { transform: translateX(2px); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}


/* ===== 25. Utility ===== */
.text-center { text-align: center; }
.text-gold { color: var(--gold); }
.text-success { color: var(--success-light); }
.text-danger { color: var(--danger-light); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }

.mt-1 { margin-top: var(--sp-sm); }
.mt-2 { margin-top: var(--sp-md); }
.mt-3 { margin-top: var(--sp-lg); }
.mb-1 { margin-bottom: var(--sp-sm); }
.mb-2 { margin-bottom: var(--sp-md); }
.mb-3 { margin-bottom: var(--sp-lg); }


/* ===== 26. Responsive ===== */
@media (max-width: 768px) {
    h1 { font-size: 1.75rem; }

    .home-hero h1 { font-size: 2.25rem; }

    nav {
        flex-wrap: wrap;
        height: auto;
        padding: var(--sp-sm) 0;
        gap: var(--sp-sm);
    }

    .nav-links { order: 3; width: 100%; justify-content: center; flex-wrap: wrap; }
    .nav-links a { white-space: nowrap; }
    .nav-status { font-size: 0.8rem; gap: var(--sp-sm); }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .vital-stats { grid-template-columns: repeat(2, 1fr); }
    .equipped-grid { grid-template-columns: 1fr; }
    .shop-panels { grid-template-columns: 1fr; }

    /* Battle mobile */
    .battle-overlay { padding: var(--sp-md); }

    /* Both combatants stay side by side so the whole fight fits on one screen */
    .combatants {
        grid-template-columns: 1fr 1fr;
        gap: var(--sp-sm);
    }
    .vs-badge { display: none; }
    .combatant .info { font-size: 0.75rem; }
    .combatant .health-bar { height: 14px; }
    .combatant .hp-text { font-size: 0.85rem; }
    .combatant .player-portrait, .combatant .monster-portrait { width: 64px; height: 64px; }
    .pp-bar-row { flex-wrap: wrap; }
    .monster-taunt { padding: var(--sp-xs) var(--sp-sm); font-size: 0.75rem; }
    .float-number { font-size: 1.6rem; }

    .combatant { padding: var(--sp-md); }
    .combatant h2 { font-size: 1.15rem; }

    .btn-attack, .btn-defend { min-width: 110px; flex: 1; }
}

/* ===== Save/Load ===== */
.saves-container {
    max-width: 700px;
    margin: 0 auto;
}

.save-action-panel {
    text-align: center;
}

.save-slot-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-sm);
}

.save-slot {
    display: flex;
    align-items: center;
    gap: var(--sp-md);
    padding: var(--sp-md);
}

.save-portrait {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--gold);
    flex-shrink: 0;
}

.save-portrait-empty {
    background: var(--panel-bg);
}

.save-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.save-name {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    color: var(--gold);
    font-size: 1rem;
}

.save-detail {
    color: var(--text);
    font-size: 0.85rem;
}

.save-location {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.save-meta {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.save-actions {
    display: flex;
    gap: var(--sp-xs);
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .save-slot {
        flex-wrap: wrap;
    }

    .save-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 480px) {
    main { padding: var(--sp-md); }
    .home-hero { margin: calc(-1 * var(--sp-md)); padding: var(--sp-md); }
    .home-hero h1 { font-size: 1.85rem; }

    .battle-arena { gap: 0.75rem; }
    .round-badge { font-size: 0.8rem; padding: 0.25rem 1rem; }
    .hp-text { font-size: 0.95rem; }

    .steps { gap: 0; }
    .step-label { display: none; }
    .step-line { width: 24px; }

    .selection-grid { grid-template-columns: 1fr; }
    .equip-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .portrait-grid { gap: var(--sp-md); }
    .portrait-choice { width: 90px; height: 90px; }
    .player-portrait, .monster-portrait { width: 80px; height: 80px; }
}


/* ===== 27. Combat Depth: crits, conditions, flee ===== */
.log-entry.crit {
    color: var(--gold-light);
    font-weight: bold;
    text-shadow: 0 0 8px rgba(240, 200, 80, 0.5);
}
.log-entry.condition { color: #ffb74d; }
.log-entry.taunt { color: var(--text-muted); font-style: italic; }

.btn-flee {
    background: var(--bg-light);
    color: var(--text-muted);
    border: 1px solid var(--bg-lighter);
}
.btn-flee:hover {
    color: var(--text);
    border-color: var(--text-dim);
    transform: translateY(-2px);
}

.healer-panel {
    margin: var(--sp-lg) auto;
    max-width: 400px;
    text-align: center;
}


/* ===== 28. Bosses ===== */
.boss-banner {
    align-self: center;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    animation: slideDown 0.5s ease;
}
.boss-banner-label {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--danger-light);
}
.boss-banner-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--gold-light);
    text-shadow: 0 0 14px rgba(198, 40, 40, 0.7);
}

.boss-battle .battle-overlay {
    background: radial-gradient(ellipse at top, rgba(120, 10, 20, 0.35), transparent 65%);
}

.combatant.monster.boss {
    border: 2px solid var(--danger);
    box-shadow: 0 0 28px rgba(198, 40, 40, 0.45);
}
.combatant.monster.boss h2 {
    font-size: 1.45rem;
    color: var(--gold-light);
}
.combatant.monster.enraged {
    animation: dangerPulse 1.2s ease-in-out infinite;
}
.enraged-tag {
    display: inline-block;
    margin-left: var(--sp-xs);
    padding: 0.05rem 0.45rem;
    border-radius: var(--r-full);
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    font-family: var(--font-heading);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.boss-panel {
    text-align: center;
    margin-bottom: var(--sp-lg);
    border: 1px solid rgba(198, 40, 40, 0.55);
    background: linear-gradient(180deg, rgba(120, 10, 20, 0.22), var(--bg-medium));
    box-shadow: var(--shadow-glow-red);
}
.boss-panel.boss-locked {
    border-color: var(--bg-lighter);
    background: var(--bg-medium);
    box-shadow: none;
}
.boss-panel-label {
    font-family: var(--font-heading);
    font-size: 0.72rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--danger-light);
}
.boss-locked .boss-panel-label { color: var(--text-dim); }
.boss-panel-name {
    margin: var(--sp-xs) 0;
    color: var(--gold-light);
}
.boss-panel-title {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: var(--sp-md);
}
.boss-panel-text {
    margin-bottom: var(--sp-sm);
    font-style: italic;
    line-height: 1.6;
}

.btn-boss {
    margin-top: var(--sp-sm);
    background: linear-gradient(135deg, #7f0000, var(--danger));
    color: #fff;
    border: 1px solid var(--gold-dim);
    box-shadow: 0 4px 14px rgba(198, 40, 40, 0.4);
}
.btn-boss:hover {
    background: linear-gradient(135deg, var(--danger), var(--danger-light));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(198, 40, 40, 0.6);
}

.boss-defeat-panel {
    background: var(--bg-medium);
    border: 2px solid var(--gold-dim);
    border-radius: var(--r-lg);
    padding: var(--sp-xl);
    margin-bottom: var(--sp-xl);
    box-shadow: var(--shadow-glow-gold);
}
.boss-defeat-text {
    font-style: italic;
    line-height: 1.75;
    text-align: left;
}

.shard-award {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-md);
    margin-top: var(--sp-lg);
    padding-top: var(--sp-lg);
    border-top: 1px solid var(--bg-lighter);
    text-align: left;
}
.shard-award-name {
    font-family: var(--font-heading);
    color: var(--gold-light);
    font-size: 1.1rem;
}

.act-unlock {
    margin-top: var(--sp-lg);
    padding-top: var(--sp-lg);
    border-top: 1px solid var(--bg-lighter);
}
.act-unlock h3 { margin: var(--sp-xs) 0 var(--sp-sm); }
.act-unlock p { color: var(--text-muted); line-height: 1.6; }


/* ===== 29. Crown Shards ===== */
.shard-gem {
    display: inline-block;
    width: 26px;
    height: 34px;
    flex-shrink: 0;
    clip-path: polygon(50% 0%, 100% 35%, 72% 100%, 28% 100%, 0% 35%);
    background: linear-gradient(160deg, var(--gold-light), var(--gold) 55%, var(--leather));
}
.shard-gem-1 { background: linear-gradient(160deg, #b9f6ca, #2e7d32 60%, #1b5e20); }
.shard-gem-2 { background: linear-gradient(160deg, #ffcc80, #e65100 60%, #8e2400); }
.shard-gem-3 { background: linear-gradient(160deg, #b3e5fc, #0277bd 60%, #01447a); }
.shard-gem-4 { background: linear-gradient(160deg, #ffffff, #b0bec5 60%, #607d8b); }
.shard-gem-5 { background: linear-gradient(160deg, #e1bee7, #8d6e63 60%, #4e342e); }

.shard-row {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: var(--sp-md);
}
.shard-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-sm);
    min-width: 96px;
    opacity: 0.28;
    filter: grayscale(1);
}
.shard-slot.shard-found {
    opacity: 1;
    filter: drop-shadow(0 0 8px rgba(240, 200, 80, 0.45));
}
.shard-name {
    font-size: 0.75rem;
    font-family: var(--font-heading);
    color: var(--text-muted);
    text-align: center;
}
.shard-found .shard-name { color: var(--gold-light); }


/* ===== 30. Exploration Events ===== */
.event-container {
    max-width: 680px;
    margin: 0 auto;
}
.event-card {
    padding: var(--sp-xl);
    border-radius: var(--r-xl);
    text-align: center;
    animation: slideDown 0.35s ease;
}
.event-card.event-success { border-color: rgba(46, 125, 50, 0.55); }
.event-card.event-failure { border-color: rgba(198, 40, 40, 0.55); }

.event-title { margin: var(--sp-sm) 0 var(--sp-lg); }
.event-text {
    font-style: italic;
    line-height: 1.75;
    margin-bottom: var(--sp-lg);
    text-align: left;
}

.event-choices {
    display: flex;
    flex-direction: column;
    gap: var(--sp-sm);
    margin-bottom: var(--sp-md);
}
.event-choice {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-md);
    padding: var(--sp-md) var(--sp-lg);
    background: var(--bg-light);
    color: var(--text);
    border: 1px solid var(--bg-lighter);
    border-radius: var(--r-md);
    font-family: var(--font-body);
    font-size: 1rem;
    cursor: pointer;
    text-align: left;
    transition: all var(--tr-normal);
}
.event-choice:hover {
    border-color: var(--gold-dim);
    background: var(--bg-lighter);
    transform: translateX(4px);
}
.event-choice-label { font-family: var(--font-heading); }
.event-choice-check {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
    white-space: nowrap;
}
.skill-name { color: var(--info-light); font-size: 0.85rem; }
.skill-name.skill-proficient { color: var(--gold-light); }
.skill-odds {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.event-outcomes {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--sp-sm);
}
.outcome-chip {
    padding: 0.25rem 0.8rem;
    border-radius: var(--r-full);
    font-size: 0.85rem;
    font-family: var(--font-heading);
    border: 1px solid transparent;
}
.chip-gold { background: rgba(218, 165, 32, 0.18); color: var(--gold-light); border-color: var(--gold-dim); }
.chip-xp { background: rgba(21, 101, 192, 0.2); color: var(--info-light); border-color: rgba(21, 101, 192, 0.5); }
.chip-pp { background: rgba(123, 31, 162, 0.25); color: #ce93d8; border-color: rgba(123, 31, 162, 0.5); }
.chip-good { background: rgba(46, 125, 50, 0.22); color: var(--success-light); border-color: rgba(46, 125, 50, 0.5); }
.chip-bad { background: rgba(198, 40, 40, 0.22); color: var(--danger-light); border-color: rgba(198, 40, 40, 0.5); }


/* ===== 31. Travel acts & Journal ===== */
.travel-act { margin-bottom: var(--sp-xl); }
.travel-act-title {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-bottom: var(--sp-md);
    font-size: 1.3rem;
}
.travel-act-locked { opacity: 0.55; }

.loc-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-xs);
    margin-bottom: var(--sp-sm);
}
.loc-tag {
    font-size: 0.68rem;
    font-family: var(--font-heading);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.1rem 0.5rem;
    border-radius: var(--r-full);
    background: var(--bg-light);
    color: var(--text-muted);
}
.loc-tag-boss { background: rgba(198, 40, 40, 0.25); color: var(--danger-light); }
.loc-tag-cleared { background: rgba(46, 125, 50, 0.25); color: var(--success-light); }

.journal-container {
    max-width: 800px;
    margin: 0 auto;
}
.journal-container .panel { margin-bottom: var(--sp-lg); }

.journal-act-header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: var(--sp-md);
    margin-bottom: var(--sp-sm);
}
.journal-act-header h3 { flex: 1; }
.journal-act-current { border-left: 4px solid var(--gold); }
.journal-act-locked { opacity: 0.55; }
.journal-act-desc {
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.6;
    margin-bottom: var(--sp-sm);
}
.journal-main-quest { margin-bottom: var(--sp-md); }

.journal-badge-done { background: rgba(46, 125, 50, 0.25); color: var(--success-light); }
.journal-badge-current { background: rgba(218, 165, 32, 0.2); color: var(--gold-light); }
.journal-badge-locked { background: var(--bg-light); color: var(--text-dim); }

.journal-boss-list { list-style: none; }
.journal-boss-list li {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: var(--sp-sm);
    padding: var(--sp-sm) 0;
    border-bottom: 1px solid var(--bg-light);
}
.journal-boss-list li:last-child { border-bottom: none; }
.journal-boss-mark { width: 1.2rem; color: var(--danger-light); }
.journal-boss-name { font-family: var(--font-heading); flex: 1; }
.journal-boss-where { color: var(--text-muted); font-size: 0.8rem; }
.journal-boss-defeated .journal-boss-mark { color: var(--success-light); }
.journal-boss-defeated .journal-boss-name { color: var(--text-muted); text-decoration: line-through; }

.journal-stats { grid-template-columns: repeat(4, 1fr); }

.ending-screen { max-width: 720px; }
.ending-story {
    text-align: left;
    max-width: none;
    margin: 0 0 var(--sp-xl);
}
.ending-story p { margin-bottom: var(--sp-md); line-height: 1.8; }
.ending-story p:last-child { margin-bottom: 0; }

@media (max-width: 768px) {
    .journal-stats { grid-template-columns: repeat(2, 1fr); }
    .event-card { padding: var(--sp-lg); }
    .event-choice { flex-direction: column; align-items: flex-start; }
    .event-choice-check { align-items: flex-start; }
}


/* ===== 32. Ability Score Improvements ===== */
.nav-badge {
    display: inline-block;
    margin-left: var(--sp-xs);
    padding: 0 0.4rem;
    border-radius: var(--r-full);
    background: var(--gold);
    color: var(--bg-deepest);
    font-size: 0.7rem;
    font-weight: bold;
    line-height: 1.4;
}

.asi-panel { border-color: var(--gold-dim); box-shadow: var(--shadow-glow-gold); }

.asi-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--sp-sm) var(--sp-md);
    padding: var(--sp-md);
    margin-bottom: var(--sp-md);
    border: 1px solid var(--gold-dim);
    border-radius: var(--r-md);
    background: rgba(218, 165, 32, 0.08);
}
.asi-banner strong { font-family: var(--font-heading); color: var(--gold-light); }
.asi-banner .asi-points { color: var(--gold); font-weight: bold; }
.asi-banner p { flex-basis: 100%; margin: 0; color: var(--text-muted); font-size: 0.85rem; }

.asi-message { color: var(--success-light); margin-bottom: var(--sp-md); }
.asi-hint { margin: var(--sp-md) 0 0; color: var(--text-muted); font-size: 0.8rem; line-height: 1.6; }

.stat-box.stat-primary { border-color: var(--gold-dim); }
.stat-box .stat-tag {
    display: block;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold);
}
.stat-box form { margin-top: var(--sp-sm); }
.btn-asi { min-width: 3rem; }


/* ===== Keyboard hints ===== */
kbd {
    display: inline-block;
    min-width: 1.35em;
    padding: 0 0.3em;
    margin-left: 0.4em;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-bottom-width: 2px;
    border-radius: var(--r-sm);
    background: rgba(0, 0, 0, 0.3);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: normal;
    line-height: 1.5;
    letter-spacing: 0;
    text-align: center;
    text-transform: none;
    opacity: 0.8;
}
@media (hover: none) {
    kbd { display: none; }
}

form.is-submitting button { pointer-events: none; opacity: 0.6; }


/* ===== XP bars ===== */
.nav-level { display: inline-flex; flex-direction: column; gap: 3px; cursor: default; }
.nav-xp-bar {
    display: block;
    width: 100%;
    min-width: 28px;
    height: 3px;
    border-radius: var(--r-full);
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}
.nav-xp-fill { display: block; height: 100%; background: var(--gold); }

.xp-row {
    display: flex;
    align-items: center;
    gap: var(--sp-md);
    margin: var(--sp-sm) 0;
}
.xp-label { color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; }
.xp-bar {
    flex: 1;
    height: 8px;
    border-radius: var(--r-full);
    background: rgba(0, 0, 0, 0.4);
    overflow: hidden;
}
.xp-bar-fill {
    width: 0;
    height: 100%;
    border-radius: var(--r-full);
    background: linear-gradient(90deg, var(--leather-light), var(--gold-light));
    transition: width 0.9s ease-out;
}


/* ===== Area map ===== */
.area-map-panel { margin-bottom: var(--sp-lg); }
.area-map-panel h3 {
    color: var(--text-muted);
    margin-bottom: var(--sp-sm);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.area-map {
    position: relative;
    height: calc(var(--map-rows, 3) * 5.75rem);
}
.area-map-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.map-edge {
    stroke: rgba(255, 255, 255, 0.14);
    stroke-width: 2;
    stroke-dasharray: 5 5;
    vector-effect: non-scaling-stroke;
}
.map-edge-active { stroke: var(--gold); stroke-dasharray: none; opacity: 0.75; }

.map-node {
    position: absolute;
    transform: translate(-50%, -50%);
    width: max-content;
    max-width: 31%;
    --map-danger: var(--text-dim);
}
.map-danger-low { --map-danger: var(--success-light); }
.map-danger-med { --map-danger: var(--warning); }
.map-danger-high { --map-danger: var(--danger-light); }

.map-node-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    width: 100%;
    padding: 0.45rem 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--map-danger);
    border-radius: var(--r-md);
    background: var(--bg-dark);
    color: var(--text-dim);
    font: inherit;
    text-align: center;
}
.map-node-name {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    line-height: 1.25;
    letter-spacing: 0.02em;
}
.map-node-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.2rem; }
.map-node-tags:empty { display: none; }
.map-tag {
    padding: 0 0.4rem;
    border-radius: var(--r-full);
    background: var(--bg-light);
    color: var(--text-muted);
    font-size: 0.62rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}
.map-tag-here { background: var(--gold); color: var(--bg-deepest); font-weight: bold; }
.map-tag-shop { background: rgba(218, 165, 32, 0.2); color: var(--gold-light); }
.map-tag-rest { background: rgba(21, 101, 192, 0.3); color: var(--info-light); }
.map-tag-boss { background: rgba(198, 40, 40, 0.3); color: var(--danger-light); }
.map-tag-cleared { background: rgba(46, 125, 50, 0.25); color: var(--success-light); }

.map-node-current .map-node-box {
    border-color: var(--gold);
    border-top-color: var(--map-danger);
    background: var(--bg-light);
    color: var(--gold-light);
    box-shadow: var(--shadow-glow-gold);
}
button.map-node-box {
    cursor: pointer;
    color: var(--text);
    background: var(--bg-light);
    border-color: var(--gold-dim);
    border-top-color: var(--map-danger);
    transition: transform var(--tr-fast), box-shadow var(--tr-fast), border-color var(--tr-fast);
}
button.map-node-box:hover,
button.map-node-box:focus-visible {
    transform: translateY(-2px);
    border-color: var(--gold);
    border-top-color: var(--map-danger);
    box-shadow: var(--shadow-md);
    outline: none;
}

.map-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-xs) var(--sp-md);
    margin-top: var(--sp-sm);
    color: var(--text-dim);
    font-size: 0.75rem;
}
.map-key { display: inline-flex; align-items: center; gap: 0.35rem; --map-danger: var(--text-dim); }
.map-key::before {
    content: "";
    width: 14px;
    height: 3px;
    border-radius: 2px;
    background: var(--map-danger);
}
.map-legend-hint { margin-left: auto; }

.action-bar { align-items: center; }
.action-bar-danger { margin: 0 0 0 auto; }


/* ===== Battle: ability cards and feedback ===== */
.pp-pill {
    margin-left: var(--sp-sm);
    padding: 0.1rem 0.6rem;
    border-radius: var(--r-full);
    background: rgba(21, 101, 192, 0.25);
    color: var(--info-light);
    font-family: var(--font-body, inherit);
    font-size: 0.75rem;
    letter-spacing: 0;
    text-transform: none;
}
.ability-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: var(--sp-sm);
    text-align: left;
}
.ability-card {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    width: 100%;
    height: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid rgba(171, 71, 188, 0.45);
    border-left: 3px solid #ab47bc;
    border-radius: var(--r-md);
    background: rgba(74, 20, 140, 0.28);
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform var(--tr-fast), background var(--tr-fast), box-shadow var(--tr-fast);
}
.ability-card-free {
    border-color: rgba(92, 107, 192, 0.5);
    border-left-color: #5c6bc0;
    background: rgba(26, 35, 126, 0.32);
}
.ability-card:hover:not(:disabled),
.ability-card:focus-visible {
    transform: translateY(-2px);
    background: rgba(123, 31, 162, 0.42);
    box-shadow: var(--shadow-md);
    outline: none;
}
.ability-card-free:hover:not(:disabled),
.ability-card-free:focus-visible { background: rgba(40, 53, 147, 0.5); }
.ability-card:disabled { opacity: 0.4; cursor: not-allowed; }

.ability-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-sm); }
.ability-card-name {
    font-family: var(--font-heading);
    font-weight: bold;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}
.ability-card-cost { color: var(--info-light); font-size: 0.75rem; white-space: nowrap; }
.ability-card-free .ability-card-cost { color: var(--text-muted); }
.ability-card-desc { color: var(--text-muted); font-size: 0.78rem; line-height: 1.35; }
.ability-card-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    margin-top: auto;
}
.ability-card-stats kbd { margin-left: auto; }
.ability-stat {
    padding: 0 0.4rem;
    border-radius: var(--r-sm);
    background: rgba(0, 0, 0, 0.35);
    color: var(--gold-light);
    font-size: 0.7rem;
}

.btn-item .item-effect {
    margin-left: 0.4em;
    font-weight: normal;
    font-size: 0.72rem;
    text-transform: none;
    letter-spacing: 0;
    opacity: 0.85;
}

.combatant { position: relative; }
.float-number {
    position: absolute;
    top: 16%;
    left: 50%;
    z-index: 5;
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: bold;
    color: var(--danger-light);
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
    pointer-events: none;
    animation: floatNumber 1.4s ease-out forwards;
}
.float-number.float-heal { color: var(--success-light); }
@keyframes floatNumber {
    0% { opacity: 0; transform: translate(-50%, 10px) scale(0.6); }
    15% { opacity: 1; transform: translate(-50%, -6px) scale(1.25); }
    30% { transform: translate(-50%, -12px) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -64px) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    .float-number { animation-duration: 2.2s; }
    .xp-bar-fill, .health-bar-fill { transition: none; }
}


/* ===== Inventory extras ===== */
.item-count { color: var(--gold); font-weight: normal; }
.item-compare { font-size: 0.8rem; margin: var(--sp-xs) 0; }
.compare-better { color: var(--success-light); }
.compare-worse { color: var(--danger-light); }
.compare-same { color: var(--text-dim); }


/* ===== Character creation extras ===== */
.class-playstyle {
    min-height: 3.9em;
    margin-bottom: var(--sp-sm);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-style: italic;
    line-height: 1.3;
}
.class-abilities { margin-top: var(--sp-sm); padding-top: var(--sp-sm); border-top: 1px solid var(--gold-dim); }
.class-abilities-title {
    display: block;
    margin-bottom: var(--sp-xs);
    color: var(--gold);
    font-family: var(--font-heading);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.class-abilities ul { list-style: none; margin: 0; padding: 0; }
.class-abilities li {
    display: flex;
    align-items: baseline;
    gap: var(--sp-sm);
    padding: 0.12rem 0;
    font-size: 0.78rem;
}
.class-ability-level { width: 2.6em; color: var(--text-dim); white-space: nowrap; }
.class-ability-name { flex: 1; color: var(--text); }
.class-ability-cost { color: var(--info-light); white-space: nowrap; }

.char-preview { margin-bottom: var(--sp-lg); }
.char-preview .stats-grid { grid-template-columns: repeat(6, 1fr); gap: var(--sp-sm); }
.char-preview-vitals {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-xs) var(--sp-lg);
    margin-top: var(--sp-md);
    color: var(--text-muted);
    font-size: 0.9rem;
}
.char-preview-vitals strong { color: var(--gold-light); }

@media (max-width: 768px) {
    .char-preview .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .map-node { max-width: 31%; }
    .map-node-box { padding: 0.35rem 0.4rem; }
    .map-node-name { font-size: 0.7rem; }
    .map-tag { font-size: 0.56rem; padding: 0 0.3rem; }
    .map-legend-hint { margin-left: 0; width: 100%; }
    .action-bar-danger { margin-left: 0; }
    .ability-grid { grid-template-columns: 1fr; }
    .item-buttons .inline-form { max-width: 100%; }
    .btn-item { max-width: 100%; white-space: normal; }
    .class-playstyle { min-height: 0; }
}


/* ===== Health bar colour follows the percentage ===== */
.health-bar-fill { background: linear-gradient(90deg, #2e7d32, var(--success-light)); }
.health-bar-fill.hp-mid {
    background: linear-gradient(90deg, #f57f17, var(--warning));
    box-shadow: 0 0 10px rgba(249, 168, 37, 0.7);
}
.health-bar-fill.hp-low {
    background: linear-gradient(90deg, #8e0000, var(--danger-light));
    box-shadow: 0 0 12px rgba(198, 40, 40, 0.8);
}


/* ===== Battle stage ===== */
.battle-scene { margin-bottom: var(--sp-md); }

.stage-hud {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-md);
    margin-bottom: var(--sp-sm);
}
.hud-plate { padding: var(--sp-sm) var(--sp-md); text-align: left; }
.hud-plate.monster { text-align: right; }
.hud-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-sm); }
.hud-plate.monster .hud-head, .hud-plate.monster .hud-foot { flex-direction: row-reverse; }
.hud-plate h2 { font-size: 1.15rem; margin: 0; }
.hud-plate .ac { margin: 0; color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; }
.hud-plate .info { margin: 0 0 var(--sp-xs); font-size: 0.78rem; }
.hud-plate .health-bar { height: 14px; margin: 0; }
.hud-foot { display: flex; justify-content: space-between; gap: var(--sp-sm); margin-top: 0.25rem; }
.hud-plate .hp-text, .hud-plate .pp-text { margin: 0; font-size: 0.8rem; }
.hud-plate .pp-text { color: var(--info-light); }
.hud-plate .effect-badges { margin-top: var(--sp-xs); }
.hud-plate.monster .effect-badges { justify-content: flex-end; }

.battle-stage {
    --px: 4;                       /* screen pixels per sprite pixel */
    --lunge: 34%;
    position: relative;
    height: 300px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    border-radius: var(--r-lg);
    background: linear-gradient(#1b1f4a 0%, #433372 45%, #3a3326 66%, #2e281e 100%);
}
.stage-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center bottom;
    image-rendering: pixelated;
}
.stage-fx {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.actor {
    position: absolute;
    bottom: 9%;
    display: flex;
    flex-direction: column;
    align-items: center;
    --dir: 1;
}
.actor-player { left: 10%; }
.actor-monster { right: 10%; --dir: -1; }

.sprite {
    width: calc(64px * var(--px) * var(--scale, 1));
    height: calc(48px * var(--px) * var(--scale, 1));
    background-repeat: no-repeat;
    background-size: 400% 400%;
    image-rendering: pixelated;
}
.actor-monster .sprite { transform: scaleX(-1); }

.actor-portrait {
    width: calc(30px * var(--px));
    height: calc(30px * var(--px));
    margin: 0 calc(17px * var(--px)) calc(4px * var(--px));
    border-radius: var(--r-md);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.55);
}
.actor .monster-taunt {
    position: absolute;
    bottom: 100%;
    width: max-content;
    max-width: 240px;
    margin-bottom: calc(-6px * var(--px));
    z-index: 2;
}
.actor:has(.actor-portrait) .monster-taunt { margin-bottom: var(--sp-xs); }

/* Poses: sprites change frame in JS; these move the whole actor */
.pose-lunge { animation: actorLunge 0.46s ease-in-out; }
.pose-cast { animation: actorCast 0.52s ease-out; }
.pose-dodge { animation: actorDodge 0.38s ease-out; }
.is-hit { animation: actorHit 0.3s linear; }
.pose-attack:not(.pose-lunge):not(.pose-cast) { animation: none; }
.is-dead:has(.actor-portrait) { animation: portraitDeath 1s ease-in forwards; }
.is-dead:has(.sprite) { animation: spriteFade 1.6s ease-in 0.7s forwards; }
.is-dead-still { animation-duration: 0.01s !important; animation-delay: 0s !important; }

@keyframes actorLunge {
    0% { transform: translateX(0); }
    20% { transform: translateX(calc(var(--dir) * -12px)); }
    50% { transform: translateX(calc(var(--dir) * var(--lunge-px, 150px))); }
    100% { transform: translateX(0); }
}
@keyframes actorCast {
    0% { transform: translateY(0); filter: none; }
    35% { transform: translateY(-10px); filter: brightness(1.5) drop-shadow(0 0 10px rgba(255, 255, 255, 0.7)); }
    100% { transform: translateY(0); filter: none; }
}
@keyframes actorDodge {
    0% { transform: translate(0, 0); }
    40% { transform: translate(calc(var(--dir) * -22px), -8px); }
    100% { transform: translate(0, 0); }
}
@keyframes actorHit {
    0% { transform: translateX(0); filter: brightness(3) saturate(0); }
    30% { transform: translateX(calc(var(--dir) * -10px)); filter: brightness(2.2) saturate(0.2); }
    60% { transform: translateX(calc(var(--dir) * 5px)); filter: none; }
    100% { transform: translateX(0); }
}
@keyframes portraitDeath {
    to { transform: translateY(24px) rotate(calc(var(--dir) * -14deg)); filter: grayscale(1) brightness(0.5); opacity: 0; }
}
@keyframes spriteFade {
    to { opacity: 0.35; filter: grayscale(0.8) brightness(0.7); }
}

.stage-banner {
    position: absolute;
    top: 8%;
    left: 50%;
    transform: translate(-50%, -8px);
    padding: 0.2rem 0.9rem;
    border: 1px solid var(--gold-dim);
    border-radius: var(--r-sm);
    background: rgba(10, 14, 26, 0.85);
    color: var(--gold-light);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;
}
.stage-banner.is-shown { opacity: 1; transform: translate(-50%, 0); }
.stage-banner.from-monster { color: var(--danger-light); border-color: rgba(198, 40, 40, 0.5); }

.battle-stage.is-shaking { animation: stageShake 0.42s linear; }
@keyframes stageShake {
    0%, 100% { transform: translate(0, 0); }
    20% { transform: translate(-6px, 3px); }
    40% { transform: translate(6px, -3px); }
    60% { transform: translate(-4px, -2px); }
    80% { transform: translate(4px, 2px); }
}
.battle-stage::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
}
.battle-stage.flash-white::after { background: #fff; animation: stageFlash 0.26s ease-out; }
.battle-stage.flash-dark::after { background: #12081c; animation: stageFlash 0.26s ease-out; }
@keyframes stageFlash {
    0% { opacity: 0.55; }
    100% { opacity: 0; }
}

.actor .float-number { top: 4%; }
.float-number.float-crit { color: var(--gold-light); font-size: 2.6rem; }
.float-number.float-miss { color: var(--text); font-size: 1.2rem; }

.battle-arena .battle-log { max-height: 132px; }
.result-screen .battle-scene { max-width: 760px; margin: var(--sp-lg) auto; text-align: left; }
.result-screen .battle-stage { height: 240px; --px: 3; }

@media (max-width: 768px) {
    .stage-hud { gap: var(--sp-sm); }
    .hud-plate h2 { font-size: 0.95rem; }
    .battle-stage, .result-screen .battle-stage { height: 190px; --px: 2.5; }
    .actor-player { left: 0; }
    .actor-monster { right: 0; }
    .actor .monster-taunt { max-width: 150px; }
    .stage-banner { font-size: 0.8rem; }
}
@media (prefers-reduced-motion: reduce) {
    .pose-lunge, .pose-cast, .pose-dodge, .is-hit, .battle-stage.is-shaking { animation: none; }
}
