:root {
    --primary: #FF6B6B;
    --secondary: #4ECDC4;
    --accent: #FFE66D;
    --dark: #2C3E50;
    --light: #F7F9F9;
    --font-main: 'Fredoka', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none; /* Prevent text selection on touch */
}

body, html {
    height: 100%;
    width: 100%;
    font-family: var(--font-main);
    overflow: hidden; /* Prevent scrolling */
    background-color: var(--dark);
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Screens & Modals */
.screen, .modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s;
}

.hidden {
    display: none !important;
}

.panel, .modal-content {
    background: var(--light);
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    max-width: 90%;
    width: 400px;
    box-shadow: 0 10px 0 rgba(0,0,0,0.2);
    border: 4px solid var(--dark);
    max-height: 85vh;
    overflow-y: auto;
}

h1 {
    color: var(--primary);
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 0 var(--dark);
}

#game-title {
    font-size: 2rem;
    white-space: nowrap;
}

p {
    color: var(--dark);
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

/* Inputs & Buttons */
.input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 1.5rem;
    justify-content: center;
    align-items: center;
}

.input-group input {
    flex: 0 1 auto;
    width: 50%;
    min-width: 120px;
    max-width: 180px;
    padding: 10px;
    border: 2px solid var(--dark);
    border-radius: 10px;
    font-family: var(--font-main);
    font-size: 1rem;
}

input {
    padding: 10px;
    border: 2px solid var(--dark);
    border-radius: 10px;
    font-family: var(--font-main);
    font-size: 1rem;
}

.name-input-group {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.name-input-group input {
    width: 60%;
    text-align: center;
    border: 2px dashed var(--secondary);
    background: rgba(78, 205, 196, 0.1);
}

.name-input-group input:focus {
    border-style: solid;
    outline: none;
}

.speed-slider-group {
    margin-bottom: 1rem;
    text-align: center;
}

.speed-slider-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--dark);
    font-weight: 600;
}

.speed-slider-group input[type="range"] {
    width: 60%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--secondary), var(--primary));
    border-radius: 4px;
    outline: none;
}

.speed-slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--accent);
    border: 3px solid var(--dark);
    border-radius: 50%;
    cursor: pointer;
}

.max-level-group {
    margin-bottom: 1rem;
    text-align: center;
}

.max-level-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 6px;
}

.max-level-row label {
    color: var(--dark);
    font-weight: 600;
    font-size: 0.85rem;
    min-width: 90px;
    text-align: right;
}

.max-level-row select {
    font-family: var(--font-main);
    font-size: 0.85rem;
    padding: 4px 8px;
    border: 2px solid var(--dark);
    border-radius: 8px;
    background: white;
    color: var(--dark);
    cursor: pointer;
    min-width: 140px;
}

.current-level-hint {
    font-size: 0.65rem;
    color: var(--secondary);
    font-weight: 500;
    min-width: 70px;
    text-align: left;
    line-height: 1.3;
}
.current-level-hint strong {
    font-weight: 700;
    color: var(--primary);
}

button {
    font-family: var(--font-main);
    border: none;
    cursor: pointer;
    transition: transform 0.1s;
}

button:active {
    transform: scale(0.95);
}

.btn-primary {
    background: var(--secondary);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    border-bottom: 4px solid #3b9c96;
    font-weight: bold;
    font-size: 1rem;
}

.btn-gps {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    border-bottom: 3px solid #5a4a8a;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.btn-gps:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.btn-gps.loading {
    animation: pulse 1s infinite;
}

.btn-gps.success {
    background: linear-gradient(135deg, #4ECDC4 0%, #44a08d 100%);
    border-bottom-color: #3b9c96;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.95); }
}

.btn-start {
    background: var(--primary);
    color: white;
    padding: 15px 40px;
    border-radius: 50px;
    border-bottom: 6px solid #c0392b;
    font-size: 1.5rem;
    font-weight: bold;
    width: 100%;
    margin-top: 1rem;
}


.start-clock-level {
    font-size: 0.75rem;
    color: rgba(0,0,0,0.4);
    text-align: center;
    margin: 0 0 0.3rem 0;
}

.start-clock-level:empty {
    display: none;
}

.btn-reset {
    background: rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.1);
    color: rgba(0,0,0,0.35);
    font-size: 0.6rem;
    font-family: var(--font-main);
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 20px;
    transition: all 0.2s;
}

