/* Tockins Golf — Styles */

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

body {
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    background: #000;
    font-family: 'Courier New', monospace;
    user-select: none;
    -webkit-user-select: none;
}

/* ── Game Layout ─────────────────────────────────── */

#game-wrapper {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

#game-container {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}

#game-container canvas {
    position: absolute;
}

#ui-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 10;
}

#ui-overlay > * {
    pointer-events: auto;
}

/* ── Screens ─────────────────────────────────────── */

.screen {
    display: none;
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    z-index: 20;
    overflow-y: auto;
}

.screen.active {
    display: flex;
}

/* ── Menu Screen ─────────────────────────────────── */

.menu-content {
    text-align: center;
    max-width: 400px;
}

.game-title {
    font-size: 42px;
    font-weight: bold;
    color: #4a8c3f;
    text-shadow: 0 0 20px rgba(74, 140, 63, 0.5), 3px 3px 0 #2d5016;
    line-height: 1.1;
    margin-bottom: 8px;
}

.game-title .title-golf {
    color: #ffcc00;
    text-shadow: 0 0 20px rgba(255, 204, 0, 0.5), 3px 3px 0 #aa8800;
}

.menu-subtitle {
    color: #aaa;
    font-size: 13px;
    margin-bottom: 4px;
}

.menu-dedication {
    color: #ffcc00;
    font-size: 14px;
    font-style: italic;
    margin-bottom: 16px;
}

.menu-tokens {
    color: #ffcc00;
    font-size: 18px;
    margin-bottom: 20px;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.menu-version {
    color: #666;
    font-size: 11px;
    margin-top: 16px;
}

/* ── Buttons ─────────────────────────────────────── */

.menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #444, #333);
    border: 2px solid #666;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 200px;
    justify-content: center;
}

.menu-btn:hover {
    background: linear-gradient(135deg, #555, #444);
    transform: scale(1.05);
    border-color: #888;
}

.menu-btn.primary {
    background: linear-gradient(135deg, #4a8c3f, #3a7030);
    border-color: #6ab85c;
}

.menu-btn.primary:hover {
    background: linear-gradient(135deg, #5cb85c, #4a8c3f);
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #ccc;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #555;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 16px;
    transition: all 0.2s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* ── Course Select ───────────────────────────────── */

.course-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    padding: 16px;
    max-width: 700px;
}

.course-card {
    width: 130px;
    padding: 16px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid #444;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.course-card:hover:not(.locked) {
    background: rgba(255, 255, 255, 0.15);
    border-color: #4a8c3f;
    transform: scale(1.05);
}

.course-card.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.course-card.locked .course-icon::after {
    content: '🔒';
    position: absolute;
    font-size: 20px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.course-icon {
    font-size: 36px;
    margin-bottom: 8px;
    position: relative;
    display: inline-block;
}

.course-name {
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 4px;
}

.course-score {
    color: #aaa;
    font-size: 10px;
}

/* ── Shop ────────────────────────────────────────── */

.shop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    width: 100%;
    max-width: 600px;
}

.shop-header h2 {
    color: #fff;
    font-size: 20px;
}

.shop-balance {
    color: #ffcc00;
    font-size: 18px;
    font-weight: bold;
}

.shop-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.shop-tab {
    padding: 8px 16px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #aaa;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    transition: all 0.2s;
}

.shop-tab.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    border-bottom-color: transparent;
}

.shop-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
    padding: 0 4px;
    width: 100%;
    max-width: 550px;
}

.shop-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid #444;
    border-radius: 8px;
    transition: background 0.2s;
}

.shop-card:hover {
    background: rgba(255, 255, 255, 0.1);
}

.shop-card-icon {
    font-size: 28px;
    min-width: 40px;
    text-align: center;
}

.shop-card-info {
    flex: 1;
}

.shop-card-name {
    color: #fff;
    font-size: 14px;
    font-weight: bold;
}

.shop-card-subtitle {
    color: #ffcc00;
    font-size: 11px;
}

.shop-card-desc {
    color: #aaa;
    font-size: 11px;
}

.shop-card-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.shop-card-cost {
    color: #ffcc00;
    font-size: 13px;
    font-weight: bold;
}

.shop-card-status {
    color: #88ff88;
    font-size: 11px;
    font-weight: bold;
}

.shop-card-btn {
    padding: 6px 14px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    background: #4a8c3f;
    border: 1px solid #6ab85c;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.shop-card-btn:hover {
    background: #5cb85c;
}

.shop-card-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #555;
    border-color: #666;
}

/* ── Leaderboard ─────────────────────────────────── */

.leaderboard-container {
    width: 100%;
    max-width: 500px;
    padding: 0 16px;
}

.leaderboard-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    justify-content: center;
}

