* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0a;
    color: #ffffff;
    overflow-x: hidden;
    min-height: 100vh;
}

/* 言語切り替え */
[data-lang="en"] .text-ja,
body:not([data-lang]) .text-en {
    display: none;
}

[data-lang="ja"] .text-en {
    display: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

h1 {
    font-size: 2.5rem;
    background: linear-gradient(45deg, #4169E1, #FFD700, #FF6347);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    animation: glow 3s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2); }
}

.subtitle {
    font-size: 1.2rem;
    color: #888;
    margin-bottom: 20px;
}

.language-switcher {
    position: absolute;
    top: 0;
    right: 0;
}

.lang-btn {
    background: transparent;
    border: 1px solid #444;
    color: #888;
    padding: 8px 16px;
    margin-left: 10px;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.3s;
}

.lang-btn:hover {
    border-color: #FFD700;
    color: #FFD700;
}

.lang-btn.active {
    background: #FFD700;
    color: #0a0a0a;
    border-color: #FFD700;
}

/* ビジュアライゼーションエリア */
.visualization-area {
    position: relative;
    width: 100%;
    height: 400px;
    background: radial-gradient(circle at center, #1a1a2e 0%, #0a0a0a 100%);
    border-radius: 20px;
    margin-bottom: 30px;
    overflow: hidden;
}

#quantum-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.particles {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 600px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.particle {
    position: relative;
    width: 120px;
    height: 120px;
    transition: all 0.5s;
}

.particle-core {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #6495ED, #4169E1);
    box-shadow: 0 0 40px rgba(100, 149, 237, 0.5);
    animation: float 3s ease-in-out infinite;
}

#particle-b .particle-core {
    background: radial-gradient(circle at 30% 30%, #FF7F50, #FF6347);
    box-shadow: 0 0 40px rgba(255, 99, 71, 0.5);
    animation-delay: -1.5s;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.particle-spin {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.particle-label {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem;
    color: #888;
}

/* 粒子の状態 */
.particle.entangling {
    animation: entangle 1s ease-in-out;
}

@keyframes entangle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.particle.entangled .particle-core {
    box-shadow: 0 0 60px rgba(255, 215, 0, 0.6);
}

.particle.measuring {
    animation: measure 0.6s ease-in-out;
}

@keyframes measure {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(0.8) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

.spin-change {
    animation: spinChange 0.5s ease-in-out;
}

@keyframes spinChange {
    0% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
    50% { transform: translate(-50%, -50%) scale(1.5) rotate(180deg); }
    100% { transform: translate(-50%, -50%) scale(1) rotate(360deg); }
}

/* コントロール */
.controls {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn.primary {
    background: linear-gradient(45deg, #4169E1, #6495ED);
    color: white;
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(65, 105, 225, 0.4);
}

.btn.secondary {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #0a0a0a;
}

.btn.secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
}

.btn:not(.primary):not(.secondary) {
    background: #333;
    color: white;
}

.btn:not(.primary):not(.secondary):hover {
    background: #444;
}

/* 情報パネル */
.info-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
}

.stat-card h3 {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.state-display {
    font-size: 1.2rem;
    color: #FFD700;
    font-weight: bold;
}

.correlation-meter {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.correlation-fill {
    height: 100%;
    background: linear-gradient(90deg, #FF6347, #FFD700, #4169E1);
    width: 0%;
    transition: width 0.5s ease-in-out;
}

.correlation-value,
.measurement-count {
    font-size: 1.5rem;
    font-weight: bold;
    color: #4169E1;
}

/* 説明セクション */
.explanation {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
}

.explanation h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: #FFD700;
}

.explanation p {
    line-height: 1.6;
    margin-bottom: 20px;
    color: #ccc;
}

.instructions {
    margin-top: 30px;
}

.instructions h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: #4169E1;
}

.instructions ol {
    list-style-position: inside;
    color: #ccc;
}

.instructions li {
    margin-bottom: 10px;
    line-height: 1.6;
}

/* フッター */
footer {
    text-align: center;
    padding: 30px 0;
    color: #666;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* レスポンシブ */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    .visualization-area {
        height: 300px;
    }
    
    .particle {
        width: 80px;
        height: 80px;
    }
    
    .particle-spin {
        font-size: 1.5rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 200px;
    }
    
    .language-switcher {
        position: static;
        margin-top: 20px;
    }
}