@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@700;900&family=Exo+2:wght@400;600;700;800&display=swap');

:root {
    --bg: #080b14;
    --panel: rgba(255, 255, 255, 0.06);
    --border: rgba(0, 200, 255, 0.25);
    --accent: #00c8ff;
    --gold: #ffd700;
    --red: #ff4060;
    --green: #22e890;
    --purple: #bf5fff;
    --font-ui: 'Orbitron', sans-serif;
    --font-body: 'Exo 2', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    font-family: var(--font-body);
    touch-action: none;
}

/* ── LAYOUT ── */
#wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* FEATURE 4: header full width */
#ui {
    display: flex;
    position: relative;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 18px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 0;
    backdrop-filter: blur(12px);
    gap: 5px;
    flex-wrap: nowrap;
}

.ui-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.ui-label {
    font-family: var(--font-ui);
    font-size: 8px;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
}

#score-val {
    font-family: var(--font-ui);
    font-size: 10px;
    color: var(--gold);
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
}

#combo-val {
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(0, 200, 255, 0.7);
    min-width: 44px;
    text-align: center;
}

#target-word {
    font-family: var(--font-ui);
    font-size: clamp(16px, 3vw, 26px);
    color: #fff;
    text-shadow: 0 0 20px rgba(0, 200, 255, 0.8);
    animation: tpulse 2.4s ease-in-out infinite;
    letter-spacing: 2px;
}

@keyframes tpulse {

    0%,
    100% {
        text-shadow: 0 0 14px rgba(0, 200, 255, 0.8)
    }

    50% {
        text-shadow: 0 0 28px rgba(0, 200, 255, 1), 0 0 50px rgba(0, 200, 255, 0.4)
    }
}

#hearts {
    display: flex;
    gap: 5px;
    align-items: center;
}

.heart-icon {
    width: 24px;
    height: 24px;
    filter: drop-shadow(0 0 5px rgba(255, 64, 96, 0.7));
}

/* perk bar */
#perk-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
    padding: 6px 18px;
    background: rgba(0, 0, 0, 0.35);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

.perk-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: default;
}

.perk-slot .perk-emoji {
    font-size: 30px;
    line-height: 1;
    filter: grayscale(1) opacity(0.35);
    transition: filter .25s;
}

.perk-slot.owned .perk-emoji {
    filter: none;
}

.perk-slot .perk-key {
    font-size: 9px;
    font-family: var(--font-ui);
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 1px;
}

.perk-slot.owned .perk-key {
    color: var(--accent);
}

#perk-countdown {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.countdown-bar-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-family: var(--font-ui);
    color: rgba(255, 255, 255, 0.5);
}

.countdown-bar-bg {
    flex: 1;
    height: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.countdown-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .1s linear;
}

.countdown-bar-fill.freeze {
    background: #62cfff;
}

.countdown-bar-fill.hint {
    background: #ffd700;
}

/* canvas */
#gameCanvas {
    display: block;
    width: 100%;
    border: 1px solid var(--border);
    border-top: none;
    box-shadow: 0 0 40px rgba(0, 200, 255, 0.15), 0 8px 32px rgba(0, 0, 0, 0.6);
    image-rendering: pixelated;
}

/* overlays */
.overlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(8, 11, 20, 0.92);
    backdrop-filter: blur(6px);
    z-index: 100;
    gap: 28px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .45s ease;
}

.overlay.show {
    opacity: 1;
    pointer-events: all;
}

.ov-title {
    font-family: var(--font-ui);
    font-size: clamp(28px, 6vw, 52px);
    letter-spacing: 4px;
}

.ov-title.red {
    color: var(--red);
    text-shadow: 0 0 30px rgba(255, 64, 96, .7);
}

.ov-title.cyan {
    color: var(--accent);
    text-shadow: 0 0 30px rgba(0, 200, 255, .7);
}

.ov-sub {
    font-family: var(--font-ui);
    font-size: clamp(13px, 2.5vw, 18px);
    color: rgba(255, 255, 255, 0.55);
    text-align: center;
    padding: 0 20px;
    line-height: 1.7;
}

.ov-sub span {
    color: var(--gold);
}

.btn {
    padding: 14px 44px;
    font-family: var(--font-ui);
    font-size: 14px;
    letter-spacing: 2px;
    color: #000;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.5);
    transition: transform .2s, box-shadow .2s;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 34px rgba(0, 200, 255, 0.8);
}

.btn.danger {
    background: var(--red);
    box-shadow: 0 0 20px rgba(255, 64, 96, 0.4);
}

#mobile-controls {
    display: none;
}

/* Settings leaderboard table */
#leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-body);
    font-size: 13px;
    color: #fff;
}

#leaderboard-table th {
    padding: 6px 10px;
    font-family: var(--font-ui);
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--accent);
}

#leaderboard-table td {
    padding: 7px 10px;
    border-top: 1px solid rgba(0, 200, 255, 0.1);
}

/* icon buttons in header */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    opacity: 0.75;
    transition: opacity .2s;
}

.icon-btn:hover {
    opacity: 1;
}


/**NEW/* 

#fullscreenBtn {
  /* posición dentro del #ui, esquina derecha centrado verticalmente */
position: absolute;
top: 50%;
right: 8px;
transform: translateY(-50%);
z-index: 100;

