/* ── Reset & Variablen ────────────────────────────────────────────────────── */
:root {
    --bg1:    #09090b;
    --bg2:    #18181b;
    --panel:  rgba(255,255,255,.08);
    --line:   rgba(255,255,255,.16);
    --text:   #f8fafc;
    --muted:  rgba(248,250,252,.68);
    --accent: #f97316;
    --gold:   #facc15;
    --cyan:   #38bdf8;
    --good:   #22c55e;
    --bad:    #ef4444;
    --green:  #22c55e;
    --red:    #ef4444;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 12% 10%, rgba(249,115,22,.34), transparent 30%),
        radial-gradient(circle at 88% 80%, rgba(56,189,248,.18), transparent 27%),
        linear-gradient(135deg, var(--bg1), var(--bg2));
    overflow-x: hidden;
}
.page { min-height: 100vh; }

/* ── Dashboard (index.php) ────────────────────────────────────────────────── */
.dashboard {
    width: 100%; min-height: 100vh;
    padding: clamp(14px,2vw,34px);
    display: grid;
    gap: clamp(14px,1.8vw,24px);
}
.dashboard-full { grid-template-rows: auto 1fr 1fr; }

.topbar,
.score-section {
    border: 1px solid var(--line);
    background: linear-gradient(145deg, rgba(255,255,255,.10), rgba(255,255,255,.045));
    box-shadow: 0 24px 80px rgba(0,0,0,.36);
    backdrop-filter: blur(12px);
}
.topbar {
    border-radius: 30px;
    padding: clamp(14px,1.5vw,20px) clamp(18px,2vw,28px);
    display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.topbar h1 { display: none; }
.eyebrow {
    text-transform: uppercase; letter-spacing: .36em;
    color: var(--accent); font-weight: 950;
    font-size: clamp(.72rem,1vw,.95rem);
}
h1 {
    margin: .2em 0 0;
    font-size: clamp(2rem,4.8vw,5.4rem);
    line-height: .9; letter-spacing: -.06em;
}
.score-section {
    border-radius: 32px;
    padding: clamp(14px,1.6vw,24px);
    display: grid;
    grid-template-columns: minmax(120px,.22fr) 1fr;
    gap: clamp(12px,1.5vw,20px);
    align-items: stretch; min-height: 0;
}
.section-title {
    border-radius: 24px; border: 1px solid var(--line);
    background: rgba(0,0,0,.18);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-align: center; padding: 18px;
}
.section-title span {
    font-size: clamp(3.4rem,8vw,9rem);
    font-weight: 1000; line-height: .8; letter-spacing: -.09em;
}
.section-title small { display: none; }
.score-171 .section-title span { color: var(--cyan); }
.score-180 .section-title span { color: var(--gold); }

.tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: clamp(10px,1.2vw,18px);
}
.tile {
    min-height: clamp(125px,16vh,240px);
    border-radius: 26px; border: 1px solid var(--line);
    background: var(--panel);
    padding: clamp(14px,1.7vw,24px);
    display: flex; flex-direction: column;
    justify-content: space-between;
    overflow: hidden; position: relative;
}
.tile::after {
    content: ''; position: absolute;
    right: -28%; bottom: -45%;
    width: 78%; aspect-ratio: 1;
    border-radius: 50%; background: rgba(249,115,22,.11);
}
.score-171 .tile::after { background: rgba(56,189,248,.11); }
.tile span {
    position: relative; z-index: 1;
    display: block; color: var(--muted);
    font-size: clamp(.82rem,1.15vw,1.2rem); font-weight: 900;
}
.tile span em {
    display: inline-block; margin-left: 8px;
    font-style: normal; color: var(--gold);
}
.score-171 .tile span em { color: var(--cyan); }
.tile strong {
    position: relative; z-index: 1;
    display: block;
    font-size: clamp(3.1rem,6.2vw,8.5rem);
    line-height: .82; letter-spacing: -.08em; font-weight: 1000;
}
.tile-main { background: linear-gradient(145deg, rgba(249,115,22,.28), rgba(255,255,255,.08)); }
.score-171 .tile-main { background: linear-gradient(145deg, rgba(56,189,248,.24), rgba(255,255,255,.08)); }
.tile-record { background: linear-gradient(145deg, rgba(250,204,21,.18), rgba(255,255,255,.07)); }

.footerline { display: none; }

.status-row {
    display: inline-flex; align-items: center; gap: 10px;
    font-weight: 900; color: var(--muted); white-space: nowrap;
}
.dot {
    width: 14px; height: 14px; border-radius: 999px;
    background: var(--good); box-shadow: 0 0 0 8px rgba(34,197,94,.14);
}
.dot.offline { background: var(--bad); box-shadow: 0 0 0 8px rgba(239,68,68,.14); }

