/* Exit Waterfall Machine - game.css */

:root {
    --bg-dark: #09090e;
    --bg-card: rgba(18, 18, 28, 0.7);
    --border-glow: rgba(0, 242, 254, 0.25);
    --neon-blue: #00f2fe;
    --neon-green: #00ff87;
    --neon-purple: #b92b27;
    --neon-gold: #ffd700;
    --neon-red: #ff3366;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --font-cyber: 'Orbitron', 'Inter', sans-serif;
}

body.TEMPLATE-4weird-game-page {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding-top: var(--navbar-height);
}

/* Starfield canvas overlay style */
#TEMPLATE-4weird-starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    opacity: 0.3;
}



.waterfall-game-main {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 24px;
    align-items: start;
}

/* Fallback for smaller screens */
@media (max-width: 1100px) {
    .waterfall-game-main {
        grid-template-columns: 1fr;
    }
}

/* Game Frame styling */
.waterfall-game-frame {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    min-height: 600px;
    display: flex;
    flex-direction: column;
}

#waterfall-gameCanvas {
    width: 800px;
    height: 420px;
    max-width: 100%;
    height: auto;
    aspect-ratio: 800 / 420;
    display: block;
    background: #08080f;
    margin: 0 auto;
}

/* Machine Canvas / Area */
.machine-container {
    flex-grow: 1;
    position: relative;
    background: radial-gradient(circle at center, #111122 0%, #08080f 100%);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

.machine-header {
    text-align: center;
    width: 100%;
    margin-bottom: 10px;
    z-index: 10;
}

.exit-billboard {
    display: inline-block;
    background: #000;
    border: 3px solid #ffaa00;
    border-radius: 8px;
    padding: 10px 24px;
    box-shadow: 0 0 20px rgba(255, 170, 0, 0.3), inset 0 0 15px rgba(255, 170, 0, 0.2);
    position: relative;
}

.exit-billboard::before {
    content: '';
    position: absolute;
    top: -5px; left: -5px; right: -5px; bottom: -5px;
    border: 1px dashed #ffaa00;
    border-radius: 10px;
    pointer-events: none;
    animation: dash-blink 1.5s infinite linear;
}

@keyframes dash-blink {
    to { stroke-dashoffset: 20; }
}

.exit-amount-display {
    font-family: var(--font-cyber);
    font-size: 2.2rem;
    font-weight: 800;
    color: #ffaa00;
    text-shadow: 0 0 10px rgba(255, 170, 0, 0.8);
    margin: 0;
}

.exit-vibes-tag {
    font-size: 0.8rem;
    color: #ffaa00;
    opacity: 0.8;
    letter-spacing: 2px;
    margin-top: 4px;
    text-transform: uppercase;
}

/* The physical Machine visualization */
.waterfall-diagram {
    width: 100%;
    height: 400px;
    position: relative;
    margin: 20px 0;
}

/* Interactive Slider */
.exit-slider-container {
    width: 90%;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    padding: 15px 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 10;
    margin-bottom: 10px;
}

.slider-label-row {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-cyber);
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.exit-range-input {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #1a1a2e;
    outline: none;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.exit-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--neon-green);
    cursor: pointer;
    box-shadow: 0 0 10px var(--neon-green);
    transition: transform 0.1s;
}

.exit-range-input::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Sidebar / Info & Control tabs */
.control-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(10, 10, 15, 0.4);
}

.tab-btn {
    flex: 1;
    padding: 14px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-cyber);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
    color: var(--neon-blue);
    border-bottom-color: var(--neon-blue);
    background: rgba(0, 242, 254, 0.05);
}

.tab-content {
    padding: 20px;
    display: none;
    height: calc(100% - 48px);
    overflow-y: auto;
}

.tab-content.active {
    display: block;
}

/* Scenario level selector list */
.scenario-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scenario-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.scenario-card:hover {
    background: rgba(0, 242, 254, 0.03);
    border-color: rgba(0, 242, 254, 0.2);
    transform: translateY(-2px);
}

.scenario-card.active {
    background: rgba(0, 242, 254, 0.06);
    border-color: var(--neon-blue);
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.1);
}

