/* ============================================================
   VARIABLES BASE Y TEMAS
   ============================================================ */
:root {
    --bg: #EAF2EC;
    --surface: #FFFFFF;
    --ink: #0E2818;
    --muted: #5C7866;
    --line: #D5E3D8;
    --accent: #16A34A;
    --accent-soft: #C9EED4;
    --on-accent: #FFFFFF;
    --error: #E5484D;
    --error-soft: #FBD5D6;
    --yellow: #CA8A04;
    --yellow-soft: #FEF08A;
    --red: #DC2626;
    --red-soft: #FECACA;
    --box-bg: #FFFFFF;
    --key-border: #CBD5E1;
    --key-shadow: #CBD5E1;

    --mode-green: #15803D;
    --mode-green-soft: #C9EED4;
    --gold: #8A5F00;
    --gold-soft: #FBE7A1;
    --gold-line: #D4AF37;

    color-scheme: light;

    --font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", ui-sans-serif, system-ui, sans-serif;
    --font-body: "Barlow", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    --app-w: 100%;
    --header-h: 56px;
    --gap: 14px;
    --pad-x: 12px;

    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;

    --shadow-sm: 0 1px 2px rgba(8, 30, 18, 0.04);
    --shadow-md: 0 1px 3px rgba(8, 30, 18, 0.05), 0 8px 24px -10px rgba(8, 30, 18, 0.10);

    --clue-size: 20px;
    --box-max: 42px;
    --h1-size: 18px;

    /* Cancha vertical (móvil) */
    --pitch-p: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 900 1600' preserveAspectRatio='none' fill='none' stroke='%230E5A2B' stroke-width='3.5' stroke-linejoin='round'%3E%3Cstyle%3E*%7Bvector-effect:non-scaling-stroke%7D%3C/style%3E%3Cg opacity='0.18'%3E%3Crect x='12' y='12' width='876' height='1576'/%3E%3Cpath d='M12 800H888'/%3E%3Ccircle cx='450' cy='800' r='110'/%3E%3Ccircle cx='450' cy='800' r='7' fill='%230E5A2B' stroke='none'/%3E%3Crect x='180' y='12' width='540' height='170'/%3E%3Crect x='180' y='1418' width='540' height='170'/%3E%3Crect x='300' y='12' width='300' height='70'/%3E%3Crect x='300' y='1518' width='300' height='70'/%3E%3Ccircle cx='450' cy='132' r='7' fill='%230E5A2B' stroke='none'/%3E%3Ccircle cx='450' cy='1468' r='7' fill='%230E5A2B' stroke='none'/%3E%3Cpath d='M352 182A110 110 0 0 0 548 182M352 1418A110 110 0 0 1 548 1418'/%3E%3Cpath d='M12 36A24 24 0 0 0 36 12M864 12A24 24 0 0 0 888 36M888 1564A24 24 0 0 0 864 1588M36 1588A24 24 0 0 0 12 1564'/%3E%3C/g%3E%3C/svg%3E");
    /* Cancha horizontal (escritorio) */
    --pitch-l: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 900' preserveAspectRatio='none' fill='none' stroke='%230E5A2B' stroke-width='3.5' stroke-linejoin='round'%3E%3Cstyle%3E*%7Bvector-effect:non-scaling-stroke%7D%3C/style%3E%3Cg opacity='0.18'%3E%3Crect x='12' y='12' width='1576' height='876'/%3E%3Cpath d='M800 12V888'/%3E%3Ccircle cx='800' cy='450' r='110'/%3E%3Ccircle cx='800' cy='450' r='7' fill='%230E5A2B' stroke='none'/%3E%3Crect x='12' y='180' width='170' height='540'/%3E%3Crect x='1418' y='180' width='170' height='540'/%3E%3Crect x='12' y='300' width='70' height='300'/%3E%3Crect x='1518' y='300' width='70' height='300'/%3E%3Ccircle cx='132' cy='450' r='7' fill='%230E5A2B' stroke='none'/%3E%3Ccircle cx='1468' cy='450' r='7' fill='%230E5A2B' stroke='none'/%3E%3Cpath d='M182 352A110 110 0 0 1 182 548M1418 352A110 110 0 0 0 1418 548'/%3E%3Cpath d='M12 36A24 24 0 0 0 36 12M1564 12A24 24 0 0 0 1588 36M1588 864A24 24 0 0 0 1564 888M36 888A24 24 0 0 0 12 864'/%3E%3C/g%3E%3C/svg%3E");
}

:root[data-theme="dark"] {
    --bg: #05100A;
    --surface: #0D1F14;
    --ink: #E6F4EA;
    --muted: #78A185;
    --line: #1E3A29;
    --accent: #2EE57D;
    --accent-soft: #14432B;
    --on-accent: #04170C;
    --error: #FF6B6B;
    --error-soft: #4A1F22;
    --yellow: #FACC15;
    --yellow-soft: #422006;
    --red: #F87171;
    --red-soft: #450A0A;
    --box-bg: #12241A;
    --key-border: #234230;
    --key-shadow: #1E3A29;

    --mode-green: #3DDC84;
    --mode-green-soft: #14432B;
    --gold: #F5C542;
    --gold-soft: #3A2E0A;
    --gold-line: #D4AF37;

    color-scheme: dark;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.30), 0 10px 30px -12px rgba(0, 0, 0, 0.50);

    --pitch-p: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 900 1600' preserveAspectRatio='none' fill='none' stroke='%232EE57D' stroke-width='3.5' stroke-linejoin='round'%3E%3Cstyle%3E*%7Bvector-effect:non-scaling-stroke%7D%3C/style%3E%3Cg opacity='0.15'%3E%3Crect x='12' y='12' width='876' height='1576'/%3E%3Cpath d='M12 800H888'/%3E%3Ccircle cx='450' cy='800' r='110'/%3E%3Ccircle cx='450' cy='800' r='7' fill='%232EE57D' stroke='none'/%3E%3Crect x='180' y='12' width='540' height='170'/%3E%3Crect x='180' y='1418' width='540' height='170'/%3E%3Crect x='300' y='12' width='300' height='70'/%3E%3Crect x='300' y='1518' width='300' height='70'/%3E%3Ccircle cx='450' cy='132' r='7' fill='%232EE57D' stroke='none'/%3E%3Ccircle cx='450' cy='1468' r='7' fill='%232EE57D' stroke='none'/%3E%3Cpath d='M352 182A110 110 0 0 0 548 182M352 1418A110 110 0 0 1 548 1418'/%3E%3Cpath d='M12 36A24 24 0 0 0 36 12M864 12A24 24 0 0 0 888 36M888 1564A24 24 0 0 0 864 1588M36 1588A24 24 0 0 0 12 1564'/%3E%3C/g%3E%3C/svg%3E");
    --pitch-l: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 900' preserveAspectRatio='none' fill='none' stroke='%232EE57D' stroke-width='3.5' stroke-linejoin='round'%3E%3Cstyle%3E*%7Bvector-effect:non-scaling-stroke%7D%3C/style%3E%3Cg opacity='0.15'%3E%3Crect x='12' y='12' width='1576' height='876'/%3E%3Cpath d='M800 12V888'/%3E%3Ccircle cx='800' cy='450' r='110'/%3E%3Ccircle cx='800' cy='450' r='7' fill='%232EE57D' stroke='none'/%3E%3Crect x='12' y='180' width='170' height='540'/%3E%3Crect x='1418' y='180' width='170' height='540'/%3E%3Crect x='12' y='300' width='70' height='300'/%3E%3Crect x='1518' y='300' width='70' height='300'/%3E%3Ccircle cx='132' cy='450' r='7' fill='%232EE57D' stroke='none'/%3E%3Ccircle cx='1468' cy='450' r='7' fill='%232EE57D' stroke='none'/%3E%3Cpath d='M182 352A110 110 0 0 1 182 548M1418 352A110 110 0 0 0 1418 548'/%3E%3Cpath d='M12 36A24 24 0 0 0 36 12M1564 12A24 24 0 0 0 1588 36M1588 864A24 24 0 0 0 1564 888M36 888A24 24 0 0 0 12 864'/%3E%3C/g%3E%3C/svg%3E");
}