/* ── Hit-Flash (body-level) ───────────────────────────────────────────────── */
body.hit-flash::before {
    content: ''; position: fixed; inset: 0; pointer-events: none;
    background: rgba(250,204,21,.13);
    opacity: 0; animation: flash .52s ease-out; z-index: 20;
}
@keyframes flash { 0%{opacity:0} 12%{opacity:.45} 100%{opacity:0} }

/* ── Pop-Animation auf Zahlen ─────────────────────────────────────────────── */
.pop { animation: pop .42s ease-out; }
@keyframes pop {
    0%   { transform: scale(1); }
    42%  { transform: scale(1.12); color: var(--accent); }
    100% { transform: scale(1); }
}

/* ── Hit-Overlay (index.php) ──────────────────────────────────────────────── */
#hitOverlay {
    display: none;
    position: fixed; inset: 0; z-index: 200;
    flex-direction: column; align-items: center; justify-content: center;
    pointer-events: none;
    animation: overlayIn .18s ease both;
}
#hitOverlay.hit-overlay-visible {
    display: flex;
}
@keyframes overlayIn { from{opacity:0} to{opacity:1} }

.hit-overlay-bg {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.88);
    backdrop-filter: blur(5px);
}
.hit-overlay-content {
    position: relative; z-index: 1;
    display: flex; flex-direction: column;
    align-items: center; gap: 0;
    animation: popIn .28s cubic-bezier(.175,.885,.32,1.275) both;
}
@keyframes popIn { from{transform:scale(.65);opacity:0} to{transform:scale(1);opacity:1} }

.dartboard-svg {
    width: min(52vw, 300px);
    height: min(52vw, 300px);
}

.hit-score {
    font-size: clamp(7rem, 22vw, 14rem);
    font-weight: 1000; line-height: .85;
    letter-spacing: -.06em; margin-top: -4px;
}
.hit-sub {
    font-size: clamp(1.1rem, 3.5vw, 1.8rem);
    font-weight: 900; letter-spacing: .3em;
    text-transform: uppercase; margin-top: 6px;
}

/* Farben je Typ */
#hitOverlay.hit-180 .hit-score { color: var(--gold); text-shadow: 0 0 60px rgba(250,204,21,.6), 0 0 120px rgba(250,204,21,.3); }
#hitOverlay.hit-180 .hit-sub   { color: rgba(250,204,21,.7); }
#hitOverlay.hit-171 .hit-score { color: var(--cyan); text-shadow: 0 0 60px rgba(56,189,248,.6), 0 0 120px rgba(56,189,248,.3); }
#hitOverlay.hit-171 .hit-sub   { color: rgba(56,189,248,.7); }

.hit-progress {
    position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
}
.hit-progress-fill {
    height: 100%; width: 100%; transform-origin: left;
}
#hitOverlay.hit-180 .hit-progress-fill { background: var(--gold); }
#hitOverlay.hit-171 .hit-progress-fill { background: var(--cyan); }

