/* ============================================================
    GAME GRID STYLES (Aligned with index.remote.html)
    ============================================================ */

body.game-body {
  position: fixed;
  width: 100%;
  height: 100%;
  height: -webkit-fill-available;
  overflow: hidden;
}

#game-root {
  height: 100%;
  height: -webkit-fill-available;
  overflow: hidden;
}

:root {
    --grid-bg: #0a0b10;
    --tile-empty: #1c202d;
    --tile-border: #2d3345;
    --char-color: rgba(255, 0, 255, 0.85);
    --char-glow: rgba(255, 0, 255, 0.5);
    --tile-soil: #2b1d14;
    --tile-soil-border: #3d2b1f;
    --primary: #00ff88;
    --secondary: #00d4ff;
    --accent: #ffcc00;
}

/* ============================================================
   MOBILE-FIRST BASE — 1 coluna, sem bordas
   ============================================================ */
#game-root {
    width: 100%;
    height: 100vh;
    height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    padding-bottom: 64px; /* espaço para bottom-bar */
}

.game-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    gap: 8px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Sidebar base */
.game-sidebar {
    display: none; /* oculto no mobile, vira overlay ao ativar */
    flex-direction: column;
    gap: 8px;
    padding: 10px 8px;
    overflow-y: auto;
    background: transparent;
}

/* Sidebars como bottom-sheet overlay no mobile */
.game-sidebar.visible {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 250;
    max-height: 55vh;
    background: var(--surface);
    border-top: 2px solid var(--border);
    border-radius: 16px 16px 0 0;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    animation: sidebarSlideUp 0.25s ease;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.5);
}

@keyframes sidebarSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.game-sidebar.visible::before {
    content: '';
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 12px;
    display: block;
    flex-shrink: 0;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 240;
}
.sidebar-backdrop.visible {
    display: block;
}

