/* ---------- shell ---------- */
.app-head { background: var(--deep); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.app-head-row { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--paper); text-decoration: none; font: 700 22px var(--font-display); flex-shrink: 0; }
.brand:hover { color: var(--paper); }
.brand-mark { width: 36px; height: 18px; }
.brand-mark circle { fill: var(--gold); }
.brand-mark path { stroke: var(--gold); stroke-width: 3; stroke-linecap: round; }
.app-nav { display: flex; gap: 4px; }
.app-nav a {
  display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 14px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-weight: 500;
}
.app-nav a:hover { color: var(--paper); background: var(--panel); }
.app-nav a[aria-current="page"] { color: var(--paper); background: var(--panel-2); }
.app-nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.app-head-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.app-main { padding: 40px 0 96px; outline: none; }
.app-main h1 { font-size: clamp(28px, 3.4vw, 40px); }
.btn.sm { min-height: 40px; padding: 0 16px; font-size: 14px; }
.btn.big { min-height: 56px; padding: 0 32px; font-size: 17px; }
.hint { color: var(--muted); font-size: 14px; margin-top: 12px; }
.notice { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-text); padding: 12px 16px; border-radius: var(--r-md); margin-bottom: 24px; }
.empty {
  border: 1px dashed var(--line); border-radius: var(--r-lg);
  padding: 40px 32px; display: flex; flex-direction: column; align-items: flex-start; gap: 20px;
}
.empty p { color: var(--text-2); max-width: 38em; }
.danger-text { color: var(--warn); }
.warn-text { color: var(--warn); font-weight: 600; }
.sub-h { font-size: 20px; margin: 32px 0 14px; }
.icon-btn {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--line);
  background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer;
}
.icon-btn:hover { color: var(--warn); border-color: var(--warn); }

/* ---------- home ---------- */
.home-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 28px; }
.t-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.t-row a {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 18px 4px; border-bottom: 1px solid var(--line);
  color: var(--paper); text-decoration: none;
}
.t-row a:hover { background: var(--panel); }
.t-row-main { display: flex; flex-direction: column; }
.t-row-main strong { font: 600 19px var(--font-display); }
.t-row-main span, .t-row-status { color: var(--muted); font-size: 15px; }
.join-box { margin-top: 48px; max-width: 460px; display: flex; flex-direction: column; gap: 8px; }
.join-box label { font-weight: 500; }
.join-row { display: flex; gap: 8px; }
.code-field { flex: 1; width: 0; text-transform: uppercase; letter-spacing: .12em; font-family: var(--font-display); }
.code-field::placeholder { letter-spacing: 0; text-transform: none; }

/* ---------- create ---------- */
.new-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 48px; align-items: start; }
.new-form { display: flex; flex-direction: column; gap: 28px; }
.q { display: flex; gap: 18px; }
.q-node {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  border: 3px solid var(--gold); color: var(--gold); font: 700 16px var(--font-display);
}
.q-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.q-body label, .q-label { font-weight: 500; margin-top: 4px; }
.q-body .field { width: 100%; }
.q-body .field.narrow { width: 140px; }
.area { padding: 12px 16px; min-height: 200px; resize: vertical; line-height: 1.6; }
select.field { appearance: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--deep); color: var(--paper);
  font: 500 15px var(--font-body); cursor: pointer;
}
.chip.on { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); font-weight: 600; }
.summary {
  position: sticky; top: 24px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 28px; display: flex; flex-direction: column; gap: 14px;
}
.summary-empty { color: var(--muted); }
.summary-cap { color: var(--muted); font-size: 14px; }
.summary-title { font: 700 24px/1.3 var(--font-display); }
.summary-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; }
.summary-stats div { background: var(--deep); border-radius: var(--r-md); padding: 12px 16px; }
.summary-stats dt { color: var(--muted); font-size: 13px; }
.summary-stats dd { margin: 0; font: 700 22px var(--font-display); }
.summary-line { color: var(--text-2); }
.summary-foot { color: var(--muted); font-size: 13px; }

