/* Trick-or-Treat Catcher — Page Styles (Halloween re-theme of the shared game page pattern) */

:root {
    --tot-night-1: #241145;
    --tot-night-2: #3b1d63;
    --tot-panel: #1d1033;
    --tot-panel-dark: #150a26;
    --tot-border: #43276e;
    --tot-orange: #ff9d2e;
    --tot-orange-deep: #f4791f;
    --tot-glow: rgba(255, 157, 46, 0.45);
    --tot-text: #fdf3e3;
    --tot-muted: #b9a3d8;
    --tot-card-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

body.game-page.tot-page {
    background: linear-gradient(160deg, var(--tot-night-1) 0%, var(--tot-night-2) 55%, #57307f 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* Drifting "stars" backdrop */
body.game-page.tot-page::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 235, 190, 0.16) 1.5px, transparent 1.5px);
    background-size: 46px 46px;
    animation: tot-float 26s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes tot-float {
    from { transform: translate(0, 0); }
    to   { transform: translate(46px, 46px); }
}

.game-main {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 2rem 0;
    position: relative;
    z-index: 1;
}

.navbar, footer {
    position: relative;
    z-index: 1;
}

/* Game Card */
.game-card-wrapper {
    background: var(--tot-panel);
    border-radius: 24px;
    box-shadow: var(--tot-card-shadow);
    overflow: hidden;
    border: 4px solid var(--tot-border);
    position: relative;
}

/* Header / HUD */
.game-header {
    background: var(--tot-panel-dark);
    padding: 0.9rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--tot-border);
}

.game-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--tot-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.title-pumpkin {
    filter: drop-shadow(0 0 8px var(--tot-glow));
}

@keyframes combo-pulse {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.18); box-shadow: 0 0 18px var(--tot-glow); }
    100% { transform: scale(1); }
}

/* Game Stage */
.game-stage-container {
    padding: 1rem;
    display: flex;
    justify-content: center;
    background: var(--tot-panel);
}

.catcher-canvas-wrap {
    position: relative;
    width: fit-content;
    margin: 0 auto;
    line-height: 0;
}

.catcher-canvas {
    display: block;
    border-radius: 16px;
    background: #1a1033;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5);
    touch-action: none; /* we handle touch drags ourselves */
    cursor: pointer;
}

/* Unified Overlay */
.game-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(21, 10, 38, 0.88);
    backdrop-filter: blur(3px);
    border-radius: 16px;
    z-index: 10;
    padding: 1rem;
    overflow-y: auto;
    line-height: 1.5; /* the wrap sets line-height: 0 for the canvas — restore it here */
}

.game-overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    color: var(--tot-text);
    max-width: 560px;
    width: 100%;
    margin: auto;
}

.overlay-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 14px var(--tot-glow));
}

.overlay-icon .fas {
    color: var(--tot-orange);
}

.overlay-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    text-shadow: 0 3px 14px rgba(0, 0, 0, 0.6);
}

.overlay-subtitle {
    color: var(--tot-muted);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.overlay-best {
    color: var(--tot-muted);
    font-weight: 700;
    margin-bottom: 1rem;
}

.new-best-banner {
    display: inline-block;
    font-size: 1.15rem;
    font-weight: 800;
    color: #ffd76a;
    background: rgba(255, 157, 46, 0.15);
    border: 2px solid rgba(255, 215, 106, 0.6);
    border-radius: 50px;
    padding: 0.35rem 1.2rem;
    margin-bottom: 0.75rem;
    animation: combo-pulse 0.9s ease infinite;
}

/* Difficulty picker */
.difficulty-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    margin: 0 0 1rem;
}

.difficulty-card {
    background: var(--tot-panel);
    border: 2px solid var(--tot-border);
    border-radius: 14px;
    padding: 0.7rem 0.6rem;
    color: var(--tot-text);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    text-align: center;
}

.difficulty-card:hover {
    transform: translateY(-3px);
    border-color: var(--tot-orange);
}

.difficulty-card.selected {
    border-color: var(--tot-orange);
    box-shadow: 0 0 16px var(--tot-glow);
    background: #2a1750;
}

.diff-name {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--tot-orange);
}

.diff-desc {
    font-size: 0.78rem;
    color: var(--tot-muted);
    line-height: 1.35;
}

.diff-best {
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffd76a;
}

/* Controls hint on title screen */
.controls-hint-line {
    color: var(--tot-muted);
    font-size: 0.9rem;
    margin-bottom: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.9rem;
    height: 1.9rem;
    padding: 0 0.4rem;
    background: var(--tot-panel);
    border: 2px solid var(--tot-border);
    border-bottom-width: 3px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--tot-text);
}

/* Buttons */
.play-button {
    background: linear-gradient(135deg, var(--tot-orange) 0%, var(--tot-orange-deep) 100%);
    color: #2a1200;
    border: none;
    border-radius: 50px;
    padding: 0.7rem 2rem;
    font-size: 1.1rem;
    font-weight: 800;
    box-shadow: 0 8px 24px var(--tot-glow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.play-button:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 12px 30px var(--tot-glow);
    color: #2a1200;
}

.pulse-animation {
    animation: play-pulse 1.8s ease-in-out infinite;
}

@keyframes play-pulse {
    0%, 100% { box-shadow: 0 8px 24px var(--tot-glow); }
    50%      { box-shadow: 0 8px 36px rgba(255, 157, 46, 0.7); }
}

.secondary-button {
    background: transparent;
    color: var(--tot-text);
    border: 2px solid var(--tot-border);
    border-radius: 50px;
    padding: 0.65rem 1.6rem;
    font-weight: 700;
    text-decoration: none;
    transition: border-color 0.15s ease, transform 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.secondary-button:hover {
    border-color: var(--tot-orange);
    color: var(--tot-text);
    transform: translateY(-2px);
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Footer */
.game-footer {
    background: var(--tot-panel-dark);
    padding: 0.9rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    border-top: 2px solid var(--tot-border);
}

.back-link {
    color: var(--tot-muted);
    text-decoration: none;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.15s ease;
}

.back-link:hover {
    color: var(--tot-orange);
}

.game-controls-hint {
    display: flex;
    gap: 0.5rem;
}

.control-btn {
    background: var(--tot-panel);
    color: var(--tot-text);
    border: 2px solid var(--tot-border);
    border-radius: 10px;
    padding: 0.4rem 0.9rem;
    font-weight: 700;
    font-size: 0.85rem;
    transition: border-color 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.control-btn:hover {
    border-color: var(--tot-orange);
}

/* Small screens: tighten things up so the canvas gets the room */
@media (max-width: 576px) {
    .game-main {
        padding: 0.75rem 0;
    }
    .game-stage-container {
        padding: 0.5rem;
    }
    .game-header {
        padding: 0.6rem 0.75rem;
    }
    .game-title {
        font-size: 1.05rem;
    }
    .difficulty-picker {
        grid-template-columns: 1fr;
    }
    .overlay-title {
        font-size: 1.4rem;
    }
}
