/* ============================================
   GAMELE - Cyberpunk Gamer UI
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;700;800;900&family=Rajdhani:wght@400;500;600;700&family=Share+Tech+Mono&display=swap');

:root {
    --bg-primary: #080A0F;
    --bg-secondary: #0E1117;
    --bg-card: #12161F;
    --border: #1A2035;
    --green: #00FFB2;
    --green-dim: #00C896;
    --green-glow: rgba(0, 255, 178, 0.3);
    --yellow: #FFD639;
    --yellow-dim: #F2C94C;
    --yellow-glow: rgba(255, 214, 57, 0.3);
    --gray: #1E2433;
    --gray-light: #2D3548;
    --gray-text: #4A5568;
    --red: #FF3E5B;
    --red-glow: rgba(255, 62, 91, 0.3);
    --accent: #6C5CE7;
    --accent-glow: rgba(108, 92, 231, 0.35);
    --cyan: #00D4FF;
    --cyan-glow: rgba(0, 212, 255, 0.25);
    --text-primary: #E8ECF4;
    --text-secondary: #7B8BA5;
    --text-dim: #3D4B63;
    --header-height: 60px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    font-family: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    user-select: none;
    -webkit-user-select: none;
}

.seo-intro {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ============= ANIMATED BACKGROUND ============= */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(108, 92, 231, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(0, 212, 255, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(0, 255, 178, 0.03) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

/* Scanline overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

/* ============= HEADER ============= */
.header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: linear-gradient(180deg, rgba(14, 17, 23, 0.98) 0%, rgba(14, 17, 23, 0.92) 100%);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

/* Neon line under header */
.header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--cyan), var(--accent), var(--cyan), transparent);
    opacity: 0.6;
}

.header-title {
    background: transparent;
    border: 0;
    padding: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    width: min(42vw, 210px);
    cursor: pointer;
    z-index: 1;
}

.header-logo {
    display: block;
    width: 100%;
    height: auto;
    max-height: 34px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px var(--cyan-glow));
    animation: titlePulse 3s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% { filter: drop-shadow(0 0 8px var(--green-glow)); }
    50% { filter: drop-shadow(0 0 16px var(--cyan-glow)); }
}

.header-title .game-number {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 2px;
    display: block;
    text-align: center;
    margin-top: -5px;
    color: var(--text-secondary);
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.25);
}

.header-title:focus-visible {
    outline: 1px solid var(--cyan);
    outline-offset: 6px;
    border-radius: 8px;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 1;
}

.header-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-size: 1rem;
    position: relative;
    overflow: hidden;
}

.header-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--cyan-glow), transparent);
    opacity: 0;
    transition: opacity 0.3s;
    border-radius: 10px;
}

.header-btn:hover::before {
    opacity: 1;
}

.header-btn:hover {
    border-color: var(--cyan);
    color: var(--text-primary);
    box-shadow: 0 0 15px var(--cyan-glow);
    transform: translateY(-1px);
}

.header-btn:active {
    transform: translateY(0) scale(0.95);
}

.lang-select {
    height: 38px;
    min-width: 52px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    outline: none;
}

.lang-select:focus,
.lang-select:hover {
    border-color: var(--cyan);
    color: var(--text-primary);
    box-shadow: 0 0 15px var(--cyan-glow);
}

.lang-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ============= MAIN AREA ============= */
.game-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding-top: var(--header-height);
    position: relative;
    z-index: 1;
}

.site-footer {
    min-height: 64px;
    padding: 14px 16px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(8, 10, 15, 0.92), rgba(14, 17, 23, 0.98));
    position: relative;
    z-index: 1;
}

.footer-link {
    background: none;
    border: 0;
    color: var(--text-secondary);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    padding: 6px 0;
    text-decoration: none;
}

.footer-link:hover,
.footer-link:focus-visible {
    color: var(--cyan);
    outline: none;
}

.footer-language {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dim);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ============= ATTEMPTS BAR (Health Bar) ============= */
.attempts-bar {
    width: 100%;
    padding: 0 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.hp-label {
    font-family: 'Orbitron', monospace;
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--text-dim);
    text-transform: uppercase;
    min-width: 24px;
}

.hp-track {
    flex: 1;
    height: 8px;
    background: var(--gray);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.hp-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.25, 0.8, 0.25, 1), background 0.6s;
    position: relative;
    background: linear-gradient(90deg, var(--green), var(--cyan));
    box-shadow: 0 0 10px var(--green-glow);
}

