/* Folkmásfélnap Kupa — mobile-first stíluslap */

:root {
    color-scheme: light;
    --pitch-900: #0b3a1f;
    --pitch-800: #14532d;
    --pitch-700: #166534;
    --pitch-600: #15803d;
    --pitch-200: #b9e4c6;
    --pitch-100: #dcf3e3;
    --pitch-50: #f0faf3;
    --gold: #b98b12;
    --gold-soft: #fdf6df;
    --ink: #13201a;
    --ink-2: #34443b;
    --muted: #66766d;
    --line: #e2e8e4;
    --bg: #f2f5f1;
    --card: #ffffff;
    --danger: #b42318;
    --g-a: #15803d;
    --g-b: #1d5fd1;
    --g-c: #c2500c;
    --g-d: #8130c4;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(15, 45, 25, .06), 0 6px 18px rgba(15, 45, 25, .05);
    --tabs-h: 62px;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
}

a { color: var(--pitch-700); }

h1, h2, h3 { line-height: 1.2; }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Fejléc ---------- */

.site-header {
    color: #fff;
    background:
        repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 36px, transparent 36px 72px),
        linear-gradient(180deg, var(--pitch-800), var(--pitch-900));
    padding-top: env(safe-area-inset-top);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 60px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    min-width: 0;
}

.brand img { flex: none; }
.brand strong { display: block; font-size: 17px; letter-spacing: .01em; white-space: nowrap; }
.brand small { display: block; font-size: 12px; opacity: .75; }

.year-picker select {
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    background: rgba(255,255,255,.14) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 11px center / 11px;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 999px;
    padding: 7px 30px 7px 14px;
    min-height: 38px;
    cursor: pointer;
}

.year-picker select option { color: var(--ink); }

/* ---------- Fő menü: mobilon alul, asztalin a fejléc alatt ---------- */

.tabs {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 20;
    background: rgba(255,255,255,.97);
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 18px rgba(15, 45, 25, .07);
    padding-bottom: env(safe-area-inset-bottom);
}

.tabs-inner { display: flex; padding: 0 4px; }

.tab {
    flex: 1 1 0;
    min-width: 0;
    height: var(--tabs-h);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.tab svg {
    width: 23px; height: 23px;
    fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

.tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.tab.active { color: var(--pitch-700); }
.tab.active::before {
    content: "";
    position: absolute;
    top: 0; left: 22%; right: 22%;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--pitch-600);
}

main.wrap { padding-top: 16px; padding-bottom: 12px; min-height: 60vh; }

.site-footer {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 13px;
    padding-top: 8px;
    padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 18px);
}

.site-footer a { color: var(--muted); }
.footer-links { display: flex; gap: 14px; }

@media (min-width: 768px) {
    .tabs {
        position: sticky;
        top: 0;
        bottom: auto;
        box-shadow: 0 1px 0 var(--line);
        border-top: 0;
        padding-bottom: 0;
    }
    .tabs-inner { gap: 4px; }
    .tab {
        flex: 0 0 auto;
        flex-direction: row;
        height: 52px;
        padding: 0 14px;
        gap: 8px;
        font-size: 15px;
    }
    .tab svg { width: 20px; height: 20px; }
    .tab.active::before { top: auto; bottom: 0; left: 10px; right: 10px; border-radius: 3px 3px 0 0; }
    main.wrap { padding-top: 24px; padding-bottom: 24px; }
    .site-footer { padding-bottom: 32px; }
}

/* ---------- Közös elemek ---------- */

.page-head { margin: 4px 0 14px; }
.page-head h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.01em; }
.page-head .sub { margin: 0; color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px; }

.jump {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--pitch-100);
    color: var(--pitch-800);
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
}

.notice, .archive-note {
    display: block;
    background: var(--pitch-50);
    border: 1px solid var(--pitch-200);
    border-radius: 12px;
    padding: 12px 14px;
    margin: 0 0 14px;
    color: var(--pitch-800);
    font-weight: 600;
    text-decoration: none;
}