.scenario-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.scenario-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.scenario-difficulty {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.diff-easy { background: rgba(0, 255, 135, 0.1); color: #00ff87; }
.diff-medium { background: rgba(255, 170, 0, 0.1); color: #ffaa00; }
.diff-hard { background: rgba(255, 51, 102, 0.1); color: #ff3366; }

.scenario-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 8px;
}

.scenario-objective {
    font-size: 0.8rem;
    color: var(--neon-blue);
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

/* Sandbox Inputs */
.input-group {
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 12px;
}

.input-group-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 4px;
}

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.control-row:last-child {
    margin-bottom: 0;
}

.control-row label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.input-num {
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--text-primary);
    padding: 4px 8px;
    width: 70px;
    text-align: right;
    font-family: var(--font-cyber);
    font-size: 0.85rem;
}

.input-checkbox {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--neon-blue);
}

/* Handbook styling */
.handbook-article {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.handbook-card {
    background: rgba(255, 255, 255, 0.02);
    border-left: 4px solid var(--neon-red);
    border-radius: 0 8px 8px 0;
    padding: 15px;
}

.handbook-card.lesson {
    border-left-color: var(--neon-green);
}

.handbook-card h4 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.handbook-card p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Info Panel below main canvas in layout if needed, or sidebar widgets */
.waterfall-stats-card {
    background: rgba(10, 10, 15, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    margin-top: 15px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 15px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-title {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.stat-value {
    font-family: var(--font-cyber);
    font-size: 1.25rem;
    font-weight: 700;
}

/* Custom coloring for metrics */
.color-debt { color: #00d2ff; }
.color-pref { color: #cf62ff; }
.color-part { color: #ffd700; }
.color-common { color: #00ff87; }

/* Disclaimer Header style */
.disclaimer-banner {
    background: rgba(255, 51, 102, 0.1);
    border: 1px solid rgba(255, 51, 102, 0.2);
    border-radius: 8px;
    padding: 10px 15px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: #ff80a0;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 12px;
}

.disclaimer-banner a {
    color: #fff;
    text-decoration: underline;
}

.disclaimer-banner a:hover {
    color: var(--neon-blue);
}

/* Secondary Action Button in Sandbox */
.action-btn {
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    border: none;
    border-radius: 6px;
    color: #000;
    font-family: var(--font-cyber);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 8px 16px;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    width: 100%;
    margin-top: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 12px rgba(0, 242, 254, 0.4);
}

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

.action-btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* SVG waterfall customization styling */
.svg-pipe {
    stroke: #22223b;
    stroke-width: 12;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    transition: stroke 0.3s;
}

.svg-pipe-glow {
    stroke-width: 12;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    opacity: 0.8;
    filter: drop-shadow(0 0 5px var(--glow-color));
}

.svg-valve {
    fill: #3e3e5e;
    stroke: #1a1a2e;
    stroke-width: 2;
    cursor: pointer;
    transition: fill 0.3s;
}

.svg-valve.open {
    fill: var(--neon-green);
}

.svg-bucket {
    fill: rgba(30, 30, 45, 0.7);
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 2;
}

/* Characters and Buckets layout in SVG area */
.svg-character-text {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    fill: var(--text-secondary);
    text-anchor: middle;
}

.svg-character-label {
    font-weight: bold;
    font-size: 12px;
    fill: var(--text-primary);
}

.svg-coin {
    fill: #ffd700;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

/* Banner caption at the bottom of visualizer */
.billboard-caption {
    font-family: var(--font-cyber);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-top: 10px;
}

.billboard-caption span {
    color: var(--neon-red);
}

/* Scenario Complete Overlay */
.scenario-complete-popup {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(9, 9, 14, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s;
    padding: 30px;
    text-align: center;
}

.scenario-complete-popup.visible {
    opacity: 1;
    pointer-events: auto;
}

.popup-emoji {
    font-size: 4rem;
    margin-bottom: 15px;
    animation: bounce 1s infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-10px); }
}

.popup-title {
    font-family: var(--font-cyber);
    font-size: 1.8rem;
    color: var(--neon-green);
    margin-bottom: 10px;
}

.popup-message {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 450px;
    margin-bottom: 25px;
}

/* Modal and links alignment */
.info-links {
    margin-top: 15px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: center;
    gap: 15px;
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 15px;
}

.info-links a {
    color: var(--neon-blue);
    text-decoration: none;
}

.info-links a:hover {
    text-decoration: underline;
}