.hp-fill.warning {
    background: linear-gradient(90deg, var(--yellow), #FF9900);
    box-shadow: 0 0 10px var(--yellow-glow);
}

.hp-fill.danger {
    background: linear-gradient(90deg, var(--red), #FF6B6B);
    box-shadow: 0 0 10px var(--red-glow);
    animation: hpPulse 1s ease-in-out infinite;
}

@keyframes hpPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.hp-count {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-secondary);
    min-width: 30px;
    text-align: right;
}

/* ============= GRID WRAPPER ============= */
.grid-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 8px 8px;
    position: relative;
}

.board-shell {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    max-width: 100%;
}

/* ============= GRID ============= */
.grid {
    display: grid;
    gap: 6px;
    max-width: 100%;
    position: relative;
}

.cell {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', monospace;
    font-size: clamp(0.85rem, 3.2vw, 1.4rem);
    font-weight: 700;
    text-transform: uppercase;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.01);
    color: var(--text-primary);
    transition: all 0.2s;
    position: relative;
}

/* Active row indicator */
.cell.active-row {
    border-color: rgba(0, 212, 255, 0.15);
}

/* Cursor blink on active cell */
.cell.cursor::after {
    content: '';
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 55%;
    height: 2px;
    background: var(--cyan);
    box-shadow: 0 0 6px var(--cyan-glow);
    animation: cursorBlink 1s step-end infinite;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.cell.filled {
    border-color: var(--cyan);
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.1), inset 0 0 12px rgba(0, 212, 255, 0.03);
    animation: cellType 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: var(--cyan);
}

@keyframes cellType {
    0% { transform: scale(0.85); }
    60% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* ============= CELL STATES ============= */
.cell.correct {
    background: linear-gradient(145deg, rgba(0, 255, 178, 0.2) 0%, rgba(0, 200, 150, 0.12) 100%);
    border-color: var(--green);
    color: var(--green);
    box-shadow: 0 0 12px var(--green-glow), inset 0 0 20px rgba(0, 255, 178, 0.06);
    text-shadow: 0 0 10px var(--green-glow);
}

.cell.present {
    background: linear-gradient(145deg, rgba(255, 214, 57, 0.18) 0%, rgba(242, 201, 76, 0.1) 100%);
    border-color: var(--yellow);
    color: var(--yellow);
    box-shadow: 0 0 12px var(--yellow-glow), inset 0 0 20px rgba(255, 214, 57, 0.05);
    text-shadow: 0 0 10px var(--yellow-glow);
}

.cell.absent {
    background: rgba(30, 36, 51, 0.6);
    border-color: rgba(45, 53, 72, 0.5);
    color: var(--gray-text);
}

/* ============= CELL ANIMATIONS ============= */
/* 3D Flip reveal */
.cell.reveal {
    animation: cellRevealFlip 0.6s ease forwards;
}

@keyframes cellRevealFlip {
    0% { transform: rotateX(0deg); }
    45% { transform: rotateX(90deg); border-color: var(--border); color: transparent; }
    55% { transform: rotateX(90deg); }
    100% { transform: rotateX(0deg); }
}

/* Victory wave */
.cell.victory-wave {
    animation: victoryWave 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes victoryWave {
    0% { transform: translateY(0) scale(1); }
    30% { transform: translateY(-16px) scale(1.12); }
    50% { transform: translateY(-16px) scale(1.12); box-shadow: 0 8px 30px var(--green-glow); }
    100% { transform: translateY(0) scale(1); }
}

/* Shake */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-8px) rotate(-1deg); }
    30% { transform: translateX(8px) rotate(1deg); }
    45% { transform: translateX(-6px); }
    60% { transform: translateX(6px); }
    75% { transform: translateX(-3px); }
    90% { transform: translateX(3px); }
}

.cell.shake-anim {
    animation: shake 0.5s ease;
}

/* Defeat */
.cell.defeat-shake {
    animation: defeatPulse 0.5s ease;
}

@keyframes defeatPulse {
    0%, 100% { transform: scale(1); }
    30% { transform: scale(0.92); border-color: var(--red); }
    60% { transform: scale(1.02); }
}

/* ============= KEYBOARD ============= */
.keyboard-wrapper {
    flex-shrink: 0;
    padding: 6px 4px 14px;
    background: linear-gradient(180deg, rgba(14, 17, 23, 0.95) 0%, var(--bg-primary) 100%);
    border-top: 1px solid var(--border);
    position: relative;
    backdrop-filter: blur(8px);
}