.archive-note { background: var(--gold-soft); border-color: #eed99a; color: #6b5208; font-weight: 500; font-size: 14px; }
.archive-note a { color: inherit; font-weight: 700; }

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
    margin-bottom: 16px;
}

.card-title { display: flex; align-items: center; gap: 8px; font-size: 18px; margin: 0 0 10px; }
.card-sub { margin: -4px 0 10px; color: var(--muted); font-size: 13px; }

.chip {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 22px; height: 22px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    background: var(--g-a);
    font-style: normal;
}
.chip.small { width: 18px; height: 18px; font-size: 10px; border-radius: 5px; vertical-align: 1px; margin-left: 2px; }
.chip.g-B { background: var(--g-b); }
.chip.g-C { background: var(--g-c); }
.chip.g-D { background: var(--g-d); }

.badge {
    margin-left: auto;
    background: var(--pitch-600);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
}

.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.empty svg { width: 64px; height: 64px; fill: none; stroke: var(--pitch-200); stroke-width: 2.2; stroke-linejoin: round; }
.empty p { margin: 12px 0 0; font-size: 16px; }

/* ---------- Meccsek ---------- */

.slot {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    overflow: hidden;
    scroll-margin-top: 70px;
}

.slot-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f7f9f7;
    border-bottom: 1px solid var(--line);
}

.slot-head time { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.slot-no { color: var(--muted); font-size: 13px; }

.slot.is-next { box-shadow: 0 0 0 2px var(--pitch-600), var(--shadow); }
.slot.is-next .slot-head { background: var(--pitch-50); }

.match { padding: 10px 14px 12px; }
.match + .match { border-top: 1px solid var(--line); }

.match-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }

.match-line { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }

.team { font-weight: 500; line-height: 1.25; overflow-wrap: anywhere; }
.team.home { text-align: right; }
.team.won { font-weight: 800; }

.score {
    min-width: 66px;
    text-align: center;
    font-size: 19px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    background: var(--pitch-800);
    color: #fff;
    border-radius: 9px;
    padding: 4px 8px;
}
.score i { font-style: normal; opacity: .6; margin: 0 4px; }
.score.pending { background: #eef1ee; color: #9aa69f; font-weight: 700; }

/* ---------- Tabella ---------- */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -14px; }

table.standings {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.standings th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--muted);
    padding: 6px 4px;
    border-bottom: 1px solid var(--line);
    text-align: center;
    background: var(--card);
}
.standings abbr { text-decoration: none; }

.standings td {
    padding: 10px 4px;
    text-align: center;
    border-bottom: 1px solid var(--line);
    background: var(--card);
}
.standings tbody tr:last-child td { border-bottom: 0; }

.standings .pos { width: 34px; padding-left: 14px; color: var(--muted); font-weight: 700; text-align: left; }
.standings .team {
    text-align: left;
    min-width: 128px;
    position: sticky;
    left: 0;
    z-index: 1;
    font-weight: 600;
}
.standings .goals { white-space: nowrap; }
.standings .pts { font-weight: 800; padding-right: 14px; }
.standings sup { color: var(--muted); font-weight: 700; margin-left: 1px; }