display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
padding: 0;
border: 1.5px solid rgba(0, 200, 255, 0.3);
border-radius: 7px;
background: rgba(0, 200, 255, 0.07);
color: var(--accent);
cursor: pointer;
transition: background 0.15s,
border-color 0.15s,
box-shadow 0.15s;
-webkit-tap-highlight-color: transparent;
touch-action: manipulation;
}

#fullscreenBtn:hover,
#fullscreenBtn:focus-visible {
    background: rgba(0, 200, 255, 0.2);
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(0, 200, 255, 0.35);
    outline: none;
}

#fullscreenBtn:active {
    transform: translateY(-50%) scale(0.9);
}


/* ──────────────────────────────────────────────────────────────
   SCREENSHOT BUTTON (en #gameOverScreen)
──────────────────────────────────────────────────────────────── */
.screenshot-btn {
    display: none;
    /* default oculto; JS lo muestra con flex */
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 12px auto 0;
    padding: 9px 20px;
    border: 1.5px solid var(--gold);
    border-radius: 10px;
    background: rgba(255, 215, 0, 0.08);
    color: var(--gold);
    font-family: var(--font-ui);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.screenshot-btn:hover,
.screenshot-btn:focus-visible {
    background: rgba(255, 215, 0, 0.2);
    box-shadow: 0 0 14px rgba(255, 215, 0, 0.4);
    outline: none;
}


/* ──────────────────────────────────────────────────────────────
   SCREENSHOT MODAL — overlay de body
   
   IMPORTANTE: ya NO usa display:flex !important
   El JS controla visibilidad con clase .ss-open
──────────────────────────────────────────────────────────────── */
.ss-modal-overlay {
    /* oculto por defecto — NO display:flex !important */
    display: none;

    position: fixed;
    inset: 0;
    z-index: 3000;
    /* encima de todo, incluyendo overlays del juego */
    background: rgba(5, 8, 16, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    padding: 16px;
}

/* Clase que JS agrega para abrir */
.ss-modal-overlay.ss-open {
    display: flex;
    animation: ssOverlayIn 0.2s ease;
}

@keyframes ssOverlayIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Caja interior */
.ss-modal-box {
    position: relative;
    background: linear-gradient(160deg, #0e1628 0%, #080f1e 100%);
    border: 1px solid rgba(0, 200, 255, 0.2);
    border-radius: 20px;
    padding: 32px 28px 26px;
    width: min(440px, 100%);
    max-height: 90dvh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow:
        0 0 0 1px rgba(0, 200, 255, 0.06),
        0 24px 64px rgba(0, 0, 0, 0.7),
        0 0 60px rgba(0, 200, 255, 0.06);
    animation: ssBoxIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes ssBoxIn {
    from {
        opacity: 0;
        transform: scale(0.94) translateY(12px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Botón X cerrar */
.ss-modal-close-x {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    background: transparent;
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.14s, color 0.14s;
    -webkit-tap-highlight-color: transparent;
}

.ss-modal-close-x:hover {
    background: rgba(255, 255, 255, 0.09);
    color: #fff;
}

/* Header del modal */
.ss-modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}

.ss-trophy {
    font-size: 2.4rem;
    line-height: 1;
    filter: drop-shadow(0 0 14px rgba(255, 215, 0, 0.5));
}

.ss-modal-title {
    font-family: var(--font-ui);
    font-size: 1rem;
    font-weight: 900;
    color: var(--gold);
    margin: 0;
    letter-spacing: 0.05em;
    text-shadow: 0 0 18px rgba(255, 215, 0, 0.4);
}

.ss-modal-sub {
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
    margin: 0;
}

/* Input nombre */
.ss-name-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ss-label {
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.ss-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(0, 200, 255, 0.25);
    border-radius: 9px;
    padding: 11px 14px;
    color: #fff;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
    box-sizing: border-box;
}

.ss-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 200, 255, 0.13);
}

.ss-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

/* Preview card */
.ss-preview-wrap {
    display: none;
    /* JS lo muestra con flex cuando hay imagen */
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.ss-preview {
    width: 100%;
    max-width: 480px;
    aspect-ratio: 16/9;
    border-radius: 12px;
    border: 1px solid rgba(0, 200, 255, 0.2);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0,200,255,0.1);
    display: block;
    object-fit: contain;
}

.ss-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 22px;
    border-radius: 8px;
    background: rgba(34, 232, 144, 0.1);
    border: 1.5px solid var(--green);
    color: var(--green);
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.ss-download-btn:hover {
    background: rgba(34, 232, 144, 0.22);
    box-shadow: 0 0 14px rgba(34, 232, 144, 0.35);
}

/* Botón Generar */
.ss-btn-row {
    display: flex;
    gap: 10px;
}

.ss-btn-generate {
    flex: 1;
    padding: 12px;
    border-radius: 9px;
    border: 1.5px solid var(--accent);
    background: rgba(0, 200, 255, 0.1);
    color: var(--accent);
    font-family: var(--font-ui);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.ss-btn-generate:hover {
    background: rgba(0, 200, 255, 0.22);
    box-shadow: 0 0 16px rgba(0, 200, 255, 0.4);
}

/* Texto de ayuda / estado */
.ss-hint-text {
    font-family: var(--font-body);
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.25);
    text-align: center;
    margin: 0;
}


/* ──────────────────────────────────────────────────────────────
   PERK BAR — Bloqueo de barra de búsqueda en móvil
──────────────────────────────────────────────────────────────── */
#perk-bar,
#perk-bar button,
#perk-bar .perk-slot,
#ps-freeze,
#ps-hint,
#ps-eggShield,
#ps-heart {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}