.game-main {
    order: 0;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-image: radial-gradient(var(--border) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* Seção genérica dentro das sidebars */
.sidebar-section {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
}
.sidebar-section__title {
    font-size: 0.5rem;
    font-weight: bold;
    letter-spacing: 1.5px;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

/* Grid de jogo — responsivo */
#grid-container {
    --tile-size: min(calc((100vw - 40px) / 10), 40px);
    display: grid;
    grid-template-columns: repeat(10, var(--tile-size));
    grid-template-rows: repeat(12, var(--tile-size));
    gap: 3px;
    padding: 10px;
    background: var(--grid-bg);
    border: 2px solid var(--tile-border);
    border-radius: 8px;
    width: max-content;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
}

/* Tile base — estrutura/parede (não cultivável) */
.tile {
    width: var(--tile-size);
    height: var(--tile-size);
    background: var(--tile-empty);
    border: 1px solid rgba(45, 51, 69, 0.5);
    border-radius: 4px;
    position: relative;
    transition: background 0.12s, border-color 0.12s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.crop-icon { font-size: 18px; }
.growth-indicator { height: 2px; }

/* Character CSS */
.tile.character {
    background-color: var(--char-color) !important;
    box-shadow: 0 0 20px var(--char-glow);
    z-index: 10;
    border-radius: 6px;
    animation: char-pulse 2s infinite;
}

/* ── Tile states ─────────────────────────────────────────── */

/* Solo cultivável — bloco plantável */
.tile--soil {
    background: var(--tile-soil);
    border: 1px solid rgba(61, 43, 31, 0.35);
    border-radius: 3px;
    /* Textura de solo arado: pontilhado sutil nos cantos */
    background-image:
        radial-gradient(circle, rgba(90,55,30,0.45) 1px, transparent 1px),
        radial-gradient(circle, rgba(90,55,30,0.25) 1px, transparent 1px);
    background-size: 10px 10px, 10px 10px;
    background-position: 0 0, 5px 5px;
}

/* Mesa Hidropônica — estilo premium azulado */
.tile--soil.tile--hydro {
    background: #0f2430;
    border: 1px solid rgba(27, 163, 216, 0.4);
    background-image: 
        radial-gradient(circle, rgba(27, 163, 216, 0.3) 1px, transparent 1px);
    background-size: 8px 8px;
}

/* Solo vazio — dica visual de que pode plantar */
.tile--soil:not(.has-crop):not(.character)::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 3px;
    border: 1px dashed rgba(90, 55, 30, 0.25);
    pointer-events: none;
}
.tile--soil.tile--hydro:not(.has-crop):not(.character)::after {
    border-color: rgba(27, 163, 216, 0.3);
}

/* Solo com planta */
.tile--soil.has-crop {
    background: #1e1208;
    border-color: #4a3020;
    background-image: none;
}

/* Pronto para colher — destaque dourado */
.tile.ready-harvest {
    border: 2px solid var(--accent) !important;
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.45), inset 0 0 6px rgba(255, 204, 0, 0.12);
    animation: harvest-pulse 1.4s ease-in-out infinite;
}

/* Deep link "Ir para o Grid" (Plano 029, Fase 5) — destaca o tile relevante
   para a missão ativa (plantar/colher o alvo), distinto do dourado de colheita
   pronta para não sobrepor sinais visuais. */
.tile.tile--mission-target {
    border: 2px solid #00e5ff !important;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.55), inset 0 0 6px rgba(0, 229, 255, 0.15);
    animation: mission-target-pulse 1.6s ease-in-out infinite;
}
@keyframes mission-target-pulse {
    0%, 100% { box-shadow: 0 0 8px rgba(0, 229, 255, 0.35); }
    50% { box-shadow: 0 0 16px rgba(0, 229, 255, 0.75); }
}

/* ── Mobile Controls ────────────────────────────────────────── */
.mobile-controls {
    display: flex;
    width: 100%;
    max-width: 400px;
    margin-top: 12px;
    justify-content: space-between;
    align-items: center;
    padding: 0 8px;
}

.dpad {
    display: grid;
    grid-template-areas: 
        ". up ."
        "left . right"
        ". down .";
    gap: 8px;
}

.btn-dpad {
    width: 50px;
    height: 50px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: white;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
}

.btn-dpad:active {
    background: var(--border);
    transform: scale(0.95);
}

.btn-dpad--up { grid-area: up; }
.btn-dpad--left { grid-area: left; }
.btn-dpad--down { grid-area: down; }
.btn-dpad--right { grid-area: right; }

/* ── Native Select (mobile-friendly) ──────────────────────── */
select {
    font-family: var(--font);
}
.native-select {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    min-height: 44px;
    appearance: auto;
    -webkit-appearance: auto;
    cursor: pointer;
}
.native-select:focus {
    border-color: var(--green);
    outline: none;
}

/* ── Mobile D-Pad ─────────────────────────────────────────── */
.mobile-dpad {
    display: none;
    flex-direction: row;
    gap: 6px;
    margin-top: 10px;
    align-items: center;
    justify-content: center;
}

/* ── Bottom Action Bar ─────────────────────────────────────── */
.bottom-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 150;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 8px 10px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

.bottom-bar__action {
    flex: 1;
    min-height: 44px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    cursor: pointer;
    touch-action: manipulation;
    text-transform: uppercase;
    color: #000;
    padding: 0 8px;
}

.bottom-bar__action--plant {
    background: var(--green);
    box-shadow: 0 3px 0 #009e4f;
}

.bottom-bar__action--harvest {
    background: var(--accent);
    box-shadow: 0 3px 0 #ccaa00;
}

.bottom-bar__spacer {
    width: 1px;
    height: 32px;
    background: var(--border);
    flex-shrink: 0;
}

.bottom-bar__toggle {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    background: var(--surface2);
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bottom-bar__toggle:active {
    background: var(--border);
    transform: scale(0.93);
}

/* ── Old action buttons (replaced by bottom bar) ────────── */
.action-buttons {
    display: none;
}

/* ── Tablet: tiles maiores ─────────────────────────────────── */
@media (min-width: 768px) {
    #grid-container {
        --tile-size: 40px;
        gap: 4px;
        padding: 16px;
    }

    .tile { width: 40px; height: 40px; }
    .crop-icon { font-size: 22px; }
    .growth-indicator { height: 3px; }

    .game-main { padding: 24px 16px; }
    .sidebar-section { padding: 12px 14px; }
    .sidebar-section__title { font-size: 0.58rem; margin-bottom: 10px; }
    .seed-btn { min-width: 48px; padding: 6px 8px; font-size: 1.3rem; }
    .seed-btn small { font-size: 0.55rem; }
    .req-item-mini { font-size: 0.85rem; }

    .mobile-dpad { display: flex; }
}

/* ── Desktop: grid-first, sem bottom-bar nem overlay ─────── */
@media (min-width: 900px) {
    #game-root {
        padding-bottom: 0;
        max-width: 1200px;
        margin: 0 auto;
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
    }

    .game-layout {
        flex-direction: unset;
        display: grid;
        grid-template-columns: 240px 1fr 240px;
        grid-template-areas: "left center right";
        overflow: hidden;
    }

    #grid-container {
        --tile-size: 40px;
        gap: 4px;
        padding: 16px;
    }

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

    .game-sidebar {
        display: flex; /* sempre visível no desktop */
        padding: 14px 12px;
        gap: 10px;
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: var(--border) transparent;
        position: static;
        border-radius: 0;
        box-shadow: none;
        max-height: none;
    }
    .game-sidebar.visible {
        display: flex;
        position: static;
        border-radius: 0;
        box-shadow: none;
        max-height: none;
        border-top: none;
        animation: none;
    }
    .game-sidebar.visible::before {
        display: none;
    }
    .game-sidebar--left {
        grid-area: left;
        border-right: 1px solid var(--border);
        background: var(--surface);
    }
    .game-sidebar--right {
        grid-area: right;
        border-left: 1px solid var(--border);
        background: var(--surface);
    }

    .game-main {
        grid-area: center;
        overflow: auto;
        padding: 24px 16px;
    }

    .bottom-bar {
        display: none;
    }

    .sidebar-backdrop {
        display: none !important;
    }

    .mobile-dpad {
        display: none;
    }

    .guest-banner { font-size: 0.6rem; padding: 6px 12px; }
}

