/* ─── Container ─────────────────────────────────────────────────────── */
#game-root .hg-wrap {
    padding: 0.75rem;
    max-width: 460px;
    margin: 0 auto;
    background: linear-gradient(180deg, #2a1010 0%, #5a1818 100%);
    border-radius: var(--jul-radius-lg, 20px);
    user-select: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}

/* ─── HUD: pill cards ───────────────────────────────────────────────── */
#game-root .hg-header {
    display: flex; align-items: stretch; gap: 0.4rem;
    margin-bottom: 0.55rem;
}
#game-root .hg-pill {
    flex: 1 1 0; min-width: 0;
    display: flex; align-items: center; gap: 0.45rem;
    padding: 0.32rem 0.65rem;
    background: linear-gradient(180deg, #fff8e1 0%, #fbf0c8 100%);
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 2px 4px rgba(0,0,0,0.18);
}
#game-root .hg-pill-icon {
    font-size: 1.2rem; line-height: 1;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));
}
#game-root .hg-pill-body { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
#game-root .hg-lbl {
    font-size: 0.6rem; letter-spacing: 0.08em;
    color: #8a5a1a; text-transform: uppercase; font-weight: 700;
}
#game-root .hg-val {
    font-size: 1.2rem; font-weight: 800;
    color: var(--jul-red-700, #8B0000);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}

#game-root .hg-audio {
    display: flex; align-items: center; gap: 0.3rem;
    padding: 0.28rem 0.5rem;
    background: linear-gradient(180deg, #fff8e1 0%, #fbf0c8 100%);
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 2px 4px rgba(0,0,0,0.18);
}
#game-root .hg-mute {
    background: transparent; border: 0;
    width: 26px; height: 26px; cursor: pointer;
    font-size: 0.95rem; padding: 0;
}
#game-root .hg-vol {
    width: 56px; cursor: pointer;
    accent-color: var(--jul-red-700, #8B0000);
}

/* ─── Mode chips ────────────────────────────────────────────────────── */
#game-root .hg-modes {
    display: flex; gap: 0.3rem;
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
}
#game-root .hg-mode {
    flex: 1 1 auto;
    padding: 0.32rem 0.55rem;
    font-size: 0.78rem; font-weight: 700;
    color: #fde9a8;
    background: rgba(0,0,0,0.28);
    border: 1px solid rgba(255, 221, 100, 0.18);
    border-radius: 999px;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
#game-root .hg-mode:hover:not(.hg-mode--active) {
    background: rgba(0,0,0,0.42);
    color: #fff8d0;
}
#game-root .hg-mode--active {
    background: linear-gradient(180deg, #fbd24a 0%, #d99b1e 100%);
    color: #4a1a05;
    border-color: #b8870b;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 2px 4px rgba(0,0,0,0.3);
}

/* ─── Canvas ────────────────────────────────────────────────────────── */
#game-root .hg-canvas-wrap {
    position: relative;
    border: 3px solid #ffd66b;
    border-radius: 12px; overflow: hidden;
    aspect-ratio: 400 / 320; max-width: 100%;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.4), inset 0 0 16px rgba(0,0,0,0.25);
}
#game-root #hg-canvas {
    display: block; width: 100%; height: auto;
    touch-action: manipulation;
}
#game-root .hg-daily-badge {
    position: absolute; top: 8px; left: 8px;
    padding: 0.22rem 0.55rem;
    font-size: 0.7rem; font-weight: 700;
    color: #4a1a05;
    background: linear-gradient(180deg, #fbd24a 0%, #d99b1e 100%);
    border: 1px solid #b8870b;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
    letter-spacing: 0.04em;
}

/* ─── Meta row (category + lives) ───────────────────────────────────── */
#game-root .hg-meta {
    display: flex; justify-content: space-between; align-items: center;
    gap: 0.5rem;
    margin: 0.55rem 0 0.6rem;
}
#game-root .hg-cat {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    background: rgba(255, 248, 225, 0.95);
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 999px;
    font-size: 0.85rem;
    color: #4a1a05;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 1px 3px rgba(0,0,0,0.18);
}
#game-root .hg-cat-emoji { font-size: 1rem; line-height: 1; }
#game-root .hg-cat strong { color: var(--jul-red-700, #8B0000); }
#game-root .hg-lives {
    display: inline-flex; gap: 2px;
    font-size: 1rem; line-height: 1;
}
#game-root .hg-life {
    color: #cfe6ff;
    filter: drop-shadow(0 0 2px rgba(255,255,255,0.6));
    transition: transform 0.2s ease, opacity 0.2s ease;
}
#game-root .hg-life--gone {
    color: rgba(180, 200, 220, 0.25);
    transform: translateY(2px);
}

/* ─── Word display ──────────────────────────────────────────────────── */
#game-root .hg-word {
    display: flex; justify-content: center; flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0 0 0.75rem;
    padding: 0.6rem 0.4rem;
    background: rgba(0,0,0,0.22);
    border-radius: 12px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.45);
}
#game-root .hg-letter {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.4em; height: 1.8em;
    padding: 0 0.18em;
    border-bottom: 3px solid #fde9a8;
    font-family: var(--jul-font-display, Georgia, serif);
    font-size: 1.45rem; font-weight: 800;
    color: #fff8d0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
    transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), color 0.2s ease;
}
#game-root .hg-letter--blank {
    color: transparent;
}
#game-root .hg-letter--space {
    border-bottom: none; min-width: 0.5em;
}
#game-root .hg-letter--revealed {
    animation: hg-letter-pop 0.45s cubic-bezier(.34,1.56,.64,1);
}
@keyframes hg-letter-pop {
    0%   { transform: translateY(-12px) scale(0.6); opacity: 0; }
    60%  { transform: translateY(2px)   scale(1.18); opacity: 1; }
    100% { transform: translateY(0)     scale(1); }
}

