:root {
    --bg: #0f1115;
    --panel: #1a1d24;
    --panel-2: #232732;
    --text: #e8eaed;
    --muted: #9aa0aa;
    --accent: #f5b301; /* Sunny Gang sunny yellow */
    --accent-2: #ffcf3f;
    --border: #2c3240;
    --radius: 12px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--panel);
    border-right: 1px solid var(--border);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand h1 {
    font-size: 20px;
    margin: 0;
}

.brand-ball {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, var(--accent-2), var(--accent));
    flex-shrink: 0;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav button {
    text-align: left;
    background: transparent;
    color: var(--text);
    border: none;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
}

.nav button:hover { background: var(--panel-2); }

.nav button.active {
    background: var(--accent);
    color: #1a1200;
    font-weight: 600;
}

/* ---- Content ---- */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.topbar h2 { margin: 0; font-size: 22px; }

.page {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ---- Cards ---- */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.card h2 { margin-top: 0; }

.muted { color: var(--muted); font-size: 14px; }

.badge {
    display: inline-block;
    background: var(--accent);
    color: #1a1200;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    margin-bottom: 8px;
}

/* ---- Medallions ---- */
.medallion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.medallion { text-align: center; cursor: pointer; transition: border-color .12s, transform .12s; }
.medallion:hover { border-color: var(--accent); transform: translateY(-2px); }

.avatar-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    margin: 0 auto 12px;
    background: var(--panel-2);
    border: 2px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
}
.avatar-lg { width: 88px; height: 88px; font-size: 36px; margin: 0; }

.medallion-roles { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; min-height: 4px; }
.badge-admin { background: var(--panel-2); color: var(--accent); border: 1px solid var(--accent); }
.medallion-avg { font-size: 26px; font-weight: 800; color: var(--accent); }
.medallion-sub { font-size: 12px; color: var(--muted); }

/* ---- Player detail ---- */
.back-button {
    background: transparent; color: var(--muted); border: none; cursor: pointer;
    font-size: 14px; padding: 4px 0; margin-bottom: 4px;
}
.back-button:hover { color: var(--text); }

.player-header { display: flex; align-items: center; gap: 20px; }
.player-header h2 { margin: 0 0 8px; }

.career-stats { display: flex; gap: 12px; flex-wrap: wrap; }

.season-list { display: flex; flex-direction: column; gap: 12px; }
.season-row { display: grid; grid-template-columns: 160px 1fr 160px; align-items: center; gap: 12px; }
.season-name { font-weight: 600; }
.season-bar-wrap { background: var(--bg); border-radius: 8px; overflow: hidden; }
.season-bar {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    color: #1a1200; font-weight: 700; font-size: 13px;
    padding: 6px 10px; border-radius: 8px; white-space: nowrap; min-width: 60px;
    box-sizing: border-box; text-align: right;
}
.season-detail { font-size: 13px; color: var(--muted); text-align: right; }

.tour-stats { text-align: right; flex-shrink: 0; white-space: nowrap; }
.tour-avg { font-size: 18px; font-weight: 800; color: var(--accent); }

@media (max-width: 720px) {
    .season-row { grid-template-columns: 1fr; }
    .season-detail { text-align: left; }
}

/* ---- Standing (pozice v lize) ---- */
.standing-card {
    display: flex;
    align-items: center;
    gap: 24px;
    background: linear-gradient(135deg, var(--panel-2), var(--panel));
    border-left: 4px solid var(--accent);
}

.standing-rank {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 92px;
    padding: 8px 16px;
    border-radius: var(--radius);
    background: radial-gradient(circle at 40% 30%, var(--accent-2), var(--accent));
    color: #1a1200;
}

