@font-face {
  font-family: "Octo";
  src: url("/assets/tt-octosquares-condensed-extrabold.ttf") format("truetype");
  font-display: swap;
  font-weight: 800;
}

:root {
  --green: #123d2a;
  --green-dark: #0b2d1e;
  --gold: #c8922e;
  --gold-soft: #e7c97d;
  --wine: #8b2430;
  --paper: #f6f3ea;
  --card: #fffdf8;
  --ink: #172019;
  --muted: #536057;
  --line: #d8cfba;
  --success: #267a45;
  --warning: #9a5d00;
  --error: #b3262d;
  font-family: "Trebuchet MS", Aptos, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); font-size: 18px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 4px solid rgb(200 146 46 / 35%); outline-offset: 2px; }

.brand {
  color: white;
  border-bottom: 3px solid var(--gold);
  background:
    radial-gradient(circle at 82% -45%, rgb(231 201 125 / 34%), transparent 38%),
    linear-gradient(108deg, var(--green-dark), var(--green) 58%, #541820 140%);
}
.brand-inner { max-width: 1200px; min-height: 102px; margin: auto; padding: 20px 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand small { color: var(--gold-soft); font-size: 14px; font-weight: 800; letter-spacing: .16em; }
.brand h1 { margin: 5px 0 0; font: 700 32px/1.05 "Palatino Linotype", Georgia, serif; }
.brand-inner > span { padding: 10px 16px; border: 1px solid rgb(231 201 125 / 50%); border-radius: 999px; background: rgb(0 0 0 / 18%); font-size: 15px; font-weight: 800; }

.top-nav { position: sticky; top: 0; z-index: 20; display: flex; gap: 8px; padding: 12px max(24px, calc((100% - 1200px) / 2)); border-bottom: 1px solid var(--line); background: rgb(255 253 248 / 96%); box-shadow: 0 5px 18px rgb(28 35 30 / 8%); backdrop-filter: blur(12px); }
.top-nav button { min-height: 50px; padding: 0 20px; border: 0; border-radius: 10px; color: #34463b; background: transparent; font-weight: 800; }
.top-nav button:hover { background: #eee8dc; }
.top-nav button.active { color: white; background: var(--green); }
.bottom-nav { display: none; }
.public-mode [data-view="results"], .public-mode .control-only { display: none !important; }

main { max-width: 1200px; margin: auto; padding: 34px 28px 80px; outline: none; }
.loading { padding: 80px 20px; color: var(--muted); text-align: center; font-weight: 700; }
.page-head { margin-bottom: 24px; }
.page-head p, .section-title p, .match-title p { margin: 0 0 5px; color: var(--muted); font-size: 16px; font-weight: 800; }
.page-head h2, .section-title h2 { margin: 0; font: 700 clamp(30px, 5vw, 44px)/1.05 "Palatino Linotype", Georgia, serif; }
.page-head > span { display: block; max-width: 800px; margin-top: 10px; color: var(--muted); line-height: 1.5; }

.today-card { overflow: hidden; margin-bottom: 20px; border: 2px solid var(--gold); border-radius: 18px; background: var(--card); box-shadow: 0 8px 24px rgb(39 43 37 / 7%); }
.today-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; color: white; background: var(--green); }
.today-head h3 { margin: 0; font: 700 26px Georgia, serif; }
.today-head span { padding: 8px 13px; border-radius: 999px; background: rgb(255 255 255 / 10%); font-size: 15px; font-weight: 800; }
.today-list { display: grid; gap: 10px; padding: 18px 22px 22px; }
.today-list b { padding: 15px 16px; border: 1px solid var(--line); border-radius: 11px; background: #fff; font-size: 20px; }

.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 20px 0 34px; }
.public-mode .actions { grid-template-columns: repeat(2, 1fr); }
.action { min-height: 168px; padding: 22px; border: 2px solid var(--line); border-radius: 18px; color: var(--ink); background: var(--card); text-align: left; transition: transform .18s, border-color .18s; }
.action:hover { transform: translateY(-2px); border-color: var(--gold); }
.action > b { display: block; margin-bottom: 16px; color: #795719; font-size: 30px; }
.action strong { display: block; font-size: 22px; }
.action span { display: block; margin-top: 8px; color: var(--muted); font-size: 16px; line-height: 1.45; }
.action.primary { color: white; border-color: var(--gold); background: var(--green); }
.action.primary > b { color: var(--gold-soft); }
.action.primary span { color: rgb(255 255 255 / 78%); }

.section-title { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 28px 0 16px; }
.section-title h2 { font-size: 30px; }
.secondary-button { min-height: 50px; padding: 0 18px; border: 1px solid var(--line); border-radius: 10px; color: var(--green); background: var(--card); font-weight: 800; }
.group-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.group-card { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.group-card h3 { margin: 0 0 14px; font-size: 22px; }
.group-card ol { margin: 0; padding-left: 28px; }
.group-card li { min-height: 34px; padding-left: 4px; font-size: 16px; font-weight: 700; line-height: 1.4; }

.rule-strip { margin-bottom: 18px; padding: 14px 16px; border-left: 5px solid var(--gold); border-radius: 10px; color: #513b0d; background: #fff5d9; font-size: 16px; line-height: 1.5; }
.date-tabs, .art-tabs, .room-tabs { display: flex; gap: 10px; margin-bottom: 16px; }
.date-tabs button, .art-tabs button { flex: 1; min-height: 54px; padding: 0 15px; border: 1px solid var(--line); border-radius: 11px; color: #35473c; background: var(--card); font-size: 19px; font-weight: 800; }
.date-tabs button.active, .art-tabs button.active { color: white; border-color: var(--green); background: var(--green); }
.room-tabs { max-width: 520px; margin: 4px 0 24px; }
.room-tabs button { flex: 1; min-height: 58px; border: 2px solid var(--gold); border-radius: 12px; color: #5d4310; background: #fff9e9; font-size: 20px; font-weight: 900; }
.room-tabs button.active { color: white; border-color: var(--green); background: var(--green); }
.match-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 24px; }
.match-tabs button { min-height: 78px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--card); text-align: left; }
.match-tabs small, .match-tabs b { display: block; }
.match-tabs small { margin-bottom: 4px; color: var(--muted); }
.match-tabs button.active { color: white; border-color: var(--gold); background: var(--green); }
.match-tabs button.active small { color: var(--gold-soft); }
.match-title { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 10px 0 14px; }
.match-title h3 { margin: 0; font: 700 30px "Palatino Linotype", Georgia, serif; }
.progress { padding: 10px 14px; border-radius: 999px; color: #694500; background: #fff0c5; font-size: 15px; font-weight: 800; }
.progress.done { color: #1b6035; background: #e1f2e5; }
.warning { margin: 14px 0; padding: 14px 16px; border: 1px solid #d49b32; border-radius: 10px; color: #5e3c00; background: #fff2cc; font-weight: 800; }
.result-head { display: grid; grid-template-columns: minmax(190px, 1fr) 180px 130px 190px 90px; gap: 10px; padding: 0 16px 8px; color: var(--muted); font-size: 14px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.result-head span:not(:first-child) { text-align: center; }
.result-list { display: grid; gap: 9px; }
.score-row { display: grid; grid-template-columns: minmax(190px, 1fr) 180px 130px 190px 90px; gap: 10px; align-items: center; min-height: 78px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); }
.score-row.status-pending { border-left: 5px solid #b8ad97; }
.score-row.status-absent { border-left: 5px solid var(--wine); background: #f7eeed; }
.score-row.is-zeroed { border-left: 5px solid var(--error); background: #fff2f2; }
.score-team { display: flex; align-items: center; gap: 12px; min-width: 0; }
.score-team small { flex: 0 0 auto; padding: 5px 7px; border-radius: 6px; color: var(--green); background: #ece6d8; font-size: 13px; font-weight: 900; }
.score-team strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-row label > span, .auto-points > span { display: none; }
.score-row select { width: 100%; height: 56px; padding: 0 12px; border: 1px solid #c9bfa8; border-radius: 10px; color: var(--ink); background: #fff; text-align: center; font-size: 20px; font-weight: 800; }
.score-row select:disabled, .stepper button:disabled, .stepper input:disabled { cursor: not-allowed; opacity: .5; }
.stepper { display: grid; grid-template-columns: 54px 1fr 54px; overflow: hidden; border: 1px solid #c9bfa8; border-radius: 10px; background: #fff; }
.stepper button { height: 54px; border: 0; color: #6f4f13; background: #f4edde; font-size: 28px; font-weight: 800; }
.stepper input { min-width: 0; border: 0; text-align: center; font-size: 21px; font-weight: 800; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.auto-points { text-align: center; }
.auto-points b { font-size: 27px; color: var(--green); font-variant-numeric: tabular-nums; }
.sanction-panel { grid-column: 1 / -1; margin-top: 2px; border-top: 1px dashed #d7c8aa; padding-top: 9px; }
.sanction-panel summary { width: fit-content; color: #765313; font-size: 15px; font-weight: 900; cursor: pointer; }
.sanction-panel.has-sanction summary { color: var(--error); }
.sanction-fields { display: grid; grid-template-columns: minmax(300px, 1fr) 220px; gap: 12px 18px; align-items: end; margin-top: 12px; padding: 14px; border-radius: 11px; background: #f4ede0; }
.zero-check { display: flex; align-items: center; gap: 10px; min-height: 52px; font-weight: 800; }
.zero-check input { width: 24px; height: 24px; accent-color: var(--error); }
.deduction-field > span { display: block !important; margin-bottom: 6px; color: #654710 !important; font-size: 14px !important; font-weight: 900; }
.deduction-field input { width: 100%; height: 52px; border: 1px solid #bda977; border-radius: 9px; background: white; text-align: center; font-size: 20px; font-weight: 900; }
.sanction-fields > small { grid-column: 1 / -1; color: #725516; font-weight: 800; }
.save-bar { position: fixed; right: 0; bottom: 0; left: 0; z-index: 30; display: none; align-items: center; justify-content: space-between; gap: 18px; padding: 12px max(24px, calc((100% - 1200px) / 2)); border-top: 1px solid var(--gold); color: #553b00; background: #fff2c9; box-shadow: 0 -8px 28px rgb(50 39 15 / 15%); font-weight: 800; }
.save-bar.visible { display: flex; }
.save-bar button { min-height: 56px; padding: 0 28px; border: 0; border-radius: 11px; color: white; background: var(--green); font-size: 19px; font-weight: 900; }
.save-bar button:disabled { opacity: .65; }

.art-wrap { max-width: 760px; margin: auto; }
.art-sheet { position: relative; width: 100%; aspect-ratio: 3 / 4; overflow: hidden; container-type: inline-size; background-position: center; background-size: cover; box-shadow: 0 16px 42px rgb(25 30 27 / 24%); }
.art-table { position: absolute; top: 41.55%; left: 16.35%; width: 77.4%; height: 48.4%; overflow: hidden; color: white; background: transparent; }
.art-page-1 .art-table { top: 41.55%; height: 48.4%; }
.art-page-2 .art-table, .art-page-3 .art-table { top: 40.45%; height: 47.5%; }
.art-row { display: grid; grid-template-columns: 44% 14.5% 14.1% 13.9% 13.5%; align-items: center; height: 8.3333%; font-family: Octo, "Trebuchet MS", sans-serif; font-size: clamp(13px, 1.7vw, 19px); font-size: clamp(11px, 1.8cqw, 19px); line-height: 1; font-variant-numeric: tabular-nums; text-shadow: 0 2px 3px #000, 0 0 4px #000; }
.art-row > * { display: grid; height: 100%; place-items: center; min-width: 0; text-align: center; }
.art-row strong { overflow: hidden; padding: 0 3%; white-space: nowrap; text-overflow: ellipsis; font-size: clamp(13px, 1.85vw, 21px); font-size: clamp(11px, var(--name-size, 1.85cqw), 21px); letter-spacing: .01em; }
.art-row b { color: #ffe67a; font-size: 1.12em; }
.table-note { margin: 14px 0 0; color: var(--muted); text-align: center; font-size: 15px; font-weight: 800; }
.download-area { display: flex; align-items: center; justify-content: center; gap: 16px; max-width: 760px; margin: 18px auto 0; }
.download-area button { min-height: 56px; padding: 0 24px; border: 0; border-radius: 12px; color: white; background: var(--green); font-size: 18px; font-weight: 900; box-shadow: 0 7px 18px rgb(18 61 42 / 18%); }
.download-area button:disabled { opacity: .65; }
.download-area span { color: var(--muted); font-size: 14px; font-weight: 800; }

.calendar-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.calendar-card { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.calendar-card > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.calendar-card > div span { padding: 6px 10px; border-radius: 999px; color: white; background: var(--green); font-size: 14px; font-weight: 800; }
.calendar-card > div b { color: #775515; font-size: 15px; }
.calendar-card h3 { margin: 16px 0 12px; font: 700 31px "Palatino Linotype", Georgia, serif; }
.calendar-card p { margin: 8px 0 0; padding: 12px 14px; border-radius: 9px; background: #f2ede2; font-weight: 700; }

.team-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.team-editor article { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.team-editor h3 { margin: 0 0 14px; font-size: 24px; }
.team-editor label { display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: center; margin-top: 9px; color: var(--muted); font-weight: 800; }
.team-editor input { width: 100%; height: 54px; padding: 0 14px; border: 1px solid #c9bfa8; border-radius: 10px; color: var(--ink); background: white; font-weight: 700; }

#toast { position: fixed; right: 24px; bottom: 24px; z-index: 60; max-width: min(520px, calc(100% - 32px)); padding: 14px 18px; border: 1px solid #9ec7aa; border-radius: 12px; color: #164d2d; background: #ecf8ef; box-shadow: 0 10px 30px rgb(30 40 33 / 22%); font-weight: 800; opacity: 0; transform: translateY(18px); pointer-events: none; transition: .2s; }
#toast.show { opacity: 1; transform: translateY(0); }
#toast.error { color: #7b181e; border-color: #dea3a7; background: #fff0f1; }
.error-card { max-width: 600px; margin: 60px auto; padding: 28px; border: 1px solid #dea3a7; border-radius: 16px; background: #fff8f8; text-align: center; }
.error-card button { min-height: 52px; padding: 0 20px; border: 0; border-radius: 10px; color: white; background: var(--green); font-weight: 800; }

@media (max-width: 900px) {
  body { padding-bottom: 82px; font-size: 17px; }
  .brand-inner { min-height: 90px; padding: 17px 18px; }
  .brand h1 { font-size: 27px; }
  .brand small { font-size: 11px; }
  .brand-inner > span, .top-nav { display: none; }
  .bottom-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 50; display: grid; grid-template-columns: repeat(5, 1fr); padding: 5px 4px max(6px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgb(255 253 248 / 98%); box-shadow: 0 -8px 24px rgb(38 39 34 / 13%); }
  .public-mode .bottom-nav { grid-template-columns: repeat(3, 1fr); }
  .bottom-nav button { min-height: 62px; padding: 5px 2px; border: 0; border-radius: 9px; color: #46554b; background: transparent; font-size: 12px; font-weight: 800; }
  .bottom-nav button b, .bottom-nav button span { display: block; }
  .bottom-nav button b { margin-bottom: 3px; font-size: 20px; }
  .bottom-nav button.active { color: white; background: var(--green); }
  main { padding: 25px 16px 90px; }
  .actions, .public-mode .actions, .group-grid, .calendar-grid, .team-editor { grid-template-columns: 1fr; }
  .action { min-height: 140px; }
  .match-tabs { grid-template-columns: 1fr; }
  .match-tabs button { min-height: 68px; }
  .result-head { display: none; }
  .score-row { grid-template-columns: 1fr 1fr; gap: 13px; padding: 15px; }
  .score-team { grid-column: 1 / -1; min-height: 38px; }
  .status-field { grid-column: 1 / -1; }
  .score-row label > span, .auto-points > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; font-weight: 900; text-transform: uppercase; }
  .auto-points b { display: grid; height: 56px; place-items: center; border-radius: 10px; color: #765313; background: #f3ecdc; font-size: 25px; }
  .sanction-fields { grid-template-columns: 1fr; }
  .sanction-fields > small { grid-column: auto; }
  .save-bar { bottom: 76px; padding: 10px 14px; }
  .save-bar span { display: none; }
  .save-bar button { width: 100%; }
  #toast { right: 16px; bottom: 92px; }
}

@media (max-width: 540px) {
  .today-head, .section-title, .match-title { align-items: flex-start; flex-direction: column; }
  .today-head span { align-self: flex-start; }
  .today-list b { font-size: 17px; }
  .date-tabs button, .art-tabs button { min-height: 50px; padding: 0 6px; font-size: 16px; }
  .calendar-card > div { align-items: flex-start; flex-direction: column; }
  .art-wrap { margin-right: -8px; margin-left: -8px; }
  .download-area { align-items: stretch; flex-direction: column; text-align: center; }
}

@media print {
  .brand, .top-nav, .bottom-nav, .page-head, .art-tabs, .table-note, #toast { display: none !important; }
  body { padding: 0; background: white; }
  main { max-width: none; padding: 0; }
  .art-wrap { max-width: 1080px; }
  .art-sheet { box-shadow: none; }
}
