:root {
    --bg1: #0b1026;
    --bg2: #1a0b2e;
    --card: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.1);
    --text: #e5e7eb;
    --muted: #94a3b8;
    --cyan: #22d3ee;
    --pink: #f472b6;
    --green: #34d399;
    --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    height: 100%;
    color: var(--text);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: radial-gradient(1200px 800px at 10% -10%, #1e3a8a55, transparent 60%),
                radial-gradient(1000px 700px at 110% 110%, #9d174d44, transparent 60%),
                linear-gradient(135deg, var(--bg1), var(--bg2));
    background-attachment: fixed;
    overscroll-behavior: none;
    -webkit-user-select: none;
    user-select: none;
}

/* ---------- Lobby ---------- */
.lobby {
    max-width: 440px;
    margin: 0 auto;
    padding: calc(2rem + env(safe-area-inset-top)) 1.25rem calc(2rem + env(safe-area-inset-bottom));
    animation: fade-in .4s ease-out;
}

.logo {
    text-align: center;
    font-size: 3.2rem;
    font-weight: 900;
    letter-spacing: .08em;
    margin: 0 0 .25rem;
    background: linear-gradient(90deg, var(--cyan), var(--pink));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 18px #22d3ee55);
}
.tagline { text-align: center; color: var(--muted); margin: 0 0 1.75rem; }

.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.card h3 { margin: 0 0 .75rem; font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: .5rem; }

.lobby label { display: block; margin-bottom: .4rem; font-size: .8rem; color: var(--muted); letter-spacing: .05em; }

.input {
    width: 100%;
    padding: .8rem 1rem;
    font-size: 1.05rem;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: rgba(0, 0, 0, .25);
    color: var(--text);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    -webkit-user-select: text;
    user-select: text;
}
.input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px #22d3ee33; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .75rem 1.1rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, .06);
    color: var(--text);
    cursor: pointer;
    transition: transform .12s ease, box-shadow .2s, background .2s, filter .2s;
}
.btn:hover { background: rgba(255, 255, 255, .1); }
.btn:active { transform: scale(.97); }
.btn.wide { display: flex; width: 100%; margin-bottom: .6rem; }
.btn.wide:last-child { margin-bottom: 0; }
.btn.primary {
    border: none;
    color: #0b1026;
    background: linear-gradient(90deg, var(--cyan), #818cf8);
    box-shadow: 0 8px 24px #22d3ee40;
    padding: 1rem;
    font-size: 1.1rem;
}
.btn.primary:hover { filter: brightness(1.1); }
.btn.success {
    border: none;
    color: #06281d;
    background: linear-gradient(90deg, var(--green), #a3e635);
    box-shadow: 0 8px 24px #34d39940;
    animation: pop-in .3s ease-out;
    justify-content: space-between;
}
.btn.icon { padding: .55rem .8rem; border-radius: 999px; font-size: .9rem; }
.seg { display: flex; gap: .4rem; }
.seg .btn { flex: 1; padding: .6rem .5rem; }
.seg .btn.sel { background: linear-gradient(90deg, var(--cyan), #818cf8); color: #0b1026; border-color: transparent; }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .75rem; }
.team { display: flex; flex-direction: column; gap: .4rem; }
.team label { margin-bottom: 0; }
.seat { padding: .6rem .5rem; border-radius: 12px; font-size: .95rem; font-weight: 600; text-align: center; }
.seat.me { background: #22d3ee22; border: 1px solid #22d3ee66; color: var(--cyan); }
.btn.seat { width: 100%; }
.btn.seat.ai { background: #f472b61a; border-color: #f472b655; }
.seg.speed { gap: .25rem; }
.seg.speed .btn { padding: .3rem 0; font-size: 1rem; }
.powerups li .btn.icon { padding: .2rem .6rem; }

.status {
    background: #22d3ee1a;
    border: 1px solid #22d3ee55;
    padding: .75rem 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    animation: pop-in .25s ease-out;
}

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.empty { color: var(--muted); text-align: center; padding: .5rem 0; margin: 0; }

.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 #34d39980; animation: ping 1.6s infinite; }

.waiting { text-align: center; padding: .75rem 0 1rem; }
.radar { width: 72px; height: 72px; margin: 0 auto 1rem; border-radius: 50%; position: relative; background: radial-gradient(circle, #22d3ee33 0 30%, transparent 31%); }
.radar::before, .radar::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--cyan); animation: radar 1.8s ease-out infinite; }
.radar::after { animation-delay: .9s; }

.powerups { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.powerups li { display: flex; align-items: center; gap: .6rem; font-size: .9rem; background: rgba(0, 0, 0, .2); padding: .5rem .6rem; border-radius: 10px; }
.powerups .toggle { cursor: pointer; transition: opacity .2s, background .2s; }
.powerups .toggle.off { opacity: .4; }
.powerups .toggle.off .dot { box-shadow: none; }
.powerups .pu-name { flex: 1; }
.powerups .switch { flex: none; width: 28px; height: 16px; border-radius: 999px; background: rgba(255,255,255,.15); position: relative; transition: background .2s; }
.powerups .switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: transform .2s; }
.powerups .toggle.on .switch { background: var(--green); }
.powerups .toggle.on .switch::after { transform: translateX(12px); }
.powerups .dot { flex: none; display: inline-flex; width: 1.8rem; height: 1.8rem; border-radius: 50%; color: #0b1026; font-weight: 800; align-items: center; justify-content: center; box-shadow: 0 0 12px currentColor; }

.diag { margin-top: .5rem; font-size: .8rem; color: var(--muted); }
.diag summary { cursor: pointer; list-style: none; text-align: center; opacity: .6; }
.diag summary::-webkit-details-marker { display: none; }
.diag > div { margin-top: .3rem; }

/* ---------- Game ---------- */
.game {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100dvh;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    animation: fade-in .3s ease-out;
}
.game-bar { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem .75rem; }
.versus { font-weight: 700; font-size: .95rem; display: flex; gap: .5rem; align-items: center; }
.versus .me { color: var(--cyan); }
.versus .them { color: var(--pink); }
.versus .vs { color: var(--muted); font-size: .75rem; }
.pong-canvas {
    flex: 1;
    min-height: 0;
    max-width: calc(100% - 1rem);
    aspect-ratio: 16 / 9;
    width: auto;
    touch-action: none;
    border-radius: 18px;
    border: 1px solid var(--card-border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5), 0 0 40px #22d3ee22;
}
.hint { font-size: .75rem; color: var(--muted); padding: .4rem 0; }

@media (orientation: portrait) {
    .game .hint::after { content: " · draai je telefoon voor een groter veld"; }
}

@media (orientation: landscape) and (max-height: 500px) {
    .game-bar { padding: .25rem .75rem; }
    .hint { display: none; }
}

/* ---------- Animations ---------- */
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: none; } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 #34d39980; } 80%, 100% { box-shadow: 0 0 0 8px #34d39900; } }
@keyframes radar { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.3); opacity: 0; } }

/* ---------- Blazor chrome ---------- */
#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; width: 100%; padding: .6rem 1rem; background: #fecaca; color: #000; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; }

.loading-progress { position: absolute; display: block; width: 7rem; height: 7rem; inset: 30vh 0 auto 0; margin: 0 auto; }
.loading-progress circle { fill: none; stroke: #ffffff15; stroke-width: .5rem; transform-origin: 50% 50%; transform: rotate(-90deg); }
.loading-progress circle:last-child { stroke: var(--cyan); stroke-linecap: round; stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%; transition: stroke-dasharray .05s ease-in-out; filter: drop-shadow(0 0 6px var(--cyan)); }
.loading-progress-text { position: absolute; text-align: center; font-weight: 700; color: var(--muted); inset: calc(30vh + 2.9rem) 0 auto .2rem; }
.loading-progress-text:after { content: var(--blazor-load-percentage-text, "Laden"); }

/* GameCenter */
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; width: 100%; max-width: 560px; }
.game-tile { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: 1.4rem 1rem; border-radius: 18px; text-decoration: none; color: #fff; text-align: center; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(12px); transition: transform .15s, border-color .15s; }
a.game-tile:hover { transform: translateY(-3px); border-color: #22d3ee88; }
.game-tile.soon { opacity: .45; }
.game-icon { font-size: 2.6rem; }
.game-name { font-weight: 800; font-size: 1.15rem; }
.back { align-self: flex-start; text-decoration: none; }