/* ── Login (login.php) ────────────────────────────────────────────────────── */
.page-login {
    min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card {
    width: min(440px, 100%);
    border: 1px solid var(--line);
    background: linear-gradient(145deg, rgba(255,255,255,.10), rgba(255,255,255,.045));
    box-shadow: 0 24px 80px rgba(0,0,0,.36);
    backdrop-filter: blur(12px);
    border-radius: 32px;
    padding: clamp(28px, 5vw, 52px);
}
.login-card h1 { font-size: clamp(2.6rem, 7vw, 4.2rem); }
.login-card .eyebrow { margin-bottom: 6px; }

.field { display: flex; flex-direction: column; gap: 7px; margin-top: 22px; }
.field label {
    font-size: .82rem; font-weight: 800;
    color: var(--muted); letter-spacing: .06em;
}
.field input {
    background: rgba(0,0,0,.35); border: 1px solid var(--line);
    border-radius: 14px; color: var(--text);
    font-size: 1rem; padding: 12px 16px; outline: none;
    transition: border-color .2s;
    font-family: inherit;
}
.field input:focus { border-color: var(--accent); }

.btn-login {
    width: 100%; margin-top: 24px;
    padding: 14px; border-radius: 999px;
    font-size: 1rem; font-weight: 900;
    cursor: pointer;
}
.back-link {
    display: block; margin-top: 18px;
    text-align: center; color: var(--muted);
    font-size: .85rem; text-decoration: none;
    transition: color .2s;
}
.back-link:hover { color: var(--text); }

/* ── Admin (admin.php) ────────────────────────────────────────────────────── */
.page-admin {
    min-height: 100vh; display: grid; place-items: start center; padding: 24px;
}
.admin-card {
    width: min(820px, 100%);
    border: 1px solid var(--line);
    background: linear-gradient(145deg, rgba(255,255,255,.10), rgba(255,255,255,.045));
    box-shadow: 0 24px 80px rgba(0,0,0,.36);
    backdrop-filter: blur(12px);
    border-radius: 32px;
    padding: clamp(22px,4vw,44px);
    margin: 0 auto;
}
.admin-topbar {
    display: flex; align-items: flex-start;
    justify-content: space-between; gap: 14px; margin-bottom: 28px;
}
.admin-topbar h1 { font-size: clamp(2.4rem, 6vw, 4rem); }
.admin-topbar-links { display: flex; gap: 8px; flex-shrink: 0; margin-top: 6px; }

.admin-mini-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 28px;
}
.mini-card {
    border: 1px solid var(--line); border-radius: 22px;
    padding: 18px 22px;
    background: rgba(255,255,255,.07);
}
.mini-card span { display: block; color: var(--muted); font-weight: 900; font-size: .9rem; }
.mini-card strong { font-size: clamp(2.4rem, 5vw, 3.6rem); line-height: 1; font-weight: 1000; }
.mini-171 strong { color: var(--cyan); }
.mini-180 strong { color: var(--gold); }

.section-label {
    text-transform: uppercase; letter-spacing: .2em;
    color: var(--muted); font-weight: 900; font-size: .8rem;
    margin-bottom: 12px;
}

.admin-actions {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 14px; margin-bottom: 24px;
}
.big-btn {
    border: 1px solid var(--line); border-radius: 30px;
    padding: clamp(22px,3vw,38px) 20px;
    color: var(--text);
    font-size: clamp(3.5rem,10vw,7rem);
    line-height: .8; font-weight: 1000;
    cursor: pointer;
    box-shadow: 0 16px 50px rgba(0,0,0,.22);
    transition: transform .1s, box-shadow .15s;
    position: relative; overflow: hidden;
}
.big-btn:active { transform: scale(.96); }
.big-btn span {
    display: block; font-size: clamp(.9rem,1.5vw,1.1rem);
    letter-spacing: .2em; margin-bottom: 14px;
}
.btn-171 { background: linear-gradient(145deg, rgba(56,189,248,.38), rgba(255,255,255,.08)); }
.btn-180 { background: linear-gradient(145deg, rgba(249,115,22,.42), rgba(255,255,255,.08)); }
.btn-171:hover { box-shadow: 0 20px 60px rgba(56,189,248,.2); }
.btn-180:hover { box-shadow: 0 20px 60px rgba(249,115,22,.2); }

.undo-row {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 10px; margin-bottom: 24px;
}
.undo-btn {
    border: 1px solid var(--line); border-radius: 16px;
    background: rgba(255,255,255,.06); color: var(--muted);
    font-family: inherit; font-size: .85rem; font-weight: 800;
    padding: 11px; cursor: pointer;
    transition: all .2s;
}
.undo-btn:not(:disabled):hover { background: rgba(255,255,255,.12); color: var(--text); }
.undo-btn:disabled { opacity: .35; cursor: not-allowed; }

.admin-hint {
    text-align: center; color: var(--muted);
    font-weight: 800; min-height: 1.4em;
    margin: 0 0 22px;
}
.hint-ok  { color: var(--good); }
.hint-err { color: var(--bad); }

.danger-zone {
    border: 1px solid rgba(239,68,68,.35); border-radius: 20px;
    padding: 18px 22px;
    background: rgba(239,68,68,.07);
    display: flex; align-items: center;
    justify-content: space-between; gap: 16px;
    margin-top: 8px;
}
.danger-text { font-size: .82rem; color: var(--muted); line-height: 1.5; }
.danger-text strong { display: block; color: var(--bad); font-weight: 900; margin-bottom: 3px; }

