/* ============================================
   CAPYBARA ARCADE — Shared Theme
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Capybara warm palette */
    --capy-brown: #8B6914;
    --capy-light: #C4A265;
    --capy-dark: #5C4A1E;
    --capy-nose: #3D2B0F;

    /* Environment */
    --water-light: #7EC8E3;
    --water-mid: #4FA3C7;
    --water-dark: #2E7D9B;
    --grass-light: #7DB86A;
    --grass-dark: #4A8B3F;
    --sky-top: #87CEEB;
    --sky-bottom: #E0F4FF;

    /* UI Colors */
    --orange-accent: #FF8C42;
    --orange-glow: #FFB347;
    --warm-white: #FFF8F0;
    --warm-cream: #FFF3E0;
    --text-primary: #3D2B0F;
    --text-secondary: #6B5B3E;
    --card-bg: rgba(255, 255, 255, 0.9);
    --card-shadow: rgba(139, 105, 20, 0.15);

    /* Typography */
    --font-main: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-display: 'Georgia', 'Times New Roman', serif;

    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    color: var(--text-primary);
    background: var(--warm-cream);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* --- Utility Classes --- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

/* --- Shared Button Styles --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--orange-accent), var(--orange-glow));
    color: white;
    box-shadow: 0 4px 15px rgba(255, 140, 66, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 140, 66, 0.6);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 2px solid var(--capy-light);
}

.btn-secondary:hover {
    background: var(--warm-cream);
    border-color: var(--orange-accent);
}

/* --- Back Navigation (shared across games) --- */
.back-nav {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 2px 10px var(--card-shadow);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.back-link:hover {
    transform: translateX(-4px);
    box-shadow: 0 4px 15px var(--card-shadow);
}

/* --- Shared Orange Counter --- */
.orange-counter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #FFF3E0, #FFE0B2);
    border-radius: var(--radius-xl);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--capy-dark);
}

/* --- Animations --- */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes wobble {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-3deg); }
    75% { transform: rotate(3deg); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

/* --- Responsive Breakpoints --- */
@media (max-width: 768px) {
    html { font-size: 14px; }
}

@media (max-width: 480px) {
    html { font-size: 13px; }
}

/* ============================================
   SHARED — Instructions Modal
   ============================================ */

/* Help Button (placed in each game) */
.help-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--card-bg);
    color: var(--orange-accent);
    font-size: 1.3rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 10px var(--card-shadow);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-main);
}

.help-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px var(--card-shadow);
    background: var(--orange-accent);
    color: white;
}

/* Modal Backdrop */
.instructions-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.instructions-modal.visible {
    opacity: 1;
    pointer-events: all;
}

.instructions-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(61, 43, 15, 0.6);
    backdrop-filter: blur(4px);
}

/* Modal Content */
.instructions-content {
    position: relative;
    background: var(--warm-white);
    border-radius: var(--radius-lg);
    max-width: 520px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.instructions-modal.visible .instructions-content {
    transform: translateY(0);
}

/* Modal Header */
.instructions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.instructions-header h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--capy-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.instructions-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f0f0f0;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.instructions-close:hover {
    background: #e0e0e0;
    color: var(--text-primary);
}

/* Modal Body */
.instructions-body {
    padding: 20px 24px 24px;
}

.instructions-body p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.6;
    font-size: 0.95rem;
}

.instructions-body p:last-child {
    margin-bottom: 0;
}

/* Section within instructions */
.instructions-section {
    margin-bottom: 20px;
}

.instructions-section:last-child {
    margin-bottom: 0;
}

.instructions-section h3 {
    font-size: 1rem;
    color: var(--capy-dark);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Controls Table */
.controls-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 0.9rem;
}

.controls-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0e6d6;
}

.controls-table td:first-child {
    font-weight: 700;
    color: var(--capy-dark);
    white-space: nowrap;
    width: 40%;
}

.controls-table td:last-child {
    color: var(--text-secondary);
}

/* Key/Badge styling for controls */
.key {
    display: inline-block;
    padding: 2px 8px;
    background: #f5f0e8;
    border: 1px solid #ddd5c5;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--capy-dark);
    margin: 0 2px;
}

/* Tips list */
.tips-list {
    list-style: none;
    padding: 0;
    margin: 8px 0;
}

