/**
 * @author      Mike Fairbrother <mike@fairbrother.me>
 * @copyright   2024-2026 Mike Fairbrother. All rights reserved.
 * @license     PROPRIETARY - No rights to copy, modify, distribute, or reuse
 *              any part of this code without explicit written permission from the author.
 */
/**
 * Pixel Garden - Styles
 * A calm, creative pixel art garden arrangement game
 */

/* ---- Game-specific tokens ---- */
:root {
    --pg-green: #2ed573;
    --pg-yellow: #ffd93d;
    --pg-green-glow: rgba(46, 213, 115, 0.4);
    --pg-yellow-glow: rgba(255, 217, 61, 0.3);
    --pg-cell-bg: rgba(255, 255, 255, 0.04);
    --pg-cell-hover: rgba(255, 255, 255, 0.08);
    --pg-cell-placed: rgba(46, 213, 115, 0.06);
    --pg-palette-bg: rgba(15, 12, 41, 0.95);
}

/* ---- Menu Screen ---- */
.menu-garden-icon {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
    height: 56px;
    align-items: center;
}

.garden-float {
    font-size: 36px;
    animation: pg-float 3s ease-in-out infinite;
}
.g-f1 { animation-delay: 0s; }
.g-f2 { animation-delay: 0.5s; }
.g-f3 { animation-delay: 1s; }
.g-f4 { animation-delay: 1.5s; }

@keyframes pg-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.menu-title {
    font-size: 48px;
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(135deg, var(--pg-green), var(--pg-yellow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.menu-subtitle {
    color: var(--gp-text-secondary);
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 28px;
}

/* ---- Size Selector ---- */
.size-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    width: 100%;
    max-width: 300px;
}

.size-btn {
    flex: 1;
    padding: 12px 8px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--gp-radius-sm);
    background: rgba(255, 255, 255, 0.03);
    color: var(--gp-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-family: var(--gp-font-stack);
}

.size-btn.active {
    border-color: var(--pg-green);
    background: rgba(46, 213, 115, 0.08);
    color: var(--gp-text-primary);
    box-shadow: 0 0 16px var(--pg-green-glow);
}

.size-label {
    font-size: 14px;
    font-weight: 700;
}

.size-detail {
    font-size: 11px;
    opacity: 0.7;
}

/* ---- Menu Stats ---- */
.menu-stats {
    display: flex;
    gap: 32px;
    margin-bottom: 28px;
}

.menu-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.menu-stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--pg-green);
}

.menu-stat-label {
    font-size: 11px;
    color: var(--gp-text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* ---- Game Screen Layout ---- */
#screen-game {
    display: flex;
    flex-direction: column;
}

#garden-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    overflow: hidden;
}