.btn-reset:hover {
    background: rgba(0,0,0,0.1);
    color: rgba(0,0,0,0.55);
}

/* Destination Select */
.destination-select .options {
    display: flex;
    justify-content: space-around;
    gap: 10px;
    margin-bottom: 1rem;
}

.dest-btn {
    background: white;
    border: 2px solid var(--dark);
    border-radius: 10px;
    padding: 10px;
    flex: 1;
    font-size: 0.9rem;
    color: var(--dark);
}

.dest-btn.selected {
    background: var(--accent);
    border-color: var(--dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 0 var(--dark);
}

/* HUD */
#hud {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 500;
    pointer-events: none; /* Let clicks pass through to map */
}

.stats-bar {
    display: flex;
    gap: 15px;
}

.stat {
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 15px;
    border-radius: 50px;
    font-size: 1.5rem;
    font-weight: bold;
    border: 3px solid var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.hearts { color: var(--primary); }
.coins { color: #f1c40f; }
.lasers { color: #e74c3c; }

.action-buttons {
    display: flex;
    gap: 10px;
    pointer-events: auto;
}

.action-btn {
    pointer-events: auto;
    background: var(--accent);
    color: var(--dark);
    border: 3px solid var(--dark);
    border-bottom: 6px solid var(--dark);
    padding: 15px 20px;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    font-size: 0.9rem;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.action-btn.laser {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border-color: #922b21;
}

.action-btn.laser.disabled {
    background: #bdc3c7;
    color: #7f8c8d;
    border-color: #95a5a6;
    opacity: 0.6;
}

.action-btn.horn {
    background: var(--accent);
}

.action-btn.center {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border-color: #1a5276;
    padding: 12px 15px;
}

.player-name-bar {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    color: var(--dark);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.route-status {
    position: absolute;
    top: 45px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a2e;
    color: #4ECDC4;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    font-weight: normal;
    padding: 6px 14px;
    border-radius: 8px;
    border: 2px solid #333;
    box-shadow: 0 0 8px rgba(78, 205, 196, 0.3);
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
    animation: routePulse 1.5s ease-in-out infinite;
    z-index: 501;
    white-space: nowrap;
}

.gps-icon {
    font-size: 0.9rem;
    line-height: 1;
}

@keyframes routePulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Math Modal */
#math-question {
    font-size: 3rem;
    color: var(--dark);
    margin: 2rem 0;
    font-weight: bold;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.math-option {
    background: var(--secondary);
    color: white;
    padding: 20px;
    border-radius: 15px;
    font-size: 2rem;
    font-weight: bold;
    border-bottom: 5px solid #3b9c96;
}

/* Super-som styling */
.modal-content.super-som {
    background: linear-gradient(135deg, #FFE66D 0%, #f39c12 100%);
    border-color: #e74c3c;
    animation: superGlow 0.5s ease-in-out infinite alternate;
}

.modal-content.super-som h2 {
    color: #e74c3c;
    text-shadow: 2px 2px 0 #fff;
}

.math-option.super {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border-bottom-color: #922b21;
}

@keyframes superGlow {
    from { box-shadow: 0 10px 0 rgba(0,0,0,0.2), 0 0 20px rgba(231, 76, 60, 0.5); }
    to { box-shadow: 0 10px 0 rgba(0,0,0,0.2), 0 0 40px rgba(231, 76, 60, 0.8); }
}

@keyframes confettiFall {
    0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) translateX(var(--drift, 0px)) rotate(720deg); opacity: 0; }
}

/* Damage Effects */
.screen-shake {
    animation: screenShake 0.4s ease-out;
}

@keyframes screenShake {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-6px, 4px); }
    30% { transform: translate(5px, -3px); }
    50% { transform: translate(-4px, 5px); }
    70% { transform: translate(3px, -4px); }
    90% { transform: translate(-2px, 2px); }
}

.damage-flash {
    position: fixed;
    inset: 0;
    background: rgba(231, 76, 60, 0.35);
    z-index: 500;
    pointer-events: none;
    animation: damageFlash 0.5s ease-out forwards;
}

@keyframes damageFlash {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

.heart-loss {
    position: fixed;
    font-size: 2.5rem;
    z-index: 700;
    pointer-events: none;
    animation: heartFloat 1s ease-out forwards;
}

@keyframes heartFloat {
    0% { transform: scale(1) translateY(0); opacity: 1; }
    100% { transform: scale(1.8) translateY(-80px); opacity: 0; }
}

/* Map Elements */
.leaflet-div-icon {
    background: transparent;
    border: none;
}

.emoji-icon {
    font-size: 2rem;
    text-align: center;
    line-height: 1;
    filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.3));
}

.player-icon { font-size: 3rem; z-index: 1000 !important; }
.player-icon.slipping div { animation: spin 0.3s linear infinite; }
.dino-icon { font-size: 2.5rem; }
.dino-icon.stunned div { animation: spin 0.5s linear infinite; }
.powerup-icon {
    font-size: 2.5rem;
    animation: powerupGlow 0.8s ease-in-out infinite alternate;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes powerupGlow {
    from { filter: drop-shadow(0 0 5px #f1c40f); }
    to { filter: drop-shadow(0 0 15px #e74c3c); }
}
.item-icon { font-size: 2rem; }

/* Info Button */
.btn-info {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--secondary);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    border-bottom: 3px solid #3b9c96;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Info Modal */
.info-content {
    max-width: 340px;
    text-align: left;
}

.info-content h2 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 1rem;
}

.info-rules {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 1.5rem;
    text-align: left;
}

.info-section-title {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 6px 0 0 0;
    padding-bottom: 2px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.info-section-title:first-child {
    margin-top: 0;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    color: var(--dark);
}

.info-icon {
    font-size: 1.5rem;
    width: 32px;
    text-align: center;
    flex-shrink: 0;
}

.info-content .btn-primary {
    width: 100%;
}

/* POI Selection */
.poi-container {
    margin-top: 1rem;
}

.poi-label {
    font-size: 0.9rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.poi-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 8px;
}

.poi-list::-webkit-scrollbar {
    width: 8px;
}

.poi-list::-webkit-scrollbar-track {
    background: #e0e0e0;
    border-radius: 4px;
}

.poi-list::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 4px;
}

.poi-list::-webkit-scrollbar-thumb:hover {
    background: #3b9c96;
}

.poi-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: white;
    border: 2px solid var(--dark);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.poi-item:hover {
    background: #f0f0f0;
}

.poi-item.selected {
    background: var(--accent);
    border-color: var(--dark);
    transform: translateY(-1px);
    box-shadow: 0 3px 0 var(--dark);
}

.poi-name {
    font-weight: 600;
    color: var(--dark);
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.poi-dist {
    font-size: 0.85rem;
    color: #666;
    flex-shrink: 0;
}

.poi-loading, .poi-empty {
    padding: 15px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 10px 24px;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: bold;
    z-index: 2000;
    text-align: center;
    animation: toastPop 0.3s ease-out;
    pointer-events: none;
}

.toast.hidden {
    display: none;
}

@keyframes toastPop {
    0% { transform: translateX(-50%) scale(0.5); opacity: 0; }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* Step Navigation */
.step { display: none; }
.step-active { display: block; }

.step-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 1rem;
}

.step-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ddd;
    border: 2px solid var(--dark);
    transition: background 0.2s;
}

.step-dot.active {
    background: var(--secondary);
}

.step-subtitle {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.step-hint {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
}

.step-nav {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 1rem;
}

.btn-next, .btn-back {
    font-family: var(--font-main);
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 1rem;
    border: none;
    cursor: pointer;
}

.btn-next {
    background: var(--secondary);
    color: white;
    border-bottom: 4px solid #3b9c96;
    width: 100%;
}

.btn-back {
    background: #eee;
    color: var(--dark);
    border-bottom: 4px solid #ccc;
}

/* Character Select */
.char-select {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 1rem;
}

.char-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
    background: white;
    border: 2px solid var(--dark);
    border-radius: 12px;
    font-size: 1.8rem;
    cursor: pointer;
    transition: all 0.15s;
}

.char-btn span {
    font-size: 0.65rem;
    color: var(--dark);
    font-weight: 600;
}

.char-btn.selected {
    background: var(--accent);
    border-color: var(--dark);
    transform: scale(1.08);
    box-shadow: 0 3px 0 var(--dark);
}

/* Friend Inputs */
.friend-inputs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 1rem;
}

.friend-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.friend-emoji {
    font-size: 1.8rem;
    width: 40px;
    text-align: center;
    flex-shrink: 0;
}

.friend-row input {
    flex: 1;
    padding: 8px 12px;
    border: 2px dashed var(--secondary);
    border-radius: 10px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    background: rgba(78, 205, 196, 0.1);
}

.friend-row input:focus {
    border-style: solid;
    outline: none;
}

/* Friend Map Markers */
.friend-icon {
    font-size: 2.2rem;
    z-index: 100 !important;
}

.friend-marker {
    position: relative;
    text-align: center;
}

.friend-label {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.9);
    color: var(--dark);
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: bold;
    white-space: nowrap;
    border: 1px solid var(--dark);
}

/* Super Mode */
.player-icon.super-mode div {
    animation: superPulse 0.5s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 10px #f1c40f) drop-shadow(0 0 20px #f39c12) drop-shadow(0 0 30px #e74c3c);
}

@keyframes superPulse {
    from { transform: scale(1) scaleX(var(--sx, -1)); }
    to { transform: scale(1.3) scaleX(var(--sx, -1)); filter: drop-shadow(0 0 15px #f1c40f) drop-shadow(0 0 30px #f39c12) drop-shadow(0 0 40px #e74c3c); }
}

/* Clock Question */
.clock-question {
    margin-top: 1rem;
}

.clock-question p#clock-task {
    font-size: 1.05rem;
    color: var(--dark);
    font-weight: normal;
    margin-bottom: 0.3rem;
    line-height: 1.3;
}

.clock-question p#clock-instruction {
    font-size: 1.3rem;
    color: #fff;
    font-weight: bold;
    margin-bottom: 1rem;
    line-height: 1.4;
    background: #e74c3c;
    display: inline-block;
    padding: 0.3rem 1rem;
    border-radius: 20px;
}

.clock-level-indicator {
    font-size: 0.75rem;
    color: #aaa;
    text-align: center;
    margin: 2px 0 6px 0;
}

#clock-container-game {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

#game-clock {
    width: 200px;
    height: 200px;
    border: 8px solid #41a6f6;
    border-radius: 50%;
    position: relative;
    background-color: rgba(135, 206, 250, 0.15);
    box-shadow: inset 0 0 12px rgba(0,0,0,0.15), 0 4px 12px rgba(0,0,0,0.15);
}

.super-som #game-clock {
    border-color: #e74c3c;
    box-shadow: inset 0 0 12px rgba(0,0,0,0.15), 0 0 20px rgba(231, 76, 60, 0.4);
}

/* Clock Tick Marks - dots like iOS ClockAdventure */
.clock-tick {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    background-color: #e74c3c;
    z-index: 3;
    pointer-events: none;
}

.clock-tick-minor {
    width: 4px;
    height: 4px;
    margin: -2px 0 0 -2px;
}

.clock-tick-major {
    width: 7px;
    height: 7px;
    margin: -3.5px 0 0 -3.5px;
}

/* Minute numbers (5, 10, 15...) inside the dot ring */
.clock-minute-num {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    text-align: center;
    line-height: 16px;
    font-size: 0.55em;
    font-weight: bold;
    color: #e74c3c;
    z-index: 4;
    pointer-events: none;
}

.clock-hand {
    position: absolute;
    bottom: 50%;
    left: 50%;
    transform-origin: bottom center;
    border-radius: 4px;
    z-index: 10;
    cursor: grab;
    touch-action: none;
}

/* Invisible wider touch target for fingers */
.clock-hand::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: calc(100% + 20px);
    background: transparent;
}

