/* Vôlei de Areia 2026 · MPRO
   Roxo institucional como identidade; areia (Quadra 1) e mar (Quadra 2) separam as quadras. */
:root {
  --bg: #f6f2fa;
  --surface: #ffffff;
  --fg: #231a30;
  --muted: #675c76;
  --border: #ded4ea;
  --accent: #6b3fa0;
  --accent-soft: #ece4f6;
  --on-accent: #ffffff;
  --q1: #9a4f06;
  --q1-bg: #fdecd6;
  --q2: #0b6f76;
  --q2-bg: #d9f1f2;
  --ok: #17663a;
  --ok-bg: #dcf3e4;
  --warn: #8a5a00;
  --warn-bg: #fff0c9;
  --err: #a12626;
  --err-bg: #fde3e3;
  --display: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16111d;
    --surface: #1f1829;
    --fg: #ece6f5;
    --muted: #a99dba;
    --border: #3a2d4d;
    --accent: #b891ec;
    --accent-soft: #2e2340;
    --on-accent: #1a1226;
    --q1: #f0a35a;
    --q1-bg: #3a2a17;
    --q2: #5cc9cf;
    --q2-bg: #12333a;
    --ok: #7fd9a2;
    --ok-bg: #12301f;
    --warn: #f2cd73;
    --warn-bg: #3a2e0e;
    --err: #f2a0a0;
    --err-bg: #3d1818;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 15px; line-height: 1.45; }
.wrap { max-width: 64rem; margin-inline: auto; padding-inline: 1rem; padding-block: 1.25rem 3rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }

header.top { display: flex; flex-direction: column; gap: .25rem; padding-block-end: 1rem; }
.eyebrow { font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(2.2rem, 7vw, 3.4rem); line-height: 1; text-transform: uppercase; color: var(--accent); text-wrap: balance; }
.venue, .muted { color: var(--muted); }
.venue { margin: .35rem 0 0; font-size: .88rem; }
.venue strong { color: var(--fg); font-weight: 600; }
.status { font-size: .8rem; color: var(--muted); margin: .25rem 0 0; }

/* abas */
.tabs { display: flex; gap: .25rem; overflow-x: auto; position: sticky; top: 0; z-index: 5; background: var(--bg); padding-block: .5rem; border-bottom: 1px solid var(--border); scrollbar-width: thin; }
.tabs button { flex: 0 0 auto; font: inherit; font-weight: 600; font-size: .9rem; color: var(--muted); background: transparent; border: 0; border-radius: .5rem; padding: .5rem .85rem; cursor: pointer; }
.tabs button:hover { background: var(--accent-soft); color: var(--fg); }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--on-accent); }

/* filtros */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .75rem; align-items: end; padding-block: 1rem; }
.filters label { display: flex; flex-direction: column; gap: .25rem; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; color: var(--muted); min-width: 0; }
select, input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="time"] {
  font: inherit; font-size: .92rem; color: var(--fg); background: var(--surface);
  border: 1px solid var(--border); border-radius: .5rem; padding: .5rem .6rem; width: 100%; min-width: 0; }