/* ─── Keyboard ──────────────────────────────────────────────────────── */
#game-root .hg-keyboard {
    display: flex; flex-direction: column; gap: 4px;
    margin-bottom: 0.6rem;
}
#game-root .hg-row {
    display: flex; gap: 4px; justify-content: center;
}
#game-root .hg-key {
    flex: 1 1 0;
    min-width: 0;
    aspect-ratio: 1 / 1.05;
    padding: 0;
    border: 1px solid rgba(0,0,0,0.18);
    background: linear-gradient(180deg, #fff8e1 0%, #fbf0c8 100%);
    color: #4a1a05;
    border-radius: 8px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 2px 3px rgba(0,0,0,0.25);
    transition: transform 0.08s ease, background 0.2s ease, color 0.2s ease;
}
#game-root .hg-key:hover:not(:disabled) {
    background: linear-gradient(180deg, #fff3c0 0%, #f5e08c 100%);
    transform: translateY(-1px);
}
#game-root .hg-key:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.25);
}
#game-root .hg-key:disabled {
    cursor: default;
    opacity: 0.85;
}
#game-root .hg-key--hit {
    background: linear-gradient(180deg, #4ade80 0%, #15803d 100%);
    color: #ffffff;
    border-color: #14532d;
    text-shadow: 0 1px 1px rgba(0,0,0,0.35);
}
#game-root .hg-key--miss {
    background: linear-gradient(180deg, #6b7280 0%, #374151 100%);
    color: #cbd5e1;
    border-color: #1f2937;
}

/* ─── End card ──────────────────────────────────────────────────────── */
#game-root .hg-end {
    margin-top: 0.6rem;
    padding: 1rem;
    text-align: center;
    background: linear-gradient(180deg, #fff8e1 0%, #fbf0c8 100%);
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.3);
    animation: hg-end-in 0.35s ease-out;
}
@keyframes hg-end-in {
    0%   { opacity: 0; transform: translateY(-6px) scale(0.95); }
    100% { opacity: 1; transform: none; }
}
#game-root .hg-end h3 {
    margin: 0 0 0.35rem;
    color: var(--jul-red-700, #8B0000);
    font-size: 1.2rem;
}
#game-root .hg-end p {
    margin: 0 0 0.65rem;
    color: #4a1a05;
    font-size: 0.95rem;
}
#game-root .hg-end strong { color: var(--jul-red-700, #8B0000); }
#game-root .hg-btn {
    display: inline-block;
    padding: 0.55rem 1.4rem;
    border: 1px solid #7f1d1d;
    background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
    transition: transform 0.08s ease, background 0.2s ease;
}
#game-root .hg-btn:hover {
    background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
    transform: translateY(-1px);
}
#game-root .hg-btn:active { transform: translateY(1px); }

/* ─── Desktop scale-up ──────────────────────────────────────────────── */
@media (min-width: 720px) {
    #game-root .hg-wrap { max-width: 600px; padding: 1rem; }
    #game-root .hg-val { font-size: 1.4rem; }
    #game-root .hg-pill-icon { font-size: 1.35rem; }
    #game-root .hg-mode { padding: 0.42rem 0.7rem; font-size: 0.86rem; }
    #game-root .hg-letter { font-size: 1.7rem; min-width: 1.5em; height: 2em; }
    #game-root .hg-cat { font-size: 0.95rem; padding: 0.38rem 0.85rem; }
    #game-root .hg-lives { font-size: 1.15rem; }
    #game-root .hg-key { font-size: 1.15rem; border-radius: 10px; }
    #game-root .hg-end h3 { font-size: 1.4rem; }
    #game-root .hg-end p { font-size: 1.05rem; }
    #game-root .hg-btn { padding: 0.65rem 1.6rem; font-size: 1.02rem; }
}
@media (min-width: 1024px) {
    #game-root .hg-wrap { max-width: 720px; padding: 1.15rem; }
    #game-root .hg-letter { font-size: 2rem; min-width: 1.55em; height: 2.05em; }
    #game-root .hg-key { font-size: 1.3rem; }
    #game-root .hg-canvas-wrap { border-width: 4px; }
}

/* ─── Mobile tweaks ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
    #game-root .hg-wrap { padding: 0.6rem; }
    #game-root .hg-header { flex-wrap: wrap; gap: 0.3rem; }
    #game-root .hg-pill { padding: 0.28rem 0.55rem; }
    #game-root .hg-val { font-size: 1.05rem; }
    #game-root .hg-audio { padding: 0.25rem 0.4rem; }
    #game-root .hg-vol { width: 48px; }
    #game-root .hg-modes { gap: 0.25rem; }
    #game-root .hg-mode { padding: 0.3rem 0.5rem; font-size: 0.74rem; }
    #game-root .hg-letter { font-size: 1.2rem; min-width: 1.2em; }
    #game-root .hg-key { font-size: 0.88rem; }
}