/* ============================================================
   RESET Y BASE
   ============================================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html,
body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    -webkit-tap-highlight-color: transparent;
}

body {
    min-height: 100vh;
    min-height: calc(var(--vh, 1vh) * 100);
    display: flex;
    flex-direction: column;
    background-color: var(--bg);
    padding-top: calc(var(--header-h) + env(safe-area-inset-top) + 18px);
    padding-bottom: max(14px, 2vh, env(safe-area-inset-bottom));
    padding-left: max(var(--pad-x), env(safe-area-inset-left));
    padding-right: max(var(--pad-x), env(safe-area-inset-right));
    transition: background-color .3s, color .3s;
}

button {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    font-family: inherit;
}

button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
.app {
    position: relative;
    z-index: 1;
    flex: 1;
    display: grid;
    grid-template-columns: min(100%, var(--app-w));
    align-content: center;
    align-content: safe center;
    justify-content: center;
    gap: var(--gap);
    width: 100%;
    margin: 0 auto;
}

header {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 10px);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: calc(100% - 24px);
    max-width: calc(var(--app-w) + 40px);
    height: var(--header-h);
    padding: 0 10px 0 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(16, 185, 129, 0.15);
    box-shadow: 0 10px 28px -12px rgba(15, 45, 25, 0.22), 0 1px 2px rgba(15, 45, 25, 0.05);
    transition: background-color .3s, border-color .3s;
}

:root[data-theme="dark"] header {
    background: rgba(13, 31, 20, 0.75);
    border: 1px solid rgba(74, 222, 128, 0.2);
    box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.7);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.logo {
    flex: none;
    width: 28px;
    height: 28px;
    stroke: var(--accent);
    fill: none;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

h1 {
    font-family: var(--font-display);
    font-size: var(--h1-size);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.stats {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 9999px;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .04em;
    line-height: 1;
    color: var(--ink);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

.stats:empty {
    display: none;
}

.tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
}

.theme {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-sm);
    transition: border-color .15s, box-shadow .15s, transform .1s;
}

.theme:hover {
    border-color: var(--accent);
}

.theme:active {
    transform: scale(0.96);
}

.theme svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.theme .sun {
    display: none;
}

:root[data-theme="dark"] .theme .sun {
    display: block;
}

:root[data-theme="dark"] .theme .moon {
    display: none;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
    position: fixed;
    top: calc(var(--header-h) + env(safe-area-inset-top) + 24px);
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    width: max-content;
    max-width: min(92vw, 440px);
    background: var(--accent);
    color: var(--on-accent);
    padding: 10px 20px;
    border-radius: var(--r-md);
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.04em;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 9999;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.bad {
    background: #DC2626;
    color: #FFFFFF;
    white-space: pre-line;
    max-width: min(90vw, 440px);
    line-height: 1.25;
}

/* ============================================================
   TARJETA PRINCIPAL Y PISTA
   ============================================================ */
.card {
    grid-row: 1;
    grid-column: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 18px;
    width: 100%;
    padding: clamp(18px, 4vw, 26px) clamp(14px, 3.6vw, 22px);
    background: var(--surface);
    border: 1px solid #D5E3D8;
    border-radius: 24px;
    box-shadow: 0 20px 25px -5px rgba(15, 45, 25, 0.08), 0 8px 10px -6px rgba(15, 45, 25, 0.05);
    transition: background-color .3s, border-color .3s;
}

:root[data-theme="dark"] .card {
    background: rgba(11, 26, 17, 0.8);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(46, 229, 125, 0.25);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.card-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    line-height: 1;
    color: var(--accent);
    padding: 6px 12px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.pill.team {
    color: var(--yellow);
    background: color-mix(in srgb, var(--yellow) 14%, transparent);
}

.clue {
    font-family: var(--font-display);
    font-size: var(--clue-size);
    line-height: 1.3;
    font-weight: 700;
    letter-spacing: 0;
    overflow-wrap: break-word;
    hyphens: manual;
    text-wrap: balance;
    padding: 0 2px;
}

.clue .len {
    display: inline-block;
    margin-left: 4px;
    padding: 2px 9px;
    border-radius: 9999px;
    font-size: .6em;
    font-weight: 700;
    letter-spacing: .04em;
    line-height: 1.3;
    vertical-align: middle;
    white-space: nowrap;
    opacity: .75;
    background: color-mix(in srgb, var(--ink) 9%, transparent);
}

mark {
    background: var(--yellow-soft);
    color: var(--ink);
    padding: 1px 6px;
    border-radius: 6px;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

mark.def-mark {
    background: var(--yellow-soft);
    font-weight: 700;
}

mark.ind-mark {
    background: var(--red-soft);
    font-weight: 700;
}

mark.mat-mark {
    background: var(--accent-soft);
    font-weight: 700;
}

/* ============================================================
   CAJAS (INPUTS DE LETRAS 3D)
   ============================================================ */
.boxes {
    display: flex;
    justify-content: center;
    gap: 5px;
    width: 100%;
    padding: 2px 0 6px;
}

.box {
    flex: 1;
    min-width: 0;
    max-width: var(--box-max);
    aspect-ratio: 1;
    border: 2px solid var(--key-border);
    border-radius: 12px;
    background: var(--box-bg);
    box-shadow: 0 3px 0 var(--key-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: clamp(12px, 3.6vw, calc(var(--box-max) * 0.45));
    font-weight: 700;
    cursor: pointer;
    color: var(--ink);
    padding: 0;
    transition: border-color .15s, background-color .15s, box-shadow .2s, transform .1s;
    -webkit-touch-callout: none;
}

.box.active {
    background: var(--box-bg);
    border-color: var(--accent);
    box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 45%, var(--key-shadow)), 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent);
    transform: translateY(-1px);
}

.box.rev {
    background: var(--accent-soft);
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 35%, var(--key-shadow));
}

.box.ok {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
    box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 65%, black);
}

.box.bad {
    background: var(--error-soft);
    border-color: var(--error);
    box-shadow: 0 3px 0 color-mix(in srgb, var(--error) 50%, var(--key-shadow));
}

.boxes.shake {
    animation: shake .35s;
}

