:root {
    --color-yo: blue;
    --color-rival: red;

    --color-yo-soft: rgba(0, 0, 255, 0.72);
    --color-rival-soft: rgba(255, 0, 0, 0.52);
}

body {
    font-family: system-ui, Arial;
    max-width: 900px;
    margin: 40px auto;
    padding: 0 16px;
}

.row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.card {
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 14px;
    margin-top: 12px;
}

code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 6px;
}

button {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #ddd;
    cursor: pointer;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ok {
    color: #0a7a2f;
    font-weight: 600;
}

.bad {
    color: #b00020;
    font-weight: 600;
}

input {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #ddd;
    min-width: 280px;
}

.small {
    opacity: 0.8;
    font-size: 14px;
}
:root{ --row-gap: 10px; }
.board {
    /*margin-top: 12px;*/
    display: grid;
    gap: var(--row-gap);
    grid-template-columns: 1fr;
}

.guessRow {
    display: flex;
    gap: 2px;
    align-items: center;
}

.hint {
    margin-left: 10px;
    font-weight: 700;
    min-width: 130px;
}

.hint .dist {
    margin-left: 6px;
    opacity: 0.9;
    font-weight: 800;
}

.tile {
    width: 35px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-weight: 800;
    font-size: 16px;
    user-select: none;
    box-sizing: border-box;
    transition: border-color 160ms ease, border-width 160ms ease, box-shadow 220ms ease, transform 220ms ease;

}

/* =========================
   CURSOR (borde + glow suave)
   ========================= */

.tile {
    transition: border-color 160ms ease, border-width 160ms ease, box-shadow 220ms ease;
}

.tile.cursor {
    border-width: 3px;
    border-color: rgba(37, 99, 235, 0.95);
    /* base */
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14), 0 0 10px rgba(37, 99, 235, 0.18);
    /* animación “disolver/aparecer” */
    animation: cursor-glow 1.25s ease-in-out infinite;
}

@keyframes cursor-glow {

    0%,
    100% {
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10), 0 0 8px rgba(37, 99, 235, 0.14);
    }

    50% {
        box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.22), 0 0 16px rgba(37, 99, 235, 0.30);
    }
}


.tile.correct {
    background: #2ea043;
    color: white;
    border-color: #2ea043;
}

.tile.present {
    background: #d29922;
    color: white;
    border-color: #d29922;
}

.tile.absent {
    background: #d0d0d0;
    color: rgb(104, 104, 104);
    border-color: #9fa2a6;
}

.banner {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #ddd;
}

.banner.win {
    border-color: #2ea043;
}

.banner.lose {
    border-color: #6e7781;
}


.guessRow.live {
    margin: 0;
}

.guessRow.live .tile {
    opacity: 0.95;
}

.guessRow.live.opponent .tile {
    opacity: 0.6;
}


.ghost {
    border: 1px solid #eee;
    background: #fafafa;
}

#teclado {
    margin: 0 auto;
    width: 100%;
    max-width: 600px;
    /* igual que AlfabReto/Wordle */
    padding: 0 8px 8px;
    /* aire lateral */
    background: #fff;
    box-sizing: border-box;
}

.fila-teclado {
    display: flex;
    gap: 6px;
    width: 100%;
    margin: 6px auto 0;
    padding: 0 4px;
    /* como Wordle: cada fila tiene padding */
    box-sizing: border-box;
    justify-content: center;
}

.tecla {
    flex: 1 1 0;
    min-width: 0;
    height: 40px;

    padding: 0;
    color: #000;
    font-weight: 700;
    user-select: none;

    font-size: 1rem;
    text-align: center;

    background-color: #d3d6da;
    border: none;
    border-radius: 5px;
    cursor: pointer;

    display: inline-flex;
    align-items: center;
    justify-content: center;
}


.tecla-accion {
    flex: 1.8 1 0;
    /* más ancha que una letra */
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* --- Iconos dentro de teclas de acción (tamaño tipo AlfabReto) --- */
.tecla-accion img {
    width: 18px;
    height: 18px;
    display: block;
    flex: 0 0 auto;
}

.tecla-wide {
    flex: 1.8 1 0;
    /* un poco más que .tecla-accion */
}

/* En pantallas pequeñas: que no se “apilen” */
@media (max-width: 600px) {
    .fila-teclado {
        width: 100% !important;
        justify-content: space-between !important;
    }
}

#barra-progreso {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 20px;
    background: #f0f0f0;
    border-radius: 10px;
    margin: 8px auto 0;
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.1);
    border: 1px solid #ccc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: .9rem;
}