/* ---------- tournament ---------- */
.t-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 20px; }
.t-game { color: var(--muted); font-size: 15px; }
.t-code { display: flex; flex-direction: column; align-items: flex-end; text-decoration: none; color: var(--paper); padding: 6px 10px; border-radius: var(--r-md); }
.t-code:hover { background: var(--panel); color: var(--paper); }
.t-code-link { color: var(--gold) !important; font-size: 13px; text-decoration: underline; }
.t-code span { color: var(--muted); font-size: 13px; }
.t-code strong { font: 700 30px var(--font-display); letter-spacing: .14em; color: var(--gold); }
.t-tools { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin: 28px 0 24px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { padding: 10px 16px; border-radius: var(--r-sm); color: var(--muted); text-decoration: none; font-weight: 500; }
.tab:hover { color: var(--paper); background: var(--panel); }
.tab.on { color: var(--paper); background: var(--panel-2); box-shadow: inset 0 -3px 0 var(--gold); }
.tool-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.round-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.round-head h2 { font-size: 26px; }
.timer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.timer-num { font: 700 32px var(--font-display); color: var(--sky); min-width: 3.4em; text-align: right; font-variant-numeric: tabular-nums; }
.timer-num.late { color: var(--warn); }

.matches { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.match {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 16px;
  padding: 12px 14px; border-radius: var(--r-md);
  background: var(--panel); border: 1px solid var(--line);
}
.match.done { background: transparent; }
.match.bye { grid-template-columns: 48px 1fr; color: var(--muted); }
.tbl {
  width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
  background: var(--deep); font: 700 18px var(--font-display);
}
.match:not(.done):not(.bye) .tbl { background: var(--gold); color: var(--gold-ink); }
.m-names { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
.m-names strong { font-weight: 600; }
.vs { color: var(--muted); font-size: 14px; }
.m-res { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.res {
  min-height: 40px; padding: 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--deep); color: var(--paper);
  font: 500 14px var(--font-body); cursor: pointer; max-width: 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.res:hover { border-color: var(--muted); }
.res.on { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); font-weight: 600; }
.round-actions { margin-top: 24px; }
.round-foot { color: var(--muted); }

.table-box { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); }
.standings { width: 100%; border-collapse: collapse; min-width: 480px; }
.standings th { text-align: left; font: 500 13px var(--font-body); color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--deep); }
.standings td { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.standings tr:last-child td { border-bottom: 0; }
.standings .num { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.standings a { color: var(--paper); text-decoration: none; font-weight: 600; }
.standings a:hover { color: var(--gold); text-decoration: underline; }
.standings tr.dropped td { color: var(--muted); }
.cut-row td { padding: 0 16px; border-bottom: 0; }
.cut-row span {
  display: flex; align-items: center; gap: 10px; color: var(--gold); font-size: 12px; font-weight: 600;
  transform: translateY(-50%);
}
.cut-row span::before, .cut-row span::after { content: ''; flex: 1; border-top: 2px dashed var(--gold); }
.tag-drop { font-size: 12px; font-weight: 600; color: var(--warn); border: 1px solid var(--warn); border-radius: 999px; padding: 1px 8px; margin-left: 6px; }

.add-player { display: flex; gap: 8px; max-width: 460px; margin-bottom: 16px; }
.add-player .field { flex: 1; width: 0; }
.p-list { list-style: none; margin: 16px 0 0; padding: 0; border-top: 1px solid var(--line); }
.p-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.p-name { flex: 1; min-width: 0; font-weight: 600; }
.p-row.dropped .p-name { color: var(--muted); }
.p-rec { font-family: var(--font-display); color: var(--muted); min-width: 4em; text-align: right; }

.bracket { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 24px; overflow-x: auto; padding-bottom: 8px; margin-top: 16px; }
.b-col { display: flex; flex-direction: column; justify-content: space-around; gap: 16px; }
.b-col h3 { font-size: 16px; color: var(--muted); font-weight: 600; }
.bm { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--panel); }
.bm.wait span { padding: 12px 14px; color: var(--placeholder); }
.bm.wait span + span { border-top: 1px solid var(--line); }
.bm-p {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px;
  background: transparent; border: 0; color: var(--paper); font: 600 15px var(--font-body); text-align: left; cursor: pointer;
}
.bm-p + .bm-p { border-top: 1px solid var(--line); }
.bm-p:hover { background: var(--panel-2); }
.bm-p.won { background: var(--gold); color: var(--gold-ink); }
.bm-p.lost { color: var(--placeholder); }
.seed { font: 600 12px var(--font-display); opacity: .8; min-width: 14px; }
.champ {
  border: 2px solid var(--gold); border-radius: var(--r-lg); padding: 28px 32px; margin-bottom: 20px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
}
.champ p { color: var(--muted); }
.champ strong { font: 700 clamp(36px, 5vw, 56px)/1.3 var(--font-display); color: var(--gold); overflow-wrap: anywhere; }

/* ---------- player view ---------- */
.pv-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 28px; }
.pv-pick { display: flex; flex-direction: column; gap: 6px; min-width: 240px; }
.pv-pick label { color: var(--muted); font-size: 14px; }
.pv-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.pv-main {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 28px; display: flex; flex-direction: column; gap: 24px;
  box-shadow: 0 30px 60px -24px var(--shadow);
}
.pv-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.pv-rec { font: 600 15px var(--font-display); color: var(--paper); padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--deep); }
.pv-big { display: flex; align-items: flex-end; gap: 18px; }
.pv-num { font: 700 clamp(96px, 11vw, 150px)/.78 var(--font-display); color: var(--gold); letter-spacing: -.04em; }
.pv-num.is-out { color: var(--loss); }
.pv-num:empty { display: none; }
.pv-label { display: flex; flex-direction: column; gap: 4px; padding-bottom: 6px; }
.pv-label strong { font: 700 24px/1.25 var(--font-display); }
.pv-label span { color: var(--muted); font-size: 15px; }
.pv-lives { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r-md); background: var(--deep); border: 1px solid var(--line); }
.pv-lives > div:last-child { display: flex; flex-direction: column; }
.pv-lives span { color: var(--muted); font-size: 14px; }
.pv-side { display: flex; flex-direction: column; gap: 12px; }
.pv-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.pv-card.next { gap: 16px; align-items: stretch; }
.next-row { display: flex; align-items: center; gap: 18px; }
.table-card {
  width: 76px; height: 96px; border-radius: 14px; background: var(--gold); color: var(--gold-ink);
  display: flex; flex-direction: column; justify-content: space-between; padding: 8px 12px; flex-shrink: 0;
}
.table-card span { font-size: 12px; font-weight: 600; }
.table-card strong { font: 700 40px/1 var(--font-display); align-self: flex-end; }
.pv-sub { color: var(--muted); font-size: 14px; }
.pv-opp { font: 700 26px/1.25 var(--font-display); }
.link-btn { align-self: flex-start; background: none; border: 0; color: var(--muted); text-decoration: underline; font: 500 15px var(--font-body); cursor: pointer; min-height: 44px; padding: 0 4px; }
.link-btn:hover { color: var(--warn); }
.back { margin-top: 32px; font-size: 15px; }