@keyframes shake {
    20% {
        transform: translateX(-6px);
    }

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

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

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

/* ============================================================
   NAV (Adivinar + Pistas)
   ============================================================ */
.nav {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 2px;
}

.nav button {
    min-width: 0;
    border-radius: 12px;
    padding: 12px 16px;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: filter .15s, background-color .15s, border-color .15s, box-shadow .2s, transform .1s;
}

.nav .btn-primary {
    flex: 1;
    background: var(--accent);
    color: var(--on-accent);
    border: 1.5px solid var(--accent);
    box-shadow: 0 4px 14px -6px color-mix(in srgb, var(--accent) 60%, transparent);
}

.nav .btn-primary:not(:disabled) {
    background: linear-gradient(180deg, #16A34A, #15803D);
    border-color: #15803D;
    color: #FFFFFF;
    box-shadow: 0 8px 18px -8px rgba(22, 163, 74, 0.6);
}

:root[data-theme="dark"] .nav .btn-primary:not(:disabled) {
    background: #2EE57D;
    border-color: #2EE57D;
    color: #04170C;
    box-shadow: 0 0 20px rgba(46, 229, 125, 0.35);
}

.nav .btn-primary:hover:not(:disabled) {
    filter: brightness(1.06);
}

.nav .btn-primary:active:not(:disabled) {
    transform: scale(0.985);
}

.nav .btn-primary:disabled {
    opacity: .4;
    cursor: default;
    filter: none;
    border-color: var(--line);
    background: var(--line);
    color: var(--muted);
    box-shadow: none;
}

.nav .btn-secondary {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    background: var(--surface);
    color: var(--ink);
    border: 1.5px solid var(--line);
    padding: 12px 22px;
}

.nav .btn-secondary .cost {
    opacity: .6;
    font-weight: 600;
    letter-spacing: .02em;
}

.nav .btn-secondary:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.nav .btn-secondary:active:not(:disabled) {
    transform: scale(0.985);
}

.nav .btn-secondary:disabled {
    opacity: .4;
    cursor: default;
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink);
}

/* ============================================================
   PANEL (Explicaciones alineadas a la izquierda)
   ============================================================ */
.panel {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 10px;
    align-items: baseline;
    width: 100%;
    max-width: 580px;
    margin: 0 auto;
    padding-top: 4px;
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: break-word;
    text-align: left;
}

.panel:empty {
    display: none;
}

.panel .row {
    display: contents;
}

.panel .row mark {
    justify-self: start;
    margin-top: 1px;
}

.panel .row.explain {
    display: block;
    grid-column: 1 / -1;
    background: var(--accent-soft);
    padding: 12px 14px;
    border-radius: 12px;
    text-align: center;
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.5;
}

/* Palabra resuelta: en negrita y pintada de verde (más fuerte que el fondo del recuadro) */
.panel .row.explain mark.mat-mark {
    background: color-mix(in srgb, var(--accent) 55%, var(--surface));
    color: var(--ink);
    font-weight: 700;
}

.msg {
    grid-column: 1;
    font-size: 13px;
    color: var(--muted);
    text-align: center;
    padding: 0 6px;
}

.msg:empty {
    display: none;
}

.msg.bad {
    color: var(--error);
}

.msg.good {
    color: var(--accent);
    font-weight: 700;
}

/* ---------- Mensajes si están dentro de la tarjeta ---------- */
.card .msg {
    width: 100%;
    padding: 9px 12px;
    border-radius: 12px;
    background: var(--bg);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.card .msg.bad {
    background: var(--error-soft);
    color: var(--red);
}

.card .msg.good {
    background: var(--accent-soft);
    color: var(--ink);
}

.card .msg:not(:empty) {
    animation: msgIn .2s ease-out both;
}

@keyframes msgIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ============================================================
   STATUS DIARIO + FOOTER
   ============================================================ */
.daily-status {
    grid-column: 1;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4px 0;
}

.daily-status:empty {
    display: none;
}

.daily-status b {
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    margin-left: 4px;
}

footer {
    grid-column: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 2px 6px;
    text-align: center;
    font-size: 11px;
    color: var(--muted);
    width: 100%;
    padding-top: 4px;
}

footer button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: 0;
    color: var(--muted);
    text-decoration: none;
    font-size: inherit;
    padding: 6px 4px;
    cursor: pointer;
    font-family: inherit;
    transition: color .2s;
}

footer button:hover {
    color: var(--ink);
}

footer button .ico {
    display: inline-flex;
    font-size: 1.1em;
    line-height: 1;
    transition: transform .45s ease;
}

footer button:hover .ico,
footer button:focus-visible .ico {
    transform: rotate(360deg);
}

/* ============================================================
   MODALES (help, reset, hints)
   ============================================================ */
.help {
    border: 0;
    border-radius: var(--r-lg);
    background: var(--surface);
    color: var(--ink);
    width: min(92vw, 460px);
    max-height: 86vh;
    max-height: 86dvh;
    margin: auto;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}

.help[open] {
    display: flex;
    flex-direction: column;
}

.help::backdrop {
    background: rgba(4, 18, 10, .55);
    backdrop-filter: blur(3px);
}

.help-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--line);
}

.help h2 {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.help-x {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: border-color .15s, background-color .15s;
}

.help-x svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
}

.help-x:hover {
    border-color: var(--accent);
}

.help-body {
    padding: 14px 20px 22px;
    overflow-y: auto;
    overscroll-behavior: contain;
    font-size: 13px;
    line-height: 1.55;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.help h3 {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin-top: 8px;
}

.help ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.help li {
    padding-left: 12px;
    border-left: 3px solid var(--line);
}

.help .ex {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 8px;
    align-items: baseline;
    background: var(--bg);
    border-radius: var(--r-md);
    padding: 12px 14px;
    text-align: left;
}

.help .ex-clue {
    grid-column: 1 / -1;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    margin-bottom: 4px;
}

.help .row {
    display: contents;
}

.help .row b {
    justify-self: start;
    font-weight: 700;
}

.help .row.def b {
    color: var(--yellow);
}

.help .row.mat b {
    color: var(--accent);
}

.help-go {
    margin-top: 8px;
    border: 0;
    border-radius: 12px;
    padding: 12px;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    background: var(--accent);
    color: var(--on-accent);
    cursor: pointer;
    box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--accent) 70%, transparent);
    transition: filter .15s, transform .1s;
}

.help-go:hover {
    filter: brightness(1.06);
}

.help-go:active {
    transform: scale(0.99);
}

.dialog-btns {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.dialog-btns button {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    border: 0;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: .06em;
    transition: filter .15s, transform .1s;
}

.dialog-btns button:hover {
    filter: brightness(1.06);
}

.dialog-btns button:active {
    transform: scale(0.99);
}

.btn-cancel {
    background: var(--bg);
    color: var(--ink);
    border: 1px solid var(--line) !important;
}

.btn-confirm {
    background: var(--red);
    color: #FFFFFF;
}

.inline-icon {
    display: inline-block;
    width: 1.2em;
    height: 1.2em;
    vertical-align: -0.25em;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    margin: 0 2px;
}

/* ============================================================
   POPUP DE PISTAS
   ============================================================ */
.hints-dialog .help-body {
    padding: 14px;
    gap: 10px;
}

.hints-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hint-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--bg);
    border: 1.5px solid var(--line);
    border-radius: var(--r-md);
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
    color: var(--ink);
    transition: border-color .15s, background-color .15s, transform .1s;
}

.hint-card:hover:not(:disabled) {
    border-color: var(--accent);
}

.hint-card:active:not(:disabled) {
    transform: scale(0.995);
}

.hint-card:disabled {
    opacity: .5;
    cursor: default;
}

.hint-card.used {
    background: var(--accent-soft);
    border-color: var(--accent-soft);
}