.keyboard-wrapper::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 15%;
    right: 15%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.4;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 4px;
}

.keyboard-row:last-child {
    margin-bottom: 0;
}

.key {
    height: 50px;
    min-width: 28px;
    flex: 1;
    max-width: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(45, 53, 72, 0.5) 0%, rgba(30, 36, 51, 0.8) 100%);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

/* LED underglow */
.key::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.06);
    transition: all 0.2s;
}

.key:active {
    transform: scale(0.9) translateY(2px);
    transition-duration: 0.05s;
}

.key:hover::after {
    background: var(--cyan);
    box-shadow: 0 2px 8px var(--cyan-glow);
}

.key.wide {
    flex: 1.6;
    max-width: 72px;
    font-family: 'Orbitron', monospace;
    font-size: 0.6rem;
    letter-spacing: 1px;
    font-weight: 600;
}

.key.correct {
    background: linear-gradient(180deg, rgba(0, 255, 178, 0.25) 0%, rgba(0, 200, 150, 0.15) 100%);
    border-color: rgba(0, 255, 178, 0.3);
    color: var(--green);
    text-shadow: 0 0 8px var(--green-glow);
}

.key.correct::after {
    background: var(--green);
    box-shadow: 0 2px 10px var(--green-glow);
}

.key.present {
    background: linear-gradient(180deg, rgba(255, 214, 57, 0.22) 0%, rgba(242, 201, 76, 0.12) 100%);
    border-color: rgba(255, 214, 57, 0.3);
    color: var(--yellow);
    text-shadow: 0 0 8px var(--yellow-glow);
}

.key.present::after {
    background: var(--yellow);
    box-shadow: 0 2px 10px var(--yellow-glow);
}

.key.absent {
    background: rgba(14, 17, 23, 0.8);
    border-color: rgba(30, 36, 51, 0.3);
    color: var(--text-dim);
}

.key.absent::after { display: none; }

/* ============= TOAST ============= */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + 50px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(30, 36, 51, 0.95) 100%);
    color: var(--text-primary);
    border: 1px solid var(--accent);
    padding: 12px 28px;
    border-radius: 6px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 30px rgba(108, 92, 231, 0.2), 0 0 1px var(--accent);
    animation: toastGlitch 0.3s ease, toastFadeOut 0.4s ease 1.8s forwards;
    pointer-events: none;
}

@keyframes toastGlitch {
    0% { opacity: 0; transform: translateY(-10px) skewX(-2deg); }
    40% { transform: translateY(2px) skewX(1deg); }
    100% { opacity: 1; transform: translateY(0) skewX(0); }
}

@keyframes toastFadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-8px); }
}

/* ============= MODAL ============= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 440px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 28px;
    transform: translateY(20px) scale(0.95);
    transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 1px var(--border);
}

/* Neon corner accents */
.modal::before,
.modal::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
}

.modal::before {
    top: -1px;
    left: -1px;
    border-top: 2px solid var(--cyan);
    border-left: 2px solid var(--cyan);
    border-top-left-radius: 16px;
    opacity: 0.5;
}