.clock-hand:active, .clock-hand.dragging {
    cursor: grabbing;
    filter: brightness(1.3);
}

.hour-hand-style {
    width: 7px;
    height: 55px;
    background-color: #1a3366;
    z-index: 11;
    transform: translateX(-50%) rotate(0deg);
}

.minute-hand-style {
    width: 5px;
    height: 75px;
    background-color: #e74c3c;
    transform: translateX(-50%) rotate(0deg);
}

.minute-hand-locked {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Visuele hulp: gekleurde helften/kwarten */
.clock-helper-overlay {
    position: absolute;
    top: 8px;
    left: 8px;
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.15;
}

.clock-helper-halves {
    background: conic-gradient(
        from 0deg,
        rgba(52, 152, 219, 0.8) 0deg 180deg,
        rgba(231, 76, 60, 0.8) 180deg 360deg
    );
}

.clock-helper-quarters {
    background: conic-gradient(
        from 0deg,
        rgba(52, 152, 219, 0.8) 0deg 90deg,
        rgba(46, 204, 113, 0.8) 90deg 180deg,
        rgba(231, 76, 60, 0.8) 180deg 270deg,
        rgba(243, 156, 18, 0.8) 270deg 360deg
    );
}

.clock-helper-label {
    position: absolute;
    font-size: 0.6em;
    font-weight: bold;
    color: rgba(0,0,0,0.5);
    pointer-events: none;
    z-index: 2;
}

#game-center-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    background-color: #e74c3c;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 12;
    pointer-events: none;
}