.lb-tab {
    padding: 6px 12px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #aaa;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.lb-tab.active {
    color: #ffcc00;
    background: rgba(255, 204, 0, 0.1);
    border-color: #ffcc00;
}

.leaderboard-list {
    max-height: 300px;
    overflow-y: auto;
}

.lb-row {
    display: flex;
    padding: 8px 12px;
    border-bottom: 1px solid #333;
    align-items: center;
}

.lb-header {
    color: #888;
    font-size: 11px;
    font-weight: bold;
    border-bottom: 2px solid #444;
}

.lb-rank { width: 50px; text-align: center; color: #aaa; }
.lb-name { flex: 1; color: #fff; font-weight: bold; }
.lb-score { width: 80px; text-align: right; color: #88ff88; }

.lb-gold .lb-rank { color: #ffcc00; }
.lb-silver .lb-rank { color: #cccccc; }
.lb-bronze .lb-rank { color: #cc8844; }

.lb-empty {
    color: #666;
    text-align: center;
    padding: 30px;
    font-style: italic;
}

/* ── Modal Box ───────────────────────────────────── */

.modal-box {
    background: rgba(30, 30, 30, 0.95);
    border: 2px solid #555;
    border-radius: 12px;
    padding: 24px 32px;
    text-align: center;
    max-width: 400px;
}

.modal-box h2 {
    color: #fff;
    font-size: 22px;
    margin-bottom: 12px;
}

.modal-box h3 {
    color: #fff;
    font-size: 18px;
    margin-bottom: 8px;
}

.modal-box p {
    color: #aaa;
    font-size: 14px;
    margin-bottom: 8px;
}

.modal-box.wide {
    max-width: 700px;
    width: 90%;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}

.tally {
    text-align: left;
    padding: 8px 0;
}

.tally-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    color: #ccc;
    font-size: 14px;
}

.tally-row.highlight {
    color: #ffcc00;
    font-weight: bold;
}

.tally-divider {
    border-top: 1px solid #444;
    margin: 6px 0;
}

/* ── Name Input ──────────────────────────────────── */

.name-input-chars {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin: 16px 0;
}

.name-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.name-char {
    font-size: 32px;
    font-weight: bold;
    color: #ffcc00;
    width: 40px;
    text-align: center;
}

.char-btn {
    padding: 6px 12px;
    font-size: 16px;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.char-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ── Hole Intro Overlay ──────────────────────────── */

.hole-intro-content {
    text-align: center;
}

.hole-intro-content h2 {
    color: #fff;
    font-size: 36px;
    text-shadow: 0 0 20px rgba(255, 204, 0, 0.5);
}

.hole-intro-content p {
    color: #aaa;
    font-size: 16px;
    margin-top: 8px;
}

/* ── Club Selector ──────────────────────────────────── */

.club-selector {
    display: none;
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #666;
    border-radius: 10px;
    padding: 8px 12px;
    z-index: 30;
}

.club-selector.active {
    display: flex;
}

.club-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
    color: #fff;
    background: linear-gradient(135deg, #4a8c3f, #3a7030);
    border: 2px solid #6ab85c;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.club-btn:hover {
    background: linear-gradient(135deg, #5cb85c, #4a8c3f);
    transform: scale(1.1);
}

.club-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
}

#club-selector-name {
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: bold;
}

.club-range {
    color: #88ff88;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

/* ── Distance Indicator ─────────────────────────────── */

.distance-indicator {
    display: none;
    position: absolute;
    top: 42px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #555;
    border-radius: 6px;
    padding: 4px 14px;
    color: #ffcc00;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    z-index: 30;
}

.distance-indicator.active {
    display: block;
}

#distance-value {
    color: #fff;
    font-size: 16px;
}

/* ── Toast ────────────────────────────────────────── */

#toast {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 10px 24px;
    background: rgba(0, 200, 100, 0.9);
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 100;
    pointer-events: none;
}

#toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Landscape Prompt ────────────────────────────── */

.landscape-prompt {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #000;
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.landscape-prompt-content {
    text-align: center;
    color: #fff;
}

.rotate-icon {
    font-size: 48px;
    animation: rotate-phone 2s infinite;
    margin-bottom: 16px;
}

@keyframes rotate-phone {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(90deg); }
    50% { transform: rotate(90deg); }
    75% { transform: rotate(0deg); }
}

@media (orientation: portrait) and (max-width: 768px) {
    .landscape-prompt { display: flex; }
}

/* ── Screen title styles ─────────────────────────── */

.screen h2 {
    color: #fff;
    font-size: 22px;
    margin-bottom: 16px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

/* ── Scrollbar styling ───────────────────────────── */

.shop-grid::-webkit-scrollbar,
.leaderboard-list::-webkit-scrollbar {
    width: 6px;
}

.shop-grid::-webkit-scrollbar-track,
.leaderboard-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.shop-grid::-webkit-scrollbar-thumb,
.leaderboard-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}