#barra-progreso .letra-a {
    color: #0015ff;
}

#barra-progreso .letra-z {
    color: red;
}

.marca-objetivo {
    position: absolute;
    top: -6px;
    width: 0;
    height: 0;
    animation: 1s infinite parpadeo;
}

@keyframes parpadeo {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .3;
    }
}

.guessRow.you .tile {
    border: 2px solid var(--color-yo);
}

.guessRow.opp .tile {
    border: 2px solid var(--color-rival);
}

/* --- Iconos SVG --- */
.icono-barra {
    position: absolute;
    top: -4px;
    width: 28px;
    height: 28px;
    transform: translateX(-50%);
    z-index: 5;
    pointer-events: none;
    animation: 1s infinite parpadeo;
}

.hint .icono-dir {
    width: 22px;
    height: 22px;
    vertical-align: middle;
    margin-right: 6px;
}

.marca-intento {
    position: absolute;
    top: 0;
    height: 100%;
    width: 2px;
    border-radius: 2px;
    z-index: 6;
    opacity: 0.45;
}

.marca-intento.you {
    background: var(--color-yo-soft);
}

.marca-intento.opp {
    background: var(--color-rival-soft);
}

/* la última marca (la más reciente) se ve intensa */
.marca-intento.last {
    opacity: 1;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.25);
    width: 2px;
    /* 👈 un pelín más gruesa la última */
}

.hint.dir-right .dist,
.hint.dir-right .icono-dir {
    color: #dc2626;
    /* rojo */
}

.hint.dir-left .dist,
.hint.dir-left .icono-dir {
    color: #2563eb;
    /* azul */
}

/* --- DEBUG/FIX: forzar visibles los controles de matchmaking --- */
#mmPanel {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#mmPanel .row {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    align-items: flex-end !important;
}

#mmPanel label {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    min-width: 220px !important;
}

#mmPanel input,
#mmPanel select {
    display: block !important;
    width: 100% !important;
    min-width: 220px !important;
    padding: 10px 12px !important;
    border: 1px solid #999 !important;
    border-radius: 10px !important;
    background: #fff !important;
    color: #111 !important;
}

/* =========================
   TURNO / TIEMPO: HUD grande
   ========================= */
.turnHud {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 12px;
    padding: 14px 14px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    margin: 10px 0 14px;
}

.turnHud-title {
    font-size: 12px;
    opacity: 0.75;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.turnHud-state {
    font-size: 22px;
    font-weight: 800;
    line-height: 1.05;
}

.turnHud-time {
    font-size: 28px;
    font-weight: 900;
    line-height: 1.05;
}

.turnHud-right {
    text-align: right;
}

/* =========================
   MODO VISUAL SEGÚN TURNO
   ========================= */

/* Por defecto */
body {
    transition: background 200ms ease, filter 200ms ease;
}

body.your-turn {
    /* “Me toca”: más vivo */
    background: radial-gradient(1200px 600px at 50% 0%, rgba(0, 255, 128, 0.12), rgba(0, 0, 0, 0) 60%),
        radial-gradient(900px 500px at 20% 20%, rgba(120, 80, 255, 0.10), rgba(0, 0, 0, 0) 60%);
}

body.opp-turn {
    /* “No me toca”: más apagado */
    background: radial-gradient(1200px 600px at 50% 0%, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0) 60%);
    filter: saturate(0.85);
}

/* Refuerza la card principal */
body.your-turn .card {
    box-shadow: 0 0 0 2px rgba(0, 255, 128, 0.25), 0 10px 30px rgba(0, 0, 0, 0.35);
}

body.opp-turn .card {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.06), 0 10px 30px rgba(0, 0, 0, 0.35);
    opacity: 0.96;
}

/* Teclado y acciones cuando NO es tu turno */
body.opp-turn #teclado {
    opacity: 0.65;
    transform: scale(0.995);
}

/* Barra de turno grande: texto */
body.your-turn #turnHudState::after {
    content: " (TU TURNO)";
    font-weight: 900;
    opacity: 0.9;
}

body.opp-turn #turnHudState::after {
    content: " (RIVAL)";
    font-weight: 900;
    opacity: 0.75;
}

/* Tiempo en rojo cuando queda poco */
.turnHud-time.low {
    opacity: 1;
}

.turnHud-time.critical {
    opacity: 1;
}

