/* ============================================================
   Flip 7 Punkte-Tracker — styles.css
   Version 1 — 2026-09-05
   Look: verspieltes Kartenspiel (Flip-7-Box-Vibe)
   ============================================================ */

:root {
    --bg: #F7EFDD;
    --bg-deep: #F1E3C8;
    --card: #FFFDF7;
    --card-soft: #FFF6E6;
    --ink: #2A2118;
    --ink-soft: #7A6A58;
    --line: #2A2118;
    --red: #E63946;
    --red-deep: #B32833;
    --gold: #F4A92A;
    --gold-deep: #D98E12;
    --teal: #2A9D8F;
    --green: #43AA8B;
    --blue: #4D96FF;
    --purple: #845EC2;
    --radius: 20px;
    --radius-sm: 12px;
    --shadow: 0 5px 0 var(--line);
    --shadow-sm: 0 3px 0 var(--line);
    --font-head: 'Fredoka', 'Nunito', sans-serif;
    --font-body: 'Nunito', sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-body);
    background:
        radial-gradient(circle at 20% 10%, rgba(244, 169, 42, .16), transparent 40%),
        radial-gradient(circle at 85% 20%, rgba(230, 57, 70, .10), transparent 40%),
        radial-gradient(circle at 60% 90%, rgba(42, 157, 143, .12), transparent 45%),
        var(--bg);
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.45;
}

