/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a2e;
    color: #ffffff;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    user-select: none;
}

/* ===== SCREENS ===== */
.screen {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.screen.active {
    display: flex;
}

/* ===== MENU ===== */
.menu-bg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
}

#menu-canvas {
    width: 100%;
    height: 100%;
}

.menu-overlay {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 20px;
}

.game-title {
    font-size: 4rem;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 0 30px rgba(46, 213, 115, 0.8), 0 4px 8px rgba(0,0,0,0.5);
    margin-bottom: 5px;
    letter-spacing: 4px;
    animation: titlePulse 3s ease-in-out infinite;
}

.subtitle {
    font-size: 1.2rem;
    color: rgba(255,255,255,0.7);
    margin-bottom: 30px;
    letter-spacing: 2px;
}

@keyframes titlePulse {
    0%, 100% { text-shadow: 0 0 30px rgba(46, 213, 115, 0.8), 0 4px 8px rgba(0,0,0,0.5); }
    50% { text-shadow: 0 0 50px rgba(46, 213, 115, 1), 0 4px 12px rgba(0,0,0,0.7); }
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 420px;
    margin: 0 auto;
}

/* ===== BUTTONS ===== */
.btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    color: #fff;
    transition: all 0.25s ease;
    text-align: left;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #2ed573, #1e90ff);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #7bed9f, #54a0ff);
}

.btn-secondary {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.2);
}

.btn-danger {
    background: linear-gradient(135deg, #ff4757, #ff6b81);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ff6b81, #ff8a9b);
}

.btn-icon {
    font-size: 1.8rem;
    min-width: 40px;
    text-align: center;
}

.btn-text {
    display: flex;
    flex-direction: column;
}

.btn-text strong {
    font-size: 1.1rem;
}

.btn-text small {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 2px;
}

/* ===== PANELS ===== */
.panel {
    background: rgba(26, 26, 46, 0.95);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 30px 40px;
    max-width: 500px;
    width: 90%;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.panel h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-align: center;
    color: #2ed573;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.input-group label {
    min-width: 100px;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
}

.input-group input[type="text"],
.input-group select {
    flex: 1;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input[type="text"]:focus,
.input-group select:focus {
    border-color: #2ed573;
}

.input-group input[type="range"] {
    flex: 1;
    accent-color: #2ed573;
}

.btn-row {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: center;
}

.btn-row .btn {
    justify-content: center;
    min-width: 120px;
}

/* ===== CHALLENGE LIST ===== */
.challenge-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-challenge {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 20px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    text-align: left;
    width: 100%;
}

.btn-challenge:hover {
    background: rgba(46, 213, 115, 0.15);
    border-color: #2ed573;
    transform: translateX(4px);
}

.challenge-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2ed573;
}

.challenge-desc {
    font-size: 0.85rem;
    opacity: 0.7;
    margin-top: 3px;
}

.challenge-stars {
    position: absolute;
    top: 16px; right: 20px;
    font-size: 1.2rem;
    color: #ffa502;
}

/* ===== GAME HUD ===== */
#game-screen {
    background: #000;
}

#hud-top {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, transparent 100%);
    z-index: 10;
    font-size: 0.95rem;
}

.hud-left, .hud-right {
    display: flex;
    gap: 16px;
}

.hud-center {
    display: flex;
    gap: 8px;
    align-items: center;
}

#hud-hole {
    font-weight: 700;
    color: #2ed573;
    font-size: 1.1rem;
}

#hud-par {
    opacity: 0.8;
}

#hud-distance {
    color: #ffeaa7;
    font-weight: 600;
}

#hud-wind {
    color: #74b9ff;
    font-weight: 600;
}

#hud-strokes {
    opacity: 0.8;
}

#hud-score {
    font-weight: 700;
    color: #2ed573;
    font-size: 1.1rem;
}

.hud-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 8px;
    color: #fff;
    font-size: 1.2rem;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}

.hud-btn:hover {
    background: rgba(255,255,255,0.25);
}

.hud-btn.muted {
    opacity: 0.4;
}

/* ===== GAME CANVAS ===== */
#game-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* ===== CLUB SELECTOR ===== */
#club-selector {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    z-index: 10;
    background: rgba(0,0,0,0.6);
    padding: 6px 10px;
    border-radius: 12px;
    backdrop-filter: blur(8px);
}

.club-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 60px;
}

.club-btn:hover {
    background: rgba(255,255,255,0.15);
}

.club-btn.active {
    background: rgba(46, 213, 115, 0.3);
    border-color: #2ed573;
}

.club-name {
    font-size: 0.75rem;
    font-weight: 700;
}

.club-dist {
    font-size: 0.65rem;
    opacity: 0.6;
    margin-top: 2px;
}