/* ── Desktop wide: ajustes finos ────────────────────────────── */
@media (min-width: 1024px) {
    .btn-dpad { width: 50px; height: 50px; font-size: 1.2rem; }
}

@keyframes harvest-pulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 204, 0, 0.45), inset 0 0 6px rgba(255, 204, 0, 0.12); }
    50%       { box-shadow: 0 0 18px rgba(255, 204, 0, 0.75), inset 0 0 10px rgba(255, 204, 0, 0.22); }
}

/* ── Crop Visuals ──────────────────────────────────────────── */
.crop-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    opacity: 0.9;
    z-index: 2;
}

/* Barra de crescimento — rodapé do tile */
.growth-indicator {
    position: absolute;
    bottom: 2px;
    left: 3px;
    right: 3px;
    height: 3px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 2px;
    overflow: hidden;
    z-index: 3;
}

.growth-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* HUD econômico da missão (Plano 039-07). Estado = cor + ícone + texto; nunca só cor. */
.meco { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; font-size: 0.68rem; }
.meco__title { font-size: 0.6rem; font-weight: bold; letter-spacing: 1px; color: var(--secondary); }
.meco__reserves { display: flex; flex-wrap: wrap; gap: 6px; color: var(--muted); }
.meco__chips { display: flex; flex-wrap: wrap; gap: 4px; }
.meco__line { color: var(--muted); }
.meco__line strong { color: var(--text, #fff); }
.meco__note { color: var(--muted); font-style: italic; }
.meco__shared { color: var(--yellow); }
.meco__details summary { cursor: pointer; color: var(--secondary); font-size: 0.6rem; letter-spacing: 1px; }
.meco__details ul { margin: 4px 0 0 14px; padding: 0; color: var(--muted); }
.meco-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 10px; border: 1px solid var(--border); }
.meco-chip--ok { color: var(--green); border-color: var(--green); }
.meco-chip--warn { color: var(--yellow); border-color: var(--yellow); }
.meco-chip--bad { color: var(--red); border-color: var(--red); }
.meco-chip--na { color: var(--muted); border-style: dashed; }
.meco-chip__label { opacity: 0.85; }
.meco-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.meco__actions { display: flex; flex-wrap: wrap; gap: 4px; }
.meco-btn { flex: 1 1 auto; min-height: 32px; padding: 4px 8px; font-size: 0.62rem; font-weight: bold; letter-spacing: 0.5px;
  color: var(--secondary); background: transparent; border: 1px solid var(--secondary); border-radius: 6px; cursor: pointer; }
.meco-btn:hover, .meco-btn:focus-visible { background: rgba(0, 212, 255, 0.15); outline: 2px solid var(--secondary); outline-offset: 1px; }

/* Mission Panel (sidebar esquerda) */
.mission-panel-mini {
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid var(--secondary);
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.mission-requirements-mini {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.req-item-mini {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem; /* Aumentado significativamente */
    font-weight: bold;
    color: var(--text);
}

.req-item-mini span:first-child {
    display: flex;
    align-items: center;
    gap: 8px;
}

.req-item-mini span:last-child {
    flex: 0 0 auto;
    margin-left: 12px;
    color: var(--secondary);
}

.req-item-mini__stage {
    color: var(--muted);
    font-family: inherit;
    font-size: 0.72em;
    font-weight: normal;
}

.req-item-mini.complete {
    color: var(--green);
    opacity: 0.7;
    text-decoration: none; /* Removido para legibilidade */
}

.req-item-mini.complete::after {
    content: ' ✓';
    color: var(--green);
}

.turns-counter-mini {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 6px 0 4px;
    padding: 5px 8px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.turns-counter__label {
    font-size: 0.6rem;
    font-weight: bold;
    letter-spacing: 1px;
    color: var(--muted);
}

.turns-counter__value {
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--green);
    transition: color 0.3s;
}

.game-timer-mini {
    font-family: monospace;
    font-size: 1rem;
    color: var(--accent);
    text-align: right;
    border-top: 1px solid var(--border);
    padding-top: 6px;
}

/* Seletor de sementes — grade na sidebar */
.seed-selector-mini {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.seed-grid-mini {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.seed-btn {
    background: var(--surface2);
    border: 2px solid var(--border);
    color: white;
    padding: 10px 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.3rem;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
    flex: 1;
}

.seed-btn small {
    font-size: 0.55rem;
    margin-top: 2px;
    color: var(--muted);
}

.seed-btn.active {
    border-color: var(--green);
    background: rgba(0, 230, 118, 0.15);
    box-shadow: 0 0 12px rgba(0, 230, 118, 0.3);
}

/* Dica de controles (sidebar esquerda) */
.game-controls-hint {
    background: var(--surface2);
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

/* Silo — sidebar direita */
.silo-panel-capacity {
    margin-bottom: 10px;
}
.silo-panel-capacity__header {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--muted);
    margin-bottom: 4px;
}
.silo-panel-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    max-height: 180px;
    overflow-y: auto;
}
.silo-item-mini {
    font-size: 0.7rem;
    color: var(--secondary);
    font-family: monospace;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Painel de status (appbar desktop) */
.appbar-status {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.6rem;
    font-family: monospace;
}

/* Scanner (sidebar direita) */
.scanner-panel {
    border-color: var(--primary);
}
.scanner-panel .sidebar-section__title {
    color: var(--primary);
    border-color: rgba(0, 255, 136, 0.3);
}

/* Banner de modo convidado — faixa full-width entre appbar e colunas */
.guest-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 215, 64, 0.10);
    border: 1px solid var(--yellow);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.6rem;
    font-weight: bold;
    color: var(--yellow);
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.2s;
}
.guest-banner:hover {
    background: rgba(255, 215, 64, 0.18);
}

.game-controls-hint span {
    font-weight: bold;
    color: var(--text);
}

/* Shop Modal Quick Access */
.shop-grid-mini {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shop-section-title {
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--muted);
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
    margin-bottom: 5px;
}

.shop-card-mini {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 8px;
    gap: 12px;
    transition: background 0.2s;
}

.shop-card-mini:hover {
    background: rgba(255,255,255,0.06);
}

.shop-card-icon {
    font-size: 1.5rem;
    min-width: 32px;
    text-align: center;
}

.shop-card-main {
    flex: 1;
}

.shop-card-name {
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--primary);
}

.shop-card-desc {
    font-size: 0.65rem;
    color: var(--muted);
    margin-top: 2px;
    line-height: 1.2;
}

.shop-card-qty {
    font-size: 0.65rem;
    color: var(--accent);
    margin-top: 2px;
}

.shop-card-side {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.shop-card-price {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--accent);
    font-family: monospace;
}

.shop-card-stock {
    font-size: 0.55rem;
    color: var(--muted);
}

.btn-buy-mini, .btn-sell-mini {
    padding: 10px 16px;
    font-size: 0.7rem;
    font-weight: bold;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    min-height: 44px;
}

.btn-buy-mini {
    background: var(--primary);
    color: var(--bg);
}

.btn-buy-mini:disabled {
    background: var(--muted);
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sell-mini {
    background: var(--secondary);
    color: var(--bg);
}

/* Controle inline de quantidade no card de semente */
.shop-inline-qty {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
}

.btn-qty-adj {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--primary);
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.btn-qty-adj:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.btn-qty-adj:not(:disabled):hover {
    background: var(--primary);
    color: var(--bg);
}

.qty-display {
    min-width: 20px;
    text-align: center;
    font-size: 0.75rem;
    font-family: monospace;
    font-weight: bold;
    color: var(--accent);
}

/* Catalog Modal Styles */
.catalog-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.catalog-item-row {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    transition: transform 0.2s;
}

.catalog-item-row:hover {
    background: rgba(255,255,255,0.08);
    transform: translateX(4px);
}

.catalog-item__icon {
    font-size: 1.8rem;
    margin-right: 15px;
    min-width: 40px;
    text-align: center;
}

.catalog-item__info {
    flex: 1;
}

.catalog-item__name {
    font-weight: bold;
    color: var(--primary);
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.catalog-item__desc {
    font-size: 0.7rem;
    color: var(--muted);
    margin-bottom: 8px;
    line-height: 1.2;
}

.catalog-item__stats {
    display: flex;
    gap: 10px;
    font-size: 0.6rem;
    color: var(--accent);
    font-family: monospace;
}

.catalog-loader {
    text-align: center;
    padding: 20px;
    color: var(--muted);
    font-style: italic;
}

/* Modais — desktop */
@media (min-width: 480px) {
    .modal {
        max-width: 620px !important;
    }
}

/* Progress bar genérica */
.progress-bar {
    background: var(--border);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}
.progress-bar--small {
    height: 5px;
}
.progress-bar__fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}
.progress-bar__fill--green { background: var(--primary); }

/* Formulário de conversão da conta convidada — mantém o progresso no mesmo usuário. */
.guest-save-panel {
    margin: 12px 0 10px;
    padding: 12px;
    border: 1px solid var(--yellow);
    border-radius: 10px;
    background: rgba(255, 204, 0, 0.08);
}

.guest-save-panel[hidden] {
    display: none;
}

.guest-save-panel h3 {
    margin: 0 0 4px;
    color: var(--yellow);
    font-size: 0.78rem;
    letter-spacing: 0.8px;
}

.guest-save-panel > p {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.4;
}

.guest-save-panel form {
    display: grid;
    gap: 8px;
}

.guest-save-panel label {
    display: grid;
    gap: 4px;
    color: var(--text);
    font-size: 0.68rem;
    font-weight: 700;
}

.guest-save-panel label span {
    color: var(--muted);
    font-weight: 400;
}

.guest-save-panel input {
    width: 100%;
    min-height: 38px;
    box-sizing: border-box;
    padding: 8px 10px;
    font-size: 0.8rem;
}

.guest-save-panel__actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.guest-save-panel__actions button {
    flex: 1;
    min-height: 40px;
    padding: 8px;
    font-size: 0.68rem;
}

.guest-save-error {
    margin: 0;
    color: var(--red);
    font-size: 0.68rem;
    line-height: 1.35;
}

.guest-save-success {
    color: var(--green) !important;
}

/* ============================================================
   GRID-FIRST LAYOUT — o jogo ocupa a maior área visual
   ============================================================ */
.game-layout {
    min-width: 0;
}

.game-main {
    order: -1;
    min-width: 0;
    min-height: 0;
    justify-content: flex-start;
    gap: clamp(8px, 1.5vh, 16px);
}

.game-main__header {
    width: min(100%, 680px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 2px;
}

.game-main__header > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.game-main__eyebrow {
    color: var(--secondary);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.game-main__title {
    color: var(--text);
    font-size: clamp(0.95rem, 2.5vw, 1.25rem);
    letter-spacing: 0.04em;
}

.game-main__hint {
    color: var(--muted);
    font-size: 0.68rem;
    text-align: right;
}

/* O tabuleiro escala pelo espaço disponível, sem overflow horizontal. */
#grid-container {
    --grid-gap: clamp(2px, 0.55vw, 5px);
    --grid-padding: clamp(8px, 1.8vw, 18px);
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    grid-template-rows: repeat(12, minmax(0, 1fr));
    width: min(100%, 680px);
    max-width: 100%;
    aspect-ratio: 10 / 12;
    box-sizing: border-box;
    gap: var(--grid-gap);
    padding: var(--grid-padding);
}

#grid-container .tile {
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
    aspect-ratio: 1;
    box-sizing: border-box;
}

#grid-container .crop-icon {
    font-size: clamp(16px, 4.8vw, 26px);
    line-height: 1;
}

#grid-container .growth-indicator {
    left: 3px;
    right: 3px;
    bottom: 2px;
    height: 3px;
}

/* Mais área clicável e leitura mais clara dos painéis contextuais. */
.seed-grid-mini {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
    gap: 8px;
}

.seed-btn {
    min-width: 0;
    min-height: 54px;
    padding: 8px 6px;
    font-size: 1.55rem;
}

.seed-btn small {
    font-size: 0.6rem;
}

.req-item-mini {
    line-height: 1.3;
}

@media (max-width: 899px) {
    .game-layout {
        overflow-y: auto;
    }

    .game-main {
        align-items: center;
        padding: clamp(10px, 3vw, 18px) clamp(8px, 4vw, 18px);
    }

    .game-main__header {
        align-items: flex-start;
    }

    .game-main__hint {
        max-width: 42%;
        font-size: 0.62rem;
    }

    #grid-container {
        width: min(100%, calc(100vw - 16px));
        padding: clamp(8px, 2.8vw, 14px);
        gap: clamp(2px, 0.9vw, 4px);
    }

    #grid-container .crop-icon {
        font-size: clamp(16px, 5.6vw, 24px);
    }

    .game-sidebar.visible {
        max-height: min(70vh, 560px);
        overflow-y: auto;
    }
}

