/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
    /* Color Palette */
    --bg-dark: #20130b;
    --primary-gradient:
        radial-gradient(circle at 18% 12%, rgba(151, 92, 40, 0.34), transparent 28%),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(180deg, #3a2112 0%, #271509 48%, #160c06 100%);
    --accent-teal: #d79b45;
    --accent-teal-glow: rgba(215, 155, 69, 0.38);
    --accent-purple: #875323;
    --accent-purple-glow: rgba(135, 83, 35, 0.42);
    --text-light: #fff3d4;
    --text-muted: #c9a878;
    
    /* UI Glassmorphism Variables */
    --glass-bg: linear-gradient(180deg, rgba(113, 66, 31, 0.88), rgba(59, 33, 15, 0.94));
    --glass-border: rgba(255, 210, 137, 0.22);
    --glass-border-active: rgba(232, 177, 91, 0.55);
    --glass-shadow: 0 8px 22px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 231, 180, 0.12);
    --backdrop-blur: blur(3px);
    
    /* Cell Variables */
    --cell-size: 50px;
    --cell-gap: 8px;
    --cell-bg: linear-gradient(180deg, #ead3a0 0%, #b98242 100%);
    --cell-border: rgba(71, 38, 14, 0.78);
    --cell-solved-bg: linear-gradient(180deg, #ffe19a 0%, #c78332 100%);
    --cell-solved-border: #f1c36a;
    --cell-solved-shadow: 0 0 12px rgba(255, 197, 87, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.22);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --wheel-size: clamp(156px, 36vmin, 285px);
    --node-size: clamp(34px, 8vmin, 52px);
    --app-height: 100vh;
    --controls-height: 230px;
    --wood-texture: url("assets/wood-planks.jpg");

    /* Fonts */
    --font-main: 'Outfit', sans-serif;
}

/* ==========================================================================
   RESET & FOUNDATIONS
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    min-height: var(--app-height);
    margin: 0;
    padding: 0;
    overflow: hidden;
    position: fixed; /* Prevents scroll elastic bounce */
    inset: 0;
    touch-action: none; /* Prevents pinch-zoom and double-tap zoom */
    -webkit-text-size-adjust: 100%;
    overscroll-behavior: none;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    background-image: var(--primary-gradient);
    background-size: 100% 100%, 34px 34px, 100% 100%;
    color: var(--text-light);
    display: flex;
    justify-content: center;
    align-items: stretch;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        linear-gradient(180deg, transparent 0 18%, rgba(255, 221, 151, 0.08) 18.3%, rgba(32, 15, 4, 0.56) 19.2%, transparent 20%),
        linear-gradient(180deg, transparent 0 43%, rgba(255, 221, 151, 0.08) 43.3%, rgba(32, 15, 4, 0.58) 44.4%, transparent 45%),
        linear-gradient(180deg, transparent 0 68%, rgba(255, 221, 151, 0.07) 68.3%, rgba(32, 15, 4, 0.55) 69.4%, transparent 70%);
    mix-blend-mode: screen;
    opacity: 0.7;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(circle at 50% 42%, transparent 0 38%, rgba(7, 3, 1, 0.42) 76%),
        linear-gradient(90deg, rgba(0, 0, 0, 0.28), transparent 13%, transparent 87%, rgba(0, 0, 0, 0.28));
}

/* ==========================================================================
   AMBIENT GLOWING ORBS
   ========================================================================== */
.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0;
    z-index: 0;
    pointer-events: none;
    transition: all 1s ease-in-out;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background-color: var(--accent-teal);
    top: 10%;
    left: -100px;
    animation: floatOrb1 15s infinite alternate ease-in-out;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background-color: var(--accent-purple);
    bottom: -100px;
    right: -100px;
    animation: floatOrb2 20s infinite alternate ease-in-out;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background-color: #7c451c;
    top: 50%;
    left: 60%;
    transform: translate(-50%, -50%);
    animation: floatOrb3 18s infinite alternate ease-in-out;
}

@keyframes floatOrb1 {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(50px) scale(1.1); }
}
@keyframes floatOrb2 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-80px, -40px) scale(0.9); }
}
@keyframes floatOrb3 {
    0% { transform: translate(-50%, -50%) scale(0.9); }
    100% { transform: translate(-30%, -60%) scale(1.2); }
}

/* ==========================================================================
   GLASSMORPHIC CARDS
   ========================================================================== */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border-radius: 8px;
    box-shadow: var(--glass-shadow);
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */
.game-container {
    width: 100%;
    height: var(--app-height);
    max-height: var(--app-height);
    display: flex;
    flex-direction: column;
    padding: calc(8px + var(--safe-top)) calc(8px + var(--safe-right)) calc(8px + var(--safe-bottom)) calc(8px + var(--safe-left));
    z-index: 10;
    gap: 7px;
    box-sizing: border-box;
    overflow: hidden;
}

/* Header / HUD */
.game-header {
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(130px, 1fr) minmax(0, auto);
    align-items: center;
    column-gap: 12px;
    padding: 6px 12px;
    height: 52px;
    min-height: 0;
    border-radius: 8px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.level-badge {
    background: linear-gradient(180deg, #c28a42 0%, #744018 100%);
    color: #fff0c7;
    padding: 4px 12px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    box-shadow: inset 0 1px 0 rgba(255, 233, 176, 0.22), 0 3px 8px var(--accent-purple-glow);
}

.game-title {
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #ffe7ad, #c59b63);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}

.level-progress {
    min-width: 0;
}

.level-progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.progress-track {
    width: 100%;
    height: 7px;
    overflow: hidden;
    border-radius: 4px;
    background: rgba(39, 20, 8, 0.72);
    border: 1px solid rgba(255, 210, 137, 0.18);
}

.progress-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #9e5d22 0%, #d79b45 55%, #ffe09a 100%);
    box-shadow: 0 0 12px rgba(215, 155, 69, 0.4);
    transition: width 0.45s ease;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.gold-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(180deg, rgba(103, 58, 24, 0.86), rgba(48, 26, 10, 0.92));
    border: 1px solid rgba(255, 211, 137, 0.22);
    padding: 8px 13px;
    border-radius: 6px;
    font-weight: 600;
    min-width: 72px;
    justify-content: center;
}

.gold-icon {
    font-size: 1.2rem;
    animation: goldPulse 2s infinite ease-in-out;
}

.gold-container.gold-pop {
    animation: goldPop 0.45s ease-out;
}

@keyframes goldPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); filter: drop-shadow(0 0 4px gold); }
}