/* ---------- overlays ---------- */
#overlay { display: none; }
#overlay.open { display: block; position: fixed; inset: 0; z-index: 50; }
.scrim { position: absolute; inset: 0; background: var(--scrim); }
.sheet {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(560px, 100%); background: var(--panel); border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 28px; display: flex; flex-direction: column; gap: 14px;
}
.sheet h2 { font-size: 26px; }
.sheet > p { color: var(--text-2); }
.modes { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mode { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 2px solid var(--line); border-radius: var(--r-md); cursor: pointer; background: var(--deep); }
.mode:has(input:checked) { border-color: var(--warn); }
.mode input { margin-top: 6px; accent-color: var(--warn); }
.mode > span { display: flex; flex-direction: column; }
.mode > span span { color: var(--muted); font-size: 14px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }

.projector { position: absolute; inset: 0; background: var(--ink); padding: 40px 48px; overflow: auto; }
.pj-head { display: flex; align-items: center; gap: 24px; margin-bottom: 32px; }
.pj-head h2 { font-size: clamp(28px, 3vw, 44px); flex: 1; }
.pj-timer { font-size: clamp(40px, 5vw, 72px); }
.pj-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 10px 32px; }
.pj-list li { display: grid; grid-template-columns: 64px 1fr 1fr; gap: 16px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: clamp(18px, 1.6vw, 26px); font-weight: 600; }
.pj-t { font: 700 1.3em var(--font-display); color: var(--gold); }
.pj-vs { color: var(--text-2); }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%);
  background: var(--paper); color: var(--ink); padding: 12px 20px; border-radius: 18px;
  font-weight: 600; z-index: 60; transition: transform .2s ease, opacity .2s ease, visibility .2s; max-width: calc(100% - 32px); text-align: center;
  opacity: 0; visibility: hidden;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .new-grid, .pv-grid { grid-template-columns: minmax(0, 1fr); }
  .summary { position: static; }
  .match { grid-template-columns: 44px minmax(0, 1fr); }
  .m-res { grid-column: 1 / -1; justify-content: stretch; }
  .res { flex: 1 1 0; max-width: none; }
  .tbl { width: 44px; height: 44px; }
}
@media (max-width: 560px) {
  .app-main { padding-top: 28px; }
  .pv-main { padding: 20px; }
  .path-node { width: 30px; height: 30px; font-size: 12px; }
  .path-node.goal { width: 40px; height: 40px; }
  .path-link { margin-top: 13px; min-width: 4px; }
  .path-step:last-child .path-link { margin-top: 18px; }
  .path-label { font-size: 11px; }
  .t-code { align-items: flex-start; }
  .projector { padding: 24px; }
  .pj-list { grid-template-columns: 1fr; }
}

/* ---------- home ---------- */
.home-sec { margin-top: 40px; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.sec-head h2 { font-size: 22px; }
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.live-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px;
  display: flex; flex-direction: column; gap: 14px; box-shadow: 0 24px 48px -28px var(--shadow);
}
.live-card h3 { font-size: 20px; }
.live-status { display: flex; align-items: center; gap: 8px; color: var(--sky); font-size: 14px; font-weight: 600; }
.dot, .live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sky); display: inline-block; animation: pulse 1.6s ease-in-out infinite; }
.live-dot { margin-right: 8px; vertical-align: middle; }
@keyframes pulse { 50% { opacity: .35; } }
.live-big { display: flex; align-items: flex-end; gap: 14px; }
.live-num { font: 700 76px/.8 var(--font-display); color: var(--gold); letter-spacing: -.04em; }
.live-num.is-out { color: var(--loss); }
.live-num:empty { display: none; }
.live-label { display: flex; flex-direction: column; }
.live-label strong { font: 700 19px/1.3 var(--font-display); }
.live-label span { color: var(--muted); font-size: 14px; }
.live-card .btn { align-self: flex-start; }
.home-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; margin-top: 40px; }
.link-card {
  display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: transparent; color: var(--paper); text-decoration: none; text-align: left;
  font: inherit; cursor: pointer;
}
.link-card:hover { background: var(--panel); color: var(--paper); border-color: var(--muted); }
.link-card strong { font: 600 17px var(--font-display); }
.link-card span { color: var(--muted); font-size: 14px; }

