/* ==========================================
   확률.com - Probability Design System
   Colors: #1a1a2e, #6c757d, #4a90d9, #e8b84b, #f5f0e8
   Font: Inter (body), Caveat (handwritten headings)
   ========================================== */

:root {
    --deep-base: #1a1a2e;
    --muted-gray: #6c757d;
    --primary-blue: #4a90d9;
    --accent-gold: #e8b84b;
    --warm-offwhite: #f5f0e8;
    --font-display: "Caveat", cursive;
    --font-body: "Inter", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--deep-base);
    color: var(--warm-offwhite);
    overflow-x: hidden;
    line-height: 1.6;
}

#particle-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }

.hud-frame { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.hud-corner { position: absolute; width: 60px; height: 60px; }
.hud-corner-tl { top: 20px; left: 20px; border-top: 2px solid var(--accent-gold); border-left: 2px solid var(--accent-gold); opacity: 0.4; }
.hud-corner-tr { top: 20px; right: 20px; border-top: 2px solid var(--accent-gold); border-right: 2px solid var(--accent-gold); opacity: 0.4; }
.hud-corner-bl { bottom: 20px; left: 20px; border-bottom: 2px solid var(--accent-gold); border-left: 2px solid var(--accent-gold); opacity: 0.4; }
.hud-corner-br { bottom: 20px; right: 20px; border-bottom: 2px solid var(--accent-gold); border-right: 2px solid var(--accent-gold); opacity: 0.4; }

.hud-scanline {
    position: absolute; top: 0; left: 0; width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
    opacity: 0.15; animation: scanline 8s linear infinite;
}
@keyframes scanline { 0% { top: 0; } 100% { top: 100%; } }

.section {
    position: relative; z-index: 2; min-height: 100vh;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 80px 40px;
}

.section-title {
    font-family: var(--font-display); font-size: 3rem; color: var(--accent-gold);
    text-align: center; margin-bottom: 60px; letter-spacing: 0.02em;
}

.bounce-enter {
    opacity: 0; transform: translateY(40px) scale(0.95);
    transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.bounce-enter.visible { opacity: 1; transform: translateY(0) scale(1); }
.delay-1 { transition-delay: 0.15s; }
.delay-2 { transition-delay: 0.3s; }
.delay-3 { transition-delay: 0.45s; }
.delay-4 { transition-delay: 0.6s; }

.hero-section { background: radial-gradient(ellipse at center, rgba(74, 144, 217, 0.08) 0%, transparent 70%); }
.hero-content { text-align: center; }
.hero-title {
    font-family: var(--font-display); font-size: 8rem; font-weight: 700;
    color: var(--accent-gold); margin-bottom: 20px;
    text-shadow: 0 0 60px rgba(232, 184, 75, 0.3);
}
.hero-subtitle { font-family: var(--font-display); font-size: 2rem; color: var(--warm-offwhite); margin-bottom: 20px; letter-spacing: 0.05em; }
.hero-divider { margin: 20px auto; }
.hero-tagline { font-family: var(--font-body); font-size: 1.1rem; color: var(--muted-gray); font-weight: 300; letter-spacing: 0.1em; text-transform: uppercase; }

.scroll-indicator { position: absolute; bottom: 40px; display: flex; flex-direction: column; align-items: center; gap: 8px; animation: float 3s ease-in-out infinite; }
.scroll-indicator span { font-size: 0.75rem; color: var(--muted-gray); text-transform: uppercase; letter-spacing: 0.15em; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.concepts-section { background: linear-gradient(180deg, var(--deep-base) 0%, rgba(26, 26, 46, 0.95) 100%); }
.hud-panel-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 30px; max-width: 900px; width: 100%; }

.hud-panel {
    background: rgba(74, 144, 217, 0.06); border: 1px solid rgba(232, 184, 75, 0.2);
    padding: 30px; position: relative; overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.hud-panel::before {
    content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
    opacity: 0; transition: opacity 0.3s;
}
.hud-panel:hover { border-color: rgba(232, 184, 75, 0.5); box-shadow: 0 0 30px rgba(232, 184, 75, 0.1); }
.hud-panel:hover::before { opacity: 1; }

.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid rgba(108, 117, 125, 0.2); }
.panel-label { font-family: var(--font-body); font-size: 0.85rem; color: var(--primary-blue); font-weight: 600; letter-spacing: 0.05em; }
.panel-value { font-family: var(--font-body); font-size: 1.5rem; color: var(--accent-gold); font-weight: 700; }
.panel-title { font-family: var(--font-display); font-size: 1.6rem; color: var(--warm-offwhite); margin-bottom: 8px; }
.panel-desc { font-size: 0.9rem; color: var(--muted-gray); line-height: 1.5; }
.panel-bar { margin-top: 16px; height: 4px; background: rgba(108, 117, 125, 0.2); border-radius: 2px; overflow: hidden; }
.panel-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary-blue), var(--accent-gold)); border-radius: 2px; transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1); }

