* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}

html, body {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    touch-action: manipulation;
}

body {
    background-color: #0f172a;
    color: #f8fafc;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    min-height: 100vh;
}

header {
    width: 100%;
    max-width: 800px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1e293b;
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid #334155;
    margin-bottom: 10px;
}

header .logo {
    font-weight: bold;
    color: #38bdf8;
    font-size: 1.1rem;
    text-decoration: none;
}

nav.nav-menu {
    display: flex;
    gap: 15px;
}

nav.nav-menu a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: color 0.2s;
}

nav.nav-menu a:hover {
    color: #38bdf8;
}

.page-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 900px;
    margin: auto;
}

.ad-banner {
    width: 100%;
    max-width: 800px;
    height: 90px;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    overflow: hidden;
    flex-shrink: 0;
    margin: 5px 0;
}

.game-container {
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    overflow: hidden;
    border: 3px solid #334155;
    width: 100%;
    max-width: 800px;
    width: min(100%, 800px);
    max-height: 85vh;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
}

canvas {
    background: #090d16;
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.sound-selector-wrapper {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 20;
}

.sound-select-btn {
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid #475569;
    color: #f8fafc;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background 0.2s, transform 0.1s;
    outline: none;
}

.sound-select-btn:hover {
    background: rgba(51, 65, 85, 0.95);
}

.sound-dropdown {
    position: absolute;
    top: 110%;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid #334155;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 200px;
    backdrop-filter: blur(8px);
    padding: 6px 0;
}

.dropdown-header {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    padding: 6px 14px 4px 14px;
    font-weight: 700;
}

.sound-option {
    background: transparent;
    border: none;
    color: #cbd5e1;
    padding: 8px 14px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.sound-option:hover {
    background: #1e293b;
    color: #38bdf8;
}

.sound-option.active {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
}

.dropdown-divider {
    height: 1px;
    background: #334155;
    margin: 6px 0;
}

.dropdown-control {
    padding: 6px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.75rem;
    color: #cbd5e1;
    font-weight: 600;
}

.dropdown-control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dropdown-control input[type="range"] {
    width: 100%;
    accent-color: #38bdf8;
    cursor: pointer;
}

.dropdown-control input[type="checkbox"] {
    accent-color: #38bdf8;
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(6px);
    z-index: 10;
    padding: 15px;
    text-align: center;
}

h1 {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    color: #38bdf8;
    margin-bottom: 0.2rem;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
    text-align: center;
}

p {
    font-size: clamp(0.85rem, 3vw, 1.1rem);
    color: #94a3b8;
    margin-bottom: 1.2rem;
    text-align: center;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
    text-decoration: none;
    display: inline-block;
    min-height: 40px;
}

.btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #0369a1, #075985);
}

.btn-secondary {
    background: linear-gradient(135deg, #d97706, #b45309);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #b45309, #92400e);
}

.instructions {
    margin-top: 10px;
    font-size: clamp(0.7rem, 2vw, 0.85rem);
    color: #64748b;
    text-align: center;
}

.shop-container {
    width: 95%;
    height: 90%;
    background: rgba(30, 41, 59, 0.95);
    border: 2px solid #334155;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
}

.shop-header {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 10px;
    align-items: center;
}

.shop-header h2 {
    font-size: clamp(1.1rem, 4vw, 1.5rem);
}

.coin-balance {
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    font-weight: bold;
    color: #f59e0b;
}

.skins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    width: 100%;
    margin-bottom: 15px;
}

.skin-card {
    background: #0f172a;
    border: 2px solid #334155;
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.skin-card.active {
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.skin-preview-canvas {
    width: 60px;
    height: 40px;
    background: #090d16;
    border-radius: 6px;
    border: 1px solid #1e293b;
}

.skin-name {
    font-size: 0.8rem;
    font-weight: bold;
    text-align: center;
}

.skin-desc {
    font-size: 0.65rem;
    color: #94a3b8;
    text-align: center;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.skin-btn {
    width: 100%;
    padding: 6px 0;
    font-size: 0.75rem;
    border-radius: 4px;
    border: none;
    font-weight: bold;
    cursor: pointer;
}

.skin-btn.buy { background: #f59e0b; color: #0f172a; }
.skin-btn.buy:hover { background: #d97706; }
.skin-btn.equip { background: #10b981; color: white; }
.skin-btn.equipped { background: #334155; color: #94a3b8; cursor: default; }

.content-page {
    width: 100%;
    max-width: 800px;
    background: rgba(30, 41, 59, 0.95);
    border: 2px solid #334155;
    border-radius: 12px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    margin: 10px 0;
}

.content-page h1 {
    color: #38bdf8;
    margin-bottom: 10px;
}

.content-page p, .content-page ul {
    color: #cbd5e1;
    font-size: 0.95rem;
    line-height: 1.6;
    text-align: left;
    width: 100%;
    margin-bottom: 15px;
}

.content-page ul {
    padding-left: 20px;
}

.content-page li {
    margin-bottom: 8px;
}

.contact-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-form label {
    font-size: 0.85rem;
    font-weight: bold;
    color: #94a3b8;
}

.contact-form input, .contact-form textarea {
    width: 100%;
    padding: 10px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: 6px;
    color: white;
    font-size: 0.95rem;
}

.contact-form textarea {
    resize: vertical;
    min-height: 120px;
}

.filter-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 15px 0;
}

.filter-tab {
    background: #1e293b;
    border: 1px solid #475569;
    color: #94a3b8;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tab:hover, .filter-tab.active {
    background: #0284c7;
    color: white;
    border-color: #38bdf8;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.leaderboard-table th, .leaderboard-table td {
    padding: 10px 15px;
    text-align: left;
    border-bottom: 1px solid #334155;
    font-size: 0.9rem;
}

.leaderboard-table th {
    color: #38bdf8;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
}

.leaderboard-table tr:hover {
    background: rgba(56, 189, 248, 0.05);
}

footer {
    width: 100%;
    max-width: 800px;
    margin-top: 15px;
    font-size: 0.8rem;
    color: #64748b;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1e293b;
    padding: 12px 20px;
    border-radius: 8px;
    border: 1px solid #334155;
}

footer .footer-links {
    display: flex;
    gap: 15px;
}

footer a {
    color: #94a3b8;
    text-decoration: none;
}

footer a:hover {
    color: #38bdf8;
}

.alert-box {
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    text-align: center;
    width: 100%;
}
.alert-success { background: rgba(16, 185, 129, 0.2); border: 1px solid #10b981; color: #34d399; }
.alert-error { background: rgba(239, 68, 68, 0.2); border: 1px solid #ef4444; color: #f87171; }

.hidden { display: none !important; }

.gameover-input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 320px;
    margin: 10px 0;
}

.gameover-input {
    width: 100%;
    padding: 10px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    text-align: center;
    outline: none;
}

.gameover-input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
}

.share-group {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 10px;
}

.btn-social {
    padding: 8px 14px;
    font-size: 0.8rem;
    border-radius: 6px;
    border: none;
    font-weight: bold;
    color: white;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: transform 0.1s, opacity 0.2s;
}

.btn-social:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.btn-facebook { background: #1877f2; }
.btn-twitter { background: #000000; border: 1px solid #334155; }
.btn-whatsapp { background: #25d366; }

.rotate-device-warning {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0f172a;
    color: #f8fafc;
    z-index: 9999;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    text-align: center;
}

.rotate-device-warning span {
    font-size: 3rem;
    margin-bottom: 15px;
    animation: bounceRotate 1.5s infinite ease-in-out;
}

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

@media (max-width: 768px) and (orientation: portrait) {
    .rotate-device-warning {
        display: flex;
    }
}

@media (max-height: 600px) {
    .ad-banner { display: none; }
}

/* ==========================================
   APP-SPECIFIEKE STIJLEN (Alleen actief in de app)
   ========================================== */

body.app-mode {
    margin: 0 !important;
    padding: 0 !important;
    background-color: #0f172a !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    width: 100vw !important;
    min-height: 100vh !important;
    justify-content: flex-start !important;
}

/* Verberg header, footer, advertenties en de web-accountbalk in de app */
body.app-mode header,
body.app-mode footer,
body.app-mode .ad-banner,
body.app-mode .web-account-bar {
    display: none !important;
}

/* Laat de page-wrapper en content-pages netjes vullen in de app */
body.app-mode .page-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100vh !important;
    justify-content: flex-start !important;
    margin: 0 !important;
    padding: 50px 10px 10px 10px !important;
    gap: 10px !important;
}

body.app-mode .game-container {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

body.app-mode .content-page {
    width: 100% !important;
    max-width: 800px !important;
    margin: 0 auto !important;
}

/* App Navigatie Balk (Zwevend linksboven in de app op elke pagina) */
body.app-mode .app-top-nav {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 9999;
    display: flex;
    gap: 6px;
    background: rgba(15, 23, 42, 0.9);
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #334155;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

body.app-mode .app-nav-btn {
    background: #1e293b;
    color: #38bdf8;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: bold;
    text-decoration: none;
    border-radius: 4px;
    border: 1px solid #475569;
    transition: background 0.2s;
}

body.app-mode .app-nav-btn:hover {
    background: #0284c7;
    color: #ffffff;
}

body.app-mode .app-nav-btn.logout-btn {
    color: #ef4444;
    border-color: #7f1d1d;
}