/* ---------- share ---------- */
.share-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.share-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 32px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
}
.qr-box { margin: 22px 0 14px; width: min(260px, 70vw); }
.qr { width: 100%; height: auto; display: block; border-radius: 14px; }
.qr-fallback { padding: 24px; border: 1px dashed var(--line); border-radius: var(--r-md); color: var(--muted); font-size: 14px; }
.code-label { color: var(--muted); font-size: 14px; }
.code-big { font: 700 clamp(40px, 6vw, 60px)/1.1 var(--font-display); letter-spacing: .16em; color: var(--gold); }
.share-hint { color: var(--text-2); max-width: 26em; margin-top: 8px; }
.share-side { display: flex; flex-direction: column; gap: 16px; }
.count-card { background: var(--deep); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.count-card span { color: var(--muted); font-size: 14px; }
.count-card strong { font: 700 28px var(--font-display); }
.share-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.share-actions .btn { padding: 0 14px; font-size: 15px; }

/* ---------- join ---------- */
.join-page { display: flex; justify-content: center; }
.join-card { width: min(520px, 100%); display: flex; flex-direction: column; gap: 6px; }
.lede-sm { color: var(--text-2); margin-bottom: 18px; }
.join-form { display: flex; flex-direction: column; gap: 8px; }
.join-form label { font-weight: 500; margin-top: 8px; }
.join-form .field { width: 100%; flex: none; }
.join-form .btn { margin-top: 16px; }
.join-preview { min-height: 1.5em; font-size: 14px; color: var(--muted); }
.join-preview.ok { color: var(--sky); }
.join-preview.bad { color: var(--warn); }
.divider { display: flex; align-items: center; gap: 12px; margin: 32px 0 14px; color: var(--muted); font-size: 14px; text-align: center; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.social { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.social-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 12px;
  border-radius: var(--r-md); border: 1px solid var(--line); background: var(--deep); color: var(--paper);
  font: 600 15px var(--font-body); cursor: pointer;
}
.social-btn:hover { border-color: var(--muted); }
.social-btn.wide { grid-column: 1 / -1; background: #06c755; border-color: #06c755; color: #fff; }
.social-btn img { width: 22px; height: 22px; object-fit: contain; border-radius: 5px; }
.join-foot { margin-top: 28px; color: var(--muted); }

/* ---------- create: extra fields ---------- */
.q-body .field.narrow-2 { width: min(280px, 100%); }

/* ---------- organizer additions ---------- */
.round-sub { color: var(--muted); font-size: 15px; }
.match.pending .tbl { background: var(--sky); color: var(--ink); }
.match.dispute { border-color: var(--warn); }
.match.dispute .tbl { background: var(--warn); color: var(--warn-ink); }
.m-note {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-sm); background: var(--deep); color: var(--text-2); font-size: 14px;
}
.m-note.warn { background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-line); }
.round-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.p-head { margin-bottom: 14px; }
.p-head h2 { font-size: 22px; }
.add-player { max-width: 640px; flex-wrap: wrap; }
.add-player .field { flex: 1 1 180px; width: auto; }
.s-deck { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.standings tr.me td { background: var(--now-bg); }
.s-name { font-weight: 600; }
.settings { display: flex; flex-direction: column; gap: 8px; max-width: 560px; }
.settings label { font-weight: 500; margin-top: 8px; }
.settings .btn { align-self: flex-start; margin-top: 16px; }
.set-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }
.set-row > div { display: flex; flex-direction: column; gap: 8px; }
.set-row .field { width: 100%; }
.set-block { max-width: 560px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.set-block h3 { font-size: 18px; }
.set-block p { color: var(--muted); font-size: 15px; }
.set-block.danger h3 { color: var(--warn); }
.bm-p.me { box-shadow: inset 4px 0 0 var(--sky); }
.pj-round { color: var(--muted); font-size: clamp(16px, 1.4vw, 22px); }

/* ---------- player additions ---------- */
.pv-timer { color: var(--muted); font-size: 14px; display: flex; align-items: baseline; gap: 8px; }
.timer-num.sm { font-size: 20px; min-width: 0; text-align: left; }
.report-btns { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; }
.report-btns .btn { padding: 0 14px; }
.pv-wait { background: var(--deep); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; color: var(--text-2); }
.pv-card .m-note { grid-column: auto; }
.pv-timer-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.judge-btn { border-color: var(--warn-line); color: var(--warn-text); }
.judge-note { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-line); border-radius: var(--r-md); padding: 10px 14px; }
.judge-note.ack { background: var(--deep); color: var(--text); border-color: var(--line); }
.judge-box { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 14px; }
.judge-box h3 { margin: 0 0 8px; font-size: 16px; color: var(--warn-text); }
.judge-box ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.judge-box li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.judge-box .j-name { flex: 1; min-width: 160px; display: flex; flex-direction: column; color: var(--text); }
.judge-box .j-ago, .judge-box .j-acked { font-size: 13px; color: var(--muted); }
.tag-judge { font-size: 12px; font-weight: 600; color: var(--warn-text); background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 999px; padding: 1px 8px; margin-left: 6px; white-space: nowrap; }
.pairs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pair-row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--line);
}
.pair-row .tbl { width: 44px; height: 44px; }
.pair-row.me { border-color: var(--gold); background: var(--panel); }
.pair-row.me .tbl { background: var(--gold); color: var(--gold-ink); }
.pill { font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.open { color: var(--sky); border-color: var(--sky); }
.pill.pending { color: var(--sky); border-style: dashed; border-color: var(--sky); }
.pill.dispute { color: var(--warn); border-color: var(--warn); }
.pair-row.me .pill { color: var(--gold); border-color: var(--gold); }

/* ---------- profile ---------- */
.me-head { display: flex; align-items: center; gap: 20px; margin-bottom: 8px; }
.avatar {
  width: 72px; height: 72px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold); color: var(--gold-ink); font: 700 32px var(--font-display);
}
.me-id { flex: 1; min-width: 0; }
.name-form { display: flex; gap: 8px; align-items: center; max-width: 460px; }
.name-field { flex: 1; width: 0; font: 700 22px var(--font-display); background: transparent; border-color: transparent; padding: 0 8px; margin-left: -8px; }
.name-field:hover, .name-field:focus { border-color: var(--line); background: var(--deep); }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tiles.two { grid-template-columns: 1fr 1fr; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; display: flex; flex-direction: column; }
.tile span { color: var(--muted); font-size: 14px; }
.tile strong { font: 700 34px/1.2 var(--font-display); }
.tile em { font-style: normal; color: var(--muted); font-size: 14px; font-family: var(--font-display); }
.badges { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 10px; }
.badge { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: var(--r-md); color: var(--muted); }
.badge > span:last-child { display: flex; flex-direction: column; }
.badge strong { font-size: 15px; }
.badge > span:last-child > span { font-size: 13px; }
.badge-ic { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); font-size: 18px; }
.badge.got { border-style: solid; border-color: var(--gold); color: var(--paper); }
.badge.got .badge-ic { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; max-width: 720px; }
.bars li { display: grid; grid-template-columns: minmax(0, 1fr) 48px; gap: 6px 12px; align-items: center; }
.bar-top { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 12px; }
.bar-top span { color: var(--muted); font-size: 14px; font-family: var(--font-display); }
.bar { height: 10px; border-radius: 999px; background: var(--deep); border: 1px solid var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold); border-radius: 999px; }
.bar.low i { background: var(--sky); }
.bar-pct { font: 600 15px var(--font-display); text-align: right; }
.count-card .bar { margin-top: 4px; }
.hist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.hist a {
  display: grid; grid-template-columns: 110px minmax(0, 1fr) auto auto; gap: 16px; align-items: center;
  padding: 14px 4px; border-bottom: 1px solid var(--line); color: var(--paper); text-decoration: none;
}
.hist a:hover { background: var(--panel); }
.hist-date { color: var(--muted); font-size: 14px; }
.hist-main { display: flex; flex-direction: column; min-width: 0; }
.hist-main strong { font: 600 17px var(--font-display); }
.hist-main span { color: var(--muted); font-size: 14px; }
.hist-rec { font: 700 18px var(--font-display); }
.hist-place { color: var(--muted); font-size: 14px; min-width: 6em; text-align: right; }
.hist-place.top { color: var(--gold); font-weight: 600; }

