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

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #888888;
    --accent: #00ff00;
    --dot-inactive: #333333;
    --dot-active: #00ff00;
    --dot-glow: rgba(0, 255, 0, 0.5);
}

body.light-theme {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-primary: #000000;
    --text-secondary: #666666;
    --accent: #009900;
    --dot-inactive: #dddddd;
    --dot-active: #009900;
    --dot-glow: rgba(0, 153, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

h1 {
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 2px;
}

.language-selector select {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.language-selector select:hover {
    border-color: var(--accent);
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.clock-container {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    margin-bottom: 30px;
}

.time-display {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 40px;
}

.time-section {
    text-align: center;
}

.time-section h2 {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.binary-display {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.binary-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.binary-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--dot-inactive);
    transition: all 0.3s ease;
    position: relative;
}

.binary-dot.active {
    background: var(--dot-active);
    box-shadow: 0 0 20px var(--dot-glow);
}

.binary-dot::after {
    content: attr(data-value);
    position: absolute;
    right: -25px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.decimal-display {
    font-size: 2rem;
    font-weight: 300;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.separator {
    font-size: 3rem;
    font-weight: 300;
    color: var(--text-secondary);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.legend {
    background: var(--bg-primary);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
}

.legend h3 {
    font-size: 1.2rem;
    font-weight: 400;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.legend-items {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--dot-inactive);
}

.legend-dot.active {
    background: var(--dot-active);
    box-shadow: 0 0 10px var(--dot-glow);
}

.legend p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.controls {
    display: flex;
    gap: 15px;
}

.controls button {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--text-secondary);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.controls button:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

#theme-toggle {
    font-size: 1.5rem;
    padding: 10px 16px;
}

footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    header {
        justify-content: center;
        text-align: center;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .clock-container {
        padding: 30px 20px;
    }
    
    .time-display {
        flex-direction: column;
        gap: 20px;
    }
    
    .separator {
        display: none;
    }
    
    .binary-dot {
        width: 35px;
        height: 35px;
    }
    
    .binary-dot::after {
        right: -20px;
        font-size: 0.7rem;
    }
    
    .decimal-display {
        font-size: 1.5rem;
    }
    
    .legend-items {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .clock-container {
        padding: 20px 15px;
    }
    
    .binary-dot {
        width: 30px;
        height: 30px;
    }
    
    .binary-column {
        gap: 8px;
    }
    
    .binary-display {
        gap: 10px;
    }
    
    .controls button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}