/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --bg-dark: #070a0e;
    --card-bg: rgba(15, 23, 42, 0.8);
    --border-color: rgba(255, 255, 255, 0.08);
    --neon-cyan: #00f2ff;
    --neon-magenta: #ec4899;
    --text-white: #f8fafc;
    --text-muted: #94a3b8;
    --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    font-family: var(--font-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-image: 
        radial-gradient(at 0% 0%, rgba(6, 182, 212, 0.08) 0, transparent 50%),
        radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.08) 0, transparent 50%);
}

/* Wrapper containing the game and UI */
#game-wrapper {
    position: relative;
    width: 1024px;
    height: 768px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.6),
        0 0 2px rgba(6, 182, 212, 0.2);
    border: 2px solid rgba(15, 23, 42, 0.6);
}

/* Phaser Canvas container */
#game-container {
    width: 100%;
    height: 100%;
    background-color: #070b09;
}

#game-container canvas {
    display: block;
}

/* Game HTML UI Wrapper (absolute overlays) */
#game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through to canvas unless interacting with UI */
    z-index: 100;
}

/* UI Header at the top */
.ui-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, rgba(7, 10, 14, 0.85) 0%, rgba(7, 10, 14, 0) 100%);
    pointer-events: auto;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.course-name {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 40%, var(--neon-cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
}

.par-badge {
    align-self: flex-start;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1px;
    background: rgba(6, 182, 212, 0.15);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: var(--neon-cyan);
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    pointer-events: auto;
}

.stat-box {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px 16px;
    min-width: 90px;
    text-align: center;
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.stat-val {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-white);
}

.strokes-val {
    color: var(--neon-cyan);
    text-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

.total-val {
    color: var(--text-white);
}

/* Reset level button styling */
.btn-reset-level {
    background: rgba(236, 72, 153, 0.1);
    border: 1px solid rgba(236, 72, 153, 0.2);
    color: var(--neon-magenta);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-reset-level:hover {
    background: rgba(236, 72, 153, 0.25);
    border-color: var(--neon-magenta);
    box-shadow: 0 0 12px rgba(236, 72, 153, 0.3);
}

.btn-reset-level:active {
    transform: scale(0.92);
}

.btn-reset-level svg {
    transition: transform 0.4s ease;
}

.btn-reset-level:hover svg {
    transform: rotate(-180deg);
}

/* Modal UI Overlay Screen styling */
.ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 10, 14, 0.7);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    pointer-events: auto; /* Catch clicks for overlays */
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.ui-overlay.hidden {
    display: none !important;
}

/* Card panel styles */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    border-radius: 24px;
    padding: 40px;
    width: 460px;
    max-width: 90%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Card custom modifications for instructions */
.card-instructions {
    width: 580px;
    text-align: left;
    align-items: stretch;
}

.glow-text {
    background: linear-gradient(to right, var(--neon-cyan), var(--neon-magenta));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(6, 182, 212, 0.2);
    font-weight: 900;
    font-size: 2.2rem;
    letter-spacing: 1px;
    text-align: center;
}

.card-intro {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: center;
    margin-bottom: 8px;
}

.card-title {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-white);
}

.card-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 1.1rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    padding: 8px 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.card-stats strong {
    color: var(--text-white);
    font-size: 1.2rem;
}

.divider {
    opacity: 0.2;
}

.card-message {
    font-size: 1.05rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Instruction Steps inside start modal */
.instruction-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 10px 0;
}

.step {
    display: flex;
    gap: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 14px 18px;
    border-radius: 16px;
    align-items: flex-start;
}

.step-icon {
    font-size: 1.6rem;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.2);
    color: var(--neon-cyan);
    min-width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-desc {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.step-desc strong {
    font-size: 0.9rem;
    color: var(--text-white);
}

.step-desc p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Action button inside dialogs */
.btn-action {
    width: 100%;
    padding: 16px 32px;
    border: none;
    outline: none;
    border-radius: 14px;
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 800;
    color: #ffffff;
    cursor: pointer;
    background: linear-gradient(135deg, #00f2ff 0%, #3b82f6 100%);
    box-shadow: 
        0 4px 20px rgba(0, 242, 255, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 30px rgba(0, 242, 255, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-action:active {
    transform: translateY(1px);
}

/* Helper text/footer below game */
.game-footer {
    margin-top: 15px;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: flex;
    gap: 15px;
}

.game-footer a {
    color: var(--neon-cyan);
    text-decoration: none;
    transition: color 0.2s;
}

.game-footer a:hover {
    color: var(--text-white);
}

/* Animations definition */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Game setup options styling */
.setup-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 15px 0;
    padding: 18px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    pointer-events: auto;
}

.setup-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.setup-label {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--neon-cyan);
    text-transform: uppercase;
}

.segmented-control {
    display: flex;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    padding: 3px;
    border-radius: 10px;
    gap: 4px;
}

.segment-btn {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-muted);
    font-family: var(--font-primary);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.segment-btn:hover {
    color: var(--text-white);
}

.segment-btn.active {
    background: linear-gradient(135deg, var(--neon-cyan) 0%, #3b82f6 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 242, 255, 0.25);
}

/* Practice screen styling */
.card-practice {
    width: 760px;
    max-width: 95%;
    max-height: 85vh;
    overflow-x: hidden;
}

.practice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;
    margin-bottom: 10px;
    max-height: 48vh;
    pointer-events: auto;
}

/* Custom scrollbar for practice grid */
.practice-grid::-webkit-scrollbar {
    width: 6px;
}
.practice-grid::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 4px;
}
.practice-grid::-webkit-scrollbar-thumb {
    background: var(--neon-cyan);
    border-radius: 4px;
}

.practice-card {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
}

.practice-card:hover {
    transform: translateY(-2px);
    border-color: var(--neon-cyan);
    box-shadow: 0 4px 15px rgba(0, 242, 255, 0.15);
    background: rgba(15, 23, 42, 0.8);
}

.practice-card-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-white);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.practice-card-par {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--neon-cyan);
    background: rgba(6, 182, 212, 0.1);
    padding: 2px 6px;
    border-radius: 10px;
    white-space: nowrap;
}

.practice-card canvas {
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: #0a1a11;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    display: block;
}

/* Secondary Button styling */
.secondary-btn {
    background: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-muted) !important;
    box-shadow: none !important;
}

.secondary-btn:hover {
    color: var(--text-white) !important;
    border-color: var(--text-muted) !important;
    transform: translateY(-2px);
}

/* Back button in header */
.btn-back-to-select {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-back-to-select:hover {
    color: var(--neon-cyan);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

.btn-back-to-select.hidden {
    display: none !important;
}

/* Online Lobby Styling */
.color-dot {
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.color-dot:hover {
    transform: scale(1.15);
}
.color-dot.active {
    border-color: #ffffff !important;
    box-shadow: 0 0 10px currentColor;
    transform: scale(1.1);
}

.lobby-player-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 8px 12px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.lobby-player-row:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(15, 23, 42, 0.85);
}