.tips-list li {
    padding: 6px 0 6px 24px;
    position: relative;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.tips-list li::before {
    content: '🍊';
    position: absolute;
    left: 0;
    top: 6px;
    font-size: 0.85rem;
}

/* Scoring info */
.scoring-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 16px;
    margin: 10px 0;
    font-size: 0.9rem;
}

.scoring-grid .score-item {
    font-weight: 700;
    color: var(--orange-accent);
}

.scoring-grid .score-desc {
    color: var(--text-secondary);
}

/* Got It button */
.instructions-footer {
    padding: 0 24px 24px;
    text-align: center;
}

.got-it-btn {
    padding: 12px 40px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--orange-accent), var(--orange-glow));
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 140, 66, 0.3);
    font-family: var(--font-main);
}

.got-it-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 140, 66, 0.5);
}

/* Responsive */
@media (max-width: 480px) {
    .instructions-content {
        max-height: 90vh;
    }

    .instructions-header h2 {
        font-size: 1.3rem;
    }

    .instructions-body {
        padding: 16px 18px 20px;
    }
}

/* ============================================
   SHARED — Instructions Modal
   ============================================ */

/* Help Button (placed in each game) */
.help-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--card-bg);
    color: var(--orange-accent);
    font-size: 1.3rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 10px var(--card-shadow);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-main);
}

.help-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px var(--card-shadow);
    background: var(--orange-accent);
    color: white;
}

/* Modal Backdrop */
.instructions-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.instructions-modal.visible {
    opacity: 1;
    pointer-events: all;
}

.instructions-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(61, 43, 15, 0.6);
    backdrop-filter: blur(4px);
}

/* Modal Content */
.instructions-content {
    position: relative;
    background: var(--warm-white);
    border-radius: var(--radius-lg);
    max-width: 520px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.instructions-modal.visible .instructions-content {
    transform: translateY(0);
}

/* Modal Header */
.instructions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.instructions-header h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--capy-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.instructions-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f0f0f0;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.instructions-close:hover {
    background: #e0e0e0;
    color: var(--text-primary);
}

/* Modal Body */
.instructions-body {
    padding: 20px 24px 24px;
}

.instructions-body p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.6;
    font-size: 0.95rem;
}

.instructions-body p:last-child {
    margin-bottom: 0;
}

/* Section within instructions */
.instructions-section {
    margin-bottom: 20px;
}

.instructions-section:last-child {
    margin-bottom: 0;
}

.instructions-section h3 {
    font-size: 1rem;
    color: var(--capy-dark);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Controls Table */
.controls-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 0.9rem;
}

.controls-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0e6d6;
}

.controls-table td:first-child {
    font-weight: 700;
    color: var(--capy-dark);
    white-space: nowrap;
    width: 40%;
}

.controls-table td:last-child {
    color: var(--text-secondary);
}

/* Key/Badge styling for controls */
.key {
    display: inline-block;
    padding: 2px 8px;
    background: #f5f0e8;
    border: 1px solid #ddd5c5;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--capy-dark);
    margin: 0 2px;
}

/* Tips list */
.tips-list {
    list-style: none;
    padding: 0;
    margin: 8px 0;
}

.tips-list li {
    padding: 6px 0 6px 24px;
    position: relative;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.tips-list li::before {
    content: '🍊';
    position: absolute;
    left: 0;
    top: 6px;
    font-size: 0.85rem;
}

/* Scoring info */
.scoring-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 16px;
    margin: 10px 0;
    font-size: 0.9rem;
}

.scoring-grid .score-item {
    font-weight: 700;
    color: var(--orange-accent);
}

.scoring-grid .score-desc {
    color: var(--text-secondary);
}

/* Got It button */
.instructions-footer {
    padding: 0 24px 24px;
    text-align: center;
}

.got-it-btn {
    padding: 12px 40px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--orange-accent), var(--orange-glow));
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 140, 66, 0.3);
    font-family: var(--font-main);
}

.got-it-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 140, 66, 0.5);
}

/* Responsive */
@media (max-width: 480px) {
    .instructions-content {
        max-height: 90vh;
    }

    .instructions-header h2 {
        font-size: 1.3rem;
    }

    .instructions-body {
        padding: 16px 18px 20px;
    }
}