/* ---------- external log ---------- */
.log-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 28px; }
.log-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.log-info, .lr-form { display: flex; flex-direction: column; gap: 8px; }
.log-info label, .lr-form label { font-weight: 500; margin-top: 8px; }
.log-info .field, .lr-form .field { width: 100%; }
.q-label { font-weight: 500; margin-top: 8px; }
.check { display: flex !important; align-items: center; gap: 10px; min-height: 48px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--gold); }
.log-rounds h2 { font-size: 22px; display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.lr-list { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lr-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); }
.lr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lr-main span { color: var(--muted); font-size: 14px; }
.lr-form { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; }
.lr-form h3 { font-size: 18px; }
.lr-form .btn { margin-top: 12px; }
.area.short { min-height: 90px; }
.chips.small .chip { min-height: 38px; font-size: 14px; padding: 0 12px; }
.path-node.mini { width: 32px; height: 32px; flex-shrink: 0; font-size: 13px; }
.log-foot { margin-top: 40px; }
.back-top { margin-bottom: 18px; font-size: 15px; }

/* ---------- event report ---------- */
.rep-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px;
  display: flex; flex-direction: column; gap: 10px; box-shadow: 0 30px 60px -24px var(--shadow);
}
.rep-big { display: flex; align-items: flex-end; gap: 18px; margin-top: 10px; }
.rep-num { font: 700 clamp(72px, 9vw, 112px)/.8 var(--font-display); color: var(--gold); letter-spacing: -.03em; }
.strip { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.rep-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.insight { margin-top: 12px; padding: 12px 14px; border-left: 3px solid var(--sky); background: var(--deep); border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--text-2); }
.notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.notes li { display: flex; gap: 12px; align-items: flex-start; }
.note-r { font: 700 14px var(--font-display); color: var(--gold); min-width: 2.2em; padding-top: 2px; }
.notes p { color: var(--text-2); }
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 28px 0 16px;
  padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer;
}
.switch-row > span { display: flex; flex-direction: column; }
.switch-row > span > span { color: var(--muted); font-size: 14px; }
.switch {
  appearance: none; -webkit-appearance: none; flex-shrink: 0; width: 52px; height: 30px; border-radius: 999px;
  background: var(--loss); position: relative; cursor: pointer; transition: background-color .15s ease; margin: 0;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; transition: transform .15s ease;
}
.switch:checked { background: var(--gold); }
.switch:checked::after { transform: translateX(22px); }