.hint-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.hint-card-title {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.hint-card-status {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: .04em;
    text-transform: uppercase;
    flex-shrink: 0;
}

.hint-card-status.done {
    color: var(--accent);
}

.hint-card-body {
    font-size: 13px;
    line-height: 1.45;
    color: var(--ink);
}

.hint-card:not(.used) .hint-card-body {
    color: var(--muted);
}

/* ============================================================
   TOUCH: neutralizar hovers
   ============================================================ */
@media (hover: none) {

    .theme:hover,
    .hint-card:hover:not(:disabled),
    .nav .btn-secondary:hover:not(:disabled),
    .help-x:hover {
        border-color: var(--line);
        color: inherit;
    }

    .nav .btn-primary:hover:not(:disabled),
    .dialog-btns button:hover,
    .help-go:hover {
        filter: none;
    }

    footer button:hover {
        color: var(--muted);
    }
}

/* ============================================================
   RESPONSIVE — BREAKPOINTS POR RESOLUCIÓN
   ============================================================ */
@media (min-width: 481px) {
    :root {
        --app-w: 440px;
        --gap: 16px;
        --pad-x: 16px;
        --clue-size: 22px;
        --box-max: 46px;
        --h1-size: 20px;
    }
}

@media (min-width: 641px) {
    :root {
        --app-w: 460px;
        --gap: 18px;
        --pad-x: 20px;
        --clue-size: 24px;
        --box-max: 50px;
        --h1-size: 22px;
    }

    body {
        padding-top: calc(var(--header-h) + env(safe-area-inset-top) + 22px);
        padding-bottom: max(20px, 3vh);
    }

    .toast {
        font-size: 18px;
    }

    .hint-card-title {
        font-size: 16px;
    }

    .nav button {
        font-size: 16px;
    }

    .nav .btn-secondary {
        padding: 12px 28px;
    }
}

@media (min-width: 801px) {
    :root {
        --app-w: 480px;
        --clue-size: 26px;
        --box-max: 54px;
        --h1-size: 24px;
    }

    .help {
        width: min(88vw, 500px);
    }
}

@media (min-width: 1025px) {
    :root {
        --app-w: 500px;
        --gap: 20px;
        --clue-size: 28px;
        --box-max: 58px;
        --h1-size: 26px;
    }

    body {
        padding-top: calc(var(--header-h) + env(safe-area-inset-top) + 26px);
        padding-bottom: max(24px, 4vh);
    }

    .help {
        width: min(85vw, 540px);
    }

    .hints-dialog .help-body {
        padding: 16px 20px 22px;
    }

    .hint-card {
        padding: 14px 16px;
    }

    .hint-card-title {
        font-size: 17px;
    }

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

    .nav button {
        padding: 14px 20px;
        font-size: 17px;
    }

    .panel,
    .msg,
    .daily-status {
        font-size: 14px;
    }
}

@media (min-width: 1281px) {
    :root {
        --app-w: 520px;
        --clue-size: 32px;
        --box-max: 62px;
        --h1-size: 28px;
        --header-h: 58px;
    }

    .theme {
        width: 38px;
        height: 38px;
    }

    .theme svg {
        width: 20px;
        height: 20px;
    }

    .nav button {
        font-size: 18px;
        padding: 16px 24px;
    }

    .panel {
        font-size: 15px;
    }
}

@media (min-width: 1441px) {
    :root {
        --app-w: 540px;
        --clue-size: 34px;
        --box-max: 66px;
    }

    body {
        padding-top: calc(var(--header-h) + env(safe-area-inset-top) + 28px);
        padding-bottom: max(28px, 4vh);
    }

    .toast {
        font-size: 20px;
        padding: 12px 28px;
    }

    .help {
        width: min(80vw, 580px);
    }

    .help-body {
        font-size: 14px;
    }

    .help h3 {
        font-size: 18px;
    }

    .hint-card-title {
        font-size: 18px;
    }

    .hint-card-body {
        font-size: 14.5px;
    }
}

@media (min-width: 1681px) {
    :root {
        --app-w: 560px;
        --clue-size: 36px;
        --box-max: 70px;
        --h1-size: 30px;
    }

    .panel {
        font-size: 15px;
    }

    .msg,
    .daily-status {
        font-size: 14px;
    }

    footer {
        font-size: 12px;
    }
}

@media (min-width: 1921px) {
    :root {
        --app-w: 600px;
        --gap: 24px;
        --clue-size: 40px;
        --box-max: 76px;
        --h1-size: 32px;
        --header-h: 62px;
    }

    body {
        padding-top: calc(var(--header-h) + env(safe-area-inset-top) + 32px);
        padding-bottom: max(32px, 4vh);
    }

    .logo {
        width: 34px;
        height: 34px;
    }

    .theme {
        width: 42px;
        height: 42px;
    }

    .theme svg {
        width: 22px;
        height: 22px;
    }

    .nav button {
        font-size: 20px;
        padding: 18px 28px;
        border-radius: 14px;
    }

    .help {
        width: min(70vw, 640px);
    }

    .help-body {
        font-size: 15px;
    }

    .hint-card {
        padding: 16px 18px;
    }

    .hint-card-title {
        font-size: 19px;
    }

    .hint-card-body {
        font-size: 15px;
    }

    .panel {
        font-size: 16px;
    }

    .panel .row.explain {
        padding: 14px 20px;
    }
}

@media (min-width: 2561px) {
    :root {
        --app-w: 660px;
        --gap: 28px;
        --clue-size: 44px;
        --box-max: 84px;
        --h1-size: 36px;
        --header-h: 66px;
    }

    body {
        padding-top: calc(var(--header-h) + env(safe-area-inset-top) + 36px);
        padding-bottom: max(40px, 5vh);
    }

    .logo {
        width: 38px;
        height: 38px;
    }

    .stats {
        font-size: 12px;
    }

    .theme {
        width: 46px;
        height: 46px;
    }

    .theme svg {
        width: 24px;
        height: 24px;
    }

    .nav button {
        font-size: 22px;
        padding: 22px 32px;
        border-radius: 16px;
    }

    .toast {
        font-size: 24px;
        padding: 14px 36px;
        border-radius: 16px;
    }

    .help {
        width: min(60vw, 720px);
        border-radius: 24px;
    }

    .help-head {
        padding: 24px 28px 16px;
    }

    .help h2 {
        font-size: 26px;
    }

    .help-body {
        font-size: 16px;
        padding: 20px 28px 28px;
    }

    .help h3 {
        font-size: 20px;
    }

    .hint-card {
        padding: 18px 22px;
        border-radius: 16px;
    }

    .hint-card-title {
        font-size: 20px;
    }

    .hint-card-body {
        font-size: 16px;
    }

    .panel {
        font-size: 17px;
        gap: 10px;
    }

    .panel .row.explain {
        padding: 16px 24px;
        border-radius: 14px;
    }

    .msg,
    .daily-status {
        font-size: 15px;
    }

    footer {
        font-size: 13px;
    }
}

@media (min-width: 3841px) {
    :root {
        --app-w: 760px;
        --gap: 36px;
        --clue-size: 54px;
        --box-max: 98px;
        --h1-size: 42px;
        --header-h: 72px;
    }

    body {
        padding-top: calc(var(--header-h) + env(safe-area-inset-top) + 44px);
        padding-bottom: max(56px, 6vh);
    }

    .logo {
        width: 44px;
        height: 44px;
    }

    .stats {
        font-size: 14px;
    }

    .theme {
        width: 52px;
        height: 52px;
    }

    .theme svg {
        width: 28px;
        height: 28px;
    }

    .nav button {
        font-size: 26px;
        padding: 26px 40px;
        border-radius: 18px;
    }

    .toast {
        font-size: 28px;
        padding: 18px 44px;
        border-radius: 20px;
    }

    .help {
        width: min(50vw, 880px);
        border-radius: 28px;
    }

    .help h2 {
        font-size: 32px;
    }

    .help-body {
        font-size: 18px;
    }

    .help h3 {
        font-size: 24px;
    }

    .hint-card {
        padding: 22px 26px;
        border-radius: 20px;
    }

    .hint-card-title {
        font-size: 24px;
    }

    .hint-card-body {
        font-size: 18px;
    }

    .panel {
        font-size: 19px;
    }

    .msg,
    .daily-status {
        font-size: 17px;
    }

    footer {
        font-size: 15px;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    :root {
        --gap: 8px;
        --clue-size: 18px;
        --box-max: 36px;
        --header-h: 48px;
    }

    body {
        padding-top: calc(var(--header-h) + env(safe-area-inset-top) + 8px);
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    .card {
        gap: 10px;
        padding: 14px 12px;
    }

    .nav button {
        padding: 10px 16px;
        font-size: 14px;
    }

    .theme {
        width: 32px;
        height: 32px;
    }

    .theme svg {
        width: 16px;
        height: 16px;
    }
}

/* ============================================================
   ATMÓSFERA DE ESTADIO Y CONTROLES FINALES
   ============================================================ */
body {
    background-image: radial-gradient(ellipse 90% 60% at 50% 38%, rgba(255, 255, 255, 0.75), transparent 70%);
    background-attachment: fixed;
    padding-top: calc(var(--header-h) + env(safe-area-inset-top) + 36px);
}

:root[data-theme="dark"] body {
    background-image: radial-gradient(ellipse 80% 55% at 50% 0%, rgba(46, 229, 125, 0.08), transparent 70%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: var(--pitch-p) center / 100% 100% no-repeat;
}

@media (min-aspect-ratio: 1/1) {
    body::before {
        background-image: var(--pitch-l);
    }
}

@media (max-width: 640px) {
    body::before {
        top: calc(env(safe-area-inset-top) + 10px + var(--header-h) + 8px);
    }
}

@media (max-width: 420px) {
    h1 {
        font-size: 15px;
        letter-spacing: .05em;
    }

    header {
        padding: 0 8px 0 14px;
    }

    .brand {
        gap: 7px;
    }

    .logo {
        width: 24px;
        height: 24px;
    }

    .tools {
        gap: 6px;
    }

    .theme {
        width: 34px;
        height: 34px;
    }

    .stats {
        padding: 5px 10px;
        font-size: 13px;
    }
}

@media (max-width: 380px) {
    h1 {
        font-size: 13px;
        letter-spacing: .03em;
    }
}

.pill svg,
.stats svg,
.nav .btn-secondary .ico svg,
footer button .ico svg {
    width: 1.15em;
    height: 1.15em;
    flex: none;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
}

.pill svg {
    width: 14px;
    height: 14px;
}

.stats svg {
    width: 15px;
    height: 15px;
    color: var(--yellow);
}

.nav .btn-secondary .ico {
    display: inline-flex;
}

.nav .btn-secondary .ico svg {
    overflow: visible;
}

.nav .btn-secondary .ico .bulb {
    stroke: var(--yellow);
    filter: drop-shadow(0 0 3px color-mix(in srgb, var(--yellow) 70%, transparent));
}

.nav .btn-secondary:disabled .ico .bulb {
    filter: none;
}

/* ============================================================
   ANIMACIÓN: "¡GOOOOL, digo... ADIVINASTE!"
   ============================================================ */
.goal-overlay {
    --g-bg: radial-gradient(ellipse at 50% 46%, rgba(248, 252, 249, .97), rgba(214, 232, 220, .98));
    --g-ink: #0E2818;
    --g-gol: #D97706;
    --g-win: #15803D;
    --g-beam: rgba(22, 163, 74, .14);
    --g-ring: rgba(21, 128, 61, .45);
    --g-fan: #14532D;

    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--g-bg);
    cursor: pointer;
    overflow: hidden;
    animation: goalFadeIn .35s ease-out both;
}

:root[data-theme="dark"] .goal-overlay {
    --g-bg: radial-gradient(ellipse at 50% 46%, rgba(9, 44, 25, .97), rgba(2, 10, 6, .98));
    --g-ink: #FFFFFF;
    --g-gol: #FACC15;
    --g-win: #2EE57D;
    --g-beam: rgba(46, 229, 125, .13);
    --g-ring: rgba(46, 229, 125, .45);
    --g-fan: #04150B;
}

.goal-overlay.out {
    animation: goalFadeOut .35s ease-in both;
}

@keyframes goalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes goalFadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

.goal-beams {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        conic-gradient(from 118deg at 4% -6%, transparent 0deg, var(--g-beam) 16deg, transparent 34deg),
        conic-gradient(from 208deg at 96% -6%, transparent 0deg, var(--g-beam) 16deg, transparent 34deg);
    animation: goalFadeIn 1.2s ease-out .1s both;
}

.goal-rings {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    pointer-events: none;
}

.ring {
    position: absolute;
    left: 0;
    top: 0;
    width: 40vmin;
    height: 40vmin;
    margin: -20vmin 0 0 -20vmin;
    border-radius: 50%;
    border: 2px solid var(--g-ring);
    opacity: 0;
    animation: ringOut 1.6s ease-out var(--rd) both;
}

.ring.r1 {
    --rd: .1s;
}

.ring.r2 {
    --rd: 1.9s;
}

@keyframes ringOut {
    0% {
        opacity: 0;
        transform: scale(.3);
    }

    20% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: scale(2.6);
    }
}

.goal-words {
    position: relative;
    display: grid;
    justify-items: center;
    align-items: center;
    text-align: center;
}

.goal-words>* {
    grid-area: 1 / 1;
}

.goal-text {
    font-family: var(--font-display);
    font-weight: 800;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
}

.goal-text span {
    display: inline-block;
    opacity: 0;
    animation: letterIn .6s ease-out calc(var(--b) + var(--i) * 55ms) both;
}

@keyframes letterIn {
    from {
        opacity: 0;
        transform: translateY(35%);
    }

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

@keyframes windowOut {

    0%,
    78% {
        opacity: 1;
        transform: translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateY(-8%);
    }
}

.goal-gol {
    --b: .1s;
    font-size: clamp(44px, 15vw, 120px);
    letter-spacing: .05em;
    color: var(--g-gol);
    animation: windowOut 1s ease-in .1s both;
}

.goal-digo {
    font-size: clamp(30px, 10vw, 58px);
    text-transform: none;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--g-ink);
    animation: windowOut .7s ease-in 1.1s both;
}

.goal-digo em {
    display: inline-block;
    font-style: italic;
    opacity: 0;
    animation: letterIn .45s ease-out 1.1s both;
}

.goal-digo u {
    text-decoration: none;
    display: inline-block;
}

.goal-digo u i {
    display: inline-block;
    font-style: normal;
    opacity: 0;
    animation: letterIn .35s ease-out both;
}

.goal-digo u i:nth-child(1) {
    animation-delay: 1.3s;
}

.goal-digo u i:nth-child(2) {
    animation-delay: 1.42s;
}

.goal-digo u i:nth-child(3) {
    animation-delay: 1.54s;
}

.goal-win-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.goal-win {
    --b: 1.85s;
    font-size: clamp(32px, 10vw, 82px);
    letter-spacing: .04em;
    color: var(--g-win);
}

.goal-bar {
    height: 4px;
    width: min(60%, 320px);
    border-radius: 4px;
    background: var(--g-win);
    opacity: 0;
    transform: scaleX(0);
    animation: barGrow .7s ease-out 2.5s both;
}

@keyframes barGrow {
    from {
        transform: scaleX(0);
        opacity: 0;
    }

    to {
        transform: scaleX(1);
        opacity: .8;
    }
}

.goal-pts {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 8px 18px 8px 16px;
    border-radius: 12px;
    font-family: var(--font-display);
    font-size: clamp(16px, 4.5vw, 22px);
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--g-ink);
    background: color-mix(in srgb, var(--g-win) 16%, transparent);
    border: 1px solid color-mix(in srgb, var(--g-win) 45%, transparent);
    opacity: 0;
    animation: fadeUp .5s ease-out 2.6s both;
}

.goal-pts span {
    font-size: 1.55em;
    font-weight: 800;
    letter-spacing: .02em;
    color: var(--g-win);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.goal-crowd {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 0;
    pointer-events: none;
}

.goal-crowd::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 8vh;
    background: linear-gradient(to top, var(--g-fan), transparent);
    opacity: .8;
    z-index: 4;
}

.crowd-row {
    position: absolute;
    left: 0;
    right: 0;
    opacity: 0;
    animation: crowdPop .18s ease-out var(--rd) both;
}

.crowd-row.back {
    z-index: 1;
}

.crowd-row.mid {
    z-index: 2;
}

.crowd-row.front {
    z-index: 3;
}

@keyframes crowdPop {
    from {
        opacity: 0;
    }

    to {
        opacity: var(--op);
    }
}

.crowd-half {
    position: absolute;
    inset: 0;
    animation: crowdJump var(--jt) ease-in-out calc(var(--rd) + var(--gd)) infinite alternate;
}

@keyframes crowdJump {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(calc(var(--h) * -.1));
    }
}