/* ---- Garden Grid ---- */
#garden-grid {
    display: grid;
    gap: 2px;
    width: 100%;
    max-width: 380px;
    aspect-ratio: 1;
    padding: 4px;
    border-radius: var(--gp-radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.grid-cell {
    aspect-ratio: 1;
    border-radius: 4px;
    background: var(--pg-cell-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.3s ease;
    font-size: 20px;
    line-height: 1;
    position: relative;
    overflow: hidden;
}

.grid-cell:active {
    transform: scale(0.92);
}

.grid-cell.empty:hover,
.grid-cell.empty:focus {
    background: var(--pg-cell-hover);
}

.grid-cell.placed {
    background: var(--pg-cell-placed);
}

.grid-cell.bonus-glow {
    animation: pg-bonus-glow 0.8s ease-out;
}

.grid-cell.rule-fail {
    animation: pg-rule-fail 0.4s ease-out;
}

.grid-cell.place-pop {
    animation: pg-place-pop 0.35s ease-out;
}

@keyframes pg-bonus-glow {
    0% { box-shadow: 0 0 0 0 var(--pg-green-glow); }
    50% { box-shadow: 0 0 12px 4px var(--pg-green-glow); }
    100% { box-shadow: 0 0 0 0 transparent; }
}

@keyframes pg-rule-fail {
    0%, 100% { background: var(--pg-cell-placed); }
    50% { background: rgba(255, 71, 87, 0.15); }
}

@keyframes pg-place-pop {
    0% { transform: scale(0.5); opacity: 0.5; }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

/* Grid cell selected indicator */
.grid-cell.empty.can-place {
    background: rgba(46, 213, 115, 0.08);
    border: 1px dashed rgba(46, 213, 115, 0.3);
}

/* ---- Palette Area ---- */
#palette-area {
    background: var(--pg-palette-bg);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 8px 12px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.palette-hint {
    text-align: center;
    font-size: 11px;
    color: var(--gp-text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: opacity 0.3s ease;
}

.palette-hint.hidden {
    opacity: 0;
}

#palette {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.palette-item {
    width: 48px;
    height: 48px;
    border-radius: var(--gp-radius-sm);
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    flex-shrink: 0;
}

.palette-item:active {
    transform: scale(0.9);
}

.palette-item.selected {
    border-color: var(--pg-green);
    background: rgba(46, 213, 115, 0.12);
    box-shadow: 0 0 14px var(--pg-green-glow);
    transform: scale(1.08);
}

.palette-item.bonus-item {
    animation: pg-bonus-pulse 1.5s ease-in-out infinite;
    border-color: rgba(255, 217, 61, 0.4);
}

.palette-item.bonus-item.selected {
    border-color: var(--pg-yellow);
    box-shadow: 0 0 14px var(--pg-yellow-glow);
}

@keyframes pg-bonus-pulse {
    0%, 100% { box-shadow: 0 0 6px rgba(255, 217, 61, 0.2); }
    50% { box-shadow: 0 0 16px rgba(255, 217, 61, 0.5); }
}

/* ---- Bonus Indicator ---- */
.bonus-indicator {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    color: var(--pg-green);
    background: rgba(46, 213, 115, 0.12);
    border: 1px solid rgba(46, 213, 115, 0.2);
    z-index: 20;
    pointer-events: none;
    animation: pg-bonus-float 1s ease-out forwards;
    white-space: nowrap;
}

@keyframes pg-bonus-float {
    0% { opacity: 0; transform: translateX(-50%) translateY(0) scale(0.8); }
    20% { opacity: 1; transform: translateX(-50%) translateY(-4px) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-30px) scale(0.9); }
}

/* ---- Complete Screen ---- */
.complete-garden-emoji {
    font-size: 64px;
    margin-bottom: 8px;
    animation: pg-complete-bounce 1s ease-out;
}

@keyframes pg-complete-bounce {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.3); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

.complete-title {
    font-size: 32px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--pg-green), var(--pg-yellow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 24px;
}

.complete-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}

.complete-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.complete-stat-num {
    font-size: 28px;
    font-weight: 800;
    color: var(--pg-green);
}

.complete-stat-label {
    font-size: 11px;
    color: var(--gp-text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.new-best {
    font-size: 16px;
    font-weight: 700;
    color: var(--gp-accent);
    margin-bottom: 20px;
    animation: gp-badge-pop 0.5s ease-out;
}

/* ---- Help Modal Rules ---- */
.help-section {
    margin-bottom: 16px;
}

.help-emoji-row {
    font-size: 28px;
    margin-bottom: 8px;
    letter-spacing: 4px;
}

.help-text {
    font-size: 14px;
    color: var(--gp-text-secondary);
    line-height: 1.5;
}

.help-rules {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.help-rule {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--gp-radius-sm);
    background: rgba(255, 255, 255, 0.03);
}

.help-rule-emoji {
    font-size: 22px;
    min-width: 48px;
    text-align: center;
    flex-shrink: 0;
}

.help-rule-text {
    font-size: 13px;
    color: var(--gp-text-secondary);
    line-height: 1.4;
}

/* ---- Particle effects ---- */
.pg-sparkle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--pg-green);
    pointer-events: none;
    animation: pg-sparkle-fly 0.7s ease-out forwards;
}

@keyframes pg-sparkle-fly {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

/* ---- Responsive adjustments ---- */
@media (max-height: 640px) {
    .grid-cell {
        font-size: 16px;
    }
    .palette-item {
        width: 40px;
        height: 40px;
        font-size: 22px;
    }
    #palette-area {
        padding: 6px 8px;
    }
}

@media (max-height: 560px) {
    #garden-area {
        padding: 4px;
    }
    .grid-cell {
        font-size: 14px;
    }
    .palette-item {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }
}