/* ---------- small screens: bottom tab bar ---------- */
@media (max-width: 860px) {
  .share-grid, .log-grid, .rep-grid { grid-template-columns: minmax(0, 1fr); }
  .hist a { grid-template-columns: minmax(0, 1fr) auto; }
  .hist-date { grid-column: 1 / -1; }
  .hist-place { grid-column: 2; text-align: right; }
}
@media (max-width: 760px) {
  body { padding-bottom: 76px; }
  .app-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--deep); border-top: 1px solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around;
  }
  .app-nav a { flex: 1; flex-direction: column; gap: 2px; min-height: 56px; padding: 6px 4px; border-radius: var(--r-sm); font-size: 12px; justify-content: center; }
  .app-nav a[aria-current="page"] { color: var(--gold); background: transparent; }
  .app-nav svg { width: 22px; height: 22px; }
  #toast { bottom: 92px; }
}
@media (max-width: 560px) {
  .t-tools .tabs { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; }
  .t-tools .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; }
  .theme-btn .theme-label { display: none; }
  .theme-btn { padding: 0 11px; }
  .brand span { display: none; }
  .app-head-row { gap: 12px; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tiles .tile:first-child { grid-column: 1 / -1; }
  .share-actions, .set-row { grid-template-columns: minmax(0, 1fr); }
  .social { grid-template-columns: 1fr 1fr; }
  .social-btn:last-child { grid-column: 1 / -1; }
  .report-btns { grid-template-columns: 1fr 1fr; }
  .report-btns .btn:nth-child(2) { grid-column: 1 / -1; order: 3; }
  .pair-row { grid-template-columns: 40px minmax(0, 1fr); }
  .pair-row .pill { grid-column: 2; justify-self: start; }
  .me-head { gap: 14px; }
  .avatar { width: 56px; height: 56px; font-size: 24px; }
  .share-card, .rep-card { padding: 22px; }
}

/* ---------- print: the QR poster only ---------- */
@media print {
  :root { --ink: #fff; --panel: #fff; --paper: #000; --muted: #333; --gold: #000; --line: #999; --text-2: #000; }
  body { background: #fff; padding: 0; }
  .app-head, .share-side, #toast, .app-nav { display: none !important; }
  .app-main { padding: 0; }
  .share-grid { display: block; }
  .share-card.poster { border: 0; box-shadow: none; padding-top: 40px; }
  .poster h1 { font-size: 44px; }
  .qr-box { width: 360px; }
}

/* ---------- accounts ---------- */
.acct-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 999px;
  background: var(--gold); color: var(--gold-ink); text-decoration: none; font-weight: 600; font-size: 15px; white-space: nowrap;
}
.acct-btn:hover { background: var(--gold-hover); color: var(--gold-ink); }
.acct-btn.in { background: transparent; color: var(--paper); border: 1px solid var(--line); padding: 0 14px 0 5px; }
.acct-btn.in:hover { background: var(--panel); color: var(--paper); }
.acct-avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold); color: var(--gold-ink); font: 700 15px var(--font-display);
}
.acct-name { max-width: 9em; overflow: hidden; text-overflow: ellipsis; }
.info-note { background: var(--now-bg); border: 1px solid var(--line); border-left: 3px solid var(--sky); border-radius: var(--r-sm); padding: 12px 14px; color: var(--text-2); margin: 4px 0 16px; }
.test-mode { border: 1px dashed var(--sky); border-radius: var(--r-md); padding: 16px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.test-mode strong { color: var(--sky); }
.test-mode p { color: var(--text-2); font-size: 14px; }
.test-mode label { font-weight: 500; margin-top: 6px; }
.test-mode .field { width: 100%; }
.auth-legal { color: var(--muted); font-size: 14px; margin-top: 14px; }
.ticks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ticks li { position: relative; padding-left: 26px; color: var(--text-2); }
.ticks li::before { content: ''; position: absolute; left: 0; top: .6em; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); }
.ticks.small { margin-top: 20px; font-size: 15px; }
.mode.role:has(input:checked) { border-color: var(--gold); }
.mode.role input { accent-color: var(--gold); }
.join-form .modes { margin-top: 12px; }
.check.consent { align-items: flex-start; min-height: 0; margin-top: 12px; font-weight: 400 !important; }
.check.consent input { margin-top: 4px; flex-shrink: 0; }
.join-form .link-btn { align-self: center; margin-top: 4px; }
.acct-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; color: var(--muted); font-size: 15px; margin-bottom: 8px; }
.plan-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); }
.plan-row span { color: var(--muted); }
.plan-row a { margin-left: auto; font-size: 15px; }
.save-card { border-color: var(--gold); }
.save-card p { color: var(--text-2); font-size: 15px; }
.legal { max-width: 720px; }
.legal h2 { font-size: 20px; margin: 28px 0 8px; }
.legal p { color: var(--text-2); }
@media (max-width: 560px) {
  .acct-name { display: none; }
  .acct-btn.in { padding: 0 5px; }
  .acct-btn:not(.in) { padding: 0 12px; font-size: 14px; }
}

