:root {
    --primary-color: #6366f1;
    --secondary-color: #ec4899;
    --accent-color: #fbbf24;
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --text-color: #e2e8f0;
    --text-secondary: #94a3b8;
    --success-color: #10b981;
    --error-color: #ef4444;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%);
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.screen {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.difficulty-selector {
    margin: 2rem 0;
}

h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    text-align: center;
}

.difficulty-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.difficulty-btn {
    background: var(--surface-color);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-width: 150px;
}

.difficulty-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.difficulty-btn.selected {
    background: var(--primary-color);
    transform: scale(1.05);
}

.difficulty-btn .emoji {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.difficulty-btn span {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
}

.difficulty-btn small {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.primary-btn, .secondary-btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.secondary-btn {
    background: transparent;
    color: var(--text-color);
    border: 2px solid var(--primary-color);
}

.secondary-btn:hover {
    background: var(--primary-color);
}

/* ゲーム画面 */
.game-header {
    display: flex;
    justify-content: space-around;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--surface-color);
    border-radius: 12px;
}

.score-display, .combo-display, .accuracy-display {
    text-align: center;
}

.score-display span:last-child,
.combo-display span:last-child,
.accuracy-display span:last-child {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
}

/* ビートインジケーター */
.beat-indicator {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0;
}

.beat-bar {
    width: 20px;
    height: 80px;
    background: var(--surface-color);
    border-radius: 10px;
    transition: all 0.15s ease;
}

.beat-bar.active {
    background: linear-gradient(to top, var(--primary-color), var(--accent-color));
    transform: scaleY(1.2);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.6);
}

/* タイピングエリア */
.typing-area {
    text-align: center;
    margin: 3rem 0;
}

.target-word {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 2rem;
    letter-spacing: 0.2em;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
    min-height: 4rem;
}

.typing-input {
    width: 100%;
    max-width: 500px;
    padding: 1rem;
    font-size: 1.5rem;
    background: var(--surface-color);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    color: var(--text-color);
    text-align: center;
    transition: all 0.3s ease;
}

.typing-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

.typing-feedback {
    margin-top: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
    min-height: 2rem;
}

.typing-feedback.perfect {
    color: var(--accent-color);
}

.typing-feedback.good {
    color: var(--success-color);
}

.typing-feedback.miss {
    color: var(--error-color);
}

/* ビジュアライザー */
.visual-effects {
    position: relative;
    height: 200px;
    margin: 2rem 0;
}

#visualizer {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.3);
}

.control-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.75rem 1.5rem;
    background: var(--surface-color);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: var(--primary-color);
}

/* 結果画面 */
.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-item {
    text-align: center;
    padding: 1.5rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-color);
}

.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* 言語切り替え */
.language-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 100;
}

.lang-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--surface-color);
    border: 2px solid var(--primary-color);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lang-btn:hover {
    transform: rotate(180deg);
    background: var(--primary-color);
}

.lang-icon {
    font-size: 1.5rem;
}

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

/* レスポンシブ */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    .target-word {
        font-size: 2rem;
    }
    
    .typing-input {
        font-size: 1.2rem;
    }
    
    .difficulty-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .game-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .beat-indicator {
        gap: 0.5rem;
    }
    
    .beat-bar {
        width: 15px;
        height: 60px;
    }
}

/* アニメーション */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

.shake {
    animation: shake 0.3s ease-in-out;
}

.pulse {
    animation: pulse 0.5s ease-in-out;
}