/* ==========================================================================
   Material You (M3) Android 15+ Tokens & Expressive Dark Architecture
   ========================================================================== */

:root {
    --md-sys-color-background: #0b0e14;
    --md-sys-color-surface: #131720;
    --md-sys-color-surface-container: #1b202c;
    --md-sys-color-surface-container-high: #242b3a;
    --md-sys-color-surface-container-highest: #2e374a;
    
    --md-sys-color-primary: #a8c7fa;
    --md-sys-color-on-primary: #062e6f;
    --md-sys-color-primary-container: #1b447e;
    --md-sys-color-on-primary-container: #d3e3fd;
    
    --md-sys-color-secondary: #c2c7cf;
    --md-sys-color-secondary-container: #333d52;
    --md-sys-color-on-secondary-container: #dfe3eb;
    
    --md-sys-color-success: #6dd58c;
    --md-sys-color-success-container: #0f5223;
    
    --md-sys-color-outline: rgba(255, 255, 255, 0.12);
    --md-sys-color-text-primary: #f0f4f9;
    --md-sys-color-text-secondary: #94a3b8;
    --md-sys-color-text-tertiary: #64748b;

    /* Nokia Retro LCD Screen */
    --nokia-screen-bg: #879b28;
    --nokia-pixel-dark: #1f270a;
    --nokia-pixel-mid: #3b4c13;
    --nokia-pixel-light: #a2b834;

    /* Shape & Elevation */
    --md-shape-corner-small: 12px;
    --md-shape-corner-medium: 18px;
    --md-shape-corner-large: 26px;
    --md-shape-corner-full: 9999px;
    
    --md-elevation-1: 0 4px 16px rgba(0, 0, 0, 0.35);
    --md-elevation-2: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px 16px 40px;
    background-image: 
        radial-gradient(circle at 10% 15%, rgba(168, 199, 250, 0.05) 0%, transparent 45%),
        radial-gradient(circle at 90% 85%, rgba(109, 213, 140, 0.04) 0%, transparent 45%);
}

.app-container {
    width: 100%;
    max-width: 720px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Status Card */
.status-card {
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-shape-corner-large);
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    box-shadow: var(--md-elevation-1);
}

.host-info { display: flex; align-items: center; gap: 14px; }

.m3-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    display: flex;
    align-items: center;
    justify-content: center;
}

.host-text h2 {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--md-sys-color-text-primary);
}

.host-text p {
    font-size: 0.78rem;
    color: var(--md-sys-color-text-secondary);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(109, 213, 140, 0.12);
    color: var(--md-sys-color-success);
    border: 1px solid rgba(109, 213, 140, 0.28);
    padding: 6px 14px;
    border-radius: var(--md-shape-corner-full);
    font-size: 0.75rem;
    font-weight: 700;
}

.live-dot {
    width: 7px;
    height: 7px;
    background-color: var(--md-sys-color-success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--md-sys-color-success);
    animation: livePulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 6px 8px 4px;
}

.hero-title {
    font-size: 1.65rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.4px;
    margin-bottom: 8px;
}

.hero-desc {
    font-size: 0.95rem;
    color: var(--md-sys-color-text-secondary);
    line-height: 1.5;
    max-width: 580px;
    margin: 0 auto;
}

/* Material 3 Chips Navigation */
.game-selector-chips {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 2px 2px 6px;
    scrollbar-width: none;
}
.game-selector-chips::-webkit-scrollbar { display: none; }

.m3-chip {
    flex: 1;
    min-width: 170px;
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-shape-corner-medium);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.2, 0, 0, 1);
    outline: none;
    text-align: left;
}

.m3-chip:hover:not(.active):not(.disabled) {
    background: var(--md-sys-color-surface-container);
    border-color: rgba(255, 255, 255, 0.22);
}

.m3-chip.active {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 4px 18px rgba(168, 199, 250, 0.16);
}

.m3-chip.active .title { color: #ffffff; font-weight: 700; }
.m3-chip.active .sub { color: var(--md-sys-color-on-primary-container); }
.m3-chip.disabled { opacity: 0.42; cursor: not-allowed; }

.chip-emoji { font-size: 1.45rem; }
.chip-meta { display: flex; flex-direction: column; }
.chip-meta .title { font-size: 0.88rem; font-weight: 600; color: var(--md-sys-color-text-primary); }
.chip-meta .sub { font-size: 0.72rem; color: var(--md-sys-color-text-secondary); }

/* Arcade Container */
.arcade-card {
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-shape-corner-large);
    padding: 20px;
    box-shadow: var(--md-elevation-2);
    display: none;
    flex-direction: column;
    gap: 14px;
}

.arcade-card.active {
    display: flex;
}

.arcade-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-tag {
    font-family: 'Space Mono', monospace;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--md-sys-color-primary);
    letter-spacing: 1px;
}

.brand-tag span {
    color: var(--md-sys-color-text-tertiary);
    font-size: 0.72rem;
}

.toolbar-actions { display: flex; gap: 8px; }