.rank-number { font-size: 44px; font-weight: 800; line-height: 1; }
.rank-label { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

.standing-info { display: flex; flex-direction: column; gap: 12px; }
.standing-league { font-size: 20px; font-weight: 700; }
.standing-stats { display: flex; gap: 12px; }

.stat-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 18px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.stat-value { font-size: 24px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* ---- Next match ---- */
.next-match { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 16px; }
.next-date { font-weight: 700; color: var(--accent); }
.next-opponent { font-weight: 700; }

/* ---- Last matches ---- */
.match-list { display: flex; flex-direction: column; gap: 8px; }

.match-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.result-badge {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    color: #fff;
}
.result-win  { background: #2e9e5b; }
.result-loss { background: #c8453b; }
.result-draw { background: #c99a1e; color: #1a1200; }
.result-none { background: var(--panel-2); color: var(--muted); }

.match-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.match-opponent { font-weight: 600; }
.match-meta { font-size: 12px; color: var(--muted); }

.match-scores { text-align: right; flex-shrink: 0; }
.duel-score { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pinfall-score { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- Členská sekce ---- */
.login-card { max-width: 380px; }
.field {
    display: block; width: 100%; box-sizing: border-box; margin: 8px 0;
    padding: 10px 12px; background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px; font-size: 15px;
}
.field:focus { outline: none; border-color: var(--accent); }
.primary-btn {
    margin-top: 8px; padding: 10px 20px; border: none; border-radius: 8px;
    background: var(--accent); color: #1a1200; font-weight: 700; font-size: 15px; cursor: pointer;
}
.primary-btn:hover { background: var(--accent-2); }
.primary-btn:disabled { opacity: .6; cursor: default; }
.form-error { margin-top: 10px; color: #e8756b; font-size: 14px; }
.form-note { margin-top: 10px; color: var(--accent); font-size: 14px; }

.member-bar { display: flex; align-items: center; justify-content: space-between; }
.member-email { font-weight: 600; margin-right: 10px; }

.tab-bar { display: flex; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }

/* ---- Statistiky ---- */
.stat-filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.filter-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-label { font-size: 13px; color: var(--muted); min-width: 92px; }
.chip {
    padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border);
    background: var(--bg); color: var(--muted); font-size: 13px; cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip-on { background: var(--accent); color: #1a1200; border-color: var(--accent); font-weight: 600; }

.card h4 { margin: 18px 0 8px; font-size: 15px; }
.bar-chart { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 70px; align-items: center; gap: 10px; }
.bar-label { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--bg); border-radius: 8px; overflow: hidden; }
.bar-fill {
    background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #1a1200;
    font-weight: 700; font-size: 13px; padding: 6px 10px; border-radius: 8px;
    white-space: nowrap; text-align: right; box-sizing: border-box; min-width: 56px;
    font-variant-numeric: tabular-nums;
}
.bar-count { font-size: 13px; color: var(--muted); text-align: right; }

.time-chart { margin-bottom: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px; }
.time-chart svg { display: block; }
.time-chart-legend { display: flex; gap: 14px; margin-bottom: 6px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.game-list { display: flex; flex-direction: column; gap: 6px; }
.game-item { padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.game-item-head { display: flex; align-items: center; gap: 10px; }
.game-src-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.game-score { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.game-label { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-sheet-mismatch { font-size: 12px; color: #e8756b; white-space: nowrap; }

/* read-only zápis (strip) */
.sheet-strip { display: flex; gap: 3px; margin-top: 8px; overflow-x: auto; }
.strip-frame { flex: 0 0 36px; width: 36px; box-sizing: border-box; border: 1px solid var(--border); border-radius: 4px; background: var(--panel-2); }
.strip-frame:last-child { flex-basis: 50px; width: 50px; }
.strip-no { font-size: 9px; color: var(--muted); text-align: center; border-bottom: 1px solid var(--border); }
.strip-marks { display: flex; justify-content: flex-start; gap: 2px; min-height: 20px; align-items: center; padding: 1px 3px; }
.strip-cell { font-size: 13px; font-weight: 700; min-width: 12px; text-align: center; }
.strip-split-mark { color: #e8756b; border: 1.5px solid #e8756b; border-radius: 50%; width: 17px; height: 17px; min-width: 17px; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; }
.strip-cum { font-size: 12px; text-align: center; border-top: 1px solid var(--border); color: var(--muted); font-variant-numeric: tabular-nums; }

@media (max-width: 720px) {
    .bar-row { grid-template-columns: 110px 1fr 56px; }
    .filter-label { min-width: auto; }
}

/* ---- Ligové zápasy ---- */
.league-games { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.league-player { padding: 10px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.league-player-name { font-weight: 600; margin-bottom: 8px; }
.league-game-row { display: flex; gap: 10px; flex-wrap: wrap; }
.league-game { display: flex; align-items: center; gap: 6px; padding: 4px 8px; background: var(--panel-2); border-radius: 8px; }
.league-game-no { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.league-game-score { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.league-mismatch { font-size: 12px; color: #e8756b; }

.placement-input {
    width: 52px; padding: 6px 8px; background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: 6px; font-size: 15px; text-align: center;
}
.placement-input:focus { outline: none; border-color: var(--accent); }
.placement-chip {
    font-size: 13px; background: var(--panel-2); border: 1px solid var(--border);
    border-radius: 999px; padding: 2px 10px;
}

.training-meta { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.training-meta label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.training-meta .field { margin: 0; min-width: 180px; }

.score-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.score-table th, .score-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border); }
.score-table th { font-size: 12px; color: var(--muted); text-transform: uppercase; font-weight: 600; }
.score-input {
    width: 68px; padding: 6px 8px; background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: 6px; font-size: 15px; text-align: center;
}
.score-input:focus { outline: none; border-color: var(--accent); }

.game-head { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.game-head-label { font-size: 12px; }
.type-select {
    background: var(--bg); color: var(--text); border: 1px solid var(--border);
    border-radius: 6px; font-size: 11px; padding: 2px 4px; max-width: 100px; cursor: pointer;
}
.type-select:focus { outline: none; border-color: var(--accent); }

.icon-btn { padding: 6px 10px; line-height: 1; font-size: 15px; }
.small-btn-on { border-color: var(--accent); color: var(--accent); }

/* ---- Skóre buňka + zápis ---- */
.score-cell { display: flex; align-items: center; gap: 4px; }
.sheet-btn {
    background: transparent; border: 1px solid transparent; border-radius: 6px;
    cursor: pointer; font-size: 14px; padding: 2px 4px; line-height: 1; opacity: .6;
}
.sheet-btn:hover { opacity: 1; border-color: var(--border); }
.sheet-btn-on { opacity: 1; border-color: var(--accent); }

/* ---- Editor zápisu (overlay) ---- */
.sheet-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.6);
    display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100;
}
.sheet-panel {
    background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
    padding: 20px; max-width: 100%; max-height: 90vh; overflow: auto;
}
.sheet-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.sheet-panel-head h3 { margin: 0; }

.frames-row { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0; }
.frame-box {
    flex: 0 0 auto; border: 1px solid var(--border); border-radius: 8px; padding: 6px;
    display: flex; flex-direction: column; align-items: center; gap: 6px; background: var(--bg);
}
.frame-split { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.frame-no { font-size: 11px; color: var(--muted); font-weight: 700; }
.frame-throws { display: flex; gap: 4px; }
.frame-input {
    width: 34px; padding: 6px 2px; text-align: center; background: var(--panel-2);
    color: var(--text); border: 1px solid var(--border); border-radius: 6px; font-size: 15px;
}
.frame-input:focus { outline: none; border-color: var(--accent); }
.frame-input-disabled { background: transparent; border-style: dashed; color: var(--muted); cursor: not-allowed; }
.frame-input-hidden { visibility: hidden; }

.sheet-total { display: flex; align-items: baseline; gap: 10px; margin: 8px 0 16px; }
.sheet-total-value { font-size: 32px; font-weight: 800; color: var(--accent); }

.game-controls { display: flex; gap: 8px; }
.small-btn {
    padding: 6px 12px; background: var(--panel-2); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px; font-size: 13px; cursor: pointer;
}
.small-btn:hover { border-color: var(--accent); }
.small-btn:disabled { opacity: .5; cursor: default; }

.form-actions { display: flex; gap: 8px; align-items: center; }
.danger-btn:hover { border-color: #c8453b; color: #e8756b; }

.training-list { display: flex; flex-direction: column; gap: 10px; }
.training-item { padding: 10px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.training-item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.training-actions { display: flex; gap: 6px; flex-shrink: 0; }
.training-head { }
.training-date { font-weight: 700; }
.training-players { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.training-player { font-size: 13px; color: var(--text); }

/* ---- CMS: úvodní text + aktuality ---- */
.intro-text { white-space: pre-wrap; line-height: 1.55; }
.news-list { display: flex; flex-direction: column; gap: 12px; }
.news-item { padding: 12px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; border-left: 3px solid var(--accent); }
.news-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.news-title { font-weight: 700; font-size: 15px; }
.news-date { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.news-body { margin-top: 6px; white-space: pre-wrap; line-height: 1.5; color: var(--text); }

.cms-textarea { width: 100%; box-sizing: border-box; resize: vertical; font-family: inherit; font-size: 14px; line-height: 1.5; }
.cms-check { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); margin: 6px 0; }
.news-admin-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.news-admin-item { padding: 10px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.news-admin-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.news-form { padding: 12px; background: var(--bg); border: 1px dashed var(--border); border-radius: 10px; display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }

/* ---- Medailonek foto ---- */
.medallion-photo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent); }
.player-photo-lg { object-fit: cover; border: 2px solid var(--accent); border-radius: 50%; }
.medallion-nick { font-size: 13px; color: var(--muted); margin-top: -2px; }

/* ---- Admin: profily + účty ---- */
.profile-admin-list { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.profile-admin-item { display: flex; gap: 16px; padding: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; align-items: flex-start; }
.profile-admin-photo { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; width: 92px; }
.profile-thumb { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); font-size: 28px; }
.upload-btn { text-align: center; cursor: pointer; }
.profile-admin-fields { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.profile-admin-fields label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.profile-admin-flags { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.field-narrow { width: 64px; }

.member-admin-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.member-admin-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.member-admin-info { display: flex; flex-direction: column; }
.member-admin-name { font-weight: 700; }
.member-admin-controls { display: flex; align-items: center; gap: 8px; }

/* ---- Responsive ---- */
@media (max-width: 720px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; }
    .nav { flex-direction: row; flex-wrap: wrap; }
}
