/* Billiard club — shared dark theme. Mobile first, flat, no animation. */

:root {
  --bg: #16181d;
  --card: #1a1d23;
  --raised: #1d2027;
  --raised-hi: #2b3038;
  --line: #272b33;
  --line-soft: #23272e;
  --text: #e9ecf1;
  --muted: #8d96a3;
  --accent: #67d68b;
  --accent-soft: rgba(103, 214, 139, 0.14);
  --accent-line: rgba(103, 214, 139, 0.28);
  --down: #e08b7c;
  --warn: #e3b872;
  --warn-soft: rgba(227, 184, 114, 0.13);
  --radius: 12px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 56px;
  min-height: 100vh;
}

.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px; }

/* --- header --- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 24px 0 0; }
.eyebrow { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
h1 { font-size: 22px; font-weight: 500; margin-top: 5px; }
h2 { font-size: 16px; font-weight: 500; margin: 22px 0 10px; }
h3 { font-size: 13px; font-weight: 500; color: var(--muted); margin: 18px 0 8px;
     letter-spacing: 0.06em; text-transform: uppercase; }

.back { color: var(--muted); text-decoration: none; font-size: 13px; display: inline-block; padding: 22px 0 6px; }
.back:hover { color: var(--text); }

/* --- stats --- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0; }
.stat { background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 12px; }
.stat b { display: block; font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--muted); }
.stat.hi b { color: var(--accent); }

/* --- tabs --- */
.tabs { display: flex; gap: 6px; background: var(--raised); border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.tabs a { flex: 1; text-align: center; font-size: 13px; padding: 8px 0; border-radius: 999px;
          color: var(--muted); text-decoration: none; }
.tabs a.on { background: var(--raised-hi); color: var(--text); }

/* --- cards & rows --- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 12px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 2px 14px; }
.row { display: flex; align-items: center; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--line-soft);
       color: inherit; text-decoration: none; }
.row:last-child { border-bottom: none; }
.row:active { opacity: 0.7; }

.rank { width: 24px; height: 24px; flex: none; border-radius: 8px; background: #22262d; color: var(--muted);
        font-size: 12px; display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.row.top .rank { background: var(--accent-soft); color: var(--accent); }

/* --- avatar --- */
.avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; object-fit: cover;
          background: var(--raised-hi); color: var(--text); font-size: 12px; font-weight: 500;
          display: flex; align-items: center; justify-content: center; letter-spacing: 0.02em;
          border: 1px solid var(--line); overflow: hidden; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.who { flex: 1; min-width: 0; }
.name { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { font-size: 11px; color: var(--muted); }
.val { text-align: right; }
.rating { display: block; font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; }
.delta { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.up { color: var(--accent); }
.dn { color: var(--down); }

/* --- badges --- */
.badge { font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; padding: 3px 7px;
         border-radius: 6px; background: var(--raised-hi); color: var(--muted); }
.badge.win { background: var(--accent-soft); color: var(--accent); }
.badge.loss { background: rgba(224, 139, 124, 0.13); color: var(--down); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.live { background: var(--accent-soft); color: var(--accent); }

/* --- timeline --- */
.tl { border-left: 1px solid var(--line); margin-left: 8px; padding-left: 16px; }
.tl-item { position: relative; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.tl-item:last-child { border-bottom: none; }
.tl-item::before { content: ""; position: absolute; left: -21px; top: 20px; width: 9px; height: 9px;
                   border-radius: 50%; background: var(--raised-hi); border: 1px solid var(--line); }
.tl-item.win::before { background: var(--accent); border-color: var(--accent); }
.tl-item.loss::before { background: var(--down); border-color: var(--down); }
.tl-head { display: flex; align-items: center; gap: 9px; }
.tl-date { font-size: 11px; color: var(--muted); }
.tl-score { font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; margin-top: 6px; }
.tl-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* --- forms --- */
label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 5px; }
input, select, textarea, button {
  font: inherit; color: var(--text); background: var(--raised); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; width: 100%; -webkit-appearance: none; appearance: none;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-line); }
select { background-image: none; }
button { background: var(--raised-hi); border-color: var(--line); cursor: pointer; font-size: 14px; }
button:active { opacity: 0.75; }
button.primary { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
button.ghost { background: transparent; color: var(--muted); }
button.sm { width: auto; padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.field-row { display: flex; gap: 8px; align-items: flex-end; }
.field-row > * { flex: 1; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.check { display: flex; align-items: center; gap: 8px; background: var(--raised); border: 1px solid var(--line);
         border-radius: 10px; padding: 8px 10px; font-size: 13px; cursor: pointer; }
.check input { width: auto; }
.check.on { border-color: var(--accent-line); background: var(--accent-soft); }

/* --- misc --- */
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 28px 12px; }
.notice { border-radius: 10px; padding: 10px 12px; font-size: 13px; margin: 10px 0; }
.notice.err { background: rgba(224, 139, 124, 0.12); color: var(--down); }
.notice.ok { background: var(--accent-soft); color: var(--accent); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack > * + * { margin-top: 10px; }
footer { margin-top: 20px; font-size: 11px; color: var(--muted); text-align: center; }
hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

/* --- match cards --- */
.match { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.match.done { border-color: var(--line-soft); }
.side { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.side .who { flex: 1; }
.side .score { font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; min-width: 28px; text-align: right; }
.side.won .score { color: var(--accent); }
.side .start { font-size: 11px; color: var(--warn); }
.frame-btns { display: flex; gap: 6px; margin-top: 10px; }
.frame-btns button { font-size: 13px; }

/* --- bracket --- */
.bracket { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.bracket-col { min-width: 180px; flex: none; }
.bracket-col h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
                  font-weight: 500; margin-bottom: 8px; }
.bracket-match { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
                 padding: 8px 10px; margin-bottom: 8px; font-size: 13px; }
.bracket-match .bm-row { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.bracket-match .bm-row.won { color: var(--accent); }
.bracket-match .bm-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- photo upload --- */
.photo-picker { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.photo-picker .avatar { width: 56px; height: 56px; font-size: 18px; }
.photo-picker .actions { flex: 1; display: flex; gap: 8px; }
.photo-picker button { width: auto; flex: 0 0 auto; }
input[type="file"] { display: none; }
.hint { font-size: 11px; color: var(--muted); margin-top: 6px; }

/* ---------------------------------------------------------------------
   Wider screens. Mobile styles above are the baseline; everything here
   only scales the same layout up — nothing is hidden or rearranged.
   --------------------------------------------------------------------- */

@media (min-width: 720px) {
  body { font-size: 17px; padding-bottom: 72px; }
  .wrap { max-width: 760px; padding: 0 24px; }
  h1 { font-size: 28px; }
  .top { padding-top: 34px; }
  .stats { gap: 12px; }
  .stat { padding: 14px 16px; }
  .stat b { font-size: 22px; }
  .stat span { font-size: 12px; }
  .tabs a { font-size: 14px; padding: 10px 0; }
  .list { padding: 2px 20px; }
  .row { padding: 14px 0; gap: 14px; }
  .avatar { width: 40px; height: 40px; font-size: 14px; }
  .rank { width: 28px; height: 28px; font-size: 13px; }
  .name { font-size: 16px; }
  .meta { font-size: 12px; }
  .rating { font-size: 18px; }
  .delta { font-size: 12px; }
  .field-row { gap: 12px; }
  .checks { grid-template-columns: repeat(3, 1fr); }
  .bracket-col { min-width: 220px; }
}

@media (min-width: 1100px) {
  body { font-size: 18px; }
  .wrap { max-width: 1060px; }
  h1 { font-size: 34px; }
  .eyebrow { font-size: 12px; }
  h3 { font-size: 14px; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .stat { padding: 18px 20px; }
  .stat b { font-size: 28px; }
  .stat span { font-size: 13px; }
  .row { padding: 16px 0; }
  .avatar { width: 46px; height: 46px; font-size: 15px; }
  .rank { width: 32px; height: 32px; font-size: 14px; }
  .name { font-size: 18px; }
  .meta { font-size: 13px; }
  .rating { font-size: 21px; }
  .checks { grid-template-columns: repeat(4, 1fr); }

  /* Admin and tournament pages read better as two columns of panels. */
  .cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
}

/* Projection / TV: split the leaderboard so a full roster fits one screen. */
@media (min-width: 1280px) {
  .wrap { max-width: 1240px; }
  .list.split { column-count: 2; column-gap: 40px; padding: 6px 24px; }
  .list.split .row { break-inside: avoid; }
  h1 { font-size: 38px; }
  .name { font-size: 19px; }
  .rating { font-size: 22px; }
  .avatar { width: 48px; height: 48px; }
}