.fan {
    position: absolute;
    bottom: 0;
}

.fan svg {
    display: block;
}

/* ============================================================
   BOTÓN RENDIRSE Y BOTÓN COMPARTIR
   ============================================================ */
.btn-giveup,
.btn-share {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    align-self: center;
    padding: 8px 18px;
    border-radius: 12px;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color .15s, color .15s, background-color .15s, transform .1s, filter .15s;
}

.btn-giveup {
    background: transparent;
    color: var(--muted);
    border: 1.5px solid var(--line);
}

.btn-giveup:hover:not(:disabled) {
    border-color: var(--yellow);
    color: var(--ink);
}

.btn-giveup:active:not(:disabled),
.btn-share:active {
    transform: scale(0.985);
}

.btn-giveup:disabled {
    opacity: .4;
    cursor: default;
}

.btn-giveup .flag-ico {
    width: 22px;
    height: 22px;
    display: block;
    flex: none;
    overflow: visible;
}

.btn-share {
    background: var(--accent-soft);
    color: var(--accent);
    border: 1.5px solid color-mix(in srgb, var(--accent) 45%, transparent);
}

.btn-share[hidden] {
    display: none !important;
}

.btn-share svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn-share:hover {
    filter: brightness(1.06);
    border-color: var(--accent);
}

