/* ─── Container ─────────────────────────────────────────────────────── */
#game-root .an-wrap {
    padding: 0.75rem;
    max-width: 520px;
    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 pills ─────────────────────────────────────────────────────── */
#game-root .an-header {
    display: flex; align-items: stretch; gap: 0.4rem;
    margin-bottom: 0.55rem;
}
#game-root .an-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 .an-pill-icon {
    font-size: 1.2rem; line-height: 1;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));
}
#game-root .an-pill-body { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
#game-root .an-lbl {
    font-size: 0.6rem; letter-spacing: 0.08em;
    color: #8a5a1a; text-transform: uppercase; font-weight: 700;
}
#game-root .an-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 .an-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 .an-mute {
    background: transparent; border: 0;
    width: 26px; height: 26px; cursor: pointer;
    font-size: 0.95rem; padding: 0;
}
#game-root .an-vol {
    width: 56px; cursor: pointer;
    accent-color: var(--jul-red-700, #8B0000);
}

/* ─── Mode chips ────────────────────────────────────────────────────── */
#game-root .an-modes {
    display: flex; gap: 0.3rem;
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
}
#game-root .an-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 .an-mode:hover:not(.an-mode--active) {
    background: rgba(0,0,0,0.42);
    color: #fff8d0;
}
#game-root .an-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);
}

/* ─── Playfield (watercolor wood-table) ─────────────────────────────── */
#game-root .an-playfield {
    position: relative;
    padding: 0.85rem 0.85rem 1.1rem;
    border: 3px solid #ffd66b;
    border-radius: 14px;
    overflow: hidden;
    background-image: url('/games/jule-anagram/background.jpg');
    background-size: cover;
    background-position: center;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.4), inset 0 0 16px rgba(0,0,0,0.25);
}
#game-root .an-playfield-bar {
    display: flex; justify-content: space-between; align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
#game-root .an-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.15);
    border-radius: 999px;
    font-size: 0.85rem;
    color: #4a1a05;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 1px 4px rgba(0,0,0,0.25);
}
#game-root .an-cat-emoji { font-size: 1rem; line-height: 1; }
#game-root .an-cat strong { color: var(--jul-red-700, #8B0000); }
#game-root .an-clock {
    display: inline-flex; align-items: center;
    padding: 0.28rem 0.65rem;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255, 221, 100, 0.4);
    border-radius: 999px;
    color: #fde9a8;
    font-weight: 700; font-variant-numeric: tabular-nums;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}
#game-root .an-daily-badge {
    position: absolute; top: 8px; right: 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;
    z-index: 2;
}
#game-root .an-prompt {
    margin: 0.4rem 0 0.6rem;
    text-align: center;
    font-size: 0.92rem;
    color: #fff8d0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}

/* ─── Answer slots ──────────────────────────────────────────────────── */
#game-root .an-answer {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 6px;
    min-height: 56px;
    margin-bottom: 1rem;
}
#game-root .an-slot {
    width: 42px; height: 52px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(40, 22, 10, 0.55);
    border: 2px dashed rgba(255, 218, 165, 0.55);
    border-radius: 8px;
    font-family: var(--jul-font-display, Georgia, serif);
    font-size: 1.4rem; font-weight: 800;
    color: #fff8d0;
    text-shadow: 0 1px 0 rgba(0,0,0,0.4);
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.45);
    cursor: default;
    padding: 0;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