/* ── Confirm Dialog ───────────────────────────────────────────────────────── */
.confirm-dialog {
    border: 1px solid var(--line); border-radius: 24px;
    background: #1c1c1f; color: var(--text);
    padding: clamp(22px,3vw,36px);
    max-width: min(420px, 90vw);
    box-shadow: 0 32px 80px rgba(0,0,0,.6);
}
.confirm-dialog::backdrop { background: rgba(0,0,0,.7); backdrop-filter: blur(4px); }
.confirm-dialog h2 { margin: 0 0 10px; color: var(--bad); }
.confirm-dialog p  { color: var(--muted); font-size: .9rem; line-height: 1.6; margin: 0 0 22px; }
.dialog-btns { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Buttons (gemeinsam) ──────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 999px;
    padding: 11px 22px;
    font-family: inherit; font-size: .9rem; font-weight: 900;
    cursor: pointer; text-decoration: none; border: 0;
    transition: opacity .15s, transform .1s;
    color: #111827; background: var(--accent);
}
.btn:hover { opacity: .88; }
.btn:active { transform: scale(.97); }
.btn-sm { padding: 7px 16px; font-size: .78rem; }
.btn-ghost {
    background: transparent; color: var(--muted);
    border: 1px solid var(--line);
}
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,.08); }
.btn-danger {
    background: var(--bad); color: #fff;
    padding: 10px 20px; font-size: .85rem;
}
.btn-login { background: var(--accent); color: #111827; border: 0; }

/* ── Notices ──────────────────────────────────────────────────────────────── */
.notice {
    margin: 16px 0; padding: 14px 18px;
    border-radius: 18px; background: rgba(255,255,255,.08);
    border: 1px solid var(--line); font-size: .9rem;
}
.notice.error { background: rgba(239,68,68,.14); border-color: rgba(239,68,68,.35); }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .score-section { grid-template-columns: 1fr; }
    .section-title { min-height: 120px; }
    .tiles { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .dashboard-full { grid-template-rows: auto auto auto auto; }
}
@media (max-width: 720px) {
    .topbar { align-items: flex-start; flex-direction: column; }
    .tiles { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .admin-actions { grid-template-columns: 1fr; }
    .undo-row { grid-template-columns: 1fr; }
    .tile { min-height: 140px; }
}
@media (max-width: 460px) {
    .dashboard { padding: 10px; gap: 10px; }
    .tiles { grid-template-columns: 1fr; }
    .score-section { border-radius: 24px; }
    .tile { min-height: 116px; }
    .admin-mini-grid { grid-template-columns: 1fr; }
    .danger-zone { flex-direction: column; }
}
@media (orientation: landscape) and (max-height: 780px) {
    .dashboard { padding: 10px; gap: 10px; }
    .topbar { padding: 14px 18px; border-radius: 22px; }
    .score-section { padding: 10px; border-radius: 22px; grid-template-columns: 130px 1fr; }
    .section-title { border-radius: 18px; padding: 10px; }
    .section-title span { font-size: 4.2rem; }
    .section-title small { margin-top: 8px; }
    .tiles { gap: 10px; }
    .tile { min-height: 118px; border-radius: 18px; padding: 12px; }
    .tile strong { font-size: clamp(2.7rem,5.5vw,5rem); }
    h1 { font-size: 2.4rem; }
    .eyebrow { font-size: .68rem; }
}

/* ── User-Verwaltung (admin.php) ─────────────────────────────────────────── */
.user-list {
    display: flex; flex-direction: column; gap: 6px;
    margin-bottom: 12px;
}
.user-row {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,.06);
    border: 1px solid var(--line); border-radius: 14px;
    padding: 10px 16px;
}
.user-name {
    font-weight: 900; font-size: .95rem; flex: 1;
}
.user-since {
    font-size: .75rem; color: var(--muted);
}
.user-self-badge {
    font-size: .7rem; font-weight: 900;
    background: rgba(249,115,22,.25); color: var(--accent);
    border-radius: 999px; padding: 2px 10px;
}
.user-del-btn {
    background: none; border: 1px solid rgba(239,68,68,.4);
    border-radius: 8px; color: var(--bad);
    font-size: .8rem; font-weight: 900;
    padding: 3px 10px; cursor: pointer;
    transition: all .15s;
}
.user-del-btn:hover { background: rgba(239,68,68,.18); }

.user-add-form {
    display: flex; gap: 8px; flex-wrap: wrap;
    margin-bottom: 24px;
}
.user-add-form input {
    background: rgba(0,0,0,.35); border: 1px solid var(--line);
    border-radius: 12px; color: var(--text);
    font-size: .85rem; padding: 9px 14px; outline: none;
    font-family: inherit; flex: 1; min-width: 140px;
    transition: border-color .2s;
}
.user-add-form input:focus { border-color: var(--accent); }

/* ── Install-Seite ────────────────────────────────────────────────────────── */
.install-hint {
    color: var(--muted); font-size: .88rem;
    margin: 14px 0 4px; line-height: 1.5;
}
.notice-ok {
    margin: 16px 0; padding: 14px 18px;
    border-radius: 18px;
    background: rgba(34,197,94,.14);
    border: 1px solid rgba(34,197,94,.35);
    font-size: .9rem;
}

.hit-sub { display: none; }

/* ═══════════════════════════════════════════════════
   INDEX.PHP – Zwei-Boxen Layout
   ═══════════════════════════════════════════════════ */

.page-index {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.page-index .topbar {
    flex-shrink: 0;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
    padding: 12px 28px;
    background: rgba(9,9,11,.7);
}

/* Score-Grid: zwei Zeilen, füllt restliche Höhe */
.score-grid {
    flex: 1;
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
    padding: 2px;
    min-height: 0;
}

/* Jede Box */
.score-box {
    display: flex;
    align-items: stretch;
    justify-content: center;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: linear-gradient(135deg, rgba(255,255,255,.09), rgba(255,255,255,.04));
    backdrop-filter: blur(12px);
    overflow: hidden;
    position: relative;
    min-height: 0;
}

/* Glow-Akzent unten */
.score-box::before {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    border-radius: 0 0 20px 20px;
}
.score-171::before { background: var(--cyan); box-shadow: 0 0 30px rgba(56,189,248,.5); }
.score-180::before { background: var(--gold); box-shadow: 0 0 30px rgba(250,204,21,.5); }

/* Spalte 1: Typ-Label (171 / 180) */
.score-left {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 2vw, 36px);
    border-right: 1px solid var(--line);
    align-self: stretch;
    flex-shrink: 0;
    width: clamp(120px, 16vw, 260px);
}

.score-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: 100%;
}