.standings tr.q td { background: var(--pitch-50); }
.standings tr.q td.pos { box-shadow: inset 4px 0 0 var(--pitch-600); color: var(--pitch-700); }
.standings tr.q3 td { background: #f6fbf4; }
.standings tr.q3 td.pos { box-shadow: inset 4px 0 0 #8fd0a4; }

.footnote { margin: 10px 0 0; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 12px; }

.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; background: var(--pitch-100); border-left: 4px solid var(--pitch-600); }
.swatch.q3 { background: #eef8f0; border-left-color: #8fd0a4; }

/* ---------- Kieséses szakasz ---------- */

.round-title { font-size: 15px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 22px 0 10px; }
.round-title:first-of-type { margin-top: 6px; }

.ko-grid { display: grid; gap: 12px; }
@media (min-width: 600px) { .ko-grid { grid-template-columns: 1fr 1fr; } }

.ko-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.ko-card.is-final { box-shadow: 0 0 0 2px #e3c768, var(--shadow); }
.ko-card header { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 14px 8px; }

.ko-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 14px;
    border-top: 1px solid var(--line);
    font-weight: 600;
}
.ko-row .goals { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 1ch; }
.ko-row.win { background: var(--pitch-50); }
.ko-row.win .name { font-weight: 800; }
.ko-row.win .name::after { content: "✓"; color: var(--pitch-600); margin-left: 6px; }
.ko-row.lose { color: var(--muted); }
.ko-row.tbd .name { color: var(--muted); font-weight: 500; font-style: italic; }
.ko-card footer { font-size: 13px; color: var(--muted); padding: 8px 14px 11px; border-top: 1px dashed var(--line); }

.champion {
    text-align: center;
    background: linear-gradient(160deg, #fffaf0, #fbefc6);
    border: 1px solid #efd998;
    border-radius: var(--radius);
    padding: 22px 16px 16px;
    margin-bottom: 8px;
}
.champion svg { width: 48px; height: 48px; fill: #f6dc82; stroke: var(--gold); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.champion-label { margin: 8px 0 2px; color: #7a5d0c; font-size: 13px; font-weight: 600; }
.champion-name { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.podium { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; color: var(--ink-2); font-size: 14px; }
.podium span { font-weight: 800; color: #7a5d0c; }

/* ---------- Gólkirály ---------- */

.scorers { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.scorers li { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.scorers li:first-child { border-top: 0; }
.scorers .rank { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.scorers .who strong { display: block; font-weight: 700; }
.scorers .who small { color: var(--muted); font-size: 13px; }
.scorers .goals { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; }
.scorers .goals small { font-size: 11px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.scorers li.top { background: var(--gold-soft); }
.scorers li.top .rank { color: var(--gold); }

/* ---------- Szabályzat ---------- */

.prose { padding: 18px 18px 8px; overflow-wrap: anywhere; }
.prose h2 { font-size: 20px; margin: 18px 0 8px; }
.prose h3 { font-size: 17px; margin: 16px 0 6px; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote { margin: 0 0 12px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin-bottom: 4px; }
.prose blockquote { border-left: 4px solid var(--pitch-200); padding-left: 12px; color: var(--ink-2); }

/* =================================================================== */
/* Admin                                                                */
/* =================================================================== */

.admin .site-header { background: linear-gradient(180deg, #1d2a23, #121b16); }
.admin main.wrap { padding-bottom: 48px; }

.admin .header-inner { flex-wrap: wrap; gap: 2px 12px; padding-top: 8px; padding-bottom: 6px; }
.admin-nav { display: flex; gap: 4px; align-items: center; width: 100%; margin: 0 -10px; overflow-x: auto; scrollbar-width: none; }
@media (min-width: 768px) {
    .admin .header-inner { flex-wrap: nowrap; padding-top: 0; padding-bottom: 0; }
    .admin-nav { width: auto; margin: 0; }
}
.admin-nav a, .admin-nav button {
    color: #fff;
    background: transparent;
    border: 0;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    opacity: .85;
}
.admin-nav a.active, .admin-nav a:hover, .admin-nav button:hover { background: rgba(255,255,255,.12); opacity: 1; }
.admin-nav form { margin: 0; }

.subtabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 16px; padding: 2px 16px 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.subtabs::-webkit-scrollbar, .admin-nav::-webkit-scrollbar { display: none; }
.subtabs a {
    flex: none;
    padding: 8px 14px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}
.subtabs a.active { background: var(--pitch-700); border-color: var(--pitch-700); color: #fff; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: var(--pitch-700);
    color: #fff;
    font: inherit;
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn.secondary { background: #fff; color: var(--ink); border-color: #cfd8d2; }
.btn.danger { background: var(--danger); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.google-btn { background: #fff; color: #1f2937; border-color: #cfd8d2; min-height: 50px; font-size: 16px; }
.google-btn svg { width: 20px; height: 20px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-weight: 700; font-size: 14px; }
.field .hint, .hint { color: var(--muted); font-size: 13px; margin: 0; }
.row { display: grid; gap: 0 12px; grid-template-columns: 1fr 1fr; }
@media (min-width: 600px) { .row.four { grid-template-columns: repeat(4, 1fr); } }

input[type=text], input[type=number], input[type=date], input[type=time], select.input, textarea {
    font: inherit;
    font-size: 16px; /* iOS: 16 px alatt ráközelítene */
    width: 100%;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid #cbd5ce;
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--pitch-600); outline-offset: 0; border-color: transparent; }
textarea { min-height: 190px; line-height: 1.5; resize: vertical; }

.flash { padding: 11px 14px; border-radius: 10px; background: var(--pitch-50); border: 1px solid var(--pitch-200); color: var(--pitch-800); margin-bottom: 14px; font-weight: 600; }
.flash.error { background: #fef3f2; border-color: #fecdca; color: #912018; }
.flash.warn { background: var(--gold-soft); border-color: #eed99a; color: #6b5208; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .meta { color: var(--muted); font-size: 13px; }

.group-grid { display: grid; gap: 12px; }
@media (min-width: 600px) { .group-grid { grid-template-columns: 1fr 1fr; } }

/* Eredmények: csapatonként egy sor, mellette a gól */
.am { padding: 10px 14px 12px; }
.am + .am { border-top: 1px solid var(--line); }
.am-head { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 6px; min-height: 26px; }
.am-head .save-state { margin-left: auto; font-weight: 700; }
.am-line { display: grid; grid-template-columns: 1fr 56px; align-items: center; gap: 8px; margin-top: 6px; }
.am-line .name { font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.am-line .name.tbd { color: var(--muted); font-style: italic; font-weight: 500; }
.am.ko .am-line { grid-template-columns: 1fr 56px 56px; }
.am .pens { visibility: hidden; }
.am.is-draw .pens { visibility: visible; }
.am .pens-label { visibility: hidden; text-align: center; font-size: 11px; color: var(--muted); font-weight: 700; }
.am.is-draw .pens-label { visibility: visible; }

input.score-input {
    width: 56px;
    height: 46px;
    min-height: 46px;
    padding: 0;
    text-align: center;
    font-size: 20px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 30px; height: 30px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.save-state { font-size: 12px; }
.save-state.saving { color: var(--muted); }
.save-state.saved { color: var(--pitch-600); }
.save-state.error { color: var(--danger); }

.tie { border: 1px solid #eed99a; background: var(--gold-soft); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.tie h3 { margin: 0 0 4px; font-size: 15px; }
.tie .tie-row { display: grid; grid-template-columns: 1fr 86px; gap: 8px; align-items: center; margin-top: 8px; }
.tie .actions { display: flex; gap: 8px; margin-top: 12px; }

/* Gólkirály admin */
.sc { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.sc:first-child { border-top: 0; }
.sc .sc-fields { display: grid; gap: 6px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .sc .sc-fields { grid-template-columns: 1fr 1fr; } }
.sc .sc-goals { display: flex; align-items: center; gap: 6px; }
.sc .sc-goals input.score-input { width: 50px; }
.sc .sc-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; }
.step-btn { width: 44px; height: 44px; border-radius: 10px; border: 1px solid #cbd5ce; background: #fff; font-size: 22px; font-weight: 700; cursor: pointer; color: var(--ink); }
.link-danger { background: none; border: 0; color: var(--danger); font: inherit; font-size: 13px; cursor: pointer; padding: 4px 0; }

/* Quill szerkesztő */
.editor-wrap { background: #fff; border-radius: 10px; }
.editor-wrap .ql-toolbar { border-radius: 10px 10px 0 0; }
.editor-wrap .ql-container { border-radius: 0 0 10px 10px; font-family: inherit; font-size: 16px; min-height: 320px; }
.editor-wrap .ql-editor { min-height: 320px; }

.danger-zone { border: 1px solid #fecdca; background: #fffbfa; }
