:root {
    --bg-color: #111827;
    --card-bg: #1f2937;
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --pace-orange: #EB9110;
    --accent: #3b82f6;
    --success: #10b981;
    --danger: #ef4444;
    --border-color: rgba(255,255,255,0.1);
}

.back-link {
    position: absolute;
    top: 1rem;
    left: 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    z-index: 100;
}

.back-link:hover {
    color: var(--pace-orange);
}

.pace-logo-icon {
    height: 1.5em;
    vertical-align: middle;
    margin-left: 0.5rem;
    display: inline-block;
    margin-bottom: 0.2rem;
}

body {
    font-family: 'Manrope', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1100px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
    text-align: center;
    margin-bottom: 1.5rem;
}

h1 {
    font-size: 2.5rem;
    margin: 0 0 0.5rem 0;
    font-weight: 400;
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin: 0 0 1rem 0;
}

.logo {
    color: var(--pace-orange);
    font-weight: 800;
    letter-spacing: 1px;
    font-size: 0.9rem;
    text-transform: uppercase;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #334155;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--pace-orange), #f97316);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-text {
    text-align: center;
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 0.5rem;
}

/* Main Game Area */
.game-area {
    display: flex;
    width: 100%;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
    .game-area {
        flex-direction: column;
    }
}

/* Scenarios Panel */
.scenarios-panel {
    flex: 1;
    min-width: 320px;
}

.scenario-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid #334155;
}

.scenario-card.complete {
    text-align: center;
    background: linear-gradient(135deg, var(--card-bg), #1a3a47);
}

.scenario-header {
    margin-bottom: 1rem;
}

.scenario-number {
    font-size: 0.75rem;
    color: var(--pace-orange);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.scenario-header h3 {
    margin: 0.5rem 0 0 0;
    font-size: 1.3rem;
}

.scenario-situation {
    color: #cbd5e1;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

/* Choice Buttons */
.choice-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.choice-btn {
    background: #334155;
    border: 2px solid transparent;
    border-radius: 0.75rem;
    padding: 1rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.choice-btn:hover {
    transform: translateX(4px);
}

.choice-btn.concede {
    border-color: rgba(239, 68, 68, 0.3);
}

.choice-btn.concede:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--danger);
}

.choice-btn.protect {
    border-color: rgba(16, 185, 129, 0.3);
}

.choice-btn.protect:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--success);
}

.choice-label {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main);
}

.choice-desc {
    font-size: 0.85rem;
    color: #94a3b8;
}

.choice-impact {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.choice-impact.negative {
    color: var(--danger);
}

.choice-impact.positive {
    color: var(--success);
}

/* Scale Container */
.scale-container {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 280px;
    position: relative;
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 1rem;
}

.scale-labels-top {
    display: flex;
    justify-content: space-between;
    width: 85%;
    margin-bottom: 6rem;
}

.scale-label {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.scale-label.left {
    color: var(--success);
}

.scale-label.right {
    color: var(--danger);
}

.balance-indicator {
    margin-bottom: 3rem;
}

.balance-status {
    font-weight: 700;
    font-size: 1rem;
    transition: color 0.3s;
}

.balance-status.balanced { color: var(--accent); }
.balance-status.tilting-debt { color: var(--danger); }
.balance-status.tilting-protect { color: var(--success); }

.beam-wrapper {
    position: relative;
    width: 100%;
    height: 180px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.balance-beam {
    width: 85%;
    height: 10px;
    background: linear-gradient(90deg, var(--success), #64748b, var(--danger));
    position: relative;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 5px;
}

.fulcrum {
    width: 0; 
    height: 0; 
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 40px solid #475569;
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
}

.pan {
    width: 90px;
    height: 6px;
    background: #64748b;
    position: absolute;
    top: 0;
    border-radius: 3px;
}

.left-pan { left: 5px; }
.right-pan { right: 5px; }

.pan::before {
    content: '';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 30px;
    background: #64748b;
}

.pan-label {
    position: absolute;
    bottom: -30px;
    width: 100%;
    text-align: center;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.left-pan .pan-label { color: var(--success); }
.right-pan .pan-label { color: var(--danger); }

.stack {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 2px;
}

.block {
    border-radius: 3px;
    width: 50px;
    transition: all 0.3s ease;
}

.protect-block {
    background: linear-gradient(135deg, var(--success), #059669);
    height: 15px;
}

.debt-block {
    background: linear-gradient(135deg, var(--danger), #dc2626);
}

.debt-block.small {
    opacity: 0.6;
    width: 35px;
}

/* Thresholds Panel */
.thresholds-panel {
    width: 100%;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.threshold {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.threshold-label {
    font-size: 0.75rem;
    color: #94a3b8;
    width: 100px;
    text-align: right;
}

.threshold-track {
    flex: 1;
    height: 12px;
    background: #1e293b;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.threshold-fill {
    height: 100%;
    transition: width 0.4s ease;
    border-radius: 6px;
}

.threshold-fill.sig {
    background: linear-gradient(90deg, #475569, var(--accent), var(--success));
}

.threshold-fill.debt {
    background: linear-gradient(90deg, var(--success), #f59e0b, var(--danger));
}

.threshold-marker {
    display: none;
}

.threshold-marker::after {
    content: attr(data-label);
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    color: #94a3b8;
    white-space: nowrap;
}

.sig-threshold .threshold-marker { left: 60%; }
.debt-threshold .threshold-marker { left: 50%; }

/* Result Panel */
.result-panel {
    display: flex;
    gap: 1.5rem;
    background: var(--card-bg);
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    width: 100%;
    justify-content: space-around;
    flex-wrap: wrap;
}

.metric {
    text-align: center;
    min-width: 100px;
}

.metric .label {
    display: block;
    font-size: 0.7rem;
    color: #94a3b8;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric .value {
    font-size: 1.3rem;
    font-weight: 800;
}

.metric .signature { color: var(--accent); }
.metric .debt { color: var(--danger); }
.metric .protect { color: var(--success); }

.warning {
    color: var(--pace-orange);
    font-weight: 600;
    min-height: 1.2rem;
    text-align: center;
    font-size: 0.85rem;
}

/* Outcome Overlay */
.outcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 2rem;
}

.outcome-overlay.hidden {
    display: none;
}

.outcome-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 1.5rem;
    max-width: 500px;
    text-align: center;
    border: 2px solid #334155;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}

.outcome-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.outcome-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.outcome-desc {
    color: #cbd5e1;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.outcome-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.outcome-stat {
    text-align: center;
}

.outcome-stat .stat-label {
    font-size: 0.7rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.outcome-stat .stat-value {
    font-size: 1.5rem;
    font-weight: 800;
}

.outcome-stat:nth-child(1) .stat-value { color: var(--accent); }
.outcome-stat:nth-child(2) .stat-value { color: var(--danger); }
.outcome-stat:nth-child(3) .stat-value { color: var(--success); }

.restart-btn {
    background: var(--pace-orange);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.restart-btn:hover {
    background: #d94d1f;
    transform: scale(1.05);
}