.clock-number {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 26px;
    height: 26px;
    margin: -13px 0 0 -13px;
    text-align: center;
    line-height: 26px;
    font-size: 0.95em;
    font-weight: bold;
    color: #1a3366;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    z-index: 5;
    pointer-events: none;
}

/* Numbers counter-rotated to stay upright (like iOS ClockAdventure) */
.clock-n12 { transform: translateY(-72px); }
.clock-n1  { transform: rotate(30deg) translateY(-72px) rotate(-30deg); }
.clock-n2  { transform: rotate(60deg) translateY(-72px) rotate(-60deg); }
.clock-n3  { transform: rotate(90deg) translateY(-72px) rotate(-90deg); }
.clock-n4  { transform: rotate(120deg) translateY(-72px) rotate(-120deg); }
.clock-n5  { transform: rotate(150deg) translateY(-72px) rotate(-150deg); }
.clock-n6  { transform: rotate(180deg) translateY(-72px) rotate(-180deg); }
.clock-n7  { transform: rotate(210deg) translateY(-72px) rotate(-210deg); }
.clock-n8  { transform: rotate(240deg) translateY(-72px) rotate(-240deg); }
.clock-n9  { transform: rotate(270deg) translateY(-72px) rotate(-270deg); }
.clock-n10 { transform: rotate(300deg) translateY(-72px) rotate(-300deg); }
.clock-n11 { transform: rotate(330deg) translateY(-72px) rotate(-330deg); }

