/* ========================================
   皿打 - Sara-Da Typing Game
   Main Stylesheet
   ======================================== */

/* CSS Variables - Soft Pastel Theme */
:root {
    --primary-color: #f8a5c2;
    --secondary-color: #c4a7e7;
    --accent-color: #ffeaa7;
    --dark-bg: #2d2d44;
    --darker-bg: #1e1e30;
    --text-light: #ffffff;
    --text-muted: #c0c0d0;
    --success-color: #a8e6cf;
    --danger-color: #f8a5c2;
    --glow-primary: 0 0 25px rgba(248, 165, 194, 0.4);
    --glow-secondary: 0 0 25px rgba(196, 167, 231, 0.4);
    --glow-accent: 0 0 25px rgba(255, 234, 167, 0.4);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    background: var(--darker-bg);
    color: var(--text-light);
    overflow: hidden;
    min-height: 100vh;
}

/* Game Container */
#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--darker-bg) 100%);
}

/* Screen Management */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
}

.screen.active {
    display: flex;
}

/* ========================================
   Main Menu
   ======================================== */
#main-menu {
    background: linear-gradient(135deg,
            rgba(26, 26, 46, 0.95) 0%,
            rgba(15, 15, 26, 0.98) 100%);
    backdrop-filter: blur(10px);
}

.menu-content {
    text-align: center;
    padding: 2rem;
    max-width: 600px;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-title {
    margin-bottom: 0.5rem;
}

.title-jp {
    display: block;
    font-size: 5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    filter: drop-shadow(0 0 30px rgba(255, 107, 107, 0.5));
    letter-spacing: 0.2em;
}

.title-en {
    display: block;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    color: var(--secondary-color);
    letter-spacing: 0.5em;
    margin-top: -0.5rem;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Difficulty Selection */
.difficulty-select {
    margin: 2rem 0;
}

.difficulty-select h2 {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    letter-spacing: 0.2em;
}

.btn-difficulty {
    display: block;
    width: 100%;
    padding: 1rem 1.5rem;
    margin: 0.75rem 0;
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.05) 0%,
            rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.btn-difficulty:hover {
    background: linear-gradient(135deg,
            rgba(132, 94, 247, 0.2) 0%,
            rgba(255, 107, 107, 0.2) 100%);
    border-color: var(--secondary-color);
    transform: translateX(10px);
    box-shadow: var(--glow-secondary);
}

.btn-difficulty .diff-name {
    display: block;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.btn-difficulty .diff-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.btn-difficulty[data-difficulty="easy"]:hover .diff-name {
    color: var(--success-color);
}

.btn-difficulty[data-difficulty="normal"]:hover .diff-name {
    color: var(--accent-color);
}

.btn-difficulty[data-difficulty="hard"]:hover .diff-name {
    color: var(--danger-color);
}

/* Instructions */
.instructions {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.instructions h3 {
    font-size: 0.9rem;
    color: var(--accent-color);
    margin-bottom: 0.75rem;
    letter-spacing: 0.1em;
}

.instructions p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.8;
}

/* ========================================
   Game Screen
   ======================================== */
#game-screen {
    background: var(--darker-bg);
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Game UI Overlay */
#game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5rem;
}

.ui-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.score-display,
.combo-display,
.lives-display {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.score-display .label,
.lives-display .label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.15em;
    margin-bottom: 0.25rem;
}

#score-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-color);
    text-shadow: var(--glow-accent);
}

.combo-display {
    text-align: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

.combo-display.active {
    opacity: 1;
    transform: scale(1);
}

#combo-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-shadow: var(--glow-primary);
}

.combo-display .label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.15em;
}

#lives-icons {
    display: flex;
    gap: 0.5rem;
}

#lives-icons .food-icon {
    width: 30px;
    height: 30px;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    transition: all 0.3s ease;
}

#lives-icons .food-icon.lost {
    background: rgba(255, 255, 255, 0.2);
    opacity: 0.3;
}

/* Input Display */
.ui-bottom {
    display: flex;
    justify-content: center;
}

.input-display {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    padding: 1rem 3rem;
    border-radius: 50px;
    border: 2px solid var(--secondary-color);
    box-shadow: var(--glow-secondary);
    min-width: 300px;
    text-align: center;
}

#current-input {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-light);
    letter-spacing: 0.15em;
}

.cursor {
    display: inline-block;
    width: 2px;
    height: 1.5rem;
    background: var(--accent-color);
    margin-left: 2px;
    animation: blink 0.8s infinite;
    vertical-align: middle;
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* ========================================
   Game Over / Clear Screens
   ======================================== */
#gameover-screen,
#clear-screen {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
}

.gameover-content,
.clear-content {
    text-align: center;
    padding: 3rem;
    animation: fadeInUp 0.5s ease-out;
}

.gameover-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 4rem;
    font-weight: 700;
    color: var(--danger-color);
    text-shadow: var(--glow-primary);
    margin-bottom: 2rem;
    letter-spacing: 0.1em;
}

.clear-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-color), var(--success-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 30px rgba(255, 212, 59, 0.5));
    margin-bottom: 0.5rem;
    letter-spacing: 0.1em;
}

.clear-message {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.final-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.stat {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem 2rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 150px;
}

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

.stat-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-color);
}

/* Buttons */
.btn-primary,
.btn-secondary {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 0.75rem auto;
    padding: 1rem 2rem;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--text-light);
    box-shadow: var(--glow-primary);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ========================================
   Animations
   ======================================== */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.3s ease;
}

@keyframes pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.pop {
    animation: pop 0.2s ease;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .title-jp {
        font-size: 3.5rem;
    }

    .title-en {
        font-size: 1rem;
    }

    .menu-content {
        padding: 1.5rem;
    }

    .gameover-title,
    .clear-title {
        font-size: 2.5rem;
    }

    .final-stats {
        gap: 1rem;
    }

    .stat {
        padding: 1rem 1.5rem;
        min-width: 120px;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}