.distributions-section { background: linear-gradient(180deg, rgba(26, 26, 46, 0.95) 0%, var(--deep-base) 100%); }
.distribution-container { max-width: 800px; width: 100%; background: rgba(74, 144, 217, 0.04); border: 1px solid rgba(232, 184, 75, 0.15); padding: 40px; }
.distribution-controls { display: flex; gap: 12px; margin-bottom: 30px; justify-content: center; flex-wrap: wrap; }

.dist-btn {
    font-family: var(--font-body); font-size: 0.85rem; padding: 10px 24px;
    background: transparent; color: var(--muted-gray); border: 1px solid rgba(108, 117, 125, 0.3);
    cursor: pointer; transition: all 0.3s; letter-spacing: 0.05em; text-transform: uppercase;
}
.dist-btn:hover { color: var(--warm-offwhite); border-color: var(--primary-blue); }
.dist-btn.active { color: var(--accent-gold); border-color: var(--accent-gold); background: rgba(232, 184, 75, 0.1); }

#distribution-canvas { width: 100%; height: 300px; display: block; margin-bottom: 30px; }
.distribution-stats { display: flex; justify-content: center; gap: 40px; }
.stat-item { text-align: center; }
.stat-label { display: block; font-size: 0.8rem; color: var(--muted-gray); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 4px; }
.stat-value { font-size: 1.4rem; color: var(--accent-gold); font-weight: 600; }

.experiment-section { background: radial-gradient(ellipse at center, rgba(232, 184, 75, 0.05) 0%, transparent 60%), var(--deep-base); }
.experiment-container { max-width: 700px; width: 100%; text-align: center; }
.dice-area { display: flex; justify-content: center; gap: 40px; margin-bottom: 30px; }

.dice {
    width: 90px; height: 90px; background: rgba(245, 240, 232, 0.08);
    border: 2px solid rgba(232, 184, 75, 0.3); border-radius: 12px;
    display: flex; align-items: center; justify-content: center; transition: transform 0.3s;
}
.dice.rolling { animation: diceRoll 0.4s ease-out; }
@keyframes diceRoll { 0% { transform: rotate(0deg) scale(1); } 25% { transform: rotate(90deg) scale(0.9); } 50% { transform: rotate(180deg) scale(1.1); } 75% { transform: rotate(270deg) scale(0.95); } 100% { transform: rotate(360deg) scale(1); } }

.dice-face { width: 100%; height: 100%; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 12px; gap: 4px; }
.dot { width: 14px; height: 14px; background: var(--accent-gold); border-radius: 50%; display: none; }
.dot.visible { display: block; }
.dot.center { grid-area: 2 / 2; justify-self: center; align-self: center; }
.dot.tl { grid-area: 1 / 1; justify-self: center; align-self: center; }
.dot.tr { grid-area: 1 / 3; justify-self: center; align-self: center; }
.dot.bl { grid-area: 3 / 1; justify-self: center; align-self: center; }
.dot.br { grid-area: 3 / 3; justify-self: center; align-self: center; }
.dot.ml { grid-area: 2 / 1; justify-self: center; align-self: center; }
.dot.mr { grid-area: 2 / 3; justify-self: center; align-self: center; }