.giveup-msg {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    padding: 8px 0 4px;
}

@media (hover: none) {
    .btn-giveup:hover:not(:disabled) {
        border-color: var(--line);
        color: var(--muted);
    }
}

.giveup-dialog .dialog-btns button {
    font-size: 15px;
    padding: 12px 8px;
    line-height: 1.1;
    transition: filter .15s, transform .1s, background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}

.dialog-btns .btn-keep {
    background: var(--accent);
    color: var(--on-accent);
}

@media (hover: hover) {
    .giveup-dialog .btn-keep:hover {
        filter: brightness(1.1);
        transform: translateY(-1px);
        box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent);
    }

    .giveup-dialog .btn-cancel:hover {
        border-color: var(--red) !important;
        background: color-mix(in srgb, var(--red) 10%, var(--bg));
        color: var(--red);
        transform: translateY(-1px);
    }
}

.giveup-dialog .dialog-btns button:active {
    transform: scale(0.98);
}

/* Modo "elegí qué letra revelar" */
.boxes.picking .box:not(.rev) {
    border-style: dashed;
    border-color: var(--accent);
    cursor: pointer;
}

.boxes.picking .box.active:not(.rev) {
    background: var(--box-bg);
    box-shadow: 0 3px 0 var(--key-shadow);
    transform: none;
}

@media (hover: hover) {
    .boxes.picking .box:not(.rev):hover {
        background: var(--accent-soft);
        border-style: solid;
        border-color: var(--accent);
        box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 45%, var(--key-shadow)), 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent);
        transform: translateY(-2px);
    }
}

/* ============================================================
   MODOS: Normal (verde) · Extremo (rojo) · Leyenda (dorado)
   ============================================================ */
.mode-selector {
    display: flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: color-mix(in srgb, var(--ink) 5%, transparent);
}

.mode-btn {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 6px 12px;
    border-radius: 9px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
    line-height: 1;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease, box-shadow .25s ease;
}

/* Tilde de "ya resuelto hoy" en el selector de modos */
.mode-btn.done::before {
    content: "✓";
    font-weight: 800;
    margin-right: 4px;
}

.mode-btn[data-mode="normal"].active {
    background: var(--mode-green-soft);
    color: var(--mode-green);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mode-green) 55%, transparent);
}

.mode-btn[data-mode="extremo"].active {
    background: var(--red-soft);
    color: var(--red);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--red) 60%, transparent);
}

.mode-btn[data-mode="leyenda"] {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.mode-btn[data-mode="leyenda"].active {
    background: var(--gold-soft);
    color: var(--gold);
    animation: leyendaGlow 3.6s ease-in-out infinite;
}

.mode-btn[data-mode="leyenda"]::after {
    content: "";
    position: absolute;
    top: -20%;
    bottom: -20%;
    left: -30%;
    width: 55%;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 250, 220, 0.25) 30%,
            rgba(255, 255, 255, 0.7) 50%,
            rgba(255, 250, 220, 0.25) 70%,
            transparent 100%);
    transform: translateX(-180%) skewX(-22deg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 1;
}

:root[data-theme="dark"] .mode-btn[data-mode="leyenda"]::after {
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(245, 197, 66, 0.15) 30%,
            rgba(255, 243, 176, 0.42) 50%,
            rgba(245, 197, 66, 0.15) 70%,
            transparent 100%);
}

.mode-btn[data-mode="leyenda"]:hover::after,
.mode-btn[data-mode="leyenda"].active::after {
    opacity: 1;
    animation: leyendaShimmer 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes leyendaShimmer {
    0% {
        transform: translateX(-180%) skewX(-22deg);
    }

    80%,
    100% {
        transform: translateX(380%) skewX(-22deg);
    }
}

@keyframes leyendaGlow {

    0%,
    100% {
        box-shadow:
            inset 0 0 0 1px var(--gold-line),
            0 0 8px -2px color-mix(in srgb, var(--gold-line) 40%, transparent);
    }

    50% {
        box-shadow:
            inset 0 0 0 1px var(--gold-line),
            0 0 14px 1px color-mix(in srgb, var(--gold-line) 70%, transparent);
    }
}

@media (hover: hover) {
    .mode-btn[data-mode="normal"]:not(.active):hover {
        background: color-mix(in srgb, var(--mode-green-soft) 75%, var(--surface));
        color: var(--mode-green);
        box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mode-green) 45%, transparent);
    }

    .mode-btn[data-mode="extremo"]:not(.active):hover {
        background: color-mix(in srgb, var(--red-soft) 75%, var(--surface));
        color: var(--red);
        box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--red) 50%, transparent);
    }

    .mode-btn[data-mode="leyenda"]:not(.active):hover {
        background: color-mix(in srgb, var(--gold-soft) 88%, var(--surface));
        color: var(--gold);
        box-shadow:
            inset 0 0 0 1px color-mix(in srgb, var(--gold-line) 75%, transparent),
            0 0 10px -2px color-mix(in srgb, var(--gold-line) 45%, transparent);
    }
}

@media (max-width: 420px) {
    .mode-btn {
        padding: 6px 8px;
        font-size: 10px;
    }
}

/* ============================================================
   TECLADO VIRTUAL EN PANTALLA (MOBILE / TOUCH)
   ============================================================ */