/* ---------- Deko-Hintergrundkarten ---------- */
.bg-deco { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.deco-card {
    position: absolute;
    width: 46px; height: 64px;
    background: var(--card);
    border: 3px solid var(--line);
    border-radius: 10px;
    box-shadow: 3px 4px 0 rgba(42, 33, 24, .5);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 800;
    opacity: .5;
}
.deco-card.c1 { top: 120px; left: 3%; transform: rotate(-14deg); color: var(--red); }
.deco-card.c2 { top: 240px; left: 92%; transform: rotate(10deg); color: var(--ink); }
.deco-card.c3 { top: 60%; left: 2%; transform: rotate(18deg); color: var(--red); }
.deco-card.c4 { top: 70%; left: 94%; transform: rotate(-8deg); color: var(--teal); }
.deco-card.c5 { top: 44%; left: 96%; transform: rotate(24deg); color: var(--gold); font-size: 24px; }

.wrap {
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 16px;
    position: relative;
    z-index: 1;
}

/* ---------- Topbar ---------- */
.topbar {
    background: var(--card);
    border-bottom: 4px solid var(--line);
    box-shadow: 0 3px 0 rgba(42, 33, 24, .15);
    position: sticky; top: 0; z-index: 20;
}
.topbar-in { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; gap: 10px; }

.brand {
    background: none; border: none; cursor: pointer;
    display: flex; align-items: center; gap: 12px;
    text-align: left;
}
.brand-fan { position: relative; width: 44px; height: 52px; flex: 0 0 auto; }
.fan-card {
    position: absolute; width: 34px; height: 48px;
    background: var(--card); border: 3px solid var(--line); border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 16px;
    box-shadow: var(--shadow-sm);
}
.fan-card.fc1 { left: 0; top: 0; transform: rotate(-16deg); color: var(--red); }
.fan-card.fc2 { left: 9px; top: 0; transform: rotate(4deg); color: var(--teal); background: #FFF; }
.fan-card.fc3 { left: 19px; top: 0; transform: rotate(18deg); color: #FFF; background: var(--red); }
.brand-title {
    font-family: var(--font-head); font-weight: 700; font-size: 26px; line-height: 1;
    display: block; letter-spacing: .5px;
}
.brand-sub { font-size: 12px; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 1.4px; display: block; margin-top: 3px; }

.top-actions { display: flex; gap: 8px; }

/* ---------- Buttons ---------- */
.btn {
    font-family: var(--font-body);
    font-weight: 800; font-size: 15px;
    border: 3px solid var(--line);
    border-radius: 999px;
    padding: 11px 20px;
    cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px;
    text-decoration: none; color: var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    transition: transform .08s ease, box-shadow .08s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm); }

.btn-primary { background: var(--red); color: #fff; box-shadow: 0 4px 0 var(--red-deep); }
.btn-primary:active { box-shadow: 0 1px 0 var(--red-deep); }
.btn-gold { background: var(--gold); box-shadow: 0 4px 0 var(--gold-deep); }
.btn-gold:active { box-shadow: 0 1px 0 var(--gold-deep); }
.btn-teal { background: var(--teal); color: #fff; box-shadow: 0 4px 0 #1F7267; }
.btn-teal:active { box-shadow: 0 1px 0 #1F7267; }
.btn-cream { background: var(--card-soft); }
.btn-danger-ghost { background: transparent; color: var(--red); box-shadow: none; border-color: transparent; }
.btn-danger-ghost:hover { background: rgba(230,57,70,.08); }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn-lg { padding: 14px 26px; font-size: 17px; }

/* ---------- Hauptbereich ---------- */
#app { padding: 26px 16px 60px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-title { font-family: var(--font-head); font-weight: 600; font-size: clamp(26px, 5vw, 38px); line-height: 1.1; }
.page-sub { color: var(--ink-soft); font-weight: 700; margin-top: 4px; font-size: 15px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Stats */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 26px; }
.stat-card {
    background: var(--card); border: 3px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 14px 16px;
    display: flex; align-items: center; gap: 12px;
}
.stat-ico {
    width: 44px; height: 44px; flex: 0 0 auto;
    border-radius: 14px; border: 3px solid var(--line);
    display: flex; align-items: center; justify-content: center;
    font-size: 19px; background: #fff;
}
.stat-card:nth-child(1) .stat-ico { background: #FFE3C2; }
.stat-card:nth-child(2) .stat-ico { background: #CDEBD8; }
.stat-card:nth-child(3) .stat-ico { background: #FFD9DE; }
.stat-num { font-family: var(--font-head); font-weight: 700; font-size: 22px; line-height: 1; }
.stat-lbl { font-size: 12px; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .6px; margin-top: 2px; }

/* Listen */
.section-title { font-family: var(--font-head); font-weight: 600; font-size: 21px; margin: 4px 0 12px; display: flex; align-items: center; gap: 10px; }

.session-list { display: flex; flex-direction: column; gap: 14px; }
.session-card {
    background: var(--card);
    border: 3px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    transition: transform .1s ease, box-shadow .1s ease;
}
.session-card:hover { transform: translateY(-2px) rotate(-.3deg); }
.session-card:active { transform: translateY(1px); }
.sess-main { min-width: 0; }
.sess-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.sess-title { font-family: var(--font-head); font-weight: 600; font-size: 20px; overflow-wrap: anywhere; }
.sess-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--ink-soft); font-weight: 700; font-size: 13.5px; }
.sess-meta i { margin-right: 4px; }

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .5px;
    padding: 4px 10px; border-radius: 999px; border: 2px solid var(--line);
}
.chip-open { background: #CDEBD8; color: #1F6E43; }
.chip-open .dot { width: 8px; height: 8px; border-radius: 50%; background: #2fa46b; animation: pulse 1.6s infinite; }
.chip-done { background: #E7E0D4; color: var(--ink-soft); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

.sess-side { text-align: right; flex: 0 0 auto; }
.sess-winner { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.win-name { font-family: var(--font-head); font-weight: 600; font-size: 18px; }
.win-pts { font-size: 13px; font-weight: 800; color: var(--gold-deep); }
.sess-arrow { font-size: 18px; color: var(--ink-soft); margin-left: 6px; }

/* Empty state */
.empty-state {
    background: var(--card); border: 3px dashed var(--line); border-radius: var(--radius);
    padding: 42px 20px; text-align: center;
}
.empty-ico { font-size: 44px; margin-bottom: 10px; }
.empty-title { font-family: var(--font-head); font-weight: 600; font-size: 20px; }
.empty-text { color: var(--ink-soft); font-weight: 600; margin: 6px 0 16px; }

/* ---------- Session-Detail ---------- */
.back-row { margin-bottom: 14px; }
.back-btn { font-weight: 800; background: none; border: none; cursor: pointer; color: var(--ink); display: inline-flex; align-items: center; gap: 8px; font-size: 15px; padding: 6px 10px; border-radius: 12px; }
.back-btn:hover { background: rgba(42,33,24,.07); }

.sess-hero {
    background: var(--card); border: 3px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px; margin-bottom: 20px;
    display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap;
}
.sess-hero-title { font-family: var(--font-head); font-weight: 600; font-size: clamp(22px, 4vw, 30px); }
.sess-hero-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--ink-soft); font-weight: 700; margin-top: 6px; font-size: 14px; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.podium { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.podium-card {
    background: var(--card); border: 3px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 16px 14px; text-align: center; position: relative;
}
.podium-card.rank-1 { border-color: var(--gold); box-shadow: 0 5px 0 var(--gold-deep); background: #FFF9EC; }
.podium-card.rank-2 { border-color: #A8A29E; }
.podium-card.rank-3 { border-color: #D98E12; }
.rank-badge {
    position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
    width: 30px; height: 30px; border-radius: 50%;
    border: 3px solid var(--line); background: var(--card);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 900;
}
.rank-1 .rank-badge { background: var(--gold); color: #fff; }
.rank-2 .rank-badge { background: #C9C5BF; color: #fff; }
.rank-3 .rank-badge { background: #E0A458; color: #fff; }
.p-avatar { font-size: 34px; line-height: 1.3; }
.p-name { font-family: var(--font-head); font-weight: 600; font-size: 17px; overflow-wrap: anywhere; }
.p-total { font-family: var(--font-head); font-weight: 700; font-size: 26px; margin-top: 2px; }
.p-total small { font-size: 13px; font-weight: 700; color: var(--ink-soft); }

/* Runden-Tabelle */
.rounds-panel {
    background: var(--card); border: 3px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 18px; overflow: hidden;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }

.rounds-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
table.rounds { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 560px; }
table.rounds th {
    font-size: 12px; text-transform: uppercase; letter-spacing: .6px; font-weight: 900;
    color: var(--ink-soft); text-align: center; padding: 8px 10px;
    border-bottom: 3px solid var(--line);
}
table.rounds th:first-child, table.rounds td:first-child { text-align: left; }
table.rounds td { padding: 10px; border-bottom: 2px dashed #E4D8C2; text-align: center; vertical-align: middle; }
table.rounds tbody tr:last-child td { border-bottom: none; }
table.rounds tbody tr:hover td { background: rgba(244,169,42,.07); }

.th-player { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.th-player .avatar-sm { font-size: 20px; line-height: 1.1; }
.th-player .th-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.round-no { font-weight: 900; font-family: var(--font-head); font-size: 16px; }
.round-time { display: block; font-size: 11px; font-weight: 700; color: var(--ink-soft); }

.pts-chip {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; height: 34px; padding: 0 10px;
    border-radius: 10px; border: 2.5px solid var(--line);
    font-family: var(--font-head); font-weight: 600; font-size: 16px;
    background: #fff;
}
.pts-chip.zero { background: #FFD9DE; color: var(--red); border-style: dashed; }
.pts-chip .fa-bolt { font-size: 12px; margin-right: 4px; color: var(--gold-deep); }

.total-cell { font-weight: 900; border-top: 3px solid var(--line) !important; }

/* ---------- Skeleton ---------- */
.skeleton-block { display: flex; flex-direction: column; gap: 14px; }
.sk { position: relative; overflow: hidden; background: rgba(255,255,255,.6); border-radius: var(--radius); }
.sk::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent);
    animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.sk-hero { height: 92px; }
.sk-row { height: 54px; }
.sk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.sk-card { height: 120px; }
.sk-list { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(42, 33, 24, .55);
    display: flex; align-items: center; justify-content: center;
    padding: 18px;
    backdrop-filter: blur(2px);
}
.modal-overlay[hidden] { display: none; }
.modal {
    background: var(--bg);
    border: 4px solid var(--line);
    border-radius: 24px;
    box-shadow: 8px 10px 0 rgba(42, 33, 24, .35);
    width: 100%; max-width: 560px;
    max-height: min(88vh, 760px);
    display: flex; flex-direction: column;
    animation: pop .16s ease;
}
@keyframes pop { from { transform: scale(.92) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 16px 20px 12px;
}
.modal-title { font-family: var(--font-head); font-weight: 600; font-size: 22px; }
.modal-close {
    width: 38px; height: 38px; border-radius: 50%;
    border: 3px solid var(--line); background: var(--card); cursor: pointer;
    font-size: 15px; font-weight: 900; color: var(--ink);
    flex: 0 0 auto;
}
.modal-close:hover { background: #FFD9DE; color: var(--red); }
.modal-body { padding: 6px 20px 20px; overflow-y: auto; }
.modal-foot { padding: 0 20px 20px; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.modal-foot-between { justify-content: space-between; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 900; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px; }
.input {
    width: 100%; padding: 12px 14px;
    border: 3px solid var(--line); border-radius: 14px;
    font-family: var(--font-body); font-weight: 700; font-size: 16px;
    background: var(--card); color: var(--ink);
    outline: none;
}
.input:focus { box-shadow: 0 0 0 3px rgba(244,169,42,.5); }

/* Avatar-Picker */
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 8px; margin-bottom: 14px; }
.avatar-opt {
    font-size: 26px; line-height: 1;
    padding: 9px 0; text-align: center;
    background: var(--card); border: 3px solid #D8CBB2; border-radius: 14px; cursor: pointer;
    transition: transform .08s ease;
}
.avatar-opt:hover { transform: scale(1.08); border-color: var(--line); }
.avatar-opt.sel { border-color: var(--line); box-shadow: 0 0 0 3px var(--gold); background: #FFF9EC; }

/* Player-Row (Verwaltung / Auswahl) */
.player-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.player-row {
    display: flex; align-items: center; gap: 12px;
    background: var(--card); border: 3px solid var(--line); border-radius: 14px;
    padding: 9px 12px;
}
.player-row .avatar { font-size: 26px; line-height: 1; }
.player-row .prow-name { font-weight: 800; font-size: 16px; flex: 1; overflow-wrap: anywhere; }
.player-row button { margin-left: auto; }

.pick-row { cursor: pointer; user-select: none; transition: transform .08s ease; }
.pick-row:hover { transform: translateX(2px); }
.pick-row .pick-box {
    width: 30px; height: 30px; flex: 0 0 auto;
    border: 3px solid var(--line); border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: #fff; font-size: 13px; color: transparent;
}
.pick-row.on .pick-box { background: var(--teal); color: #fff; }

/* Runde eintragen */
.round-form { display: flex; flex-direction: column; gap: 10px; }
.rf-row {
    display: flex; align-items: center; gap: 12px;
    background: var(--card); border: 3px solid var(--line); border-radius: 14px;
    padding: 8px 12px;
}
.rf-row .avatar { font-size: 24px; }
.rf-row .rf-name { font-weight: 800; flex: 1; overflow-wrap: anywhere; }
.rf-row .rf-input {
    width: 110px; text-align: center;
    padding: 8px 10px; border: 3px solid var(--line); border-radius: 12px;
    font-family: var(--font-head); font-weight: 600; font-size: 20px;
    background: #fff; color: var(--ink); outline: none;
}
.rf-input:focus { box-shadow: 0 0 0 3px rgba(244,169,42,.55); }
.rf-hint { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin-top: 6px; }

/* Toast */
.toast {
    position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
    background: var(--ink); color: #fff;
    padding: 12px 20px; border-radius: 999px;
    font-weight: 800; font-size: 15px;
    box-shadow: 0 6px 18px rgba(0,0,0,.25);
    z-index: 200; max-width: 92vw; text-align: center;
}
.toast[hidden] { display: none; }
.toast.err { background: var(--red); }
.toast.ok { background: #1F7267; }

/* Hinweis-Banner beendet */
.done-banner {
    display: flex; align-items: center; gap: 12px;
    background: #FFF3D6; border: 3px solid var(--gold); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 14px 18px; margin-bottom: 20px;
    font-weight: 800;
}
.done-banner .fa-crown { color: var(--gold-deep); font-size: 22px; }

/* ---------- Footer ---------- */
.foot {
    margin-top: auto; padding: 18px 16px 26px; text-align: center;
    color: var(--ink-soft); font-weight: 700; font-size: 13px;
    display: flex; justify-content: center; gap: 14px; flex-wrap: wrap;
}
.foot-ver { opacity: .7; }

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
    .stats-row { grid-template-columns: 1fr; gap: 10px; }
    .sk-grid { grid-template-columns: 1fr; }
    .session-card { flex-direction: column; align-items: flex-start; }
    .sess-side { text-align: left; width: 100%; }
    .sess-winner { align-items: flex-start; }
    .head-actions .btn { flex: 1; justify-content: center; }
    .hero-actions .btn { flex: 1 1 45%; justify-content: center; }
    .deco-card { display: none; }
}

/* ---------- Spieler-Akzentfarben (dynamisch, Klassen statt Inline) ---------- */
.acc-0 { --acc: #E63946; --acc-soft: #FFD9DE; }
.acc-1 { --acc: #2A9D8F; --acc-soft: #CDEBE3; }
.acc-2 { --acc: #D98E12; --acc-soft: #FFE3C2; }
.acc-3 { --acc: #845EC2; --acc-soft: #E4D9F5; }
.acc-4 { --acc: #4D96FF; --acc-soft: #D8E7FF; }
.acc-5 { --acc: #43AA8B; --acc-soft: #D3EFE2; }
.acc-6 { --acc: #E76F51; --acc-soft: #FFDAD2; }
.acc-7 { --acc: #3D5A80; --acc-soft: #D5DFF0; }

.pts-chip.acc-0 { color: #E63946; border-color: #E63946; background: #FFD9DE; }
.pts-chip.acc-1 { color: #1F7267; border-color: #2A9D8F; background: #CDEBE3; }
.pts-chip.acc-2 { color: #B4760B; border-color: #D98E12; background: #FFE3C2; }
.pts-chip.acc-3 { color: #5B3A8C; border-color: #845EC2; background: #E4D9F5; }
.pts-chip.acc-4 { color: #2F6FC9; border-color: #4D96FF; background: #D8E7FF; }
.pts-chip.acc-5 { color: #2E7D64; border-color: #43AA8B; background: #D3EFE2; }
.pts-chip.acc-6 { color: #C2502F; border-color: #E76F51; background: #FFDAD2; }
.pts-chip.acc-7 { color: #27415E; border-color: #3D5A80; background: #D5DFF0; }
.pts-chip.zero { background: #FFD9DE !important; color: var(--red) !important; border-color: var(--red) !important; border-style: dashed; }

.p-total { color: var(--ink); }