.score-type-heading {
    font-size: clamp(1.4rem, 2.8vw, 4rem);
    font-weight: 1000;
    line-height: 1;
    letter-spacing: -.03em;
    margin-bottom: clamp(6px, 1vh, 16px);
    text-align: center;
}
.score-171 .score-type-heading { color: var(--cyan); }
.score-180 .score-type-heading { color: var(--gold); }

.score-divider {
    width: 100%;
    height: 1px;
    background: var(--line);
    margin-bottom: clamp(6px, 1vh, 16px);
}

/* Spalte 2: Grosse Zahl */
.score-left ~ * { }

.score-total {
    font-size: clamp(4rem, 10vw, 13rem);
    font-weight: 1000;
    line-height: .9;
    letter-spacing: -.06em;
    color: var(--text);
    text-align: center;
}

/* Spalte 2: Gross-Zahl Container */
.score-number-col {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 2vw, 36px);
    border-right: 1px solid var(--line);
    align-self: stretch;
    flex-shrink: 0;
    width: clamp(140px, 18vw, 300px);
}

/* Spalte 3: Stats */
.score-right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(12px, 2.5vw, 40px) clamp(16px, 3vw, 48px);
    gap: 0;
    align-self: stretch;
    flex-shrink: 0;
    width: clamp(200px, 24vw, 380px);
}

.stat-row-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(.75rem, 2vw, 2rem);
    padding: clamp(5px, 1vh, 12px) 0;
    white-space: nowrap;
}

.stat-divider {
    height: 1px;
    background: var(--line);
    opacity: .5;
}

.stat-lbl {
    font-size: clamp(.75rem, 1.2vw, 1.2rem);
    font-weight: 900;
    color: var(--muted);
    letter-spacing: .04em;
    flex-shrink: 0;
}
.stat-lbl em {
    font-style: normal;
    margin-left: 6px;
}
.score-171 .stat-lbl em { color: var(--cyan); }
.score-180 .stat-lbl em { color: var(--gold); }

.stat-num {
    font-size: clamp(1.4rem, 3vw, 4.5rem);
    font-weight: 1000;
    line-height: 1;
    letter-spacing: -.04em;
    color: var(--text);
    flex-shrink: 0;
}

.stat-num.pop { animation: pop .42s ease-out; }
.hit-sub { display: none; }

/* Mobile: übereinander */
@media (max-width: 600px) {
    .score-box {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    .score-left {
        border-right: none;
        border-bottom: 1px solid var(--line);
        padding: 10px 16px;
    }
    .score-number-col {
        border-right: none;
        border-bottom: 1px solid var(--line);
        padding: 8px 16px;
    }
    .score-right { padding: 10px 16px; }
    .score-total { font-size: clamp(3rem, 15vw, 6rem); }
}

/* TV Landscape – 2 Boxen nebeneinander bei sehr breiten Screens */
@media (min-aspect-ratio: 21/9) {
    .score-grid {
        grid-template-rows: none;
        grid-template-columns: 1fr 1fr;
    }
}