.vkb {
    display: none;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    margin-top: 2px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

@media (pointer: coarse),
(max-width: 768px) {
    .vkb {
        display: flex;
    }
}

/* Teclado apagado = pista resuelta: no ocupa lugar */
.vkb.disabled {
    display: none;
}

.vkb-row {
    display: flex;
    justify-content: center;
    gap: 4px;
    width: 100%;
}

.vkb-key {
    flex: 1;
    min-width: 0;
    height: 44px;
    padding: 0 2px;
    border-radius: 8px;
    background: var(--box-bg);
    border: 1.5px solid var(--key-border);
    box-shadow: 0 2px 0 var(--key-shadow);
    color: var(--ink);
    font-family: var(--font-display);
    font-size: clamp(14px, 4.2vw, 17px);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    transition: transform 0.06s, background-color 0.12s, border-color 0.12s, color 0.12s;
}

.vkb-key:active {
    transform: translateY(2px);
    box-shadow: 0 0 0 var(--key-shadow);
    background: var(--accent-soft);
    border-color: var(--accent);
}

.vkb-key.wide {
    flex: 1.45;
    font-size: clamp(12px, 3.5vw, 14px);
    letter-spacing: 0.03em;
}

.vkb-key svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (max-width: 360px) {
    .vkb-row {
        gap: 3px;
    }

    .vkb-key {
        height: 40px;
        border-radius: 7px;
    }
}

/* ============================================================
   CELULAR VERTICAL (hasta 640px)
   ============================================================ */
@media (max-width: 640px) {
    :root {
        --header-h: 52px;
        --gap: 12px;
        --pad-x: 12px;
        --clue-size: clamp(19px, 5.6vw, 26px);
        --box-max: 44px;
    }

    body {
        min-height: 100vh;
        min-height: 100dvh;
        padding-top: calc(var(--header-h) + env(safe-area-inset-top) + 24px);
        padding-bottom: max(18px, env(safe-area-inset-bottom));
    }

    .app {
        align-content: start;
    }

    header {
        width: calc(100% - 20px);
        padding: 0 8px 0 14px;
        border-radius: 16px;
    }

    .brand {
        gap: 8px;
    }

    .logo {
        width: 26px;
        height: 26px;
    }

    h1 {
        width: min-content;
        font-size: 15px;
        letter-spacing: .06em;
        line-height: 1.02;
    }

    .tools {
        gap: 6px;
    }

    .theme {
        width: 40px;
        height: 40px;
    }

    .stats {
        padding: 6px 11px;
        font-size: 14px;
    }

    .card {
        gap: 14px;
        padding: 14px 14px 12px;
        border-radius: 22px;
    }

    .mode-selector {
        order: -2;
        width: 100%;
        padding: 4px;
        gap: 4px;
        border-radius: 14px;
    }

    .mode-btn {
        flex: 1 1 0;
        min-width: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        height: 38px;
        padding: 0 4px;
        border-radius: 10px;
        font-size: 13px;
        letter-spacing: .08em;
    }

    .card-head {
        order: -1;
        justify-content: center;
        margin: 2px 0 -6px;
    }

    .card-head .pill {
        padding: 0;
        background: none;
        font-size: 12px;
        letter-spacing: .2em;
    }

    .pill.team {
        background: none;
    }

    .clue {
        line-height: 1.22;
        padding: 0 2px;
    }

    .boxes {
        --bgap: 6px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px var(--bgap);
        padding: 2px 0 6px;
    }

    .box {
        flex: 0 0 auto;
        width: min(var(--box-max), calc((100% - (var(--cols, 6) - 1) * var(--bgap)) / var(--cols, 6) - .5px));
        max-width: none;
        font-size: clamp(19px, 5.6vw, 24px);
    }

    .box.ok,
    .box.rev {
        opacity: 1 !important;
    }

    .vkb {
        gap: 7px;
        margin-top: 0;
    }

    .vkb-row {
        gap: 5px;
    }

    .vkb-key {
        height: 48px;
        border-radius: 10px;
        font-size: 19px;
    }

    .vkb-key.wide {
        flex: 1.5;
    }

    .nav {
        gap: 10px;
        margin-top: 0;
    }

    .nav button {
        min-height: 52px;
        padding: 12px 16px;
        font-size: 17px;
        border-radius: 14px;
    }

    .nav .btn-secondary {
        padding: 12px 18px;
    }

    .btn-giveup {
        min-height: 40px;
        margin-top: -4px;
        padding: 8px 14px;
        border-color: transparent;
        font-size: 13px;
    }

    .btn-share {
        min-height: 44px;
        padding: 10px 18px;
        font-size: 15px;
    }

    .nav:has(#next:disabled),
    .btn-giveup:disabled {
        display: none;
    }

    .panel {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        max-width: none;
        padding-top: 0;
        font-size: 14px;
    }

    .panel .row {
        display: block;
        padding: 9px 12px;
        border-radius: 12px;
        background: var(--bg);
        text-align: left;
    }

    .panel .row mark {
        margin: 0 6px 0 0;
    }

    .panel .row.explain {
        margin-top: 0;
        padding: 12px 14px;
        font-size: 14px;
        text-align: center;
        background: var(--accent-soft);
    }

    .daily-status {
        font-size: 14px;
    }

    footer {
        font-size: 12px;
    }

    footer button {
        padding: 10px 6px;
    }

    .help {
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
        max-height: 90dvh;
        margin: auto 0 0;
        border-radius: 24px 24px 0 0;
    }

    .help::before {
        content: "";
        flex: none;
        width: 40px;
        height: 4px;
        margin: 8px auto -4px;
        border-radius: 4px;
        background: var(--line);
    }

    .help[open] {
        animation: sheetUp .28s cubic-bezier(.22, 1, .36, 1) both;
    }

    .help[open]::backdrop {
        animation: goalFadeIn .25s ease-out both;
    }

    .help-body {
        padding-bottom: max(22px, env(safe-area-inset-bottom));
        font-size: 14px;
    }

    .help-x {
        width: 40px;
        height: 40px;
    }

    .dialog-btns button {
        min-height: 52px;
    }
}

@keyframes sheetUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (max-width: 640px) and (max-height: 700px) {
    .card {
        gap: 12px;
    }

    .vkb {
        gap: 6px;
    }

    .vkb-key {
        height: 43px;
    }

    .nav button {
        min-height: 48px;
    }
}

@media (max-width: 640px) and (min-height: 780px) {
    .card {
        gap: 16px;
        padding: 18px 16px 14px;
    }

    .vkb {
        gap: 8px;
    }

    .vkb-key {
        height: 54px;
        font-size: 21px;
    }

    .nav button {
        min-height: 56px;
    }
}

@media (max-width: 340px) {
    .theme {
        width: 36px;
        height: 36px;
    }

    .stats {
        padding: 5px 9px;
        font-size: 13px;
    }

    h1 {
        font-size: 14px;
    }

    .card {
        padding: 12px;
    }

    .mode-btn {
        font-size: 12px;
        letter-spacing: .05em;
    }

    .vkb-row {
        gap: 4px;
    }
}

/* ============================================================
   CELULAR APAISADO: dos columnas (pista a la izquierda, teclado a la derecha)
   ============================================================ */
@media (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
    :root {
        --app-w: 880px;
        --header-h: 44px;
        --clue-size: 19px;
        --box-max: 40px;
    }

    body {
        padding-top: calc(var(--header-h) + env(safe-area-inset-top) + 20px);
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    .app {
        align-content: start;
    }

    header {
        top: calc(env(safe-area-inset-top) + 6px);
        padding: 0 8px 0 14px;
        border-radius: 14px;
    }

    h1 {
        font-size: 16px;
    }

    .theme {
        width: 34px;
        height: 34px;
    }

    .card {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        column-gap: 20px;
        row-gap: 10px;
        align-items: center;
        padding: 12px 16px;
    }

    .mode-selector {
        grid-column: 1;
        grid-row: 1;
        width: 100%;
    }

    .card-head {
        grid-column: 1;
        grid-row: 2;
        justify-content: center;
        margin: 0;
    }

    .card-head .pill {
        padding: 0;
        background: none;
        font-size: 11px;
    }

    .clue {
        grid-column: 1;
        grid-row: 3;
    }

    .boxes {
        grid-column: 1;
        grid-row: 4;
        --bgap: 6px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px var(--bgap);
        padding: 2px 0 6px;
    }

    .box {
        flex: 0 0 auto;
        width: min(var(--box-max), calc((100% - (var(--cols, 6) - 1) * var(--bgap)) / var(--cols, 6) - .5px));
        max-width: none;
        font-size: 22px;
    }

    .box.ok,
    .box.rev {
        opacity: 1 !important;
    }

    .card .msg {
        grid-column: 1;
        grid-row: 5;
    }

    .vkb {
        grid-column: 2;
        grid-row: 1 / span 3;
        gap: 6px;
    }

    .vkb-key {
        height: 38px;
    }

    .nav {
        grid-column: 2;
        grid-row: 4;
    }

    .nav button {
        padding: 10px 14px;
        font-size: 15px;
    }

    .btn-giveup {
        grid-column: 2;
        grid-row: 5;
        justify-self: center;
        min-height: 36px;
        padding: 6px 14px;
        border-color: transparent;
        font-size: 13px;
    }

    .btn-share {
        grid-column: 1 / -1;
        justify-self: center;
    }

    .panel {
        grid-column: 1 / -1;
        grid-row: 6;
        max-width: none;
    }

    .help {
        width: min(88vw, 560px);
        max-height: 92vh;
        max-height: 92dvh;
    }

    .mode-btn {
        flex: 1 1 0;
        min-width: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        height: 34px;
        padding: 0 4px;
        font-size: 12px;
    }

    .nav:has(#next:disabled),
    .btn-giveup:disabled {
        display: none;
    }
}

/* ============================================================
   ACCESIBILIDAD (REDUCED MOTION)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }

    .mode-btn[data-mode="leyenda"].active {
        animation: none !important;
    }

    .mode-btn[data-mode="leyenda"]::after {
        animation: none !important;
        opacity: 0 !important;
    }
}

/* ============================================================
   TOOLTIP EN PALABRAS RESALTADAS DE LA PISTA
   ============================================================ */
#clue mark[data-tip] {
    position: relative;
    cursor: pointer;
    outline: none;
    transition: filter .15s;
}

#clue mark[data-tip]:hover,
#clue mark[data-tip].tip-open {
    filter: brightness(1.08);
}

#clue mark[data-tip]::after {
    content: attr(data-tip-title) ": " attr(data-tip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%) translateY(4px);
    width: max-content;
    max-width: min(78vw, 290px);
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    border: 1.5px solid var(--line);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.28);
    font-family: var(--font-body);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: 0;
    text-align: center;
    white-space: normal;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
    z-index: 60;
}