/* ===== Turno MUY visible ===== */
code#turnLabel,
code#timeLeftLabel {
    font-size: 18px;
    font-weight: 900;
    padding: 8px 12px;
    border-radius: 999px;
    display: inline-block;
    letter-spacing: 0.3px;
}

/* Fondo/ambiente según turno */
body.your-turn {
    background: #f1fff5;
}

body.opp-turn {
    background: #f7f7f7;
}

body.your-turn .card:first-of-type {
    border-color: #2ea043;
    box-shadow: 0 0 0 3px rgba(46, 160, 67, 0.15);
}

body.opp-turn .card:first-of-type {
    border-color: #6e7781;
    box-shadow: 0 0 0 3px rgba(110, 119, 129, 0.12);
}

/* Colores “badge” */
body.your-turn code#turnLabel {
    background: #2ea043;
    color: #fff;
}

body.opp-turn code#turnLabel {
    background: #6e7781;
    color: #fff;
}

body.your-turn code#timeLeftLabel {
    background: #dcfce7;
    color: #065f46;
    border: 1px solid #86efac;
}

body.opp-turn code#timeLeftLabel {
    background: #e5e7eb;
    color: #111827;
    border: 1px solid #cbd5e1;
}

/* --- Timeout hint --- */
.hint.timeout {
    padding: 0;
    border: none;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}


/* =========================
   LAYOUT APP: header fijo, main scroll, footer fijo
   ========================= */

html,
body {
    height: 100%;
}

body {
    margin: 0;
    padding: 0;
    max-width: none;
    /* ✅ antes limitabas a 900px */
    background: #fff;
}

