* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

button, input, select, textarea {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, #fef9ef 0%, #fde8c8 100%);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.screen {
    width: 100%;
    max-width: 500px;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ============================================================
   SHARED
   ============================================================ */
.coin-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffd54f, #ffb300);
    color: #7b5800;
    font-size: 0.7em;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.4);
    flex-shrink: 0;
}

.coins-value {
    font-weight: 700;
    color: #ffc107;
}

/* ============================================================
   HOME SCREEN
   ============================================================ */
#home-screen {
    position: relative;
    align-items: center;
}

.home-inner {
    position: relative;
    z-index: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    padding: 20px 30px 40px;
}

.home-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    width: 100%;
}

.home-coins {
    background: rgba(0,0,0,0.06);
    color: #5a4a30;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 1em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.home-coins .coins-value {
    color: #b8860b;
}

.home-settings {
    background: rgba(0,0,0,0.06);
    border: none;
    color: #6b7b8d;
    font-size: 1.4em;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-settings:hover { background: rgba(0,0,0,0.1); }

.home-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: auto;
    padding-bottom: 20px;
}

.lives-icon { color: #ef5350; }
.lives-value { font-weight: 700; }

/* Logo banner */
.home-logo {
    margin: auto 0;
    padding: 30px 0;
}

.logo-icon {
    font-size: 4em;
    line-height: 1;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.logo-banner {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: white;
    padding: 16px 40px 20px;
    border-radius: 18px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
}

.logo-word {
    font-size: 2.6em;
    font-weight: 800;
    color: #3a3a3a;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.logo-pack {
    font-size: 1.3em;
    font-weight: 700;
    color: #ff9800;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-top: 2px;
}

.btn-play {
    -webkit-appearance: none;
    appearance: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto;
    background: linear-gradient(180deg, #43e97b 0%, #38c96a 100%);
    color: white;
    border: none;
    border-bottom: 5px solid #2a9d50;
    padding: 16px 60px;
    border-radius: 18px;
    font-size: 1.5em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 6px 20px rgba(56,201,106,0.35);
}
.btn-play-label {
    display: block;
    line-height: 1.2;
}
.btn-play-level {
    display: block;
    font-size: 0.5em;
    font-weight: 600;
    opacity: 0.85;
    margin-top: 2px;
}

.btn-play:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(56,201,106,0.5);
}

.btn-play:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
    box-shadow: 0 2px 8px rgba(56,201,106,0.3);
}
.btn-shop {
    margin-top: 14px;
    background: transparent;
    border: 2px solid rgba(0,0,0,0.12);
    color: #7a6a50;
    padding: 10px 28px;
    border-radius: 12px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-shop:active { background: rgba(0,0,0,0.04); }

.home-dev-levels {
    margin-top: 16px;
    background: transparent;
    border: 1px solid rgba(0,0,0,0.1);
    color: rgba(0,0,0,0.35);
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 0.85em;
    cursor: pointer;
}
.home-dev-levels:active {
    background: rgba(0,0,0,0.04);
}

/* ============================================================
   LEVEL MAP
   ============================================================ */
#level-map {
    background: linear-gradient(180deg, #0288d1 0%, #4fc3f7 50%, #b3e5fc 100%);
}

.map-header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    gap: 12px;
    background: rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 10;
}

.map-back-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 1.3em;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.map-back-btn:hover { background: rgba(255,255,255,0.3); }

.map-title {
    flex: 1;
    color: white;
    font-size: 1.3em;
    font-weight: 700;
}

.map-coins {
    background: rgba(0,0,0,0.2);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.map-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0 40px;
    -webkit-overflow-scrolling: touch;
}

.level-path {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 0 20px;
    position: relative;
}

/* Continuous center line behind all nodes */
.level-path::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: rgba(255,255,255,0.2);
    transform: translateX(-50%);
    z-index: 0;
}

/* Tier labels */
.tier-label {
    color: rgba(255,255,255,0.9);
    font-size: 0.8em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 10px 20px;
    margin: 8px 0;
    background: rgba(0,0,0,0.15);
    border-radius: 20px;
    position: relative;
    z-index: 1;
}

/* Map nodes */
.map-node {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 320px;
    padding: 6px 0;
    position: relative;
    z-index: 1;
}

.map-node.left { flex-direction: row; align-self: flex-start; margin-left: 10%; }
.map-node.right { flex-direction: row-reverse; align-self: flex-end; margin-right: 10%; text-align: right; }

.map-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: white;
    border: 3px solid rgba(255,255,255,0.6);
    color: #0288d1;
    font-size: 1.3em;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.map-node.completed .map-circle {
    background: #66bb6a;
    color: white;
    border-color: #43a047;
}

.map-node.locked .map-circle {
    background: rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.6);
    cursor: not-allowed;
    border-color: rgba(255,255,255,0.2);
    box-shadow: none;
}

.map-node.current .map-circle {
    animation: currentPulse 2s ease-in-out infinite;
    border-color: #ffc107;
    box-shadow: 0 0 20px rgba(255,193,7,0.4);
}

@keyframes currentPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(255,193,7,0.4); }
    50% { transform: scale(1.08); box-shadow: 0 0 30px rgba(255,193,7,0.6); }
}

.map-circle:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 6px 18px rgba(0,0,0,0.2);
}

.map-info { flex: 1; }