#clue mark.def-mark[data-tip]::after {
    border-color: var(--yellow);
}

#clue mark.ind-mark[data-tip]::after {
    border-color: var(--red);
}

#clue mark.mat-mark[data-tip]::after {
    border-color: var(--accent);
}

/* Mostrar al pasar el mouse (PC) o al tocar (Mobile/Teclado) */
@media (hover: hover) {
    #clue mark[data-tip]:hover::after {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
    }
}

#clue mark[data-tip].tip-open::after,
#clue mark[data-tip]:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
/* ============================================================
   FOOTER: links a páginas
   ============================================================ */
footer a {
    color: var(--muted);
    text-decoration: none;
    padding: 8px 6px;
    transition: color .2s;
}

footer a:hover {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.help-more {
    text-align: center;
}

.help-more a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.help-more a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ============================================================
   RANKING
   ============================================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* El puntaje del encabezado abre el ranking */
button.stats {
    cursor: pointer;
    font-family: var(--font-display);
    transition: border-color .15s, background-color .15s, transform .1s;
}

button.stats:hover {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 18%, transparent);
}

button.stats:active {
    transform: scale(.97);
}

.btn-rank {
    background: color-mix(in srgb, var(--yellow) 14%, var(--surface));
    color: var(--ink);
    border-color: color-mix(in srgb, var(--yellow) 55%, transparent);
}

.btn-rank svg {
    color: var(--yellow);
}

.rank-body {
    gap: 14px;
}

.rank-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: color-mix(in srgb, var(--ink) 5%, transparent);
}

.rank-tabs button {
    flex: 1;
    min-height: 36px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color .15s, color .15s;
}

.rank-tabs button[aria-selected="true"] {
    background: var(--surface);
    color: var(--ink);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent), var(--shadow-sm);
}

.rank-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 120px;
}

.help .rank-list li {
    border-left: 0;
    padding: 0;
}

.rank-row {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 9px 12px !important;
    border-radius: 12px;
    background: var(--bg);
    font-size: 15px;
}

.rank-pos {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 800;
    color: var(--muted);
    background: color-mix(in srgb, var(--ink) 7%, transparent);
    font-variant-numeric: tabular-nums;
}

.rank-row.p1 .rank-pos {
    background: #F5C542;
    color: #3A2E0A;
}

.rank-row.p2 .rank-pos {
    background: #CBD5E1;
    color: #1E293B;
}

.rank-row.p3 .rank-pos {
    background: #D9A066;
    color: #3B2410;
}

.rank-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.rank-pts {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.rank-pts small {
    font-size: .7em;
    font-weight: 700;
    color: var(--muted);
}

.rank-row.me {
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent);
}

.rank-empty {
    padding: 24px 12px !important;
    text-align: center;
    color: var(--muted);
}

.rank-me {
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--accent-soft);
    text-align: center;
    font-size: 14px;
}

.rank-join {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    border-radius: 14px;
    border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, var(--line));
    background: color-mix(in srgb, var(--accent-soft) 40%, transparent);
}

.rank-join[hidden],
.rank-profile[hidden],
.rank-me[hidden] {
    display: none;
}

.help .rank-join h3 {
    margin-top: 0;
}

.rank-join p {
    color: var(--muted);
}

.rank-name-row {
    display: flex;
    gap: 8px;
}

.rank-name-row input {
    flex: 1;
    min-width: 0;
    height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    border: 2px solid var(--key-border);
    background: var(--box-bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 600;
}

.rank-name-row input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

.rank-dice {
    flex: none;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    border: 2px solid var(--key-border);
    background: var(--box-bg);
    color: var(--ink);
    cursor: pointer;
    transition: border-color .15s, transform .2s;
}

.rank-dice:hover {
    border-color: var(--accent);
}

.rank-dice:active {
    transform: rotate(90deg) scale(.95);
}

.rank-dice svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
}

.rank-err {
    min-height: 0;
    color: var(--red) !important;
    font-weight: 600;
    font-size: 13px;
}

.rank-err:empty {
    display: none;
}

.rank-join-btns {
    display: flex;
    gap: 8px;
}

.rank-join-btns .help-go {
    flex: 1;
    margin-top: 0;
}

.rank-join-btns .btn-cancel {
    flex: 0 0 auto;
    padding: 0 18px;
    border-radius: 12px;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    cursor: pointer;
}

.rank-join-btns .btn-cancel[hidden] {
    display: none;
}

.help-go:disabled,
.btn-confirm:disabled {
    opacity: .6;
    cursor: wait;
}

.rank-note {
    font-size: 12.5px;
    text-align: center;
}

.rank-note a,
.rank-profile button {
    color: var(--accent);
}

.rank-profile {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 6px 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-size: 14px;
}

.rank-actions {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    color: var(--muted);
}

.rank-profile button {
    border: 0;
    background: none;
    padding: 4px 2px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.rank-profile #rankDelete {
    color: var(--red);
}

@media (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
    .btn-rank {
        grid-column: 1 / -1;
        justify-self: center;
    }
}
