:root {
  --green: #1f6f43;
  --green-dark: #174f31;
  --green-soft: #e9f3ed;
  --ink: #1a1a1a;
  --muted: #5c5c5c;
  --line: #e3e3e3;
  --border: #cfcfcf;
  --red: #8a2c12;
  --warn: #a14a00;
  --warn-soft: #fff4e5;
  --bg: #f6f6f4;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.4;
}
a { color: var(--green); }
a:hover { color: var(--green-dark); }
h1, h2, h3 { margin: 0; }

.shell { max-width: 480px; min-height: 100vh; margin: 0 auto; background: #fff; display: flex; flex-direction: column; }
.page { padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.page-narrow { padding: 32px 24px; }

/* App bar */
.appbar { position: sticky; top: 0; z-index: 5; height: 56px; display: flex; align-items: center; gap: 8px; padding: 0 8px; border-bottom: 1px solid var(--line); background: #fff; }
.appbar-back { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--ink); }
.appbar-spacer { width: 12px; }
.appbar-title { font-size: 17px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar a.appbar-action, .appbar .appbar-action { font-size: 14px; font-weight: 600; padding: 12px; text-decoration: none; background: none; border: 0; color: var(--green); cursor: pointer; font-family: inherit; }

/* Buttons */
.btn { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 10px; font-weight: 600; font-size: 14px; text-decoration: none; border: none; font-family: inherit; cursor: pointer; width: 100%; text-align: center; }
.btn-lg { min-height: 50px; font-size: 15px; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); color: #fff; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #333; color: #fff; }
.btn-secondary { background: #fff; color: var(--ink); border: 1.5px solid var(--ink); }
.btn-secondary:hover { background: #f2f2f2; color: var(--ink); }
.btn-ghost { background: none; color: var(--green); width: auto; min-height: 36px; padding: 0 8px; }
.btn-danger-text { background: none; border: 0; color: var(--red); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 6px; }
.btn-small { min-height: 36px; width: auto; padding: 0 10px; border-radius: 8px; border: 1.5px solid #bdbdbd; background: #fff; font-size: 12px; font-weight: 600; color: var(--ink); font-family: inherit; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.btn-small.danger { color: var(--red); }
form.button_to { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grow { flex: 1; min-width: 0; }

/* Text */
.sect { margin: 0; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 600; }
.center { text-align: center; }
.brand { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.brand span { color: var(--green); }

/* Cards */
.card { border: 1.5px solid var(--border); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card-strong { border: 2px solid var(--ink); border-radius: 14px; }
.card-soft { background: var(--green-soft); border-color: transparent; color: var(--green-dark); }
.card-link { text-decoration: none; color: inherit; }
.card-link:hover { border-color: var(--ink); color: inherit; }
.big-number { font-size: 22px; font-weight: 700; }
.progress { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress > div { height: 8px; background: var(--green); }
.badge { font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 6px; background: #eee; color: #333; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.badge-green { background: var(--green-soft); color: var(--green-dark); }
.badge-dark { background: var(--ink); color: #fff; }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.linkbox { border: 1.5px dashed #9a9a9a; border-radius: 10px; padding: 10px 12px; font-size: 13px; color: #333; font-family: ui-monospace, monospace; word-break: break-all; }

/* Lists */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-num { width: 20px; font-size: 13px; color: var(--muted); text-align: right; flex-shrink: 0; }
.list-title { font-size: 14px; font-weight: 600; }
.list-sub { font-size: 12px; color: var(--muted); }

/* Avatar */
.av { border-radius: 50%; background: #e6e6e3; border: 1.5px solid #c4c4c0; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #555; object-fit: cover; }
.av-md { width: 36px; height: 36px; }
.av-lg { width: 72px; height: 72px; font-size: 22px; }
.av-sm { width: 28px; height: 28px; font-size: 10px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 13px; font-weight: 600; color: #333; }
.input, .field input[type=text], .field input[type=email], .field input[type=tel], .field input[type=password], .field input[type=number], .field input[type=datetime-local], .field input[type=date], .field select, .field textarea {
  width: 100%; min-height: 46px; border: 1.5px solid #bdbdbd; border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 15px; background: #fff; color: var(--ink);
}
.field textarea { min-height: 160px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--green); outline-offset: 1px; border-color: var(--green); }
.hint { font-size: 12px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span, a.chip-link { display: inline-flex; align-items: center; height: 40px; padding: 0 14px; border-radius: 20px; border: 1.5px solid #bdbdbd; background: #fff; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink); text-decoration: none; white-space: nowrap; }
.chip input:checked + span, a.chip-link.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }
.check-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.check-row input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--green); flex-shrink: 0; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper input { width: 80px !important; text-align: center; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Flash */
.alert { border-radius: 10px; padding: 12px 14px; font-size: 14px; margin: 12px 20px 0; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-notice { background: var(--green-soft); color: var(--green-dark); }
.alert-error { background: #fdecea; color: var(--red); margin: 0; }
.alert-alert { background: var(--warn-soft); color: var(--warn); }

/* Scoreboard */
.score { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; }
.score-num { font-size: 38px; font-weight: 700; letter-spacing: .02em; }
.score-team { font-size: 15px; font-weight: 700; }
.adj { width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid #9a9a9a; background: #fff; font: inherit; font-size: 18px; cursor: pointer; color: var(--ink); }
.player-btn { width: 100%; min-height: 46px; border-radius: 8px; border: 1.5px solid var(--border); background: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink); text-align: left; padding: 6px 10px; }
.player-btn:hover { border-color: var(--ink); }
.player-btn:active { background: var(--green-soft); }
.col-head { font-size: 12px; font-weight: 700; color: var(--muted); }

/* Team picker */
.team-pick { position: relative; }
.team-pick input { position: absolute; opacity: 0; }
.team-pick span { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 10px; border: 1.5px solid #bdbdbd; font-size: 14px; font-weight: 600; cursor: pointer; }
.team-pick input:checked + span { border: 2px solid var(--green); background: var(--green-soft); }

/* Table */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { font-size: 11px; color: var(--muted); font-weight: 700; text-align: center; padding: 6px 2px; border-bottom: 1.5px solid var(--ink); }
.table td { padding: 9px 2px; text-align: center; border-bottom: 1px solid var(--line); }
.table th:nth-child(2), .table td:nth-child(2) { text-align: left; }
.table td.pts { font-weight: 700; }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.podium > div { border: 1.5px solid var(--border); border-radius: 12px; padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }

.empty { border: 1.5px dashed var(--border); border-radius: 12px; padding: 20px; text-align: center; color: var(--muted); font-size: 14px; }
.footer-nav { margin-top: auto; padding: 20px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; font-size: 13px; }
.footer-nav a, .footer-nav button { color: var(--muted); background: none; border: 0; font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }

/* Resenha */
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.gallery-item { position: relative; aspect-ratio: 1; background: #ececea; border-radius: 6px; overflow: hidden; }
.gallery-item a, .gallery-item button.tile { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.gallery-item img, .gallery-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.gallery-play span { width: 38px; height: 38px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; padding-left: 3px; }
.gallery-remove { position: absolute; top: 4px; right: 4px; margin: 0; }
.gallery-remove button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 15px; line-height: 1; cursor: pointer; }
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.strip .gallery-item { border-radius: 8px; }

.lightbox { width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; margin: 0; padding: 0; border: 0; background: rgba(0,0,0,.94); color: #fff; }
.lightbox::backdrop { background: rgba(0,0,0,.94); }
.lightbox[open] { display: flex; flex-direction: column; }
.lightbox-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; font-size: 14px; }
.lightbox-bar a, .lightbox-bar button { color: #fff; background: none; border: 0; font: inherit; font-weight: 600; cursor: pointer; padding: 8px; text-decoration: none; }
.lightbox-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 8px; }
.lightbox-media { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox-nav { display: flex; justify-content: space-between; padding: 10px 12px 18px; }
.lightbox-nav button { width: 48px; height: 48px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.4); background: none; color: #fff; font-size: 20px; cursor: pointer; }
.gallery-item span.tile { display: block; width: 100%; height: 100%; }