@media (max-width: 479px) {
    /* O appbar também precisa caber em aparelhos estreitos sem roubar área
       do tabuleiro. Os rótulos completos continuam disponíveis via title/AX. */
    .appbar {
        gap: 4px;
        padding: 6px;
    }

    .btn-back {
        width: 28px;
        min-width: 28px;
        padding: 0;
        font-size: 0;
        justify-content: center;
    }

    .btn-back::before {
        content: '‹';
        font-size: 24px;
    }

    .appbar__title {
        min-width: 0;
        max-width: 105px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 9px;
        letter-spacing: 0.7px;
    }

    .appbar-status {
        display: none;
    }

    .scrap-badge {
        padding: 3px 5px;
        font-size: 9px;
        white-space: nowrap;
    }

    .appbar__actions {
        gap: 2px;
    }

    .appbar__actions .btn-icon {
        width: 32px;
        min-width: 32px;
        height: 32px;
        min-height: 32px;
        padding: 3px;
        font-size: 13px;
    }
}

@media (min-width: 900px) {
    #game-root {
        max-width: 1440px;
    }

    /* Um palco amplo para o grid e uma rail empilhada para o contexto. */
    .game-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) clamp(250px, 28vw, 340px);
        grid-template-rows: minmax(0, 1.15fr) minmax(200px, 0.85fr);
        grid-template-areas:
            "center left"
            "center right";
        gap: 0;
    }

    .game-main {
        grid-area: center;
        order: 0;
        align-items: center;
        justify-content: center;
        overflow: auto;
        padding: clamp(18px, 3vw, 34px);
    }

    .game-main__header {
        flex-shrink: 0;
    }

    .game-sidebar {
        min-width: 0;
        padding: 14px;
    }

    .game-sidebar--left {
        border-right: 0;
        border-left: 1px solid var(--border);
    }

    .game-sidebar--right {
        border-left: 1px solid var(--border);
        border-top: 1px solid var(--border);
    }

    #grid-container {
        /* Mantém as 12 linhas visíveis junto do cabeçalho, mesmo em telas
           desktop baixas ou com o banner de convidado aberto. */
        width: min(100%, 640px, calc(83.333vh - 121px));
    }

    #grid-container .crop-icon {
        font-size: clamp(20px, 2.2vw, 28px);
    }
}

