@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --success: #10b981;
    --error: #ef4444;
    --glass-border: rgba(255, 255, 255, 0.1);
    --onboarding-bg: rgba(15, 23, 42, 0.95);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    margin: 0;
}

#game-intro {
    width: 100%;
    padding: 1.5rem;
    text-align: center;
}

#game-intro h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #818cf8, #10b981);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

#keyboard {
    display: grid;
    grid-template-columns: repeat(11, 1fr);
    gap: 0.5rem;
    max-width: 800px;
    width: 95%;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    padding: 1.5rem;
    border-radius: 1.5rem;
    border: 1px solid var(--glass-border);
    margin-bottom: 3rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

.key {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 0.75rem 0.25rem;
    border-radius: 0.75rem;
    text-align: center;
    font-weight: 600;
    cursor: grab;
    transition: all 0.2s;
    user-select: none;
    font-size: 1.2rem;
}

.key:hover,
.key.active {
    background: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.key:active {
    cursor: grabbing;
}

.game-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 4rem;
    flex-wrap: wrap;
}

.hook-slot {
    width: 60px;
    height: 70px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px dashed var(--glass-border);
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    transition: all 0.3s;
    position: relative;
}

.hook-slot.active {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.05);
}

.hook-slot.drag-over {
    background: rgba(99, 102, 241, 0.2);
    transform: scale(1.1);
    border-style: solid;
}

.hook-slot.solved {
    border: 2px solid var(--success);
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    animation: pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hook-dot.solved {
    border: 2px solid var(--success) !important;
    background: rgba(16, 185, 129, 0.1) !important;
    color: var(--success) !important;
    animation: pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.word-display {
    display: flex;
    gap: 0.5rem;
}

.letter-box {
    width: 60px;
    height: 70px;
    background: var(--accent);
    color: white;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
}

@keyframes pop {
    0% {
        transform: scale(0.8);
    }

    100% {
        transform: scale(1);
    }
}

.controls {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 1rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

button:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.game-over-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    padding: 3rem;
    border-radius: 2rem;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.modal-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.all-hooks-display {
    margin: 1.5rem 0;
    color: var(--text-secondary);
}

.all-hooks-display span {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.6rem;
    border-radius: 0.5rem;
    margin: 0.2rem;
    color: var(--success);
    font-weight: 600;
}

@media (max-width: 600px) {
    #keyboard {
        grid-template-columns: repeat(8, 1fr);
    }

    .letter-box,
    .hook-slot {
        width: 40px;
        height: 50px;
        font-size: 1.2rem;
    }

    h1 {
        font-size: 1.8rem;
    }
}

/* Keyboard Selection Bar */
#arrow-overlay {
    width: 100%;
    max-width: 600px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    display: none;
    /* Changed via JS */
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    border-radius: 2rem;
    padding: 1.5rem;
    border: 1px solid var(--glass-border);
    margin: 1rem 0;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.arrow-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    gap: 0.8rem;
    padding: 1rem;
    border-radius: 1.5rem;
}

.arrow-side:hover {
    background: rgba(255, 255, 255, 0.05);
}

.arrow-side:hover .arrow-icon {
    fill: var(--accent-hover);
    transform: scale(1.1);
}

.arrow-icon {
    width: 60px;
    height: 60px;
    fill: var(--text-primary);
    filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.4));
    transition: all 0.2s;
}

.arrow-side[data-side="left"] .arrow-icon {
    animation: bounceLeftSmall 2s infinite ease-in-out;
}

.arrow-side[data-side="right"] .arrow-icon {
    animation: bounceRightSmall 2s infinite ease-in-out;
}

@keyframes bounceLeftSmall {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(-8px);
    }
}

@keyframes bounceRightSmall {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(8px);
    }
}

.shake-error {
    animation: shakeCenter 0.4s cubic-bezier(.36, .07, .19, .97) both;
    background: var(--error) !important;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.6) !important;
}

@keyframes shakeCenter {

    10%,
    90% {
        transform: translateX(-2px);
    }

    20%,
    80% {
        transform: translateX(4px);
    }

    30%,
    50%,
    70% {
        transform: translateX(-8px);
    }

    40%,
    60% {
        transform: translateX(8px);
    }
}

.keyboard-hint {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

#current-key-display {
    width: 80px;
    height: 90px;
    background: var(--accent);
    color: white;
    border-radius: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 800;
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.5);
    margin: 0 2rem;
}

/* Onboarding */
#onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--onboarding-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(8px);
    padding: 1.5rem;
}

.onboarding-card {
    background: #1e293b;
    border: 1px solid var(--glass-border);
    border-radius: 2rem;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.onboarding-card h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #818cf8, #10b981);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.onboarding-steps {
    text-align: left;
    margin-bottom: 2rem;
}

.onboarding-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

.onboarding-step .icon {
    background: var(--accent);
    color: white;
    min-width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
}

.onboarding-step p {
    font-size: 1.05rem;
    line-height: 1.5;
}

.onboarding-step strong {
    color: #818cf8;
}

.onboarding-card button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.onboarding-card button:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

.kbd-key {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.9rem;
    font-family: monospace;
}