.appShell {
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* --- Header fijo --- */
.appTop {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 10px 8px;
}

/* Fila superior: nombre/nivel/dificultad/botón */
.topRow {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.topBlock {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.topLabel {
    font-size: 12px;
    opacity: 0.75;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.topInline {
    min-width: 90px;
}

.topValue {
    font-weight: 900;
    font-size: 18px;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fafafa;
    line-height: 1;
}

.topActions {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: flex-end;
}

/* Línea de partida */
.matchRow {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.matchLeft,
.matchRight {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.pill {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #fafafa;
    font-weight: 700;
    font-size: 13px;
}

/* --- Status bar (ancho completo) con progreso de fondo --- */
.statusBar {
    margin-top: 10px;
    border-radius: 12px;
    border: 1px solid #ddd;
    overflow: hidden;
    position: relative;
    height: 44px;
    display: flex;
    align-items: center;
    padding: 0 12px;

    /* Progreso: usamos una variable CSS --p en 0..100 */
    --pc: rgba(37, 99, 235, 0.18);
    /* azul claro por defecto */

    background:
        linear-gradient(var(--dir, to right), var(--pc) var(--p), rgba(0, 0, 0, 0) var(--p)),
        #fff;
}

.statusText {
    font-weight: 900;
    letter-spacing: 0.04em;
}

/* Colores suaves según estado */
.statusBar[data-state="queue"] {
    border-color: #cbd5e1;
}

.statusBar[data-state="your"] {
    border-color: #86efac;
}

.statusBar[data-state="opp"] {
    border-color: #e5e7eb;
}

.statusBar[data-state="done"] {
    border-color: #cbd5e1;
}

/* --- Main scroll --- */
.appMain {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px 10px 10px;
}

/* --- Footer fijo con teclado --- */
.appBottom {
    position: sticky;
    bottom: 0;
    z-index: 40;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    padding: 8px 0 10px;
}

/* El teclado ya tenía width/min(600px...). Lo centramos “bonito”. */
#teclado {
    margin: 0 auto;
}

/* Ocultos (pero presentes para JS) */
.hiddenRow {
    display: none;
}

/* =========================
   BOTÓN ÚNICO (Play / Stop / Revancha)
   ========================= */

.appTop {
    position: sticky;
    /* ya lo tienes, pero lo reafirmamos */
}

/* Centro: solo 3 filas reales (barra, nombres, elo) */
.duelCenter {
    position: relative;
    display: grid;
    grid-template-rows: auto auto auto;
    gap: 6px;
}

/* El wrapper del botón NO ocupa espacio */
.duelBtnWrap {
    position: absolute;
    left: 50%;
    top: 45px;
    /* ajusta: cae “debajo” de la barra */
    transform: translate(-50%, -50%);
    z-index: 10;
    pointer-events: none;
    /* para que no bloquee clicks alrededor */
}

/* Pero el botón sí debe poder clickarse */
.duelBtnWrap .gameBtn {
    pointer-events: auto;
}

/* Botón centrado, sin absolute global */
.gameBtn {
    position: static;
    margin: 0;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 2px solid #e5e7eb;
    background: #fff;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.10);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
}


.gameBtn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.gameBtnIcon {
    width: 22px;
    height: 22px;
    display: block;
    position: relative;
}

/* PLAY (triángulo verde) */
.gameBtn.is-idle .gameBtnIcon,
.gameBtn.is-finished .gameBtnIcon,
.gameBtn.is-rematch .gameBtnIcon {
    width: 0;
    height: 0;
    border-left: 18px solid #22c55e;
    border-top: 11px solid transparent;
    border-bottom: 11px solid transparent;
    transform: translateX(2px);
}

/* STOP (cuadrado rojo) */
.gameBtn.is-playing .gameBtnIcon,
.gameBtn.is-searching .gameBtnIcon {
    width: 18px;
    height: 18px;
    background: #ef4444;
    border-radius: 4px;
}

/* opcional: borde algo más “activo” en búsqueda */
.gameBtn.is-searching {
    border-color: #cbd5e1;
}

/* Cuando hay revancha disponible: pequeña “R” */
.gameBtn.has-rematch::after {
    content: "R";
    position: absolute;
    right: -4px;
    top: -4px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #111827;
    color: #fff;
    font-weight: 900;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.boardFocus {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* =========================
   HUD DUELO SUPERIOR
   ========================= */

.duelHud {
    display: grid;
    grid-template-columns: 56px 1fr 56px;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

/* --- Avatares --- */
.duelAvatar {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    overflow: visible;
    border: 2px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.duelAvatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.duelAvatar.you {
    border-color: #2563eb;
}

.duelAvatar.opp {
    border-color: #dc2626;
}

/* --- Zona central --- */
.duelCenter {
    display: grid;
    grid-template-rows: auto auto auto;
    gap: 6px;
}

/* ===== Barra de puntuación ===== */
.scoreBar {
    position: relative;
    height: 22px;
    border-radius: 999px;
    overflow: hidden;
    background: #e5e7eb;
    display: flex;
    font-weight: 900;
    font-size: 13px;
}

.scoreBlue,
.scoreRed {
    display: flex;
    align-items: center;
    color: white;
    white-space: nowrap;
}

.scoreBlue {
    background: #2563eb;
    justify-content: flex-start;
    padding-left: 10px;
    width: 50%;
    transition: width 300ms ease;
}

.scoreRed {
    background: #dc2626;
    justify-content: flex-end;
    padding-right: 10px;
    width: 50%;
    transition: width 300ms ease;
}

/* ===== Nombres ===== */
.duelNames {
    display: flex;
    justify-content: space-between;
    font-weight: 800;
    font-size: 14px;
}

.duelNames span:first-child {
    color: #2563eb;
}

.duelNames span:last-child {
    color: #dc2626;
}

/* ===== ELO ===== */
.duelElo {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 700;
    opacity: 0.85;
}

.duelElo .you {
    color: #2563eb;
}

.duelElo .opp {
    color: #dc2626;
}

.duelNameInput {
    width: 140px;
    min-width: 0;
    padding: 0;
    border: none;
    background: transparent;
    font-weight: 800;
    font-size: 14px;
    outline: none;
}

.duelNameInput.you {
    color: #2563eb;
}

.duelNameInput::placeholder {
    opacity: 0.55;
}

/* Contenedor del slot superior (mismo tamaño que scoreBar) */
.duelTopSlot {
    position: relative;
    height: 22px;
    /* mismo alto que .scoreBar */
}

/* Selector de dificultad tipo “píldoras” */
.difficultyPills {
    height: 22px;
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.pillDiff {
    height: 22px;
    padding: 0 10px;
    border-radius: 999px;
    border: 2px solid #e5e7eb;
    background: #fff;
    font-weight: 900;
    font-size: 12px;
    cursor: pointer;
    line-height: 1;
}

/* Colores por dificultad (activo) */
.pillDiff.active[data-diff="easy"] {
    border-color: #16a34a;
    background: #16a34a;
    color: #fff;
}

.pillDiff.active[data-diff="medium"] {
    border-color: #f59e0b;
    background: #f59e0b;
    color: #fff;
}

.pillDiff.active[data-diff="hard"] {
    border-color: #dc2626;
    background: #dc2626;
    color: #fff;
}

/* Cuando está bloqueado (buscando / en partida) */
.difficultyPills.is-locked .pillDiff {
    opacity: 0.55;
    cursor: not-allowed;
}

/* La scoreBar ya la tienes: solo asegura su altura */
.scoreBar {
    height: 22px;
}

/* ===== Timeouts sobre avatar ===== */
.duelAvatar {
    position: relative;
    /* necesario para superponer */
}

.timeoutBadges {
    position: absolute;
    left: 50%;
    bottom: 6px;
    /* dentro un poco */
    transform: translateX(-50%) translateY(60%);
    /* <-- sobresale hacia abajo */
    display: flex;
    gap: 6px;
    z-index: 20;
    /* por encima de todo */
    pointer-events: none;
    filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.28));
    /* plano superior */
}

.timeoutBadge {
    width: 16px;
    height: 22px;
    border-radius: 4px;
    background: #facc15;
    border: 1px solid rgba(0, 0, 0, 0.22);
    box-shadow:
        0 2px 0 rgba(0, 0, 0, 0.22),
        0 10px 18px rgba(0, 0, 0, 0.18);
}

.timeoutBadge.third {
    background: #ef4444;
    /* rojo */
    border-color: rgba(0, 0, 0, 0.28);
}

.hint.timeout img.timeoutCard {
    height: 40px;
    /* ← ahora sí */
    width: auto;
    display: block;
}

/* Timeout pegado al tablero (como las flechas) */
.hint.timeout {
    margin-left: 6px;
    /* más cerca */
    min-width: 0;
    /* que no reserve espacio */
    padding: 0;
    border: none;
    background: transparent;
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-4px);
    }

    40% {
        transform: translateX(4px);
    }

    60% {
        transform: translateX(-3px);
    }

    80% {
        transform: translateX(3px);
    }

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

.guessRow.shake {
    animation: shake 0.35s ease;
}



/* Icono RESET usando SVG */
.gameBtn.is-reset .gameBtnIcon {
    width: 32px;
    height: 32px;
    background: url("./icons/reset.svg") no-repeat center;
    background-size: contain;
}

.statusBar[data-state="opp"] {
    justify-content: flex-end;
}

/* Estado base: centrado */
.statusBar {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* TU TURNO → izquierda */
.statusBar[data-state="your"] {
    justify-content: flex-start;
}

/* TURNO RIVAL → derecha */
.statusBar[data-state="opp"] {
    justify-content: flex-end;
}

/* Para que el hint NO reserve 130px en filas normales */
.hint {
    min-width: 0;
}

/* Y que el hint se comporte como “bloque pegado” */
.guessRow .hint {
    flex: 0 0 auto;
}

/* Cuando es timeout/celebración: aún más pegado y sin margen */
.hint.timeout {
    margin-left: 6px;
    min-width: 0;
}


/* Hint “solo icono” (trofeo / tarjetas) */
.hint.iconHint {
    min-width: 40px;
    /* alto de tile */
    width: 40px;
    margin-left: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Evita comportamientos raros con imágenes inline */
.hint.iconHint img {
    display: block;
    height: 40px;
    width: auto;
}

/* Asegura que la fila NO haga wrap */
.guessRow {
    flex-wrap: nowrap;
}

/* La fila de intento SIEMPRE en una sola línea: tiles + hint a la derecha */
.guessRow {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    width: 100%;
    box-sizing: border-box;
}

/* El bloque de tiles no debe empujar al hint debajo */
.guessRow .tile {
    flex: 0 0 auto;
}

/* El hint siempre a la derecha y sin saltar de línea */
.guessRow .hint {
    flex: 0 0 auto;
    min-width: 0;
    margin-left: 6px;
    white-space: nowrap;
}

/* Hint solo icono (trofeo / tarjetas) */
.hint.iconHint {
    width: 40px;
    min-width: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Imagen del trofeo: 40px de alto */
.hint.iconHint img {
    height: 40px;
    width: auto;
    display: block;
}

/* =========================
   Responsive: ajustar tiles + gap cuando no cabe (6/7 letras)
   ========================= */

/* Base: usa variables para poder reducir según longitud */
.guessRow {
    --tile-w: 35px;
    --tile-h: 40px;
    --gap-x: 8px;
    /* ahora mismo acabas con gap: 8px */
    gap: var(--gap-x);
}

.tile {
    width: var(--tile-w);
    height: var(--tile-h);
}

/* En 6 letras: un pelín más compacto */
body.len6 .guessRow {
    --tile-w: 32px;
    --tile-h: 38px;
    --gap-x: 6px;
}

body.len6 .hint .icono-dir {
    width: 20px;
    height: 20px;
}

/* En 7 letras: más compacto */
body.len7 .guessRow {
    --tile-w: 30px;
    --tile-h: 36px;
    --gap-x: 5px;
}

body.len7 .tile {
    font-size: 15px;
}

body.len7 .hint {
    font-size: 14px;
}

body.len7 .hint .icono-dir {
    width: 18px;
    height: 18px;
    margin-right: 4px;
}

body.len7 .hint .dist {
    margin-left: 4px;
}

/* Pantallas estrechas: apretamos más (solo cuando hace falta) */
@media (max-width: 380px) {
    body.len6 .guessRow {
        --tile-w: 30px;
        --tile-h: 36px;
        --gap-x: 4px;
    }

    body.len7 .guessRow {
        --tile-w: 26px;
        --tile-h: 32px;
        --gap-x: 2px;
    }

    body.len7 .tile {
        font-size: 14px;
        border-radius: 7px;
    }

    body.len7 .hint {
        font-size: 13px;
    }

    body.len7 .hint .icono-dir {
        width: 16px;
        height: 16px;
    }
}

/* Extra: que la distancia ocupe menos y no “bote” (opcional pero ayuda) */
.hint .dist {
    font-variant-numeric: tabular-nums;
}

/* =========================
   Auto-compact por overflow (JS añade .compact / .compact2)
   ========================= */

.guessRow.compact {
    --tile-w: 26px;
    --tile-h: 32px;
    --gap-x: 2px;
}

.guessRow.compact2 {
    --tile-w: 23px;
    --tile-h: 30px;
    --gap-x: 1px;
}

/* ===== Reservar hueco para el teclado sticky (lo rellena JS) ===== */
:root {
    --kb-pad: 0px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

.appMain {
    padding-bottom: calc(var(--kb-pad, 0px) + var(--safe-bottom) + 10px);
}

/* ===== El tablero y la fila live centrados horizontalmente ===== */
#board,
#liveRow {
    width: 100%;
    max-width: 330px;
    /* ajusta si quieres, pero funciona bien con 7+hint */
    margin-left: auto;
    margin-right: auto;
}

/* ===== Fuerza que las filas NO se queden en ancho “contenido” ===== */
#board .guessRow,
#liveRow .guessRow {
    width: 100% !important;
    justify-content: center !important;
    /* centrado real */
    justify-self: stretch !important;
}

/* Hint: sin reservas antiguas */
#board .hint,
#liveRow .hint {
    min-width: 0 !important;
}

/* ===== FIX: NO centrar cada fila, solo el tablero ===== */
#board .guessRow,
#liveRow .guessRow {
    justify-content: flex-start !important;
}

/* ===== La distancia SIEMPRE reserva hueco de 6 dígitos ===== */
.hint .dist {
    display: inline-block;
    width: 6ch;
    /* reserva exactamente 6 caracteres */
    text-align: right;
    /* números pegados a la derecha */
    font-variant-numeric: tabular-nums;
}

/* =========================
   TABLERO REAL = board + liveRow
   ========================= */

.boardWrap {
    width: 100%;
    max-width: 330px;
    /* el mismo que ya usabas para #board/#liveRow */
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    /* separación constante entre filas jugadas y liveRow */
}

/* liveRow: margen “de seguridad” para scroll (evita quedar tapada por teclado) */
#liveRow {
    scroll-margin-top: 0px;
    scroll-margin-bottom: 0px;
}

/* OJO: ahora el ancho lo controla .boardWrap */
#board,
#liveRow {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

#teclado.is-disabled {
    opacity: 0.55;
    filter: grayscale(0.2);
    pointer-events: none;
    /* evita clicks aunque algún botón se colara */
}

#teclado.is-disabled button {
    cursor: not-allowed;
}
.hintPlaceholder{
    width: 40px;       /* igual que .hint.iconHint */
    min-width: 40px;
    margin-left: 10px; /* igual que iconHint */
    visibility: hidden; /* ocupa espacio pero no se ve */
  }

  #liveRow{ margin-top: 0; } /* ✅ primera jugada: misma posición que 1ª fila */

.boardWrap:has(#board .guessRow) #liveRow{
  margin-top: var(--row-gap); /* ✅ cuando ya hay filas, mismo hueco que entre filas */
}