/* ===== SWING UI ===== */
#swing-ui {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    z-index: 10;
    width: 500px;
    max-width: 90%;
}

#power-bar-container, #accuracy-bar-container {
    width: 100%;
    text-align: center;
}

#power-bar, #accuracy-bar {
    width: 100%;
    height: 24px;
    background: rgba(0,0,0,0.6);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255,255,255,0.2);
}

#power-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #2ed573, #ffa502, #ff4757);
    transition: width 0.03s linear;
    border-radius: 12px;
}

#power-marker, #accuracy-marker {
    position: absolute;
    top: -2px;
    width: 4px;
    height: 28px;
    background: #fff;
    border-radius: 2px;
    left: 0%;
    box-shadow: 0 0 8px rgba(255,255,255,0.8);
    transition: left 0.02s linear;
}

#accuracy-zone {
    position: absolute;
    top: 0;
    height: 100%;
    background: rgba(46, 213, 115, 0.4);
    border-left: 2px solid #2ed573;
    border-right: 2px solid #2ed573;
    left: 44%;
    width: 12%;
}

#power-label, #accuracy-label {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 2px;
}

#swing-instructions {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ===== MINIMAP ===== */
#minimap {
    position: absolute;
    top: 50px;
    right: 10px;
    width: 180px;
    height: 300px;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    overflow: hidden;
    z-index: 10;
}

#minimap-canvas {
    width: 100%;
    height: 100%;
}

/* ===== OVERLAYS ===== */
.overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.overlay .panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.scorecard-panel {
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
}

/* ===== SCORECARD TABLE ===== */
.scorecard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin: 10px 0;
}

.scorecard-table th,
.scorecard-table td {
    padding: 6px 10px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.1);
}

.scorecard-table th {
    background: rgba(46, 213, 115, 0.2);
    font-weight: 700;
    color: #2ed573;
}

.scorecard-table .score-eagle {
    color: #ffd700;
    font-weight: 700;
}

.scorecard-table .score-birdie {
    color: #ff4757;
    font-weight: 700;
}

.scorecard-table .score-par {
    color: #2ed573;
}

.scorecard-table .score-bogey {
    color: #74b9ff;
}

.scorecard-table .score-double {
    color: #a29bfe;
}

/* ===== MATCH INFO ===== */
#match-info {
    position: absolute;
    top: 45px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    background: rgba(0,0,0,0.6);
    padding: 6px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    gap: 20px;
    backdrop-filter: blur(8px);
}

#match-player {
    color: #ffeaa7;
    font-weight: 600;
}

#match-status {
    color: #74b9ff;
}

/* ===== RESULT SCREEN ===== */
.result-panel {
    max-width: 700px;
    text-align: center;
}

.result-panel h2 {
    font-size: 2rem;
    margin-bottom: 10px;
}

#result-content {
    font-size: 1.2rem;
    margin-bottom: 15px;
    line-height: 1.8;
}

#result-scorecard {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
}

/* ===== SHOT INFO POPUP ===== */
.shot-info {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    background: rgba(0,0,0,0.8);
    padding: 20px 40px;
    border-radius: 16px;
    text-align: center;
    pointer-events: none;
    animation: shotInfoAnim 2s ease-out forwards;
}

.shot-info h3 {
    font-size: 1.6rem;
    color: #2ed573;
    margin-bottom: 5px;
}

.shot-info p {
    font-size: 1rem;
    opacity: 0.8;
}

@keyframes shotInfoAnim {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -60%) scale(1); }
}

/* ===== TERRAIN LEGEND ===== */
.terrain-legend {
    position: absolute;
    bottom: 140px;
    right: 10px;
    z-index: 10;
    font-size: 0.7rem;
    background: rgba(0,0,0,0.5);
    padding: 8px 12px;
    border-radius: 8px;
}

.terrain-legend div {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 2px 0;
}

.terrain-swatch {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
}
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .game-title {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .btn-icon {
        font-size: 1.4rem;
        min-width: 30px;
    }

    #club-selector {
        bottom: 70px;
        gap: 2px;
        padding: 4px 6px;
    }

    .club-btn {
        padding: 6px 8px;
        min-width: 44px;
    }

    .club-name {
        font-size: 0.65rem;
    }

    .club-dist {
        font-size: 0.55rem;
    }

    #minimap {
        width: 120px;
        height: 200px;
    }

    #swing-ui {
        width: 90%;
    }

    .panel {
        padding: 20px 24px;
    }

    .hud-left, .hud-right {
        flex-direction: column;
        gap: 2px;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 2rem;
    }

    #club-selector {
        flex-wrap: wrap;
        max-width: 90vw;
        justify-content: center;
    }

    #minimap {
        width: 90px;
        height: 150px;
    }
}