.m3-btn-tonal {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border: none;
    padding: 7px 14px;
    border-radius: var(--md-shape-corner-small);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.m3-btn-tonal:hover { background: #414e66; color: #ffffff; }

.screen-viewport {
    position: relative;
    width: 100%;
    background-color: var(--nokia-screen-bg);
    border-radius: var(--md-shape-corner-medium);
    overflow: hidden;
    border: 4px solid #0d1117;
    box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.5), 0 4px 14px rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
}

.screen-viewport.cyber-theme {
    background-color: #06090e;
    box-shadow: inset 0 0 35px rgba(168, 199, 250, 0.12), 0 4px 14px rgba(0,0,0,0.6);
}

.screen-viewport.garden-screen {
    background-color: #141c26;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.7), 0 4px 14px rgba(0,0,0,0.5);
}

.crt-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.16) 50%);
    background-size: 100% 4px;
    z-index: 2;
}

canvas {
    display: block;
    width: 100%;
    height: auto;
    max-height: 380px;
    image-rendering: pixelated;
    z-index: 1;
}

/* Desktop Controls */
.desktop-controls-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.78rem;
    color: var(--md-sys-color-text-secondary);
    background: var(--md-sys-color-surface-container);
    padding: 10px 14px;
    border-radius: var(--md-shape-corner-small);
}

kbd {
    background: var(--md-sys-color-surface-container-high);
    color: #ffffff;
    padding: 2px 7px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.72rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0 2px;
}

/* Mobile Touch Gamepad */
.mobile-gamepad {
    display: none;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px 0;
    user-select: none;
}

.dpad-grid {
    display: grid;
    grid-template-columns: repeat(3, 50px);
    grid-template-rows: repeat(3, 50px);
    gap: 5px;
}

.dpad-key {
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline);
    color: var(--md-sys-color-text-primary);
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.25rem;
    touch-action: manipulation;
    cursor: pointer;
    transition: transform 0.08s;
}

.dpad-key:active {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    transform: scale(0.92);
}

.dpad-key.ghost { visibility: hidden; }

.action-buttons { display: flex; gap: 14px; align-items: center; }

.m3-fab-fire {
    width: 66px;
    height: 66px;
    border-radius: 22px;
    background: #f87171;
    color: #450a0a;
    font-weight: 800;
    font-size: 0.9rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(248, 113, 113, 0.35);
    touch-action: manipulation;
    border: none;
    cursor: pointer;
}

.m3-fab-fire:active { transform: scale(0.92); background: #ef4444; }

.m3-fab-bomb {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: #fbbf24;
    color: #451a03;
    font-weight: 800;
    font-size: 0.8rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
    touch-action: manipulation;
    border: none;
    cursor: pointer;
}

.m3-fab-bomb:active { transform: scale(0.92); background: #f59e0b; }

/* ==========================================================================
   Flower Garden Controls & 3D Watering Buttons
   ========================================================================== */

.garden-action-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cooldown-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--md-sys-color-surface-container);
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.cooldown-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: var(--md-sys-color-primary);
}

.cooldown-indicator .timer-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--md-sys-color-primary);
}

.cooldown-indicator.waiting {
    color: #fbbf24;
}
.cooldown-indicator.waiting .timer-dot {
    background-color: #fbbf24;
    animation: blinkDot 0.6s infinite alternate;
}

@keyframes blinkDot {
    from { opacity: 0.3; } to { opacity: 1; }
}

.water-quota-text {
    font-weight: 600;
    color: var(--md-sys-color-text-secondary);
}

.watering-buttons-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.m3-btn-water {
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 18px;
    padding: 12px 10px;
    color: var(--md-sys-color-text-primary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    outline: none;
    user-select: none;
}

.m3-btn-water:hover:not(:disabled) {
    background: var(--md-sys-color-surface-container-highest);
    border-color: var(--md-sys-color-primary);
    transform: translateY(-2px);
}

.m3-btn-water:active:not(:disabled) {
    transform: scale(0.95);
    background: var(--md-sys-color-primary-container);
}

.m3-btn-water:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.water-icon {
    font-size: 1.6rem;
}

.water-btn-text {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.water-btn-text .btn-name {
    font-size: 0.82rem;
    font-weight: 700;
}

.water-btn-text .btn-sub {
    font-size: 0.72rem;
    color: var(--md-sys-color-text-secondary);
}

@media (max-width: 768px) {
    .mobile-gamepad { display: flex; }
    .desktop-controls-bar { display: none; }
    .hero-title { font-size: 1.35rem; }
    .arcade-card { padding: 14px; border-radius: 20px; }
    .watering-buttons-grid { grid-template-columns: 1fr; gap: 8px; }
    .m3-btn-water { flex-direction: row; justify-content: flex-start; padding: 10px 14px; }
    .water-btn-text { align-items: flex-start; }
}

.app-footer {
    text-align: center;
    font-size: 0.76rem;
    color: var(--md-sys-color-text-tertiary);
    margin-top: 10px;
}

/* ==========================================================================
   Social Media Placeholder Links (M3 Pill Buttons)
   ========================================================================== */

.social-links-card {
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-shape-corner-medium);
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.social-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--md-sys-color-text-secondary);
}

.social-chips {
    display: flex;
    gap: 10px;
    align-items: center;
}

.m3-social-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline);
    color: var(--md-sys-color-text-primary);
    padding: 8px 14px;
    border-radius: var(--md-shape-corner-full);
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.m3-social-btn:hover {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(168, 199, 250, 0.15);
}

.m3-social-btn svg {
    flex-shrink: 0;
}
