/* Heart Defense: Sacred Reframe — arcade motion-era page shell */

:root {
    --bg-dark: #0a0a0f;
    --bg-card: #12121a;
    --bg-hover: #1a1a25;
    --accent: #ff6b35;
    --accent-2: #f7c735;
    --accent-3: #35c7ff;
    --text: #e8e8e8;
    --text-dim: #888;
    --purple: #a855f7;

    /* game-native palette (matches in-canvas art) */
    --hd-gold: #d4a017;
    --hd-red: #dc2626;
    --mono: 'Courier New', ui-monospace, Consolas, monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg-dark);
    color: var(--text);
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    min-height: 100vh;
    line-height: 1.6;
}

/* Arcade background grid (gold-tinted for this cabinet) */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(212, 160, 23, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(212, 160, 23, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Header */
header.hero {
    text-align: center;
    padding: 32px 0 18px;
    border-bottom: 2px solid var(--hd-red);
    margin-bottom: 28px;
}

.back-link {
    display: inline-block;
    font-size: 12px;
    color: var(--text-dim);
    text-decoration: none;
    margin-bottom: 18px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.back-link:hover {
    color: var(--accent-3);
}

.logo {
    font-family: var(--mono);
    font-weight: 800;
    letter-spacing: 0.06em;
    font-size: 32px;
    color: var(--hd-red);
    text-shadow:
        3px 3px 0 rgba(212, 160, 23, 0.35),
        0 0 18px rgba(220, 38, 38, 0.35);
    margin-bottom: 8px;
    animation: heartbeat 2.4s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.82; }
}

.tagline {
    font-size: 14px;
    color: var(--text-dim);
    font-style: italic;
}

/* Game frame */
main {
    padding-bottom: 30px;
}

.game-frame {
    background: var(--bg-card);
    border: 1px solid rgba(212, 160, 23, 0.35);
    border-radius: 12px;
    padding: 10px;
    max-width: 820px;
    margin: 0 auto;
    box-shadow:
        0 0 30px rgba(220, 38, 38, 0.08),
        0 0 12px rgba(212, 160, 23, 0.1);
}

#gameCanvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 800 / 600;
    border: 2px solid var(--hd-gold);
    border-radius: 6px;
    cursor: crosshair;
    /* Keep the procedural board smooth at responsive CSS sizes; pixelation
       made the ordinary tower-defense shapes read like a prototype. */
    image-rendering: auto;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

#gameCanvas:focus-visible,
.control-deck button:focus-visible,
.game-instructions summary:focus-visible {
    outline: 3px solid var(--accent-3);
    outline-offset: 3px;
}

.control-deck {
    max-width: 820px;
    margin: 12px auto 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.control-deck button {
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid rgba(212, 160, 23, 0.7);
    border-radius: 4px;
    background: #1a1a25;
    color: #f7c735;
    font-family: var(--mono);
    font-weight: 700;
    cursor: pointer;
}

.control-deck button:hover:not(:disabled) {
    background: rgba(212, 160, 23, 0.16);
}

.control-deck button:disabled {
    border-color: #374151;
    color: #6b7280;
    cursor: not-allowed;
}

.game-status,
.game-instructions {
    grid-column: 1 / -1;
    background: rgba(18, 18, 26, 0.88);
    border-left: 3px solid var(--hd-gold);
    padding: 8px 12px;
    color: #d1d5db;
    font-family: var(--mono);
    font-size: 12px;
}

.sr-campaign-result {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.wave-intel {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.wave-intel-card {
    min-height: 62px;
    padding: 9px 12px;
    border: 1px solid rgba(53, 199, 255, 0.32);
    border-left: 3px solid var(--accent-3);
    border-radius: 4px;
    background: rgba(18, 18, 26, 0.88);
    color: #d1d5db;
    font-family: var(--mono);
    font-size: 11px;
}

.wave-intel-card:last-child {
    border-left-color: var(--hd-gold);
}

.wave-intel-label {
    display: block;
    margin-bottom: 4px;
    color: var(--accent-3);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.wave-intel-card:last-child .wave-intel-label {
    color: var(--hd-gold);
}

.wave-intel-card p {
    margin: 0;
}

.game-instructions summary {
    color: var(--hd-gold);
    cursor: pointer;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.game-instructions p {
    margin-top: 8px;
}

/* Under-canvas bar */
.under-bar {
    max-width: 820px;
    margin: 12px auto 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.game-badge {
    font-family: var(--mono);
    color: var(--hd-gold);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.6;
}

.sound-toggle {
    background: var(--bg-card);
    color: var(--hd-gold);
    border: 1.5px solid var(--hd-gold);
    border-radius: 4px;
    padding: 6px 18px;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
}

.sound-toggle:hover {
    background: rgba(212, 160, 23, 0.15);
}

.sound-toggle.muted {
    color: #6b7280;
    border-color: #4b5563;
}

/* Footer */
footer {
    text-align: center;
    padding: 24px 20px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-dim);
    font-size: 13px;
}

footer .certified {
    margin-top: 6px;
    font-size: 12px;
    letter-spacing: 0.04em;
}

footer a {
    color: var(--accent-3);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

@media (max-width: 600px) {
    .logo { font-size: 22px; }
    .container { padding: 12px; }
    header.hero { padding-top: 20px; margin-bottom: 18px; }
    .control-deck { grid-template-columns: 1fr; }
    .wave-intel { grid-template-columns: 1fr; }
    .game-status,
    .game-instructions { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .logo { animation: none; }
}