.btn-clock-check {
    background: var(--secondary);
    color: white;
    padding: 12px 30px;
    border-radius: 12px;
    border-bottom: 4px solid #3b9c96;
    font-weight: bold;
    font-size: 1.3rem;
    font-family: var(--font-main);
}

.super-som .btn-clock-check {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border-bottom-color: #922b21;
}

/* Mobile compact layout */
@media (max-height: 750px) {
    .panel {
        padding: 1rem 1.5rem;
    }

    .panel h1 {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }

    .panel p {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    .name-input-group {
        margin-bottom: 0.5rem;
    }

    .name-input-group input {
        padding: 6px;
        font-size: 0.9rem;
    }

    .speed-slider-group {
        margin-bottom: 0.5rem;
    }

    .speed-slider-group label {
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
    }

    .input-group {
        margin-bottom: 0.75rem;
    }

    .dest-btn {
        padding: 8px;
        font-size: 0.8rem;
    }

    .poi-list {
        max-height: 120px;
    }

    .poi-item {
        padding: 8px 10px;
    }

    .btn-start {
        padding: 12px 30px;
        font-size: 1.2rem;
        margin-top: 0.5rem;
    }

    .start-extras {
        margin-top: 0.75rem;
    }
}

/* Mobile game HUD layout */
@media (max-width: 600px) {
    #hud {
        top: 15px;
        left: 15px;
        right: 15px;
        bottom: 20px;
        flex-direction: column;
        justify-content: space-between;
    }

    .stats-bar {
        gap: 8px;
    }

    .stat {
        padding: 6px 10px;
        font-size: 1.1rem;
        border-width: 2px;
    }

    .action-buttons {
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        gap: 15px;
    }

    .action-btn {
        width: 65px;
        height: 65px;
        padding: 10px;
        font-size: 0.75rem;
        border-width: 2px;
        border-bottom-width: 4px;
    }

    .action-btn i {
        font-size: 1.2rem;
    }
}

/* ================================
   LEADERBOARD & STICKER BOOK
   ================================ */

/* Start screen extras */
.start-extras {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 1.5rem;
}