/* ---------- phone polish: get the table, opponent and report buttons on screen sooner ---------- */
@media (max-width: 560px) {
  .app-main { padding: 20px 0 40px; }
  .app-main h1 { font-size: 26px; }
  .acct-btn:not(.in) { display: none; } /* the Profile tab carries sign-in on phones */
  .pv-head, .home-head, .log-head { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 16px; }
  .pv-pick { flex-direction: row; align-items: center; gap: 10px; min-width: 0; }
  .pv-pick label { white-space: nowrap; }
  .pv-pick .field { flex: 1; min-width: 0; min-height: 44px; }
  .t-tools { margin: 14px 0 16px; padding-bottom: 8px; gap: 8px; }
  .tool-btns { width: 100%; }
  .tool-btns .btn { flex: 1; }
  .pv-main { gap: 18px; }
  .pv-num { font-size: 88px; }
  .pv-label strong { font-size: 21px; }
  .pv-card { padding: 18px; }
  .table-card { width: 64px; height: 80px; }
  .table-card strong { font-size: 34px; }
  .pv-opp { font-size: 22px; }
  .report-btns .btn { min-height: 52px; font-size: 16px; }
  .home-head .row-btns .btn { flex: 1; }
  .t-head { gap: 10px; }
  .t-code { align-items: flex-start; padding: 0; }
  .t-code strong { font-size: 24px; }
  .round-head { gap: 10px; }
  .timer { width: 100%; }
  .timer-num { text-align: left; min-width: 0; margin-right: auto; font-size: 28px; }
  .empty { padding: 28px 20px; }
  .live-num { font-size: 64px; }
  .hist a { padding: 12px 2px; gap: 6px 12px; }
}
@media (max-width: 560px) {
  /* result buttons: names wrap instead of being cut off; Draw stays narrow in the middle */
  .m-res { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; }
  .res { white-space: normal; text-overflow: clip; overflow: visible; overflow-wrap: anywhere; line-height: 1.3; padding: 6px 8px; min-height: 44px; max-width: none; }
  .res[data-v="D"] { padding: 6px 12px; }
}

/* ---------- large events: search, show more, dense path, paged big screen ---------- */
.list-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 14px; }
.list-tools .field { flex: 1 1 260px; min-width: 0; }
.list-tools .chips { flex-wrap: wrap; }
.list-more { display: flex; justify-content: center; margin-top: 14px; }
.ok-text { color: var(--sky); }
.my-rank { margin: 0 0 14px; padding: 12px 16px; border-radius: var(--r-md); background: var(--now-bg); border: 1px solid var(--line); font-weight: 600; }
.path.dense .path-node { width: 28px; height: 28px; font-size: 11px; }
.path.dense .path-node.goal { width: 36px; height: 36px; }
.path.dense .path-link { margin-top: 12px; min-width: 2px; }
.path.dense .path-step:last-child .path-link { margin-top: 16px; }
.path.dense .path-label { font-size: 10px; }
.pj-pager { display: flex; align-items: center; gap: 12px; margin: -12px 0 20px; color: var(--muted); font-size: clamp(15px, 1.3vw, 20px); }
.pj-pager #pj-page { color: var(--paper); font-weight: 600; }
.pj-cols { margin-left: auto; }
.pj-list.by-name { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 40px; grid-auto-flow: column; grid-template-rows: repeat(15, auto); }
.pj-list.by-name li { grid-template-columns: minmax(0, 1.2fr) 2.6em minmax(0, 1fr); gap: 12px; padding: 7px 0; font-size: clamp(15px, 1.35vw, 22px); }
.pj-list.by-name li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-list.by-name .pj-t { text-align: right; }
.pj-list.by-name .pj-vs { font-weight: 400; }
.bracket { grid-auto-columns: minmax(200px, 1fr); }
@media (max-width: 900px) {
  .pj-list.by-name { grid-template-columns: 1fr; grid-auto-flow: row; grid-template-rows: none; }
}
@media (max-width: 560px) {
  .path.dense .path-node { width: 22px; height: 22px; font-size: 10px; border-width: 1.5px; }
  .path.dense .path-node.goal { width: 30px; height: 30px; font-size: 10px; }
  .path.dense .path-link { margin-top: 10px; }
  .path.dense .path-step:last-child .path-link { margin-top: 14px; }
  .path.dense .path-label:not(.now) { visibility: hidden; }
  .pv-pick input.field { flex: 1; min-width: 0; min-height: 44px; }
}