@keyframes goldPop {
    0% { transform: scale(1); border-color: rgba(255, 255, 255, 0.1); }
    45% { transform: scale(1.08); border-color: rgba(255, 215, 0, 0.65); box-shadow: 0 0 18px rgba(255, 215, 0, 0.28); }
    100% { transform: scale(1); border-color: rgba(255, 255, 255, 0.1); }
}

.hud-btn {
    background: linear-gradient(180deg, rgba(117, 67, 27, 0.86), rgba(50, 27, 10, 0.94));
    border: 1px solid rgba(255, 211, 137, 0.2);
    color: var(--text-light);
    width: 44px;
    height: 44px;
    border-radius: 7px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.hud-btn:hover {
    background: linear-gradient(180deg, rgba(146, 86, 35, 0.9), rgba(66, 36, 14, 0.96));
    border-color: var(--accent-teal);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(215, 155, 69, 0.22);
}

.hud-btn:active {
    transform: scale(0.95);
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #a83218;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* ==========================================================================
   GAME WORKSPACE LAYOUT
   ========================================================================== */
.game-workspace {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(230px, 0.8fr);
    gap: 10px;
    min-height: 0; /* Important for flex child overflow */
    overflow: hidden;
}

/* ==========================================================================
   PUZZLE BOARD SECTION
   ========================================================================== */
.board-section {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    position: relative;
    min-height: 0;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(98, 55, 24, 0.92), rgba(42, 23, 10, 0.96)),
        repeating-linear-gradient(90deg, rgba(255, 224, 164, 0.04) 0 6px, rgba(0, 0, 0, 0.03) 6px 12px);
}

.board-scroll-wrapper {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden; /* Ensure absolutely no scrollbars */
    padding: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Board Crossword Grid */
.board-grid {
    display: grid;
    gap: var(--cell-gap, 8px);
    position: relative;
    margin: auto;
}

/* Grid Cell Styles */
.grid-cell {
    width: var(--cell-size, 50px);
    height: var(--cell-size, 50px);
    border-radius: 5px;
    border: 2px solid var(--cell-border);
    background: var(--cell-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: calc(var(--cell-size, 50px) * 0.55); /* Fully dynamic text scaling! */
    font-weight: 800;
    color: #2c1608;
    text-transform: uppercase;
    position: relative;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: inset 0 1px 0 rgba(255, 247, 219, 0.26), inset 0 -3px 0 rgba(65, 33, 11, 0.18), 0 3px 0 rgba(35, 18, 7, 0.55);
}

.grid-cell.null-cell {
    border-color: transparent;
    background: transparent;
    visibility: hidden;
    pointer-events: none;
}

.grid-cell.solved {
    background: var(--cell-solved-bg);
    border-color: var(--cell-solved-border);
    color: #321807;
    box-shadow: var(--cell-solved-shadow);
    transform: scale(1.05);
    animation: solvePulse 0.5s ease-out;
}

.grid-cell.word-hit {
    animation: cellHit 0.62s ease-out;
}

@keyframes solvePulse {
    0% { transform: scale(1); filter: brightness(1.5); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1.05); }
}

@keyframes cellHit {
    0% { transform: scale(0.78); filter: brightness(1.8); }
    55% { transform: scale(1.16); }
    100% { transform: scale(1.05); filter: brightness(1); }
}

.board-section.board-complete {
    animation: boardComplete 0.9s ease-out;
}

@keyframes boardComplete {
    0% { border-color: rgba(255, 255, 255, 0.08); box-shadow: var(--glass-shadow); }
    40% { border-color: rgba(255, 215, 0, 0.75); box-shadow: 0 0 32px rgba(255, 215, 0, 0.35); }
    100% { border-color: rgba(255, 255, 255, 0.08); box-shadow: var(--glass-shadow); }
}

/* Cell Letter Reveal Effect (Hint) */
.grid-cell.hint-revealed {
    background: linear-gradient(180deg, #f2c46e 0%, #9f5d24 100%);
    border-color: #f0cf87;
    color: #2c1608;
    box-shadow: 0 0 15px rgba(240, 207, 135, 0.45);
    animation: hintRevealPulse 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes hintRevealPulse {
    0% { transform: scale(0.6) rotate(-10deg); opacity: 0; }
    70% { transform: scale(1.2) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* ==========================================================================
   WHEEL & LETTER SELECTION SECTION
   ========================================================================== */
.wheel-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0;
    gap: 7px;
    min-height: 0;
    overflow: hidden;
}

/* Floating Spelled Preview Bubble */
.preview-container {
    height: 34px;
    min-height: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.preview-bubble {
    background: linear-gradient(180deg, rgba(79, 45, 19, 0.94), rgba(34, 18, 7, 0.96));
    border: 1px solid rgba(255, 211, 137, 0.22);
    padding: 5px 16px;
    border-radius: 6px;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #fff;
    text-transform: uppercase;
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
    transform: scale(0);
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.preview-bubble.active {
    transform: scale(1);
    opacity: 1;
    border-color: var(--accent-teal);
    box-shadow: 0 0 15px rgba(215, 155, 69, 0.3);
}

/* Interactive Wheel Box */
.wheel-workspace {
    position: relative;
    width: var(--wheel-size);
    height: var(--wheel-size);
    max-width: 100%;
    max-height: 100%;
    margin: 2px 0;
    flex: 0 1 auto;
}

.wheel-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.letter-wheel {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background:
        radial-gradient(circle at 34% 28%, rgba(255, 226, 163, 0.18), transparent 22%),
        radial-gradient(circle, #8a4f22 0%, #5b3013 58%, #2d1608 100%);
    border: 6px solid rgba(70, 36, 13, 0.92);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.48), 0 6px 0 rgba(31, 15, 5, 0.7), 0 0 0 1px rgba(255, 211, 137, 0.18);
    touch-action: none; /* Disable panning & zooming while dragging */
}

/* Re-ordering Animation */
.letter-wheel.spinning {
    animation: wheelRotate 0.6s cubic-bezier(0.645, 0.045, 0.355, 1), wheelFlash 0.6s ease-out;
}

@keyframes wheelRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes wheelFlash {
    0% { box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.4); border-color: rgba(255, 255, 255, 0.03); }
    50% { box-shadow: inset 0 0 28px rgba(0, 242, 254, 0.18), 0 0 22px rgba(0, 242, 254, 0.18); border-color: rgba(0, 242, 254, 0.28); }
    100% { box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.4); border-color: rgba(255, 255, 255, 0.03); }
}

/* Letter Node Styles */
.letter-node {
    position: absolute;
    width: var(--node-size);
    height: var(--node-size);
    margin-left: calc(var(--node-size) / -2);
    margin-top: calc(var(--node-size) / -2);
    border-radius: 50%;
    background: radial-gradient(circle at 30% 25%, #ffe1a1, #bd7a34 58%, #6d3a15);
    border: 1px solid rgba(58, 29, 9, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: calc(var(--node-size) * 0.52);
    font-weight: 800;
    color: #2d1608;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), 0 4px 0 rgba(38, 18, 6, 0.72), 0 8px 12px rgba(0,0,0,0.28);
    transition: transform 0.2s, background 0.2s, border-color 0.2s;
    z-index: 10;
}

.letter-node span {
    position: relative;
    z-index: 2;
    text-shadow: 0 1px 0 rgba(255, 245, 211, 0.38), 0 2px 2px rgba(45, 20, 5, 0.22);
}

.letter-node::after {
    content: "";
    position: absolute;
    inset: 10%;
    border-radius: 50%;
    background: radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.42), transparent 34%);
    pointer-events: none;
    z-index: 1;
}

.letter-node:hover {
    transform: scale(1.08);
    border-color: rgba(255, 255, 255, 0.35);
}

.letter-node.selected {
    background: radial-gradient(circle at 30% 25%, #fff1bb, #e6a84f 55%, #9b5b21);
    border-color: var(--accent-teal);
    color: #2d1608;
    transform: scale(1.15);
    box-shadow: 0 0 15px var(--accent-teal-glow);
}

.letter-node.selected span {
    animation: nodepop 0.25s ease-out;
}

@keyframes nodepop {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Action Control Buttons (Shuffle, Hint) */
.wheel-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    width: 100%;
    min-height: 44px;
    flex-shrink: 0;
}

.action-btn {
    background: linear-gradient(180deg, rgba(116, 67, 28, 0.9), rgba(45, 24, 9, 0.96));
    border: 1px solid rgba(255, 211, 137, 0.22);
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.circle-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.circle-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--accent-teal);
    transform: rotate(45deg) translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 242, 254, 0.2);
}

.action-icon {
    width: 20px;
    height: 20px;
}

.hint-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 7px;
    font-weight: 700;
    font-size: 0.9rem;
}

.hint-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: #ffd700;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.2);
}

.hint-icon {
    font-size: 1rem;
}

.hint-cost {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 0.85rem;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.premium-joker {
    color: #fff2bd;
    font-size: 1.15rem;
}

.solve-btn {
    min-width: 88px;
}

.joker-activated {
    animation: jokerActivated 0.72s ease-out;
}

.dimmed-letter {
    opacity: 0.32;
    filter: grayscale(0.75) brightness(0.78);
}

@keyframes jokerActivated {
    0% { transform: scale(1); filter: brightness(1); }
    35% { transform: scale(1.12); filter: brightness(1.55); box-shadow: 0 0 24px rgba(255, 224, 154, 0.72); }
    100% { transform: scale(1); filter: brightness(1); }
}

.action-btn:active {
    transform: scale(0.95);
}

/* ==========================================================================
   MODAL WINDOWS & OVERLAYS
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(20, 11, 5, 0.84);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 90%;
    max-width: 420px;
    max-height: calc(var(--app-height) - 24px - var(--safe-top) - var(--safe-bottom));
    overflow-y: auto;
    padding: clamp(18px, 4vmin, 28px);
    position: relative;
    text-align: center;
    border: 1px solid rgba(255, 211, 137, 0.24);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #ff2d55;
}

/* Animation Zoom In */
.animated-zoom {
    transform: scale(0.7);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .animated-zoom {
    transform: scale(1);
    opacity: 1;
}

/* Success Card Banner Details */
.success-banner {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(45deg, #ffe09a, #d79b45, #8f4d1c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    animation: textFlash 1.5s infinite alternate ease-in-out;
}

@keyframes textFlash {
    0% { filter: drop-shadow(0 0 2px rgba(255,215,0,0.2)); }
    100% { filter: drop-shadow(0 0 15px rgba(255,170,0,0.8)); }
}

.modal-content h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.modal-desc {
    color: var(--text-muted);
    margin-bottom: 25px;
}

.reward-stats {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.stat-card {
    background: linear-gradient(180deg, rgba(99, 57, 24, 0.82), rgba(45, 24, 9, 0.92));
    border: 1px solid rgba(255, 211, 137, 0.2);
    border-radius: 7px;
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    min-width: 128px;
}

.stat-value {
    color: #ffe09a;
    font-size: 2.2rem;
    font-weight: 800;
    text-shadow: 0 0 10px rgba(255,215,0,0.3);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 5px;
}

/* Modular Buttons */
.btn {
    border: none;
    border-radius: 7px;
    padding: 14px 35px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-primary {
    background: linear-gradient(180deg, #f2c46e 0%, #a76025 100%);
    color: #2b1507;
    box-shadow: 0 8px 18px rgba(94, 50, 18, 0.35);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(215, 155, 69, 0.35);
}

.btn-secondary {
    background: rgba(75, 42, 17, 0.74);
    border: 1px solid rgba(255, 211, 137, 0.2);
    color: var(--text-light);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);
}

.btn:active {
    transform: scale(0.97);
}

/* Extra Words Modal List */
.chest-header {
    margin-bottom: 20px;
}

.chest-header h2 {
    font-size: 1.6rem;
}

.chest-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

.extra-words-list {
    background: rgba(32, 17, 6, 0.54);
    border: 1px solid rgba(255, 211, 137, 0.13);
    border-radius: 7px;
    min-height: 150px;
    max-height: 250px;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-content: flex-start;
    margin-bottom: 20px;
}

.extra-word-tag {
    background: rgba(215, 155, 69, 0.14);
    border: 1px solid rgba(215, 155, 69, 0.28);
    color: var(--accent-teal);
    padding: 5px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    animation: nodepop 0.3s ease-out;
}

.chest-footer {
    font-size: 0.85rem;
    color: #ffd700;
    font-weight: 600;
}

/* Help Modal Steps */
.help-steps {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 25px 0;
}

.help-step {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.step-num {
    background: var(--accent-teal);
    color: #2b1507;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.help-step p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.4;
}

/* ==========================================================================
   TOAST SYSTEM NOTIFICATIONS
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: rgba(57, 32, 13, 0.94);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    color: #fff;
    padding: 12px 28px;
    border-radius: 7px;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-left: 4px solid var(--accent-teal);
}

.toast.toast-error {
    border-left-color: #b33b1e;
    background: rgba(61, 25, 14, 0.94);
}

.toast.toast-success {
    border-left-color: #d79b45;
    background: rgba(42, 46, 20, 0.94);
}

.toast.active {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   CONFETTI CELEBRATORY CANVAS
   ========================================================================== */
.confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: var(--app-height);
    z-index: 99;
    pointer-events: none;
}

/* ==========================================================================
   RESPONSIVE DESIGN BREAKPOINTS
   ========================================================================== */

/* Large Tablets / Small Desktops / Mobile Portrait Stacking */
@media (max-width: 900px) and (orientation: portrait) {
    .game-container {
        height: var(--app-height);
        max-height: var(--app-height);
        overflow: hidden;
        padding: calc(6px + var(--safe-top)) calc(6px + var(--safe-right)) calc(6px + var(--safe-bottom)) calc(6px + var(--safe-left));
        gap: 6px;
    }
    
    .game-header {
        grid-template-columns: minmax(0, auto) minmax(72px, 1fr) minmax(0, auto);
        height: var(--header-height, 46px);
        padding: 6px 8px;
        border-radius: 8px;
        column-gap: 7px;
    }

    .header-left {
        gap: 6px;
        min-width: 0;
    }

    .game-title {
        display: none;
    }

    .level-progress-meta {
        font-size: 0.64rem;
        margin-bottom: 3px;
    }

    .progress-track {
        height: 6px;
    }

    .header-right {
        gap: 5px;
    }

    .gold-container {
        min-width: 58px;
        gap: 4px;
        padding: 6px 8px;
        font-size: 0.82rem;
    }

    .hud-btn {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }
    
    .game-workspace {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) var(--controls-height);
        gap: 6px;
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }
    
    .board-section {
        min-height: 0;
        padding: 6px;
    }
    
    .wheel-section {
        padding: 2px 0;
        justify-content: center;
        gap: 3px;
        height: var(--controls-height);
    }
    
    .preview-container {
        height: 28px;
    }
    
    .preview-bubble {
        padding: 4px 12px;
        font-size: 1rem;
        border-radius: 6px;
    }
    
    .wheel-workspace {
        margin: 2px 0;
    }
    
    .circle-btn {
        width: 38px;
        height: 38px;
    }
    
    .hint-btn {
        padding: 6px 14px;
        font-size: 0.8rem;
    }

    .action-icon {
        width: 16px;
        height: 16px;
    }
    
    :root {
        --wheel-size: clamp(124px, 26dvh, 198px);
        --node-size: clamp(30px, 5.6dvh, 39px);
    }
}

/* Mobile Devices Spacing Optimizations */
@media (max-width: 600px) {
    .game-container {
        padding: calc(5px + var(--safe-top)) calc(5px + var(--safe-right)) calc(5px + var(--safe-bottom)) calc(5px + var(--safe-left));
        gap: 5px;
    }
    
    .game-header {
        padding: 5px 6px;
        height: var(--header-height, 42px);
    }
    
    .level-badge {
        padding: 3px 7px;
        font-size: 0.66rem;
        white-space: nowrap;
    }
    
    .board-section {
        padding: 4px;
    }
    
    .modal-content {
        padding: 18px;
        max-width: 380px;
    }
    
    .success-banner {
        font-size: 1.6rem;
    }

    .toast-container {
        bottom: calc(12px + var(--safe-bottom));
        width: calc(100vw - 20px);
    }

    .toast {
        width: 100%;
        text-align: center;
        padding: 10px 16px;
        font-size: 0.88rem;
    }
}

@media (max-height: 620px) {
    .game-container {
        padding-top: calc(4px + var(--safe-top));
        padding-bottom: calc(4px + var(--safe-bottom));
        gap: 4px;
    }

    .game-header {
        height: var(--header-height, 38px);
    }

    .preview-container {
        height: 26px;
    }

    .wheel-actions {
        min-height: 36px;
    }

    .circle-btn {
        width: 34px;
        height: 34px;
    }

    .hint-btn {
        padding: 5px 12px;
    }

    :root {
        --wheel-size: clamp(112px, 23dvh, 176px);
        --node-size: clamp(28px, 5dvh, 36px);
    }
}

@media (orientation: landscape) and (max-height: 520px) {
    .game-header {
        height: 44px;
    }

    .game-title {
        display: none;
    }

    .game-workspace {
        grid-template-columns: minmax(0, 1fr) minmax(170px, 0.62fr);
        gap: 6px;
    }

    .board-section {
        padding: 5px;
    }

    .preview-container {
        height: 24px;
    }

    :root {
        --wheel-size: clamp(118px, 56dvh, 210px);
        --node-size: clamp(28px, 11dvh, 38px);
    }
}

/* ==========================================================================
   INTERACTION ANIMATIONS
   ========================================================================== */
.preview-bubble.animated-shake {
    animation: bubbleShake 0.4s ease-in-out;
}

@keyframes bubbleShake {
    0%, 100% { transform: scale(1) translateX(0); }
    20%, 60% { transform: scale(1) translateX(-8px); }
    40%, 80% { transform: scale(1) translateX(8px); }
}

/* ==========================================================================
   HARD MOBILE WEBVIEW LOCK + ANTIQUE WOOD SKIN
   ========================================================================== */
html,
body {
    width: 100vw !important;
    height: var(--app-height) !important;
    max-height: var(--app-height) !important;
    overflow: hidden !important;
    overscroll-behavior: none !important;
}

body {
    background:
        linear-gradient(180deg, rgba(37, 18, 6, 0.32), rgba(15, 7, 2, 0.52)),
        var(--wood-texture),
        linear-gradient(90deg, rgba(255, 226, 158, 0.06), rgba(44, 22, 7, 0.12) 16%, rgba(255, 221, 149, 0.04) 33%, rgba(26, 12, 4, 0.14) 52%, rgba(255, 226, 158, 0.05) 70%, rgba(52, 27, 9, 0.16)),
        repeating-linear-gradient(90deg, #4b2811 0 28px, #5d3417 28px 54px, #3b1f0d 54px 82px),
        linear-gradient(180deg, #6c3e1b 0%, #321707 100%) !important;
    background-size: cover, 520px auto, auto, auto, auto !important;
    background-blend-mode: multiply, soft-light, normal, normal, normal !important;
    color: #fff3d4 !important;
}

.game-container {
    width: 100vw !important;
    height: var(--app-height) !important;
    max-height: var(--app-height) !important;
    padding: calc(4px + var(--safe-top)) calc(4px + var(--safe-right)) calc(4px + var(--safe-bottom)) calc(4px + var(--safe-left)) !important;
    gap: 4px !important;
    overflow: hidden !important;
}

.glass-card,
.game-header,
.board-section,
.modal-content {
    background:
        linear-gradient(180deg, rgba(39, 18, 5, 0.38), rgba(22, 10, 3, 0.55)),
        var(--wood-texture),
        linear-gradient(90deg, rgba(255, 229, 164, 0.06), transparent 18%, rgba(0, 0, 0, 0.1) 38%, rgba(255, 229, 164, 0.05) 60%, transparent 82%),
        repeating-linear-gradient(90deg, #744218 0 24px, #633613 24px 47px, #814d20 47px 72px),
        linear-gradient(180deg, rgba(107, 61, 25, 0.96), rgba(48, 25, 9, 0.98)) !important;
    background-size: cover, 460px auto, auto, auto, auto !important;
    background-blend-mode: multiply, soft-light, normal, normal, normal !important;
    border: 1px solid rgba(255, 211, 137, 0.32) !important;
    border-radius: 8px !important;
    box-shadow: inset 0 1px 0 rgba(255, 235, 184, 0.18), 0 5px 14px rgba(0, 0, 0, 0.42) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.board-section {
    background:
        radial-gradient(circle at center, rgba(125, 71, 30, 0.58), rgba(30, 13, 4, 0.74) 70%),
        var(--wood-texture),
        linear-gradient(180deg, rgba(115, 68, 30, 0.78), rgba(45, 23, 8, 0.9)),
        repeating-linear-gradient(0deg, rgba(255, 230, 168, 0.08) 0 2px, transparent 2px 18px),
        repeating-linear-gradient(90deg, #6d3e18 0 30px, #7c491f 30px 62px, #553013 62px 96px) !important;
    background-size: cover, 600px auto, auto, auto, auto !important;
    background-blend-mode: normal, soft-light, normal, normal, normal !important;
    border-width: 2px !important;
    box-shadow:
        inset 0 0 0 2px rgba(255, 231, 168, 0.07),
        inset 0 20px 44px rgba(255, 210, 125, 0.08),
        inset 0 -38px 70px rgba(14, 6, 2, 0.38),
        0 12px 24px rgba(0, 0, 0, 0.42) !important;
}

.board-section::before,
.board-section::after {
    content: "";
    position: absolute;
    inset: 7px;
    border-radius: 7px;
    pointer-events: none;
    background:
        radial-gradient(circle at 10px 10px, #fff0b7 0 3px, #b8782e 4px 9px, transparent 10px),
        radial-gradient(circle at calc(100% - 10px) 10px, #fff0b7 0 3px, #b8782e 4px 9px, transparent 10px),
        radial-gradient(circle at 10px calc(100% - 10px), #fff0b7 0 3px, #b8782e 4px 9px, transparent 10px),
        radial-gradient(circle at calc(100% - 10px) calc(100% - 10px), #fff0b7 0 3px, #b8782e 4px 9px, transparent 10px);
    box-shadow: inset 0 0 0 1px rgba(255, 224, 154, 0.08);
    opacity: 0.55;
}

.board-section::before {
    top: 7px;
    left: 7px;
}

.board-section::after {
    display: none;
}

.level-badge,
.gold-container,
.hud-btn,
.action-btn,
.btn {
    border-radius: 7px !important;
    background: linear-gradient(180deg, #c98d43 0%, #7a4219 55%, #3c1e0a 100%) !important;
    color: #fff1c7 !important;
    border: 1px solid rgba(255, 218, 146, 0.34) !important;
    box-shadow: inset 0 1px 0 rgba(255, 243, 205, 0.25), 0 3px 0 rgba(45, 21, 6, 0.68) !important;
}

.progress-track {
    background: #2e1607 !important;
    border-color: rgba(255, 218, 146, 0.28) !important;
}

.progress-fill {
    background: linear-gradient(90deg, #7a4219 0%, #d79b45 62%, #ffe09a 100%) !important;
}

.grid-cell {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent 34%),
        linear-gradient(180deg, #eed19a 0%, #c48943 56%, #8d501f 100%) !important;
    border: 2px solid rgba(58, 29, 9, 0.82) !important;
    border-radius: 7px !important;
    color: #2c1506 !important;
    box-shadow: inset 0 1px 0 rgba(255, 249, 222, 0.36), inset 0 -3px 0 rgba(57, 28, 8, 0.22), 0 3px 0 rgba(35, 17, 5, 0.55) !important;
}

.grid-cell.null-cell {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

.grid-cell.solved,
.grid-cell.hint-revealed {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.24), transparent 34%),
        linear-gradient(180deg, #ffe6a8 0%, #d79b45 58%, #9c5b21 100%) !important;
    color: #2c1506 !important;
}

.letter-wheel {
    background:
        radial-gradient(circle at 32% 25%, rgba(255, 232, 171, 0.35), transparent 18%),
        repeating-radial-gradient(circle, rgba(255, 230, 170, 0.08) 0 2px, transparent 2px 14px),
        radial-gradient(circle, #8a4f22 0%, #5c3114 58%, #2b1406 100%) !important;
    border: 10px solid #4a250b !important;
    box-shadow:
        inset 0 0 18px rgba(0, 0, 0, 0.52),
        inset 0 0 0 7px rgba(255, 214, 137, 0.08),
        0 8px 0 rgba(28, 12, 3, 0.75),
        0 18px 28px rgba(0, 0, 0, 0.36),
        0 0 0 2px rgba(255, 218, 146, 0.28) !important;
}

    .letter-node {
        width: var(--node-size) !important;
        height: var(--node-size) !important;
        font-size: calc(var(--node-size) * 0.52) !important;
        border-width: 2px !important;
        box-shadow: inset 0 2px 0 rgba(255,255,255,0.34), 0 6px 0 rgba(38, 18, 6, 0.76), 0 12px 18px rgba(0,0,0,0.32), 0 0 18px rgba(255, 218, 146, 0.22) !important;
    }

    .letter-node.selected {
        transform: scale(1.13) !important;
        box-shadow: inset 0 2px 0 rgba(255,255,255,0.4), 0 0 28px rgba(255, 224, 154, 0.76), 0 7px 0 rgba(57, 26, 7, 0.8) !important;
    }

    .letter-node {
        background: radial-gradient(circle at 30% 24%, #fff0bb 0%, #d89a45 48%, #7b4218 100%) !important;
        color: #2c1506 !important;
        border: 1px solid rgba(47, 22, 6, 0.88) !important;
    }

.connection-line {
    stroke-dasharray: 18 10;
    animation: connectionFlow 0.75s linear infinite;
}

@keyframes connectionFlow {
    to { stroke-dashoffset: -28; }
}

.tile-correct {
    animation: tileCorrectFlash 0.58s ease-out !important;
}

@keyframes tileCorrectFlash {
    0% { transform: scale(1); filter: brightness(1); }
    35% { transform: scale(1.14); filter: brightness(1.45); box-shadow: 0 0 22px rgba(255, 223, 139, 0.8), 0 4px 0 rgba(45, 21, 6, 0.7); }
    100% { transform: scale(1.05); filter: brightness(1); }
}

.wrong-pulse {
    animation: wrongPulse 0.46s ease-out !important;
}

@keyframes wrongPulse {
    0%, 100% { transform: translateX(0); filter: brightness(1); }
    20% { transform: translateX(-7px); filter: sepia(0.4) saturate(1.6) hue-rotate(-18deg); }
    45% { transform: translateX(7px); }
    70% { transform: translateX(-4px); }
}

.game-bg,
.effects-layer,
.combo-badge,
.finger-tutorial {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.game-bg {
    z-index: 1;
    overflow: hidden;
}

.game-container {
    position: relative;
}

.game-container::before {
    content: "";
    position: absolute;
    inset: calc(3px + var(--safe-top)) calc(3px + var(--safe-right)) calc(3px + var(--safe-bottom)) calc(3px + var(--safe-left));
    border-radius: 12px;
    pointer-events: none;
    z-index: -1;
    background:
        linear-gradient(180deg, rgba(255, 231, 174, 0.11), transparent 16%, transparent 84%, rgba(34, 14, 4, 0.24)),
        rgba(40, 18, 6, 0.28);
    border: 1px solid rgba(255, 215, 139, 0.18);
    box-shadow: inset 0 0 32px rgba(255, 213, 132, 0.08), 0 0 0 2px rgba(54, 25, 8, 0.35);
}

.light-ray {
    position: absolute;
    width: 42vw;
    height: 130vh;
    top: -20vh;
    background: linear-gradient(90deg, transparent, rgba(255, 216, 139, 0.09), transparent);
    transform: rotate(18deg);
    filter: blur(10px);
    opacity: 0.75;
    animation: lightSweep 9s ease-in-out infinite;
}

.ray-1 { left: -18vw; }
.ray-2 { right: -24vw; animation-delay: -4s; opacity: 0.45; }

.dust {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 226, 158, 0.32);
    box-shadow: 0 0 10px rgba(255, 205, 106, 0.45);
    animation: dustFloat 7s linear infinite;
}

.dust-1 { left: 18%; top: 80%; animation-delay: -1s; }
.dust-2 { left: 58%; top: 86%; animation-delay: -3s; transform: scale(0.7); }
.dust-3 { left: 84%; top: 76%; animation-delay: -5s; transform: scale(0.55); }

@keyframes lightSweep {
    0%, 100% { transform: translateX(-8vw) rotate(18deg); opacity: 0.38; }
    50% { transform: translateX(14vw) rotate(18deg); opacity: 0.8; }
}

@keyframes dustFloat {
    0% { transform: translate3d(0, 0, 0) scale(0.7); opacity: 0; }
    18% { opacity: 0.65; }
    100% { transform: translate3d(18px, -58vh, 0) scale(1.15); opacity: 0; }
}

.grid-cell:not(.null-cell):empty {
    animation: tileBreathe 2.8s ease-in-out infinite;
}

@keyframes tileBreathe {
    0%, 100% { filter: brightness(0.96); transform: translateY(0); }
    50% { filter: brightness(1.12); transform: translateY(-1px); }
}

.letter-wheel::before {
    content: "";
    position: absolute;
    inset: 10%;
    border-radius: 50%;
    background: radial-gradient(circle at 36% 26%, rgba(255, 231, 166, 0.22), transparent 28%);
    animation: wheelAura 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes wheelAura {
    0%, 100% { opacity: 0.48; transform: rotate(0deg) scale(1); }
    50% { opacity: 0.9; transform: rotate(16deg) scale(1.03); }
}

.letter-node.selected {
    animation: selectedGem 0.36s ease-out;
}

@keyframes selectedGem {
    0% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.22); filter: brightness(1.35); }
    100% { transform: scale(1.15); filter: brightness(1.1); }
}

.letter-ripple {
    position: absolute;
    width: var(--node-size);
    height: var(--node-size);
    border-radius: 50%;
    border: 2px solid rgba(255, 225, 154, 0.7);
    transform: translate(-50%, -50%) scale(0.65);
    animation: letterRipple 0.55s ease-out forwards;
    pointer-events: none;
    z-index: 9;
}

@keyframes letterRipple {
    to { transform: translate(-50%, -50%) scale(1.65); opacity: 0; }
}

.effects-layer {
    z-index: 110;
    overflow: hidden;
}

.sparkle,
.coin-fly {
    position: fixed;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff8ce, #d79b45 58%, rgba(215, 155, 69, 0));
    box-shadow: 0 0 12px rgba(255, 224, 154, 0.75);
    animation: sparklePop 0.72s ease-out forwards;
    pointer-events: none;
}

.coin-fly {
    width: 18px;
    height: 18px;
    background: radial-gradient(circle at 34% 28%, #fff2ae, #d79b45 52%, #875323);
    border: 1px solid rgba(83, 43, 10, 0.62);
    animation: coinFly 0.75s cubic-bezier(0.2, 0.78, 0.2, 1) forwards;
}

@keyframes sparklePop {
    0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
    35% { opacity: 1; }
    100% { transform: translate(var(--dx), var(--dy)) scale(0.1); opacity: 0; }
}

@keyframes coinFly {
    0% { transform: translate3d(var(--sx), var(--sy), 0) scale(0.8); opacity: 0; }
    18% { opacity: 1; }
    100% { transform: translate3d(var(--tx), var(--ty), 0) scale(0.42); opacity: 0; }
}

.combo-badge {
    z-index: 115;
    display: grid;
    place-items: center;
    opacity: 0;
    color: #fff2b7;
    font-weight: 800;
    font-size: clamp(1.8rem, 8vw, 3.4rem);
    text-shadow: 0 4px 0 #5d2c0c, 0 0 20px rgba(255, 209, 105, 0.75);
    transform: scale(0.6);
}

.combo-badge.show {
    animation: comboBurst 0.95s ease-out forwards;
}

@keyframes comboBurst {
    0% { opacity: 0; transform: scale(0.55) translateY(20px); }
    30% { opacity: 1; transform: scale(1.08) translateY(0); }
    100% { opacity: 0; transform: scale(1) translateY(-38px); }
}

.finger-tutorial {
    z-index: 112;
    display: none;
}

.finger-tutorial.active {
    display: block;
}

.tutorial-copy {
    position: fixed;
    left: 50%;
    bottom: calc(var(--safe-bottom) + var(--controls-height, 300px) - 12px);
    transform: translateX(-50%);
    width: min(88vw, 380px);
    padding: 10px 14px;
    border-radius: 10px;
    text-align: center;
    font-weight: 800;
    color: #fff0c1;
    background: rgba(56, 31, 12, 0.86);
    border: 1px solid rgba(255, 218, 146, 0.38);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
}

.finger-dot {
    position: fixed;
    width: 34px;
    height: 34px;
    border-radius: 50% 50% 46% 46%;
    background: radial-gradient(circle at 38% 30%, #fff6db, #d8ad73 62%, #8e5e30);
    box-shadow: 0 8px 14px rgba(0, 0, 0, 0.35), 0 0 18px rgba(255, 218, 146, 0.45);
    animation: fingerMove 2.25s ease-in-out infinite;
}

.finger-trail {
    position: fixed;
    width: 124px;
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(255, 224, 154, 0), rgba(255, 224, 154, 0.9), rgba(255, 224, 154, 0));
    animation: trailMove 2.25s ease-in-out infinite;
}

@keyframes fingerMove {
    0%, 100% { left: 34%; top: 72%; transform: scale(0.9); }
    45% { left: 50%; top: 66%; transform: scale(1.06); }
    72% { left: 66%; top: 72%; transform: scale(0.96); }
}

@keyframes trailMove {
    0%, 100% { left: 34%; top: 75%; opacity: 0; transform: rotate(-18deg) scaleX(0.35); }
    40% { opacity: 1; transform: rotate(-18deg) scaleX(1); }
    78% { left: 46%; top: 75%; opacity: 0.2; transform: rotate(18deg) scaleX(0.8); }
}

@media (prefers-reduced-motion: reduce) {
    .light-ray,
    .dust,
    .grid-cell:not(.null-cell):empty,
    .letter-wheel::before,
    .finger-dot,
    .finger-trail {
        animation: none !important;
    }
}

@media (max-width: 900px) and (orientation: portrait) {
    .game-container {
        padding: calc(5px + var(--safe-top)) calc(5px + var(--safe-right)) calc(5px + var(--safe-bottom)) calc(5px + var(--safe-left)) !important;
        gap: 5px !important;
    }

    .game-header {
        display: grid !important;
        grid-template-columns: auto minmax(92px, 1fr) auto !important;
        height: var(--header-height, 56px) !important;
        min-height: var(--header-height, 56px) !important;
        max-height: var(--header-height, 56px) !important;
        padding: 6px 8px !important;
        gap: 8px !important;
        overflow: hidden !important;
    }

    .game-title {
        display: none !important;
    }

    .header-left {
        min-width: 0 !important;
        gap: 0 !important;
    }

    .level-badge {
        padding: 6px 9px !important;
        font-size: 0.78rem !important;
        line-height: 1 !important;
        white-space: nowrap !important;
    }

    .level-progress {
        min-width: 92px !important;
        overflow: hidden !important;
    }

    .level-progress-meta {
        font-size: 0.72rem !important;
        line-height: 1 !important;
        margin-bottom: 4px !important;
        gap: 5px !important;
    }

    .progress-track {
        height: 5px !important;
    }

    .header-right {
        gap: 5px !important;
        min-width: 0 !important;
    }

    .gold-container {
        min-width: 58px !important;
        height: 38px !important;
        padding: 4px 8px !important;
        gap: 5px !important;
        font-size: 0.86rem !important;
    }

    .gold-icon {
        font-size: 0.98rem !important;
    }

    .hud-btn {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        font-size: 1rem !important;
    }

    .badge {
        min-width: 14px !important;
        height: 14px !important;
        top: -4px !important;
        right: -4px !important;
        font-size: 0.58rem !important;
    }

    .game-workspace {
        height: calc(var(--app-height) - var(--header-height, 56px) - var(--safe-top) - var(--safe-bottom) - 17px) !important;
        min-height: 0 !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        grid-template-rows: minmax(0, 1fr) var(--controls-height, 170px) !important;
        gap: 5px !important;
        overflow: hidden !important;
    }

    .board-section {
        min-height: 0 !important;
        height: 100% !important;
        padding: 8px !important;
        overflow: hidden !important;
    }

    .board-scroll-wrapper {
        width: 100% !important;
        height: 100% !important;
        padding: 1px !important;
        overflow: hidden !important;
    }

    .grid-cell {
        border-width: 1px !important;
        border-radius: 6px !important;
    }

    .wheel-section {
        height: var(--controls-height, 170px) !important;
        max-height: var(--controls-height, 170px) !important;
        min-height: 0 !important;
        gap: 2px !important;
        padding: 0 !important;
        overflow: hidden !important;
    }

    .preview-container {
        height: 28px !important;
        min-height: 28px !important;
    }

    .preview-bubble {
        padding: 3px 10px !important;
        font-size: 0.95rem !important;
        border-radius: 6px !important;
    }

    .wheel-workspace {
        width: var(--wheel-size) !important;
        height: var(--wheel-size) !important;
        margin: 0 !important;
    }

    .wheel-actions {
        height: 44px !important;
        min-height: 44px !important;
        gap: 8px !important;
        justify-content: center !important;
    }

    .circle-btn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
    }

    .hint-btn {
        height: 44px !important;
        min-width: 82px !important;
        padding: 6px 10px !important;
        font-size: 0.9rem !important;
    }

    .letter-node {
        width: var(--node-size) !important;
        height: var(--node-size) !important;
        border: 2px solid rgba(47, 22, 6, 0.9) !important;
        font-size: calc(var(--node-size) * 0.52) !important;
    }

    .toast-container {
        bottom: calc(var(--safe-bottom) + var(--controls-height, 240px) + 10px) !important;
        width: calc(100vw - 22px) !important;
        max-width: 430px !important;
    }

    .toast {
        padding: 10px 14px !important;
        font-size: 0.9rem !important;
        border-radius: 8px !important;
    }
}