.btn-leaderboard, .btn-stickers {
    background: white;
    border: 2px solid var(--dark);
    border-bottom: 4px solid var(--dark);
    border-radius: 12px;
    padding: 10px 16px;
    font-family: var(--font-main);
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-leaderboard i { color: #f1c40f; }
.btn-stickers i { color: var(--accent); }

.btn-leaderboard:active, .btn-stickers:active {
    transform: scale(0.95);
    border-bottom-width: 2px;
}

/* End Screen - Score Summary */
.end-panel {
    width: 420px;
}

.score-summary {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.score-item {
    background: white;
    border: 2px solid var(--dark);
    border-radius: 12px;
    padding: 8px 14px;
    font-weight: bold;
    font-size: 1rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 6px;
}

.score-item i {
    font-size: 1.1rem;
}

/* End Screen - Buttons */
.end-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 1rem;
}

.btn-stickers-sm {
    background: white;
    border: 2px solid var(--dark);
    border-bottom: 4px solid var(--dark);
    border-radius: 12px;
    padding: 10px 16px;
    font-family: var(--font-main);
    font-weight: bold;
    font-size: 0.95rem;
    color: var(--dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-stickers-sm i { color: var(--accent); }

.btn-restart {
    flex: 1;
}

/* New Stickers Alert */
.new-stickers-alert {
    background: linear-gradient(135deg, var(--accent) 0%, #f39c12 100%);
    border: 2px solid var(--dark);
    border-radius: 12px;
    padding: 8px 14px;
    margin: 0.5rem 0;
    font-weight: bold;
    color: var(--dark);
    animation: alertPulse 1s ease-in-out infinite alternate;
}

@keyframes alertPulse {
    from { box-shadow: 0 0 0 rgba(241, 196, 15, 0); }
    to { box-shadow: 0 0 15px rgba(241, 196, 15, 0.6); }
}

/* Leaderboard */
.leaderboard-section {
    margin: 1rem 0 0.5rem;
}

.leaderboard-tabs {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.lb-tab {
    background: #eee;
    border: 2px solid var(--dark);
    border-radius: 20px;
    padding: 6px 16px;
    font-family: var(--font-main);
    font-weight: bold;
    font-size: 0.85rem;
    color: var(--dark);
    cursor: pointer;
}

.lb-tab.active {
    background: var(--secondary);
    color: white;
}

.leaderboard-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lb-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: white;
    border-radius: 10px;
    border: 2px solid #eee;
    font-size: 0.9rem;
}

.lb-row.rank-1 {
    background: linear-gradient(135deg, #fff9c4, #ffe082);
    border-color: #f1c40f;
}

.lb-row.rank-2 {
    background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
    border-color: #bdbdbd;
}

.lb-row.rank-3 {
    background: linear-gradient(135deg, #ffe0b2, #ffcc80);
    border-color: #cd7f32;
}

.lb-row.lb-me {
    box-shadow: 0 0 0 3px var(--secondary);
    animation: meGlow 1.5s ease-in-out infinite alternate;
}

@keyframes meGlow {
    from { box-shadow: 0 0 0 3px var(--secondary); }
    to { box-shadow: 0 0 10px 3px var(--secondary); }
}

.lb-rank {
    font-weight: bold;
    min-width: 28px;
    text-align: center;
    font-size: 1.1rem;
}

.lb-player {
    flex: 1;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-score {
    font-weight: bold;
    color: #f1c40f;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.lb-score i {
    font-size: 0.8rem;
}

.lb-loading, .lb-empty {
    text-align: center;
    color: #888;
    font-size: 0.9rem;
    padding: 1rem;
    margin: 0;
}

/* Leaderboard Modal */
.leaderboard-modal-content {
    max-width: 400px;
    width: 90%;
}

.leaderboard-modal-content .leaderboard-list {
    max-height: 300px;
    margin-bottom: 1rem;
}

/* Sticker Book */
.sticker-book-content {
    max-width: 420px;
    width: 95%;
    position: relative;
}

.sticker-book-content h2 {
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.btn-reset-stickers {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: rgba(0,0,0,0.2);
    font-size: 0.6rem;
    font-family: var(--font-main);
    padding: 4px 8px;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-reset-stickers:hover {
    color: rgba(0,0,0,0.45);
}

.sticker-progress {
    margin-bottom: 1rem;
    text-align: center;
}

.progress-bar-track {
    background: #eee;
    border: 2px solid var(--dark);
    border-radius: 20px;
    height: 20px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar-fill {
    background: linear-gradient(90deg, var(--secondary), var(--accent));
    height: 100%;
    border-radius: 18px;
    transition: width 0.5s ease-out;
}

.progress-text {
    font-weight: bold;
    color: var(--dark);
    font-size: 0.95rem;
}

.sticker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 1rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 4px;
}

.sticker-card {
    border-radius: 15px;
    padding: 10px 6px;
    text-align: center;
    border: 3px solid var(--dark);
    transition: transform 0.2s;
}

.sticker-card.earned {
    background: white;
    animation: stickerWobble 3s ease-in-out infinite;
}

.sticker-card.locked {
    background: #f0f0f0;
    opacity: 0.5;
}

@keyframes stickerWobble {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(1.5deg); }
    75% { transform: rotate(-1.5deg); }
}

.sticker-emoji {
    font-size: 2.5rem;
    margin-bottom: 4px;
}

.locked-emoji {
    font-size: 2.5rem;
    filter: grayscale(1);
}

.sticker-name {
    font-weight: bold;
    font-size: 0.7rem;
    color: var(--dark);
    margin-bottom: 2px;
}

.sticker-desc {
    font-size: 0.6rem;
    color: #888;
    line-height: 1.2;
}

/* Sticker Celebration */
.sticker-celebrate-content {
    background: linear-gradient(135deg, var(--accent) 0%, #f39c12 100%);
    padding: 2.5rem;
    border-radius: 25px;
    text-align: center;
    border: 4px solid var(--dark);
    box-shadow: 0 10px 0 rgba(0,0,0,0.2);
    animation: celebratePop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes celebratePop {
    0% { transform: scale(0.3); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.sticker-celebrate-content h2 {
    color: var(--dark);
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.celebrate-sticker {
    font-size: 5rem;
    animation: celebrateBounce 0.8s ease-in-out infinite alternate;
}

@keyframes celebrateBounce {
    from { transform: scale(1) rotate(-5deg); }
    to { transform: scale(1.15) rotate(5deg); }
}

.celebrate-name {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--dark);
    margin: 0.5rem 0 0.25rem;
}

.celebrate-desc {
    font-size: 1rem;
    color: rgba(44, 62, 80, 0.7);
    margin-bottom: 1rem;
}

/* Destination Direction Arrow */
.dest-arrow {
    position: fixed;
    z-index: 600;
    background: rgba(26, 26, 46, 0.92);
    color: #4ECDC4;
    border: 2px solid #4ECDC4;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    cursor: pointer;
    box-shadow: 0 0 12px rgba(78, 205, 196, 0.5), inset 0 0 8px rgba(78, 205, 196, 0.15);
    transition: box-shadow 0.3s;
    touch-action: manipulation;
}

.dest-arrow:active {
    transform: scale(0.92);
}

.dest-arrow.close {
    animation: destPulse 0.8s ease-in-out infinite alternate;
    border-color: #FFE66D;
    color: #FFE66D;
    box-shadow: 0 0 16px rgba(255, 230, 109, 0.6), inset 0 0 8px rgba(255, 230, 109, 0.15);
}

.dest-arrow-icon {
    font-size: 1.3rem;
    line-height: 1;
    display: block;
    transition: transform 0.15s;
}

.dest-arrow-dist {
    font-family: 'Courier New', monospace;
    font-size: 0.55rem;
    font-weight: bold;
    line-height: 1;
    margin-top: 1px;
    white-space: nowrap;
}

@keyframes destPulse {
    from { box-shadow: 0 0 8px rgba(255, 230, 109, 0.4); }
    to { box-shadow: 0 0 22px rgba(255, 230, 109, 0.8); }
}

/* Mobile compact for leaderboard/stickers */
@media (max-height: 750px) {
    .score-summary {
        gap: 6px;
        margin: 0.5rem 0;
    }

    .score-item {
        padding: 5px 10px;
        font-size: 0.85rem;
    }

    .leaderboard-list {
        max-height: 130px;
    }

    .sticker-grid {
        max-height: 200px;
    }

    .end-panel {
        padding: 1rem 1.5rem;
    }

    .end-panel h1 {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }

    .end-panel p {
        margin-bottom: 0.5rem;
    }
}