/* ---------- notification banner (demo) ---------- */
#note {
  position: fixed; top: 14px; left: 50%; z-index: 70; width: min(440px, calc(100% - 24px));
  display: flex; gap: 12px; align-items: flex-start; text-align: left; cursor: pointer;
  padding: 14px 16px; border-radius: 22px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--paper); font: inherit;
  box-shadow: 0 18px 40px -12px var(--shadow);
  transform: translate(-50%, -140%); opacity: 0; visibility: hidden;
  transition: transform .28s ease, opacity .28s ease, visibility .28s;
}
#note.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.note-ic { width: 40px; height: 40px; flex-shrink: 0; border-radius: 11px; background: var(--deep); display: grid; place-items: center; border: 1px solid var(--line); }
.note-ic svg { width: 28px; height: 14px; }
.note-ic circle { fill: var(--gold); }
.note-ic path { stroke: var(--gold); stroke-width: 3; stroke-linecap: round; }
.note-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.note-top { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }
.note-top strong { color: var(--paper); }
.note-title { font-weight: 600; font-size: 16px; }
.note-body { font-size: 15px; color: var(--text-2); }
.note-card p { color: var(--text-2); font-size: 15px; }
.note-card .hint { margin-top: 0; }
@media print { #note { display: none !important; } }

/* ---------- profile: photo, facts, editor, share card ---------- */
.avatar.has-photo, .acct-avatar.has-photo { overflow: hidden; background: var(--panel-2); }
.avatar img, .acct-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.me-head { align-items: flex-start; }
.me-head > .avatar { width: 96px; height: 96px; font-size: 40px; }
.me-name { font: 700 30px/1.3 var(--font-display); }
.me-bio { color: var(--text-2); margin-top: 2px; }
.me-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.me-fact { font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.me-actions { margin-top: 12px; }
.prof-sheet { max-height: 92vh; overflow-y: auto; }
.pf-form { display: flex; flex-direction: column; gap: 8px; }
.pf-form label { font-weight: 500; margin-top: 6px; }
.pf-form .field { width: 100%; }
.pf-form .sheet-actions { margin-top: 16px; }
.pf-photo-row { display: flex; align-items: center; gap: 16px; }
.pf-photo-row .avatar { width: 88px; height: 88px; font-size: 36px; }
.pf-photo-btns { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.pf-photo-btns .hint { margin-top: 0; font-size: 13px; }
.pf-upload { cursor: pointer; margin-top: 0 !important; }
.card-preview { display: grid; place-items: center; min-height: 200px; }
.card-preview img { width: min(100%, 320px); height: auto; border-radius: 16px; box-shadow: 0 16px 40px -16px var(--shadow); }
@media (max-width: 560px) {
  .me-head > .avatar { width: 72px; height: 72px; font-size: 30px; }
  .me-name { font-size: 24px; }
  .me-actions .btn { flex: 1; }
}

/* ---------- game logos ---------- */
.game-logo { display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; flex-shrink: 0; }
.game-logo img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.tile-dark { background: #131a33; border: 1px solid #2e3a68; }
.tile-light { background: #f4f1e8; border: 1px solid #d5d9e6; }
.tile-none { background: var(--deep); border: 1px dashed var(--line); color: var(--muted); font: 700 22px var(--font-display); }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.chip.game-tile {
  min-height: 0; height: auto; padding: 8px; border-radius: var(--r-md); flex-direction: column; gap: 6px;
  display: flex; align-items: stretch; background: var(--deep); color: var(--paper);
}
.chip.game-tile .game-logo { height: 52px; padding: 6px 8px; }
.chip.game-tile .game-name { font-size: 13px; font-weight: 500; text-align: center; line-height: 1.3; }
.chip.game-tile.on { background: var(--panel-2); border-color: var(--gold); box-shadow: inset 0 0 0 2px var(--gold); color: var(--paper); }
.chip.game-tile.on .game-name { color: var(--gold); font-weight: 600; }
.row-logo { width: 72px; height: 40px; padding: 4px 6px; margin-right: 14px; }
.t-row a { justify-content: flex-start; }
.t-row-status { margin-left: auto; text-align: right; }
.share-logo { height: 56px; padding: 8px 14px; margin: 6px 0 4px; }
.share-logo img { max-width: 200px; }
@media (max-width: 560px) {
  .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .row-logo { width: 56px; height: 34px; margin-right: 10px; }
  .t-row a { flex-wrap: wrap; }
}

/* ---------- share card colour swatches ---------- */
.swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; width: 100%; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--deep); color: var(--muted); font: 500 12px var(--font-body); cursor: pointer; }
.swatch.on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); color: var(--paper); }
.swatch-dot { width: 34px; height: 34px; border-radius: 50%; border: 3px solid; display: grid; place-items: center; }
.swatch-dot span { width: 12px; height: 12px; border-radius: 50%; }
.swatch-name { line-height: 1.3; text-align: center; }
.swatch { position: relative; }
.swatch-pass { position: absolute; top: 4px; right: 4px; font: 700 10px var(--font-body); color: #131a33; background: #8db8ff; border-radius: 999px; padding: 1px 6px; }
.swatch-hint { margin: 0; width: 100%; }
.prof-sheet .q-label { align-self: flex-start; margin-top: 4px; }
.prof-sheet > * { flex-shrink: 0; }   /* a tall sheet scrolls instead of squeezing the card under the swatches */
.card-preview img { width: min(100%, 260px); }

/* ---------- elimination Swiss ---------- */
.tag-out { font-size: 12px; font-weight: 600; color: var(--muted); border: 1px solid var(--muted); border-radius: 999px; padding: 1px 8px; margin-left: 6px; }
.standings tr:has(.tag-out) td { color: var(--muted); }
.elim-line { color: var(--sky) !important; }
#elim-hint:empty { display: none; }

.champ .champ-by { font-size: 14px; color: var(--muted); margin-top: 6px; }

/* ---------- mascot: บุญโต้ง ---------- */
.tong { display: block; height: auto; pointer-events: none; user-select: none; }
.empty.has-tong { flex-direction: row; flex-wrap: wrap; align-items: center; }
.empty.has-tong > p, .empty.has-tong > .row-btns { flex: 1 1 260px; }
.empty.has-tong > .row-btns { flex-basis: 100%; }
.tong-wait { width: 112px; flex: none; }
.champ { position: relative; padding-right: 180px; }
.tong-champ { position: absolute; right: 20px; bottom: 12px; width: 150px; }
@media (max-width: 640px) {
  .champ { padding-right: 24px; padding-top: 120px; }
  .tong-champ { width: 120px; top: 12px; right: 16px; bottom: auto; }
  .tong-wait { width: 88px; }
}