.modal::after {
    bottom: -1px;
    right: -1px;
    border-bottom: 2px solid var(--accent);
    border-right: 2px solid var(--accent);
    border-bottom-right-radius: 16px;
    opacity: 0.5;
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-title {
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: linear-gradient(90deg, var(--green), var(--cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-close {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 10px;
    line-height: 1;
    border-radius: 8px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255, 62, 91, 0.1);
    border-color: var(--red);
    color: var(--red);
}

/* ============= PRIVACY MODAL ============= */
.privacy-content {
    display: grid;
    gap: 18px;
}

.privacy-content section {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.privacy-content section:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.privacy-content h3 {
    margin: 0 0 8px;
    font-family: 'Orbitron', monospace;
    font-size: 0.72rem;
    color: var(--cyan);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.privacy-content p {
    margin: 0;
    color: var(--text-secondary);
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.98rem;
    line-height: 1.45;
}

.toggle-row {
    margin-top: 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: var(--text-primary);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.toggle-row input {
    width: 44px;
    height: 24px;
    accent-color: var(--cyan);
}

.cookie-consent {
    position: fixed;
    left: 50%;
    bottom: 16px;
    z-index: 3000;
    width: min(720px, calc(100vw - 24px));
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(18, 22, 31, 0.98), rgba(8, 10, 15, 0.98));
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), 0 0 20px rgba(0, 212, 255, 0.08);
    transform: translateX(-50%);
}

.cookie-consent.active {
    display: flex;
}

.cookie-copy {
    flex: 1;
}

.cookie-copy strong {
    display: block;
    margin-bottom: 6px;
    color: var(--cyan);
    font-family: 'Orbitron', monospace;
    font-size: 0.76rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.cookie-copy p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.35;
}

.cookie-actions,
.cookie-modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.cookie-modal-actions {
    margin-top: 2px;
}

.cookie-btn {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 8px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
}

.cookie-btn.primary {
    border: 1px solid rgba(0, 255, 178, 0.35);
    background: rgba(0, 255, 178, 0.12);
    color: var(--green);
}

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

.cookie-btn:hover,
.cookie-btn:focus-visible {
    border-color: var(--cyan);
    color: var(--cyan);
    outline: none;
}

/* ============= LEGAL PAGES ============= */
.legal-page {
    user-select: text;
    -webkit-user-select: text;
}

.legal-page .header {
    justify-content: center;
}

.legal-main {
    width: min(880px, calc(100vw - 32px));
    margin: 0 auto;
    padding: calc(var(--header-height) + 42px) 0 56px;
    position: relative;
    z-index: 1;
}

.legal-kicker {
    margin-bottom: 10px;
    color: var(--cyan);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.legal-main h1 {
    margin: 0 0 12px;
    font-family: 'Orbitron', monospace;
    font-size: clamp(1.55rem, 4vw, 2.4rem);
    letter-spacing: 0;
}

.legal-updated {
    margin: 0 0 32px;
    color: var(--text-dim);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.76rem;
    text-transform: uppercase;
}

.legal-section {
    padding: 22px 0;
    border-top: 1px solid var(--border);
}

.legal-section h2 {
    margin: 0 0 10px;
    color: var(--green);
    font-family: 'Orbitron', monospace;
    font-size: 0.95rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.legal-section p,
.legal-section li {
    color: var(--text-secondary);
    font-size: 1.03rem;
    line-height: 1.55;
}

.legal-section p + p,
.legal-section ul + p,
.legal-section p + ul {
    margin-top: 10px;
}

.legal-section ul {
    margin: 10px 0 0 20px;
}

.legal-section a,
.legal-back {
    color: var(--cyan);
    text-decoration: none;
}

.legal-section a:hover,
.legal-back:hover {
    text-decoration: underline;
}

.legal-note {
    color: var(--text-dim);
    font-size: 0.92rem;
}

/* ============= STATS MODAL ============= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 28px;
}

.stat-item {
    text-align: center;
    padding: 12px 6px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.stat-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 30%;
    right: 30%;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
    opacity: 0.4;
}

.stat-value {
    font-family: 'Orbitron', monospace;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 6px;
}

.stat-label {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Distribution */
.dist-title {
    font-family: 'Orbitron', monospace;
    font-size: 0.65rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 14px;
}

.dist-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.dist-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    font-weight: 600;
    width: 16px;
    text-align: center;
    color: var(--text-dim);
}

.dist-bar {
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 8px;
    border-radius: 3px;
    background: var(--gray);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 28px;
    transition: width 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.dist-bar.highlight {
    background: linear-gradient(90deg, var(--green-dim), var(--green));
    color: var(--bg-primary);
    box-shadow: 0 0 12px var(--green-glow);
}

/* ============= RESULT SECTION ============= */
.result-section {
    text-align: center;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    margin-top: 20px;
}

.result-message {
    font-family: 'Orbitron', monospace;
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.result-message.win {
    background: linear-gradient(90deg, var(--green), var(--cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: resultGlow 2s ease-in-out infinite;
}

@keyframes resultGlow {
    0%, 100% { filter: drop-shadow(0 0 8px var(--green-glow)); }
    50% { filter: drop-shadow(0 0 20px var(--green-glow)); }
}

.result-message.lose {
    color: var(--red);
    text-shadow: 0 0 12px var(--red-glow);
}

.result-word {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 18px;
}

.result-word strong {
    color: var(--cyan);
    text-shadow: 0 0 6px var(--cyan-glow);
}

.btn-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, rgba(0, 255, 178, 0.15) 0%, rgba(0, 200, 150, 0.08) 100%);
    border-color: var(--green-dim);
    color: var(--green);
}

.btn-primary:hover {
    box-shadow: 0 0 20px var(--green-glow);
    border-color: var(--green);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--gray);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.btn-accent {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.2) 0%, rgba(108, 92, 231, 0.08) 100%);
    border-color: var(--accent);
    color: #C4B5FD;
}

.btn-accent:hover {
    box-shadow: 0 0 20px var(--accent-glow);
    transform: translateY(-2px);
}

/* ============= RANKING MODAL ============= */
.ranking-tabs {
    display: flex;
    gap: 3px;
    margin-bottom: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 3px;
    border: 1px solid var(--border);
}

.ranking-tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: none;
    color: var(--text-dim);
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.25s;
}

.ranking-tab.active {
    background: linear-gradient(135deg, var(--accent), #8B5CF6);
    color: #fff;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.ranking-list { list-style: none; }

.ranking-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 4px;
    gap: 12px;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid transparent;
    transition: all 0.2s;
}

.ranking-item:hover { background: rgba(255, 255, 255, 0.03); }

.ranking-item.self {
    border-color: var(--accent);
    background: rgba(108, 92, 231, 0.06);
}

.ranking-pos {
    font-family: 'Orbitron', monospace;
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--text-dim);
    width: 28px;
    text-align: center;
}

.ranking-item:nth-child(1) .ranking-pos { color: #FFD700; text-shadow: 0 0 8px rgba(255, 215, 0, 0.4); }
.ranking-item:nth-child(2) .ranking-pos { color: #C0C0C0; text-shadow: 0 0 6px rgba(192, 192, 192, 0.3); }
.ranking-item:nth-child(3) .ranking-pos { color: #CD7F32; text-shadow: 0 0 6px rgba(205, 127, 50, 0.3); }

.ranking-name {
    flex: 1;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.82rem;
    color: var(--text-primary);
}

.ranking-value {
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--green);
    text-shadow: 0 0 6px var(--green-glow);
}

/* ============= ARCHIVE MODAL ============= */
.archive-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.archive-item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s;
    gap: 12px;
}

.archive-item:hover {
    background: rgba(0, 212, 255, 0.04);
    border-color: rgba(0, 212, 255, 0.15);
}

.archive-item.today {
    border-color: var(--cyan);
    background: rgba(0, 212, 255, 0.05);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.06);
}

.archive-date {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-dim);
    min-width: 72px;
}

.archive-number {
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.8rem;
    min-width: 48px;
}

.archive-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.archive-length {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.archive-status {
    font-size: 1rem;
    min-width: 24px;
    text-align: center;
}

/* ============= CONFETTI CANVAS ============= */
#confettiCanvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 5000;
}

/* ============= PARTICLE BG ============= */
#particleBg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

/* ============= LOADING ============= */
.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 16px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border);
    border-top-color: var(--cyan);
    border-right-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    box-shadow: 0 0 12px var(--cyan-glow);
}

.loader-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-dim);
    letter-spacing: 2px;
    text-transform: uppercase;
    animation: loaderPulse 1.5s ease-in-out infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes loaderPulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

