/* retoor <retoor@molodetz.nl> */

:root {
    --game-gold-rgb: 245, 197, 24;
    --game-gold: rgb(var(--game-gold-rgb));
}

.game-page {
    max-width: var(--max-content);
    margin: 0 auto;
    padding: var(--space-lg);
}

.game-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.game-title h1 {
    margin: 0;
    font-size: 1.8rem;
}

.game-subtitle {
    margin: var(--space-xs) 0 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.game-hud {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.hud-stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.hud-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hud-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.hud-sub {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.hud-xp-bar {
    height: 6px;
    background: var(--bg-muted);
    border-radius: 999px;
    overflow: hidden;
}

.hud-xp-fill {
    display: block;
    height: 100%;
    width: var(--hud-xp, 0);
    background: var(--accent);
    transition: width 0.4s ease;
}

.game-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: var(--space-xl);
    align-items: start;
}

.game-main {
    min-width: 0;
}

.game-section-title {
    font-size: 1.1rem;
    margin: 0 0 var(--space-md);
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.game-plot {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    min-height: 140px;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    text-align: center;
}

.game-plot-empty {
    border-style: dashed;
}

.game-plot-growing {
    border-color: var(--warning);
}

.game-plot-ready {
    border-color: var(--success);
    box-shadow: 0 0 0 1px var(--success) inset;
}

.plot-icon {
    font-size: 2.4rem;
    line-height: 1;
}

.plot-ready-icon {
    animation: plot-bounce 1.2s ease-in-out infinite;
}

@keyframes plot-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.plot-crop-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.plot-timer {
    font-family: var(--font-mono);
    color: var(--warning);
    font-size: 0.85rem;
}

.plot-water-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.plot-empty-label,
.plot-ready-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.plot-plant-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    width: 100%;
}

.plot-crop-select {
    width: 100%;
    padding: var(--space-xs);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    color: var(--text-primary);
    font-size: 0.8rem;
}

.game-plot-buy {
    border-style: dashed;
    color: var(--text-secondary);
}

.game-shop {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.shop-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.shop-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.shop-info span {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.game-side {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.game-leaderboard {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.game-lb-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-input);
}

.game-lb-self {
    background: var(--bg-muted);
}

.game-lb-rank {
    flex-shrink: 0;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    min-width: 2.2em;
}

.game-lb-name-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.game-lb-name {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.game-lb-name:hover {
    color: var(--accent);
}

.game-lb-level {
    flex-shrink: 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.game-lb-title {
    color: var(--accent);
    font-size: 0.7rem;
    font-style: italic;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.game-lb-score {
    flex-shrink: 0;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    min-width: 4em;
    text-align: right;
}

.game-lb-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
}

@media (max-width: 1024px) {
    .game-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .game-page {
        padding: var(--space-md);
    }
    .game-hud {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }
    .game-title h1 {
        font-size: 1.5rem;
    }
    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: var(--space-sm);
    }
    .perk-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

@media (max-width: 480px) {
    .game-page {
        padding: var(--space-sm);
    }
    .hud-value {
        font-size: 1.3rem;
    }
    .game-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .game-plot {
        min-height: 120px;
        padding: var(--space-sm);
    }
    .plot-icon {
        font-size: 2rem;
    }
    .shop-row {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-sm);
    }
    .shop-row form,
    .shop-row .btn {
        width: 100%;
    }
    .perk-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 360px) {
    .game-hud {
        grid-template-columns: 1fr;
    }
    .game-grid,
    .perk-grid {
        grid-template-columns: 1fr;
    }
}

@media (hover: none) and (pointer: coarse) {
    .game-plot .btn,
    .perk-card .btn,
    .quest-foot .btn,
    .game-daily .btn,
    .plot-crop-select {
        min-height: 44px;
    }
    .game-plot form,
    .perk-card form,
    .game-daily form {
        width: 100%;
    }
    .game-plot .btn,
    .perk-card .btn,
    .game-daily .btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .plot-ready-icon {
        animation: none;
    }
    .hud-xp-fill,
    .quest-fill {
        transition: none;
    }
}

.game-daily,
.game-quests,
.game-lb-section {
    margin-bottom: var(--space-lg);
}

.daily-streak {
    margin: 0 0 var(--space-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.daily-claimed {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.quest-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.quest-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-sm) var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.quest-done {
    opacity: 0.6;
}

.quest-head {
    display: flex;
    justify-content: space-between;
    gap: var(--space-sm);
    font-size: 0.85rem;
    font-weight: 600;
}

.quest-reward {
    color: var(--success);
    white-space: nowrap;
}

.quest-bar {
    height: 5px;
    background: var(--bg-muted);
    border-radius: 999px;
    overflow: hidden;
}

.quest-fill {
    display: block;
    height: 100%;
    width: var(--quest-pct, 0);
    background: var(--accent);
}

.quest-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.quest-claimed {
    color: var(--success);
}

.perk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-md);
}

.perk-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    text-align: center;
}

.perk-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.perk-name {
    font-size: 0.9rem;
}

.perk-level {
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
}

.perk-effect {
    color: var(--text-secondary);
    font-size: 0.78rem;
    min-height: 2.2em;
}

.perk-maxed {
    color: var(--success);
    font-size: 0.8rem;
    font-weight: 600;
}

.game-perks {
    margin-top: var(--space-xl);
}

.game-legacy {
    margin-top: var(--space-xl);
}

.game-legacy-note {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0 0 var(--space-md);
}

.legacy-card {
    border-color: var(--game-gold);
}

.game-plot-golden {
    border-color: var(--game-gold);
    box-shadow: 0 0 0 1px var(--game-gold) inset, 0 0 12px rgba(var(--game-gold-rgb), 0.4);
}

.plot-steal-locked {
    color: var(--warning);
    font-family: var(--font-mono);
}

.game-error {
    background: var(--bg-card);
    border: 1px solid var(--danger);
    border-left: 3px solid var(--danger);
    border-radius: var(--radius);
    color: var(--danger);
    margin: 0 0 var(--space-md);
    padding: var(--space-sm) var(--space-md);
}

.shop-actions {
    align-items: center;
    display: flex;
    gap: var(--space-sm);
}

.plot-raided {
    color: var(--warning);
    font-size: 0.75rem;
    font-weight: 600;
}