.roll-btn {
    font-family: var(--font-display); font-size: 1.4rem; padding: 14px 48px;
    background: transparent; color: var(--accent-gold); border: 2px solid var(--accent-gold);
    cursor: pointer; transition: all 0.3s; letter-spacing: 0.05em; margin-bottom: 30px;
}
.roll-btn:hover { background: rgba(232, 184, 75, 0.15); box-shadow: 0 0 20px rgba(232, 184, 75, 0.2); transform: scale(1.05); }
.roll-btn:active { transform: scale(0.98); }

.experiment-results { display: flex; justify-content: center; gap: 40px; margin-bottom: 40px; }
.result-item { text-align: center; }
.result-label { display: block; font-size: 0.8rem; color: var(--muted-gray); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 4px; }
.result-value { font-size: 1.4rem; color: var(--accent-gold); font-weight: 600; }

.frequency-chart { display: flex; align-items: flex-end; justify-content: center; gap: 8px; height: 160px; padding-top: 20px; }
.freq-bar-container { display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; width: 36px; }
.freq-bar { width: 100%; min-height: 2px; background: linear-gradient(to top, var(--primary-blue), var(--accent-gold)); border-radius: 2px 2px 0 0; transition: height 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
.freq-label { font-size: 0.7rem; color: var(--muted-gray); margin-top: 8px; }

.formulas-section { background: linear-gradient(180deg, var(--deep-base) 0%, rgba(26, 26, 46, 0.98) 100%); }
.formulas-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 30px; max-width: 900px; width: 100%; }

.formula-card {
    background: rgba(74, 144, 217, 0.04); border: 1px solid rgba(108, 117, 125, 0.2);
    padding: 30px; text-align: center; transition: all 0.3s; position: relative; overflow: hidden;
}
.formula-card::after {
    content: ""; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 0; height: 2px; background: var(--accent-gold); transition: width 0.4s;
}
.formula-card:hover { border-color: rgba(232, 184, 75, 0.3); transform: translateY(-4px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }
.formula-card:hover::after { width: 60%; }

.formula-icon { margin-bottom: 16px; }
.formula-name { font-family: var(--font-display); font-size: 1.5rem; color: var(--warm-offwhite); margin-bottom: 12px; }
.formula-expression {
    font-family: var(--font-body); font-size: 1.1rem; color: var(--accent-gold);
    padding: 12px; background: rgba(232, 184, 75, 0.06); border: 1px solid rgba(232, 184, 75, 0.15);
    margin-bottom: 12px; letter-spacing: 0.02em;
}
.formula-desc { font-size: 0.85rem; color: var(--muted-gray); line-height: 1.5; }

.footer { position: relative; z-index: 2; padding: 60px 40px; border-top: 1px solid rgba(232, 184, 75, 0.1); background: rgba(26, 26, 46, 0.98); }
.footer-content { max-width: 900px; margin: 0 auto; text-align: center; }
.footer-brand { margin-bottom: 20px; }
.footer-logo { font-family: var(--font-display); font-size: 2.5rem; color: var(--accent-gold); display: block; margin-bottom: 4px; }
.footer-tagline { font-family: var(--font-body); font-size: 0.85rem; color: var(--muted-gray); letter-spacing: 0.1em; text-transform: uppercase; }
.footer-mid-century { margin: 24px 0; display: flex; justify-content: center; }
.footer-copy { font-size: 0.8rem; color: var(--muted-gray); }

@media (max-width: 768px) {
    .hero-title { font-size: 5rem; }
    .hero-subtitle { font-size: 1.4rem; }
    .section { padding: 60px 20px; }
    .section-title { font-size: 2.2rem; margin-bottom: 40px; }
    .hud-panel-grid, .formulas-grid { grid-template-columns: 1fr; }
    .distribution-container { padding: 20px; }
    .distribution-stats, .experiment-results { flex-direction: column; gap: 16px; }
    .freq-bar-container { width: 24px; }
}

@media (max-width: 480px) {
    .hero-title { font-size: 3.5rem; }
    .distribution-controls { flex-direction: column; align-items: center; }
}