#game-root .an-slot--filled {
    background:
        linear-gradient(135deg, rgba(255,255,255,0.18) 0%, rgba(0,0,0,0.18) 100%),
        linear-gradient(180deg, #e1b079 0%, #a87338 100%);
    border: 1px solid #6a4222;
    border-style: solid;
    color: #3a1d08;
    text-shadow: 0 1px 0 rgba(255,240,210,0.5);
    box-shadow:
        inset 0 1px 0 rgba(255,240,210,0.5),
        inset 0 -2px 0 rgba(0,0,0,0.2),
        0 3px 0 #5a3a1a,
        0 5px 8px rgba(0,0,0,0.45);
    cursor: pointer;
}
#game-root .an-slot--filled:hover {
    transform: translateY(-2px);
    box-shadow:
        inset 0 1px 0 rgba(255,240,210,0.5),
        inset 0 -2px 0 rgba(0,0,0,0.2),
        0 5px 0 #5a3a1a,
        0 8px 12px rgba(0,0,0,0.5);
}
#game-root .an-slot--pop {
    animation: an-slot-pop 0.35s cubic-bezier(.34,1.56,.64,1);
}
@keyframes an-slot-pop {
    0%   { transform: translateY(-22px) scale(0.6) rotate(-6deg); opacity: 0; }
    60%  { transform: translateY(2px)   scale(1.1) rotate(2deg);  opacity: 1; }
    100% { transform: none; opacity: 1; }
}
#game-root .an-slot--win {
    animation: an-slot-win 0.55s ease;
}
@keyframes an-slot-win {
    0%   { transform: scale(1); box-shadow: inset 0 1px 0 rgba(255,240,210,0.5), 0 3px 0 #5a3a1a, 0 0 0 rgba(253,224,71,0); }
    40%  { transform: scale(1.12) translateY(-4px); box-shadow: inset 0 1px 0 rgba(255,240,210,0.5), 0 5px 0 #5a3a1a, 0 0 18px rgba(253,224,71,0.85); }
    100% { transform: scale(1); box-shadow: inset 0 1px 0 rgba(255,240,210,0.5), 0 3px 0 #5a3a1a, 0 0 0 rgba(253,224,71,0); }
}
#game-root .an-shake { animation: an-shake 0.45s ease; }
@keyframes an-shake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-6px); }
    40%      { transform: translateX(5px); }
    60%      { transform: translateX(-4px); }
    80%      { transform: translateX(3px); }
}

/* ─── Tile tray ─────────────────────────────────────────────────────── */
#game-root .an-tiles {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 6px;
    min-height: 56px;
    padding: 0.45rem 0.55rem;
    background: rgba(0,0,0,0.32);
    border-radius: 12px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.55);
}
#game-root .an-tile {
    position: relative;
    width: 42px; height: 52px;
    padding: 0; border: 1px solid #6a4222;
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(0,0,0,0.18) 100%),
        linear-gradient(180deg, #e1b079 0%, #a87338 100%);
    color: #3a1d08;
    font-family: var(--jul-font-display, Georgia, serif);
    font-size: 1.4rem; font-weight: 800;
    text-shadow: 0 1px 0 rgba(255,240,210,0.55);
    cursor: pointer;
    box-shadow:
        inset 0 1px 0 rgba(255,240,210,0.55),
        inset 0 -2px 0 rgba(0,0,0,0.22),
        0 3px 0 #5a3a1a,
        0 5px 8px rgba(0,0,0,0.45);
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.2s ease;
}
#game-root .an-tile::before {
    content: '';
    position: absolute; inset: 2px;
    border-radius: 6px;
    background: repeating-linear-gradient(
        90deg,
        transparent 0%, transparent 14%,
        rgba(74, 40, 24, 0.06) 14%, rgba(74, 40, 24, 0.06) 15%
    );
    pointer-events: none;
}
#game-root .an-tile:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow:
        inset 0 1px 0 rgba(255,240,210,0.55),
        inset 0 -2px 0 rgba(0,0,0,0.22),
        0 6px 0 #5a3a1a,
        0 10px 14px rgba(0,0,0,0.5);
}
#game-root .an-tile:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow:
        inset 0 1px 0 rgba(255,240,210,0.55),
        inset 0 1px 4px rgba(0,0,0,0.4),
        0 1px 0 #5a3a1a;
}
#game-root .an-tile--used {
    opacity: 0.22;
    pointer-events: none;
    filter: grayscale(0.5);
}

/* ─── Confetti ──────────────────────────────────────────────────────── */
#game-root .an-confetti {
    position: absolute; inset: 0;
    pointer-events: none; overflow: hidden;
}
#game-root .an-confetti-piece {
    position: absolute;
    top: 38%; left: 50%;
    width: 8px; height: 12px;
    border-radius: 2px;
    animation: an-confetti-fall 1.4s ease-out forwards;
}
@keyframes an-confetti-fall {
    0%   { transform: translate(0, 0) rotate(0); opacity: 1; }
    100% { transform: translate(var(--dx), 240px) rotate(var(--rot)); opacity: 0; }
}