.map-name {
    display: block;
    color: white;
    font-weight: 600;
    font-size: 0.95em;
    text-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.map-node.locked .map-name { color: rgba(255,255,255,0.5); }

.map-done-check {
    display: inline-block;
    color: rgba(255,255,255,0.85);
    font-size: 1em;
    font-weight: 700;
    margin-top: 2px;
}

/* Removed per-node connector – using continuous center line via .level-path::before */

/* ============================================================
   GAME CONTAINER
   ============================================================ */
.game-container {
    position: relative;
}

.game-header {
    text-align: center;
    padding: 10px 14px 0;
}

.header-compact {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    position: relative;
}

.btn-icon {
    background: rgba(0,0,0,0.04);
    border: 2px solid #e0d6c8;
    border-radius: 10px;
    width: 40px;
    height: 40px;
    font-size: 1.2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-icon:hover { border-color: #0288d1; }

.level-indicator {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9em;
    font-weight: 700;
    color: #333;
    text-align: center;
    pointer-events: none;
}

.header-lives {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    background: #ffebee;
    padding: 5px 10px;
    border-radius: 16px;
    font-size: 0.85em;
    font-weight: 700;
    color: #c62828;
    flex-shrink: 0;
}

.header-coins {
    background: #f5f5f5;
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 0.85em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Timer */
.timer-container {
    text-align: center;
    margin: 6px 0;
}

.timer-container.hidden { display: none; }

.timer-bar-bg {
    width: 100%;
    max-width: 300px;
    height: 10px;
    background: #e0d6c8;
    border-radius: 5px;
    margin: 0 auto;
    overflow: hidden;
}

.timer-bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #42a5f5, #0288d1);
    border-radius: 5px;
    transition: width 0.3s linear, background 0.3s ease;
}

.timer-bar-fill.warning { background: #e53935; }

.timer-text {
    font-size: 1.2em;
    font-weight: bold;
    color: #0288d1;
    margin-top: 4px;
}

.timer-text.warning { color: #e53935; }

/* Timer freeze effect */
.timer-container.timer-frozen .timer-bar-fill {
    background: #4fc3f7;
    animation: timerFrozenPulse 1.5s ease-in-out infinite;
}

.timer-container.timer-frozen .timer-text {
    color: #4fc3f7;
}

.timer-container.timer-frozen::after {
    content: '❄️ Frozen';
    display: block;
    font-size: 0.75em;
    font-weight: 700;
    color: #4fc3f7;
    margin-top: 2px;
}

@keyframes timerFrozenPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* +10s flash */
.timer-container.time-bonus-flash .timer-bar-fill {
    background: #66bb6a;
    transition: none;
}

.timer-container.time-bonus-flash .timer-text {
    color: #66bb6a;
    animation: timeBonusPop 0.6s ease;
}

@keyframes timeBonusPop {
    0% { transform: scale(1); }
    30% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Goals */
.goals-container { margin: 8px 0 4px; }

.goals-list {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.goal-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 0.85em;
    font-weight: 600;
    border: 2px solid #ddd;
    background: #fafafa;
    transition: all 0.3s ease;
}

.goal-item .goal-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    color: transparent;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.goal-item .goal-name { color: #555; transition: all 0.3s ease; }

.goal-item.animals  { border-color: #c5e1a5; }
.goal-item.food     { border-color: #f8bbd0; }
.goal-item.vehicles { border-color: #ffe0b2; }
.goal-item.weather  { border-color: #bbdefb; }
.goal-item.colors   { border-color: #e1bee7; }
.goal-item.body     { border-color: #ffcdd2; }
.goal-item.home     { border-color: #b2dfdb; }
.goal-item.nature   { border-color: #d7ccc8; }
.goal-item.sports   { border-color: #c5cae9; }
.goal-item.clothes  { border-color: #ffccbc; }

.goal-item.animals  .goal-check { border-color: #8bc34a; }
.goal-item.food     .goal-check { border-color: #e91e63; }
.goal-item.vehicles .goal-check { border-color: #ff9800; }
.goal-item.weather  .goal-check { border-color: #42a5f5; }
.goal-item.colors   .goal-check { border-color: #ab47bc; }
.goal-item.body     .goal-check { border-color: #ef5350; }
.goal-item.home     .goal-check { border-color: #26a69a; }
.goal-item.nature   .goal-check { border-color: #8d6e63; }
.goal-item.sports   .goal-check { border-color: #5c6bc0; }
.goal-item.clothes  .goal-check { border-color: #ff7043; }

.goal-item.generic { border-color: #b0bec5; }
.goal-item.generic .goal-check { border-color: #78909c; }

.goal-item.danger { border-color: #ef5350; background: #ffebee; }
.goal-item.danger .goal-check { border-color: #ef5350; color: #ef5350; font-size: 0.75em; }
.goal-item.danger .goal-name { color: #c62828; }

.goal-item.completed { background: #e8f5e9; border-color: #66bb6a; }
.goal-item.completed .goal-check { background: #66bb6a; border-color: #66bb6a; color: white; }
.goal-item.completed .goal-name { color: #2e7d32; text-decoration: line-through; }

/* ============================================================
   CONVEYOR QUEUE
   ============================================================ */
.conveyor-header {
    padding: 6px 0 2px;
    text-align: center;
}

.pack-progress {
    font-size: 0.95em;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.target-slots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 4px 0;
}

.target-card {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    height: 42px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9em;
    border: 2px solid #ddd;
    background: #fafafa;
    animation: cardSlideIn 0.35s ease-out;
    min-width: 110px;
    justify-content: center;
    box-sizing: border-box;
}

.target-card .target-icon {
    font-size: 1.2em;
    line-height: 1;
}

.target-card .target-name {
    color: #333;
}

/* Category-colored borders */
.target-card.animals  { border-color: #8bc34a; background: #f1f8e9; }
.target-card.food     { border-color: #e91e63; background: #fce4ec; }
.target-card.vehicles { border-color: #ff9800; background: #fff3e0; }
.target-card.weather  { border-color: #42a5f5; background: #e3f2fd; }
.target-card.colors   { border-color: #ab47bc; background: #f3e5f5; }
.target-card.body     { border-color: #ef5350; background: #ffebee; }
.target-card.home     { border-color: #26a69a; background: #e0f2f1; }
.target-card.nature   { border-color: #8d6e63; background: #efebe9; }
.target-card.sports   { border-color: #5c6bc0; background: #e8eaf6; }
.target-card.clothes  { border-color: #ff7043; background: #fbe9e7; }
.target-card.tools    { border-color: #78909c; background: #eceff1; }
.target-card.jobs     { border-color: #7e57c2; background: #ede7f6; }
.target-card.rooms    { border-color: #a1887f; background: #efebe9; }
.target-card.travel   { border-color: #29b6f6; background: #e1f5fe; }
.target-card.school   { border-color: #fdd835; background: #fffde7; }
.target-card.kitchen  { border-color: #ec407a; background: #fce4ec; }
.target-card.ocean    { border-color: #0097a7; background: #e0f7fa; }
.target-card.music    { border-color: #d81b60; background: #fce4ec; }
.target-card.flags    { border-color: #43a047; background: #e8f5e9; }
.target-card.space    { border-color: #5e35b1; background: #ede7f6; }


@keyframes cardSlideIn {
    0% { opacity: 0; transform: translateX(40px) scale(0.8); }
    100% { opacity: 1; transform: translateX(0) scale(1); }
}

/* Send button toolbar */
.send-toolbar {
    display: flex;
    justify-content: center;
    padding: 8px 14px 4px;
}

.send-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(180deg, #ff9800 0%, #f57c00 100%);
    color: white;
    border: none;
    border-bottom: 4px solid #e65100;
    padding: 12px 28px;
    border-radius: 14px;
    font-size: 1.05em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 4px 14px rgba(255,152,0,0.4);
}

.send-btn .send-icon { font-size: 1.2em; }

.send-btn .send-count {
    background: rgba(0,0,0,0.15);
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.85em;
}

.send-btn:active:not(.disabled) {
    transform: translateY(2px);
    border-bottom-width: 2px;
    box-shadow: 0 2px 8px rgba(255,152,0,0.3);
}

.send-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.send-btn.send-pulse {
    animation: sendPulse 0.6s ease-in-out 3;
}

@keyframes sendPulse {
    0%, 100% { box-shadow: 0 4px 14px rgba(255,152,0,0.4); }
    50% { box-shadow: 0 4px 28px rgba(255,152,0,0.8); transform: scale(1.05); }
}

/* ============================================================
   BOARD
   ============================================================ */
.board-container {
    display: flex;
    justify-content: center;
    position: relative;
    overflow: visible;
    flex: 1;
    align-items: stretch;
    padding: 6px 10px;
}

#game-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 5px;
    background: #e8dfd4;
    padding: 8px;
    border-radius: 14px;
    touch-action: none;
    user-select: none;
    width: 100%;
    max-width: 400px;
}

.tile {
    background: #fffcf7;
    border: 2px solid #e0d6c8;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: visible;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    min-height: 42px;
    padding: 4px 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.tile::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 6px;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .tile:hover { transform: scale(1.05); box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
}

.tile.selected {
    border: 3px solid #ff9800;
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(255,152,0,0.35);
}

.tile .word {
    font-size: 0.9em;
    font-weight: bold;
    color: #333;
    text-align: center;
    padding: 5px;
    width: 100%;
    line-height: 1.3;
}

.tile.emoji .word {
    font-size: 2.5em;
    line-height: 1;
    overflow-wrap: break-word;
}

.tile.neutral::before  { background: transparent; }
.tile.animals::before  { background: #8bc34a; }
.tile.food::before     { background: #e91e63; }
.tile.vehicles::before { background: #ff9800; }
.tile.weather::before  { background: #42a5f5; }
.tile.colors::before   { background: #ab47bc; }
.tile.body::before     { background: #ef5350; }
.tile.home::before     { background: #26a69a; }
.tile.nature::before   { background: #8d6e63; }
.tile.sports::before   { background: #5c6bc0; }
.tile.clothes::before  { background: #ff7043; }

.tile.empty {
    background: transparent;
    border: 2px dashed #e0e0e0;
    cursor: default;
    opacity: 0.3;
}
.tile.empty:hover { transform: none; box-shadow: none; }
.tile.empty::before { display: none; }

.tile.frozen { cursor: not-allowed; }
.tile.frozen.animals  { background: #c5e1a5; border-color: #8bc34a; }
.tile.frozen.food     { background: #f8bbd0; border-color: #e91e63; }
.tile.frozen.vehicles { background: #ffe0b2; border-color: #ff9800; }
.tile.frozen.weather  { background: #bbdefb; border-color: #42a5f5; }
.tile.frozen.colors   { background: #e1bee7; border-color: #ab47bc; }
.tile.frozen.body     { background: #ffcdd2; border-color: #ef5350; }
.tile.frozen.home     { background: #b2dfdb; border-color: #26a69a; }
.tile.frozen.nature   { background: #d7ccc8; border-color: #8d6e63; }
.tile.frozen.sports   { background: #c5cae9; border-color: #5c6bc0; }
.tile.frozen.clothes  { background: #ffccbc; border-color: #ff7043; }
.tile.frozen.tools    { background: #cfd8dc; border-color: #78909c; }
.tile.frozen.jobs     { background: #d1c4e9; border-color: #7e57c2; }
.tile.frozen.rooms    { background: #d7ccc8; border-color: #a1887f; }
.tile.frozen.travel   { background: #b3e5fc; border-color: #29b6f6; }
.tile.frozen.school   { background: #fff9c4; border-color: #fdd835; }
.tile.frozen.kitchen  { background: #f8bbd0; border-color: #ec407a; }
.tile.frozen.ocean    { background: #b2ebf2; border-color: #0097a7; }
.tile.frozen.music    { background: #f8bbd0; border-color: #d81b60; }
.tile.frozen.flags    { background: #c8e6c9; border-color: #43a047; }
.tile.frozen.space    { background: #d1c4e9; border-color: #5e35b1; }

.tile.frozen::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 6px;
    background: linear-gradient(135deg,
        rgba(255,255,255,0.5) 0%,
        rgba(255,255,255,0.15) 30%,
        rgba(255,255,255,0.4) 60%,
        rgba(255,255,255,0.1) 100%);
    border: 2px solid rgba(255,255,255,0.6);
    pointer-events: none;
}

.tile.frozen:hover { transform: none; box-shadow: none; }
.tile.frozen .word { color: #333; opacity: 0.8; }

.tile.freezing { animation: freezeEffect 0.4s ease forwards; }

@keyframes freezeEffect {
    0% { transform: scale(1); border-color: #ddd; }
    30% { transform: scale(1.1); border-color: #4fc3f7; box-shadow: 0 0 20px rgba(79,195,247,0.6); }
    60% { transform: scale(1.05); }
    100% { transform: scale(1); border-color: #81d4fa; background: #e1f5fe; box-shadow: 0 0 10px rgba(79,195,247,0.3); }
}

.tile.clearing { animation: clearEffect 0.5s ease forwards; }

@keyframes clearEffect {
    0% { opacity: 0.75; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
    100% { opacity: 0; transform: scale(0.3); }
}

/* --- Match highlight: glow with category color, stay visible --- */
.tile.match-highlight {
    z-index: 10;
    animation: matchHighlight 0.5s ease forwards;
    border-width: 3px;
}

@keyframes matchHighlight {
    0%   { transform: scale(1); filter: brightness(1); box-shadow: none; }
    40%  { transform: scale(1.15); filter: brightness(1.4); box-shadow: 0 0 18px rgba(255,255,255,0.5); }
    100% { transform: scale(1.1); filter: brightness(1.3); box-shadow: 0 0 12px rgba(255,255,255,0.3); }
}

/* Per-category highlight colors */
.tile.match-highlight.animals  { border-color: #8bc34a; background: #e8f5e9; }
.tile.match-highlight.food     { border-color: #e91e63; background: #fce4ec; }
.tile.match-highlight.vehicles { border-color: #ff9800; background: #fff3e0; }
.tile.match-highlight.weather  { border-color: #42a5f5; background: #e3f2fd; }
.tile.match-highlight.colors   { border-color: #ab47bc; background: #f3e5f5; }
.tile.match-highlight.body     { border-color: #ef5350; background: #ffebee; }
.tile.match-highlight.home     { border-color: #26a69a; background: #e0f2f1; }
.tile.match-highlight.nature   { border-color: #8d6e63; background: #efebe9; }
.tile.match-highlight.sports   { border-color: #5c6bc0; background: #e8eaf6; }
.tile.match-highlight.clothes  { border-color: #ff7043; background: #fbe9e7; }
.tile.match-highlight.tools    { border-color: #78909c; background: #eceff1; }
.tile.match-highlight.jobs     { border-color: #7e57c2; background: #ede7f6; }
.tile.match-highlight.rooms    { border-color: #a1887f; background: #efebe9; }
.tile.match-highlight.travel   { border-color: #29b6f6; background: #e1f5fe; }
.tile.match-highlight.school   { border-color: #fdd835; background: #fffde7; }
.tile.match-highlight.kitchen  { border-color: #ec407a; background: #fce4ec; }
.tile.match-highlight.ocean    { border-color: #0097a7; background: #e0f7fa; }
.tile.match-highlight.music    { border-color: #d81b60; background: #fce4ec; }
.tile.match-highlight.flags    { border-color: #43a047; background: #e8f5e9; }
.tile.match-highlight.space    { border-color: #5e35b1; background: #ede7f6; }

/* --- Match remove: shrink and fade out --- */
.tile.match-remove {
    z-index: 10;
    animation: matchRemove 0.3s ease forwards;
}

@keyframes matchRemove {
    0%   { transform: scale(1.1); opacity: 1; filter: brightness(1.3); }
    100% { transform: scale(0); opacity: 0; filter: brightness(2); }
}

/* --- Tile bounce on gravity landing --- */
.tile.tile-bounce {
    animation: tileBounce 0.4s ease-out;
}

@keyframes tileBounce {
    0% { transform: translateY(-30px); opacity: 0.3; }
    50% { transform: translateY(4px); opacity: 1; }
    70% { transform: translateY(-2px); }
    100% { transform: translateY(0); opacity: 1; }
}

/* --- Board shake (3 intensities) --- */
@keyframes boardShakeLight {
    0%, 100% { transform: translate(0, 0); }
    15% { transform: translate(-2px, 1px); }
    30% { transform: translate(2px, -1px); }
    45% { transform: translate(-1px, 2px); }
    60% { transform: translate(1px, -1px); }
    75% { transform: translate(-1px, 0px); }
}

@keyframes boardShakeMedium {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-3px, 2px); }
    20% { transform: translate(4px, -2px); }
    30% { transform: translate(-4px, 3px); }
    40% { transform: translate(3px, -3px); }
    50% { transform: translate(-2px, 2px); }
    60% { transform: translate(3px, -1px); }
    70% { transform: translate(-2px, 1px); }
    80% { transform: translate(1px, -1px); }
}

@keyframes boardShakeHeavy {
    0%, 100% { transform: translate(0, 0); }
    8% { transform: translate(-5px, 3px) rotate(-0.5deg); }
    16% { transform: translate(6px, -4px) rotate(0.5deg); }
    24% { transform: translate(-6px, 4px) rotate(-0.3deg); }
    32% { transform: translate(5px, -3px) rotate(0.3deg); }
    40% { transform: translate(-4px, 3px); }
    48% { transform: translate(4px, -2px); }
    56% { transform: translate(-3px, 2px); }
    64% { transform: translate(3px, -1px); }
    72% { transform: translate(-2px, 1px); }
    80% { transform: translate(1px, -1px); }
}

#game-board.board-shake-light { animation: boardShakeLight 0.25s ease; }
#game-board.board-shake-medium { animation: boardShakeMedium 0.35s ease; }
#game-board.board-shake-heavy { animation: boardShakeHeavy 0.5s ease; }

/* --- Category color flash overlay --- */
.category-flash {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 14px;
    pointer-events: none;
    z-index: 50;
    animation: categoryFlash 0.5s ease-out forwards;
}

@keyframes categoryFlash {
    0% { opacity: 0.35; }
    100% { opacity: 0; }
}

.category-flash.animals  { background: radial-gradient(circle, rgba(139,195,74,0.4) 0%, transparent 70%); }
.category-flash.food     { background: radial-gradient(circle, rgba(233,30,99,0.4) 0%, transparent 70%); }
.category-flash.vehicles { background: radial-gradient(circle, rgba(255,152,0,0.4) 0%, transparent 70%); }
.category-flash.weather  { background: radial-gradient(circle, rgba(66,165,245,0.4) 0%, transparent 70%); }
.category-flash.colors   { background: radial-gradient(circle, rgba(171,71,188,0.4) 0%, transparent 70%); }
.category-flash.body     { background: radial-gradient(circle, rgba(239,83,80,0.4) 0%, transparent 70%); }
.category-flash.home     { background: radial-gradient(circle, rgba(38,166,154,0.4) 0%, transparent 70%); }
.category-flash.nature   { background: radial-gradient(circle, rgba(141,110,99,0.4) 0%, transparent 70%); }
.category-flash.sports   { background: radial-gradient(circle, rgba(92,107,192,0.4) 0%, transparent 70%); }
.category-flash.clothes  { background: radial-gradient(circle, rgba(255,112,67,0.4) 0%, transparent 70%); }
.category-flash.tools    { background: radial-gradient(circle, rgba(120,144,156,0.4) 0%, transparent 70%); }
.category-flash.jobs     { background: radial-gradient(circle, rgba(126,87,194,0.4) 0%, transparent 70%); }
.category-flash.rooms    { background: radial-gradient(circle, rgba(161,136,127,0.4) 0%, transparent 70%); }
.category-flash.travel   { background: radial-gradient(circle, rgba(41,182,246,0.4) 0%, transparent 70%); }
.category-flash.school   { background: radial-gradient(circle, rgba(253,216,53,0.4) 0%, transparent 70%); }
.category-flash.kitchen  { background: radial-gradient(circle, rgba(236,64,122,0.4) 0%, transparent 70%); }
.category-flash.ocean    { background: radial-gradient(circle, rgba(0,151,167,0.4) 0%, transparent 70%); }
.category-flash.music    { background: radial-gradient(circle, rgba(216,27,96,0.4) 0%, transparent 70%); }
.category-flash.flags    { background: radial-gradient(circle, rgba(67,160,71,0.4) 0%, transparent 70%); }
.category-flash.space    { background: radial-gradient(circle, rgba(94,53,177,0.4) 0%, transparent 70%); }

/* --- Score pop --- */
@keyframes scorePop {
    0% { transform: scale(1); }
    40% { transform: scale(1.35); }
    100% { transform: scale(1); }
}

/* --- Mini confetti for bundle packed --- */
@keyframes miniConfettiFall {
    0% { opacity: 1; transform: translateY(0) translateX(0) rotate(0deg) scale(1); }
    100% { opacity: 0; transform: translateY(var(--fall)) translateX(var(--drift)) rotate(var(--rot)) scale(0.3); }
}

.mini-confetti {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 2px;
    pointer-events: none;
    z-index: 100;
    animation: miniConfettiFall 1.2s ease-out forwards;
}

/* ============================================================
   POWER-UP TOOLBAR (bottom)
   ============================================================ */
.powerup-toolbar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    background: rgba(0,0,0,0.04);
    border-top: 1px solid rgba(0,0,0,0.06);
}

.powerup-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fffcf7;
    color: #333;
    border: 2px solid #e0d6c8;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.powerup-btn .powerup-icon { font-size: 1.2em; }

.powerup-charges {
    background: #0288d1;
    color: white;
    font-size: 0.7em;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 8px;
    margin-left: 2px;
    min-width: 22px;
    text-align: center;
    line-height: 1.3;
}

.powerup-btn:hover:not(.disabled) {
    border-color: #ff9800;
    background: #fff3e0;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(255,152,0,0.2);
}

.powerup-btn:active:not(.disabled) { transform: translateY(0); }
.powerup-btn.disabled { opacity: 0.4; cursor: not-allowed; }

.powerup-btn.active {
    background: #0288d1;
    color: white;
    border-color: #0277bd;
    box-shadow: 0 3px 12px rgba(2,136,209,0.4);
    animation: pulse 1.2s ease-in-out infinite;
}

.powerup-btn.active .powerup-charges { background: rgba(255,255,255,0.3); color: white; }

@keyframes pulse {
    0%, 100% { box-shadow: 0 3px 12px rgba(2,136,209,0.4); }
    50% { box-shadow: 0 3px 20px rgba(2,136,209,0.7); }
}

#game-board.targeting-bundle .tile.frozen,
#game-board.targeting-category .tile { cursor: crosshair; }

@media (hover: hover) and (pointer: fine) {
    #game-board.targeting-bundle .tile.frozen:hover,
    #game-board.targeting-category .tile:hover {
        transform: scale(1.08);
        box-shadow: 0 4px 14px rgba(2,136,209,0.5);
        filter: brightness(1.1);
    }
}

/* Dev toolbar */
.dev-toolbar {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(255,152,0,0.08);
    border-top: 1px dashed rgba(255,152,0,0.3);
}

.dev-btn {
    padding: 6px 16px;
    border-radius: 8px;
    font-size: 0.8em;
    font-weight: 700;
    cursor: pointer;
    border: none;
    color: white;
}

.dev-btn-win { background: #43a047; }
.dev-btn-win:active { background: #2e7d32; }
.dev-btn-lose { background: #e53935; }
.dev-btn-lose:active { background: #c62828; }

/* ============================================================
   ANIMATIONS & PARTICLES
   ============================================================ */
@keyframes particleBurst {
    0% { opacity: 1; transform: translate(0,0) scale(1) rotate(0deg); }
    100% { opacity: 0; transform: translate(var(--tx),var(--ty)) scale(0) rotate(var(--rotation)); }
}

@keyframes fadeIn {
    from { opacity: 0; } to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; } to { transform: translateY(0); opacity: 1; }
}

@keyframes popIn {
    0% { opacity: 0; transform: translate(-50%,-50%) scale(0); }
    50% { opacity: 1; transform: translate(-50%,-50%) scale(1.15); }
    70% { transform: translate(-50%,-50%) scale(0.95); }
    100% { opacity: 0; transform: translate(-50%,-50%) scale(1); }
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 99;
    animation: particleBurst 0.6s ease-out forwards;
}

.particle.animals  { background: #66bb6a; }
.particle.food     { background: #ec407a; }
.particle.vehicles { background: #ff9800; }
.particle.weather  { background: #42a5f5; }
.particle.colors   { background: #ab47bc; }
.particle.body     { background: #ef5350; }
.particle.home     { background: #26a69a; }
.particle.nature   { background: #8d6e63; }
.particle.sports   { background: #5c6bc0; }
.particle.clothes  { background: #ff7043; }
.particle.neutral  { background: #999; }

.goal-popup {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    font-size: 1.6em;
    font-weight: bold;
    color: white;
    padding: 15px 30px;
    border-radius: 12px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
    pointer-events: none;
    z-index: 101;
    animation: popIn 1.2s ease-out forwards;
}

.goal-popup.animals  { background: rgba(102,187,106,0.9); }
.goal-popup.food     { background: rgba(236,64,122,0.9); }
.goal-popup.vehicles { background: rgba(255,152,0,0.9); }
.goal-popup.weather  { background: rgba(66,165,245,0.9); }
.goal-popup.colors   { background: rgba(171,71,188,0.9); }
.goal-popup.body     { background: rgba(239,83,80,0.9); }
.goal-popup.home     { background: rgba(38,166,154,0.9); }
.goal-popup.nature   { background: rgba(141,110,99,0.9); }
.goal-popup.sports   { background: rgba(92,107,192,0.9); }
.goal-popup.clothes  { background: rgba(255,112,67,0.9); }
.goal-popup.generic  { background: rgba(96,125,139,0.9); }
.goal-popup.danger   { background: rgba(229,57,53,0.9); }

/* Confetti */
@keyframes confettiFall {
    0% { opacity: 1; transform: translateY(-10px) translateX(0) rotate(0deg); }
    100% { opacity: 0; transform: translateY(100vh) translateX(var(--drift)) rotate(var(--rot)); }
}

.confetti {
    position: fixed;
    top: -10px;
    pointer-events: none;
    z-index: 9999;
    animation: confettiFall 2s ease-in forwards;
}

/* Goal sparkles */
@keyframes sparkleBurst {
    0% { opacity: 1; transform: translate(0,0) scale(1); }
    100% { opacity: 0; transform: translate(var(--tx),var(--ty)) scale(0.3); }
}

.sparkle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #fdd835;
    border-radius: 1px;
    transform: rotate(45deg);
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 0 4px rgba(253,216,53,0.6);
    animation: sparkleBurst 0.8s ease-out forwards;
}

/* Combo text */
@keyframes comboFloat {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
    15% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
    30% { transform: translate(-50%, -50%) scale(1); }
    70% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, calc(-50% - 50px)) scale(0.85); }
}

.combo-text {
    position: absolute;
    top: 45%; left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5), 0 0 30px rgba(255,215,0,0.6), 0 0 60px rgba(255,152,0,0.3);
    pointer-events: none;
    z-index: 102;
    animation: comboFloat 1.1s ease-out forwards;
    letter-spacing: -0.02em;
}

/* Unlock banner sparkles */
@keyframes unlockFloat {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-30px) scale(0.3); }
}

.unlock-sparkle {
    position: absolute;
    bottom: 0;
    width: 5px;
    height: 5px;
    background: #fdd835;
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(253,216,53,0.7);
    animation: unlockFloat 1.5s ease-out forwards;
}

/* Coin fly animation */
@keyframes coinFly {
    0% { opacity: 1; transform: translate(0,0) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--ox), var(--oy)) scale(0.5); }
}

.coin-fly {
    position: fixed;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #fdd835, #f9a825);
    border-radius: 50%;
    color: #7b5800;
    font-size: 10px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    animation: coinFly 0.7s ease-in forwards;
}

/* ============================================================
   MODALS
   ============================================================ */
.game-modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.game-modal.show { display: flex; animation: fadeIn 0.3s ease; }

.modal-content {
    background: white;
    padding: 36px 28px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    text-align: center;
    min-width: 280px;
    max-width: 360px;
    width: 90%;
    animation: slideUp 0.3s ease;
}

.modal-content h2 {
    font-size: 2em;
    margin-bottom: 12px;
}

.modal-content.win h2 { color: #2e7d32; }
.modal-content.lose h2 { color: #e53935; }
.modal-content.pause h2 { color: #0288d1; }
.modal-content.settings h2 { color: #333; }

.settings-options {
    margin-bottom: 18px;
}

.settings-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    cursor: pointer;
}

.toggle-label {
    font-size: 0.95em;
    font-weight: 600;
    color: #555;
}

.settings-toggle input { display: none; }

.toggle-slider {
    width: 46px;
    height: 26px;
    background: #ccc;
    border-radius: 13px;
    position: relative;
    transition: background 0.3s;
    flex-shrink: 0;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.settings-toggle input:checked + .toggle-slider {
    background: #0288d1;
}

.settings-toggle input:checked + .toggle-slider::after {
    transform: translateX(20px);
}

.dev-settings {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dev-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dev-field-label {
    font-size: 0.9em;
    font-weight: 600;
    color: #555;
    display: flex;
    align-items: center;
    gap: 4px;
}

.dev-input {
    width: 80px;
    padding: 6px 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 600;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.dev-input:focus {
    border-color: #0288d1;
}

.modal-info {
    font-size: 1em;
    color: #666;
    margin-bottom: 16px;
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.btn-primary {
    background: #0288d1;
    color: white;
    border: none;
    padding: 14px 36px;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    max-width: 260px;
}

.btn-primary:hover { background: #0277bd; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(2,136,209,0.4); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: white;
    color: #0288d1;
    border: 2px solid #0288d1;
    padding: 12px 28px;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    max-width: 260px;
}

.btn-secondary:hover { background: #e1f5fe; }

.btn-secondary.btn-danger {
    color: #e53935;
    border-color: #e53935;
}

.btn-secondary.btn-danger:hover { background: #ffebee; }

.restart-life-cost {
    display: inline-block;
    background: #ffebee;
    color: #e53935;
    font-size: 0.8em;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
}

.btn-tertiary {
    background: none;
    border: none;
    color: #888;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 20px;
    transition: all 0.2s;
    text-decoration: underline;
}

.btn-tertiary:hover { color: #0288d1; }

/* Pause help section */
.pause-help {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    text-align: left;
}

.pause-help.show {
    max-height: 300px;
    padding: 14px 0 0;
}

.pause-help p {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 6px;
    line-height: 1.4;
}

/* ============================================================
   WIN SCREEN
   ============================================================ */
/* ============================================================
   SHOP
   ============================================================ */
.modal-content.shop h2 { color: #333; }

.shop-powerups {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.shop-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #f9f9f9;
    border-radius: 10px;
}

.shop-icon { font-size: 1.2em; }
.shop-name { flex: 1; font-weight: 600; font-size: 0.9em; color: #333; }
.shop-count { font-weight: 700; color: #0288d1; font-size: 1em; }

.shop-buy-btn {
    background: #43a047;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.8em;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}
.shop-buy-btn:active { transform: scale(0.95); }
.shop-buy-btn .coin-badge-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffd54f, #ffb300);
    color: #7b5800;
    font-size: 0.55em;
    font-weight: 800;
}
.shop-buy-btn.cant-afford {
    background: #ccc;
    color: #888;
    cursor: default;
}

.win-unlock-banner {
    background: linear-gradient(135deg, #ffd54f, #ffb300);
    color: #5d4037;
    text-align: center;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 700;
    margin-bottom: 14px;
    border: 2px solid rgba(255,255,255,0.5);
}
.win-unlock-banner .unlock-icon { display: block; font-size: 1.6em; margin-bottom: 2px; }
.win-unlock-banner .unlock-label { display: block; font-size: 0.7em; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; opacity: 0.65; margin-bottom: 4px; }
.win-unlock-banner .unlock-name { display: block; font-size: 1.3em; }

.win-coins-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 18px;
    font-size: 1.5em;
    font-weight: 700;
}

.win-coins-amount { color: #ffc107; }

/* Ad reward button */
.btn-ad-reward {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 260px;
    background: linear-gradient(180deg, #43e97b 0%, #38c96a 100%);
    color: white;
    border: none;
    border-bottom: 4px solid #2a9d50;
    padding: 12px 20px;
    border-radius: 14px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 4px 16px rgba(56,201,106,0.4);
}

.btn-ad-reward:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(56,201,106,0.5);
}

.btn-ad-reward:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
    box-shadow: 0 2px 8px rgba(56,201,106,0.3);
}

.btn-ad-reward.used {
    background: #bbb;
    border-bottom-color: #999;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.5;
}

.ad-play-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(0,0,0,0.15);
    border-radius: 8px;
    font-size: 0.9em;
}

.ad-label {
    text-align: left;
    line-height: 1.2;
}

.ad-amount {
    font-size: 0.85em;
    opacity: 0.9;
}

.btn-ad-reward .coin-badge-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffd54f, #ffb300);
    color: #7b5800;
    font-size: 0.55em;
    font-weight: 800;
    vertical-align: middle;
}

/* Mock ad overlay */
.mock-ad-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.mock-ad-content {
    background: white;
    padding: 60px 50px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    min-width: 260px;
}

.mock-ad-label {
    font-size: 2.5em;
    font-weight: 800;
    color: #bbb;
    letter-spacing: 4px;
    margin-bottom: 30px;
}

.btn-ad-close {
    background: #0288d1;
    color: white;
    border: none;
    padding: 12px 40px;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-ad-close:hover {
    background: #0277bd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(2,136,209,0.4);
}

.btn-ad-close:active { transform: translateY(0); }

/* ============================================================
   LOSE SCREEN
   ============================================================ */
.lose-life-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 4px 0 18px;
    animation: lifePopIn 0.4s ease-out;
}

.lose-heart-broken {
    font-size: 2.8em;
    line-height: 1;
    filter: drop-shadow(0 2px 6px rgba(239,83,80,0.3));
    position: relative;
    display: inline-block;
}

.lose-heart-minus {
    font-size: 1.5em;
    font-weight: 800;
    color: #c62828;
    text-shadow: 0 1px 3px rgba(0,0,0,0.15);
    margin-left: 2px;
}

@keyframes lifePopIn {
    0%   { transform: scale(0.3); opacity: 0; }
    60%  { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); }
}

.lose-progress {
    margin-bottom: 20px;
}

.lose-progress-bar-bg {
    height: 10px;
    background: #eee;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 8px;
}

.lose-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef5350, #e53935);
    border-radius: 5px;
    transition: width 0.4s ease;
}

.lose-progress-text {
    font-size: 0.95em;
    font-weight: 600;
    color: #666;
}

/* ============================================================
   NO LIVES MODAL
   ============================================================ */
.lose-no-lives { margin-top: 12px; }

.no-lives-heart {
    position: relative;
    display: inline-block;
    margin: 10px 0 16px;
}

.no-lives-heart .big-heart {
    font-size: 4em;
    color: #ef5350;
    filter: drop-shadow(0 2px 6px rgba(239,83,80,0.3));
}

.no-lives-heart .heart-count {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.8em;
    font-weight: 800;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.no-lives-timer {
    font-size: 1em;
    color: #888;
    margin-bottom: 18px;
    font-weight: 600;
}

.no-lives-timer span {
    color: #e53935;
    font-weight: 700;
    font-size: 1.1em;
}

#btn-buy-lives {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

#btn-buy-lives.cant-afford {
    background: #bbb;
    cursor: not-allowed;
}

#btn-buy-lives.cant-afford:hover {
    background: #bbb;
    transform: none;
    box-shadow: none;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    body {
        padding: 0;
        align-items: flex-start;
    }

    .screen { max-width: 100%; }

    /* Home */
    .logo-word { font-size: 2.2em; }
    .logo-pack { font-size: 1.1em; }
    .logo-icon { font-size: 3.5em; }
    .btn-play { padding: 14px 50px; font-size: 1.3em; }

    /* Map */
    .map-node.left { margin-left: 5%; }
    .map-node.right { margin-right: 5%; }
    .map-circle { width: 50px; height: 50px; font-size: 1.1em; }
    .map-name { font-size: 0.85em; }

    /* Game */
    .game-container {
        border-radius: 0;
    }

    .game-header { padding: 8px 10px 0; }
    .header-compact { gap: 6px; margin-bottom: 4px; }
    .btn-icon { width: 36px; height: 36px; font-size: 1em; }
    .level-indicator { font-size: 0.8em; }

    .timer-container { margin: 4px 0; }
    .timer-bar-bg { max-width: 260px; height: 8px; }
    .timer-text { font-size: 1em; }

    .goals-list { gap: 5px; }
    .goal-item { padding: 4px 10px; font-size: 0.75em; gap: 4px; }
    .goal-item .goal-check { width: 16px; height: 16px; font-size: 0.7em; }

    .target-card { padding: 0 12px; height: 36px; font-size: 0.8em; min-width: 90px; }
    .pack-progress { font-size: 0.85em; margin-bottom: 6px; }
    .send-btn { padding: 10px 22px; font-size: 0.95em; }
    .board-container { padding: 4px 8px; }

    #game-board {
        grid-template-columns: repeat(5, 1fr);
        grid-template-rows: repeat(8, 1fr);
        gap: 4px;
        padding: 6px;
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
    }

    .tile { min-height: 36px; padding: 3px 1px; border-radius: 8px; }
    .tile .word { font-size: 0.65em; padding: 2px; }
    .tile.emoji .word { font-size: 1.8em; }

    .powerup-toolbar {
        gap: 6px;
        padding: 8px 10px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    .powerup-btn { padding: 8px 12px; font-size: 0.8em; gap: 4px; border-radius: 10px; }
    .powerup-btn .powerup-icon { font-size: 1em; }
    .powerup-charges { font-size: 0.65em; padding: 1px 5px; }

    .particle { width: 6px; height: 6px; }

    .goal-popup { font-size: 1.2em; padding: 10px 20px; }

    .modal-content { padding: 28px 20px; min-width: auto; margin: 0 15px; }
    .modal-content h2 { font-size: 1.7em; }

    .btn-primary { padding: 12px 28px; font-size: 1em; }
    .btn-secondary { padding: 10px 24px; font-size: 0.9em; }
}

/* Extra small screens */
@media (max-width: 380px) {
    .logo-word { font-size: 1.9em; }
    .logo-pack { font-size: 1em; }
    .logo-icon { font-size: 3em; }
    .btn-play { padding: 12px 40px; font-size: 1.1em; }
    .map-circle { width: 44px; height: 44px; font-size: 1em; }
    .powerup-btn .powerup-name { display: none; }

    #game-board { gap: 3px; padding: 5px; }
    .tile { min-height: 32px; border-radius: 7px; }
    .tile .word { font-size: 0.6em; }
    .tile.emoji .word { font-size: 1.5em; }
}