/* ============= MODE BADGE ============= */
.mode-badge {
    display: none;
    position: fixed;
    top: calc(var(--header-height) + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--accent), #8B5CF6);
    color: #fff;
    font-family: 'Orbitron', monospace;
    font-size: 0.55rem;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    z-index: 99;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.mode-badge.visible {
    display: block;
    animation: badgeIn 0.3s ease;
}

@keyframes badgeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-6px) scale(0.9); }
    to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* ============= SCROLLBAR ============= */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-light); }

/* ============= RESPONSIVE ============= */
@media (min-width: 600px) {
    .key { height: 54px; font-size: 1.05rem; }
    .key.wide { max-width: 82px; font-size: 0.65rem; }
    .cell { font-size: 1.4rem; }
}

@media (max-width: 640px) {
    .cookie-consent {
        align-items: stretch;
        flex-direction: column;
        bottom: 10px;
        padding: 14px;
    }

    .cookie-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .cookie-actions .primary {
        grid-column: span 2;
    }

    .cookie-btn {
        width: 100%;
    }

    .legal-main {
        padding-top: calc(var(--header-height) + 28px);
    }
}

@media (min-width: 900px) and (min-height: 760px) {
    .game-container {
        height: calc(100vh - 64px);
    }
}

@media (max-height: 650px) {
    .key { height: 42px; }
    .attempts-bar { padding-bottom: 5px; }
    .grid-wrapper { padding: 4px 8px; }
}