.filters select { letter-spacing: 0; text-transform: none; font-weight: 500; }
.count { margin: 0 0 .75rem; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* blocos de jogos */
#out { display: flex; flex-direction: column; gap: 1rem; padding-block-start: .75rem; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: 1rem; align-items: start; }
.cols > * { min-width: 0; }
.blk { background: var(--surface); border: 1px solid var(--border); border-radius: .75rem; overflow: hidden; }
.blk > header { padding: .75rem .9rem; background: var(--accent-soft); border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .75rem; }
.blk h2 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 1.4rem; line-height: 1.1; text-transform: uppercase; letter-spacing: .02em; text-wrap: balance; }
.blk header p { margin: 0; font-size: .84rem; color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; }
.g { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; padding: .7rem .9rem; border-top: 1px solid var(--border); }
.g:first-child { border-top: 0; }
.num { font-family: var(--display); font-weight: 700; font-size: 1.35rem; color: var(--accent); min-width: 2rem; font-variant-numeric: tabular-nums; }
.match { flex: 1 1 15rem; min-width: 0; font-weight: 600; display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .45rem; }
.vs { color: var(--muted); font-weight: 400; }
.score { font-weight: 700; font-variant-numeric: tabular-nums; background: var(--accent-soft); border-radius: .35rem; padding-inline: .45em; }
.t.ph { color: var(--muted); font-weight: 500; font-style: italic; }
.t.win { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.t.me { background: var(--accent-soft); border-radius: .25rem; padding-inline: .3em; }
.setline { flex-basis: 100%; padding-inline-start: 3rem; margin-block-start: -.2rem; font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.meta { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { font-size: .78rem; font-weight: 600; padding: .15rem .6rem; border-radius: 99px; background: var(--accent-soft); color: var(--fg); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip.c1 { background: var(--q1-bg); color: var(--q1); }
.chip.c2 { background: var(--q2-bg); color: var(--q2); }
.chip.final { background: var(--accent); color: var(--on-accent); }
.chip.st-andamento { background: var(--warn-bg); color: var(--warn); }
.chip.st-encerrado { background: var(--ok-bg); color: var(--ok); }
.empty { text-align: center; padding: 2.5rem 1rem; background: var(--surface); border: 1px dashed var(--border); border-radius: .75rem; color: var(--muted); }

/* classificação */
.scroll { overflow-x: auto; }
table.rank { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
table.rank th, table.rank td { padding: .55rem .6rem; text-align: right; border-top: 1px solid var(--border); white-space: nowrap; }
table.rank th { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-top: 0; }
table.rank th:nth-child(2), table.rank td:nth-child(2) { text-align: left; white-space: normal; min-width: 9rem; font-weight: 600; }
table.rank th:first-child, table.rank td:first-child { text-align: center; width: 2.5rem; }
table.rank tr.q td { background: var(--ok-bg); }
table.rank tr.q td:first-child { color: var(--ok); font-weight: 700; }
.tag { display: inline-block; margin-inline-start: .4rem; font-size: .7rem; font-weight: 600; color: var(--muted); background: var(--accent-soft); border-radius: .3rem; padding: .05rem .4rem; }
.note { margin: 0; padding: .75rem .9rem; font-size: .85rem; color: var(--muted); border-top: 1px solid var(--border); }
.alert { padding: .75rem .9rem; border-radius: .6rem; background: var(--warn-bg); color: var(--warn); font-weight: 600; }
footer.page { margin-top: 1.5rem; font-size: .82rem; color: var(--muted); }
footer.page p { margin: 0 0 .35rem; max-width: 65ch; }

/* login e administração */
.narrow { max-width: 26rem; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: .75rem; padding: 1rem; margin-block-end: 1rem; }
.panel h2 { margin: 0 0 .5rem; font-family: var(--display); font-size: 1.4rem; text-transform: uppercase; letter-spacing: .02em; }
.panel.warn { border-color: var(--warn); }
.form-grid { display: grid; gap: .75rem; }
.form-grid label { display: flex; flex-direction: column; gap: .25rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.btn { font: inherit; font-weight: 600; font-size: .9rem; color: var(--accent); background: transparent; border: 1px solid var(--border); border-radius: .5rem; padding: .5rem .9rem; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { background: var(--accent-soft); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.flash { padding: .6rem .9rem; border-radius: .6rem; margin: 0 0 .75rem; font-weight: 600; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.erro { background: var(--err-bg); color: var(--err); }
.flash.aviso { background: var(--warn-bg); color: var(--warn); }
.adm-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: flex-end; padding-block-end: 1rem; }
.adm-top h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); }
.adm-top p { margin: .25rem 0 0; }
.adm-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.adm-actions form { margin: 0; }
.jogo { border-top: 1px solid var(--border); padding-block: .85rem; scroll-margin-top: 1rem; }
.jogo:first-of-type { border-top: 0; }
.jogo > header { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem; margin-block-end: .5rem; }
.jogo .who { flex: 1 1 14rem; min-width: 0; }
.jogo .who small { display: block; color: var(--muted); }
.sets { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.sets fieldset { border: 1px solid var(--border); border-radius: .5rem; padding: .35rem .5rem .5rem; display: flex; align-items: center; gap: .35rem; margin: 0; }
.sets legend { font-size: .72rem; color: var(--muted); padding-inline: .25rem; }
.sets input[type="number"] { width: 3.6rem; text-align: center; padding: .4rem .25rem; }
details.agenda { margin-block-start: .5rem; }
details.agenda summary { cursor: pointer; font-size: .85rem; color: var(--muted); }
details.agenda form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; margin-block-start: .5rem; }
details.agenda label { display: flex; flex-direction: column; gap: .2rem; font-size: .72rem; color: var(--muted); font-weight: 600; }
details.agenda input, details.agenda select { width: auto; }
.draw { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-block-end: .75rem; }
.draw p { flex-basis: 100%; margin: 0; font-weight: 600; }
.draw label { display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; font-weight: 600; }
.draw input { width: 5rem; }
table.log { width: 100%; border-collapse: collapse; font-size: .82rem; }
table.log th, table.log td { text-align: left; padding: .35rem .5rem; border-top: 1px solid var(--border); vertical-align: top; }
table.log th { color: var(--muted); border-top: 0; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.crit { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .75rem; align-items: end; }
.crit label { display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; font-weight: 600; color: var(--muted); }

@media (max-width: 520px) {
  /* Na classificação, J (sempre 3) e D (3 menos V) saem para caber Pts, V, Sets e Pontos */
  table.rank th:nth-child(4), table.rank td:nth-child(4),
  table.rank th:nth-child(6), table.rank td:nth-child(6) { display: none; }
  table.rank th, table.rank td { padding-inline: .4rem; }
  table.rank th:nth-child(2), table.rank td:nth-child(2) { min-width: 7rem; }
}
@media (max-width: 480px) {
  .g { padding-inline: .75rem; }
  .num { min-width: 1.6rem; }
  .setline { padding-inline-start: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .tabs button { transition: background-color .15s; }
}