/* ─── Actions ───────────────────────────────────────────────────────── */
#game-root .an-actions {
    display: flex; justify-content: center; gap: 0.4rem;
    margin-top: 0.7rem; flex-wrap: wrap;
}
#game-root .an-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem; font-weight: 700;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.08s ease, background 0.2s ease, opacity 0.2s ease;
}
#game-root .an-btn--primary {
    background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
    color: #fff;
    border: 1px solid #7f1d1d;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
}
#game-root .an-btn--primary:hover:not(:disabled) {
    background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
    transform: translateY(-1px);
}
#game-root .an-btn--primary:active { transform: translateY(1px); }
#game-root .an-btn--primary:disabled {
    background: linear-gradient(180deg, #7a3030 0%, #4a1818 100%);
    cursor: default; opacity: 0.55;
    box-shadow: none;
}
#game-root .an-btn--ghost {
    background: rgba(255, 248, 225, 0.95);
    color: #4a1a05;
    border: 1px solid rgba(0,0,0,0.12);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 2px 4px rgba(0,0,0,0.18);
}
#game-root .an-btn--ghost:hover {
    background: #fff;
    transform: translateY(-1px);
}
#game-root .an-btn--ghost:active { transform: translateY(1px); }

/* ─── Status message ────────────────────────────────────────────────── */
#game-root .an-message {
    text-align: center;
    margin-top: 0.65rem;
    min-height: 1.6em;
    font-weight: 600;
    color: #fde9a8;
}
#game-root .an-msg-good {
    color: #4ade80;
    font-size: 1.1rem;
    text-shadow: 0 1px 6px rgba(74, 222, 128, 0.4);
}
#game-root .an-msg-bad {
    color: #fda4af;
}
#game-root .an-msg-time {
    display: inline-block; margin-left: 0.4rem;
    padding: 0.1rem 0.55rem;
    background: rgba(0,0,0,0.45);
    border-radius: 999px;
    color: #fff8d0;
    font-weight: 700; font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

/* ─── Desktop scale-up ──────────────────────────────────────────────── */
@media (min-width: 720px) {
    #game-root .an-wrap { max-width: 640px; padding: 1rem; }
    #game-root .an-val { font-size: 1.4rem; }
    #game-root .an-pill-icon { font-size: 1.35rem; }
    #game-root .an-mode { padding: 0.42rem 0.7rem; font-size: 0.86rem; }
    #game-root .an-playfield { padding: 1.1rem 1.1rem 1.35rem; }
    #game-root .an-cat { font-size: 0.95rem; padding: 0.38rem 0.85rem; }
    #game-root .an-clock { font-size: 0.95rem; padding: 0.32rem 0.8rem; }
    #game-root .an-prompt { font-size: 1.05rem; }
    #game-root .an-slot,
    #game-root .an-tile { width: 52px; height: 64px; font-size: 1.7rem; border-radius: 10px; }
    #game-root .an-answer,
    #game-root .an-tiles { min-height: 68px; gap: 8px; }
    #game-root .an-btn { font-size: 0.98rem; padding: 0.6rem 1.15rem; }
    #game-root .an-msg-good { font-size: 1.2rem; }
}
@media (min-width: 1024px) {
    #game-root .an-wrap { max-width: 760px; padding: 1.15rem; }
    #game-root .an-playfield { padding: 1.25rem 1.25rem 1.5rem; }
    #game-root .an-slot,
    #game-root .an-tile { width: 60px; height: 74px; font-size: 1.95rem; }
    #game-root .an-answer,
    #game-root .an-tiles { min-height: 78px; gap: 10px; }
    #game-root .an-cat { font-size: 1rem; }
    #game-root .an-prompt { font-size: 1.1rem; }
}

/* ─── Mobile ────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    #game-root .an-wrap { padding: 0.6rem; }
    #game-root .an-header { flex-wrap: wrap; gap: 0.3rem; }
    #game-root .an-val { font-size: 1.05rem; }
    #game-root .an-audio { padding: 0.25rem 0.4rem; }
    #game-root .an-vol { width: 48px; }
    #game-root .an-modes { gap: 0.25rem; }
    #game-root .an-mode { padding: 0.3rem 0.5rem; font-size: 0.74rem; }
    #game-root .an-slot,
    #game-root .an-tile { width: 36px; height: 46px; font-size: 1.2rem; }
    #game-root .an-cat { font-size: 0.78rem; padding: 0.25rem 0.55rem; }
    #game-root .an-clock { font-size: 0.78rem; padding: 0.2rem 0.55rem; }
}
