/* Sunday school bracket: phone, big screen and admin pages */

:root {
  --bg: #f7f3ec;
  --surface: #ffffff;
  --sunk: #efe9df;
  --ink: #1f2430;
  --muted: #6a6f7b;
  --line: #e2dacd;
  --accent: #2c5a88;
  --accent-ink: #ffffff;
  --accent-soft: #dfe9f4;
  --gold: #b9811f;
  --gold-soft: #f6e7c8;
  --danger: #a8402c;
  --ok: #2f7d4f;
  --shadow: 0 1px 2px rgba(31, 36, 48, .06), 0 4px 16px rgba(31, 36, 48, .06);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171d;
    --surface: #1d212a;
    --sunk: #252a35;
    --ink: #f1ede6;
    --muted: #a2a7b2;
    --line: #313744;
    --accent: #7fb0e3;
    --accent-ink: #0f1a26;
    --accent-soft: #22334a;
    --gold: #e6b75c;
    --gold-soft: #3a3020;
    --danger: #e88a76;
    --ok: #7cc79a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14171d; --surface: #1d212a; --sunk: #252a35; --ink: #f1ede6; --muted: #a2a7b2; --line: #313744;
  --accent: #7fb0e3; --accent-ink: #0f1a26; --accent-soft: #22334a; --gold: #e6b75c; --gold-soft: #3a3020;
  --danger: #e88a76; --ok: #7cc79a; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
p { margin: 0 0 .8em; }
button, input, textarea { font: inherit; color: inherit; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: 48px; padding: 0 20px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 600; cursor: pointer; text-decoration: none; touch-action: manipulation;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 15px; border-radius: 10px; }
.btn.big { min-height: 60px; font-size: 20px; padding: 0 28px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .45; cursor: default; }

input[type=text], input[type=password], input[inputmode], textarea {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); font-size: 17px;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea { min-height: 120px; resize: vertical; line-height: 1.45; }

.muted { color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); vertical-align: middle; }
.dot.off { background: var(--danger); }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px;
  font-size: 15px; max-width: calc(100% - 32px); z-index: 50; box-shadow: var(--shadow);
}

/* ------------------------------------------------------------ phone */

.page-phone #app {
  max-width: 520px; margin: 0 auto; min-height: 100dvh;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
}
.ph-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); margin-bottom: 18px; }
.ph-top b { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-main { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.ph-card { background: var(--surface); border-radius: var(--radius); padding: 22px 20px; box-shadow: var(--shadow); }
.ph-welcome h1 { font-size: 28px; }
.ph-welcome p { font-size: 18px; line-height: 1.55; }
.ph-center { text-align: center; }
.ph-center h1 { font-size: 26px; }
.ph-big { font-size: 20px; }
.ph-label { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.ph-choices { display: flex; flex-direction: column; gap: 10px; }
.ph-vs { text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.choice {
  width: 100%; min-height: 76px; padding: 14px 18px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--surface); text-align: left;
  font-size: 20px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 12px;
  touch-action: manipulation;
}
.choice.long { font-size: 17px; font-weight: 500; line-height: 1.35; }
.ph-center h1 { overflow-wrap: break-word; }
.choice .tick {
  flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line);
  display: grid; place-items: center; font-size: 16px; color: transparent;
}
.choice.on { border-color: var(--accent); background: var(--accent-soft); }
.choice.on .tick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ph-note { font-size: 15px; color: var(--muted); text-align: center; margin: 12px 0 0; }
.ph-note.ok { color: var(--ok); font-weight: 600; }
.ph-foot { text-align: center; margin-top: 24px; font-size: 14px; }
.linkish { background: none; border: 0; padding: 6px; color: var(--accent); cursor: pointer; font-size: 14px; }
.trophy { font-size: 56px; line-height: 1; margin-bottom: 8px; }

/* ------------------------------------------------------------ big screen */

.page-screen { overflow: hidden; }
.page-screen #app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; font-size: 2.1vmin; }
.sc-top { display: flex; align-items: center; justify-content: space-between; padding: 2.2vmin 3vmin 0; gap: 2vmin; }
.sc-title { font-size: 2.6em; font-weight: 750; letter-spacing: -.02em; margin: 0; }
.sc-joined { font-size: 1.4em; color: var(--muted); white-space: nowrap; }
.sc-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 2vmin 3vmin 3vmin; }
.sc-corner { display: flex; align-items: center; gap: 1.4vmin; text-align: right; font-size: 1.3em; flex: none; }
.sc-corner img { width: 10vmin; height: 10vmin; display: block; border-radius: .8vmin; background: #fff; box-shadow: var(--shadow); }
.sc-corner b { display: block; font-size: 1.15em; }
.sc-fs { position: fixed; left: 2vmin; bottom: 2vmin; opacity: 0; transition: opacity .3s; }
.sc-fs.show { opacity: 1; }

/* join screen */
.join { display: flex; align-items: center; gap: 7vmin; }
.join img { width: 52vmin; height: 52vmin; background: #fff; border-radius: 2vmin; padding: 1vmin; box-shadow: var(--shadow); }
.join h2 { font-size: 3.6em; margin-bottom: .3em; }
.join .url { font-size: 2.4em; font-weight: 700; color: var(--accent); margin-bottom: .6em; }
.join .count { font-size: 2em; color: var(--muted); }
.join .count b { color: var(--ink); }

/* one matchup */
.mv { width: 100%; max-width: 160vmin; text-align: center; }
.mv-round { font-size: 1.6em; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; margin-bottom: 3vmin; }
.mv-pair { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 3vmin; height: 58vh; }
.mv-card {
  background: var(--surface); border: .5vmin solid var(--line); border-radius: 2.4vmin; box-shadow: var(--shadow);
  padding: 4vmin; display: flex; flex-direction: column; justify-content: center; gap: 2vmin; min-height: 0; min-width: 0;
  transition: opacity .4s, border-color .4s, transform .4s;
}
/* The name takes whatever room the card has left; B.fit sizes the text to it */
.mv-name { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.mv-name span { display: block; max-height: 100%; font-weight: 750; line-height: 1.15; letter-spacing: -.01em; overflow-wrap: break-word; }
.mv-card.win, .mv-card.lose { gap: 1.4vmin; }
.mv-vs { align-self: center; font-size: 2.4em; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.mv-card.win { border-color: var(--gold); background: var(--gold-soft); transform: scale(1.03); }
.mv-card.lose { opacity: .45; }
.mv-pct { font-size: 4.6em; font-weight: 800; line-height: 1; }
.mv-votes { font-size: 1.5em; color: var(--muted); }
.mv-bar { height: 1.4vmin; border-radius: 1vmin; background: var(--sunk); overflow: hidden; }
.mv-bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .8s ease-out; }
.mv-card.win .mv-bar i { background: var(--gold); }
.mv-badge { font-size: 1.6em; font-weight: 800; color: var(--gold); text-transform: uppercase; letter-spacing: .1em; }
.mv-status { margin-top: 4vmin; font-size: 2em; font-weight: 600; }
.mv-status .live { color: var(--ok); }
.mv-status.tie { color: var(--gold); font-weight: 800; font-size: 2.6em; }

/* the whole bracket */
.br { width: 100%; height: 100%; display: flex; gap: 2.2vmin; }
.br-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.br-h { text-align: center; font-size: 1.15em; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 1vmin; }
.br-body { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 1vmin; }
.br-m { background: var(--surface); border: .25vmin solid var(--line); border-radius: 1.2vmin; overflow: hidden; box-shadow: var(--shadow); position: relative; }
.br-m.focus { border-color: var(--accent); box-shadow: 0 0 0 .4vmin var(--accent-soft); }
.br-m.open { border-color: var(--ok); }
.br-row { display: flex; align-items: center; gap: 1vmin; padding: .8vmin 1.2vmin; min-height: 4.4vmin; font-size: 1.3em; font-weight: 600; }
.br-row + .br-row { border-top: .2vmin solid var(--line); }
.br-row span { flex: 1; min-width: 0; overflow: hidden; line-height: 1.2; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--lines, 2); }
.br-row em { font-style: normal; color: var(--muted); font-weight: 700; font-size: .9em; }
.br-row.win { background: var(--gold-soft); }
.br-row.lose { color: var(--muted); }
.br-row.lose span { text-decoration: line-through; text-decoration-thickness: .15vmin; }
.br-row.tbd { color: var(--muted); font-weight: 400; font-style: italic; }
.br-m.open .br-row, .br-m.tied .br-row { padding-right: 7vmin; }
.br.big .br-body { gap: .5vmin; }
.br.big .br-row { min-height: 3.4vmin; padding: .35vmin 1vmin; font-size: 1.15em; }
.br.big .br-m.open .br-row, .br.big .br-m.tied .br-row { padding-right: 7vmin; }
.br-tag { position: absolute; right: .8vmin; top: 50%; transform: translateY(-50%); background: var(--ok); color: #fff; font-size: .95em; font-weight: 700; padding: .3vmin .9vmin; border-radius: 1vmin; }
.br-tag.tie { background: var(--gold); }
.br-champ { text-align: center; }
.br-champ .box { background: var(--gold-soft); border: .4vmin solid var(--gold); border-radius: 1.6vmin; padding: 2vmin; font-size: 1.6em; font-weight: 800; width: 100%; overflow-wrap: anywhere; }
.br-champ .box.tbd { background: var(--surface); border-color: var(--line); color: var(--muted); font-weight: 400; font-style: italic; }

/* two leagues side by side, the final in the middle */
.br-side { flex: 2; min-width: 0; display: flex; flex-direction: column; }
.br-cols { flex: 1; min-height: 0; display: flex; gap: 2.2vmin; }
.br-lg-h { text-align: center; font-size: 1.7em; font-weight: 800; color: var(--accent); margin-bottom: 1.2vmin; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-ws { flex: 1.2; min-width: 0; display: flex; flex-direction: column; }
.br-ws .br-lg-h { color: var(--gold); }
.br-ws .br-body { justify-content: center; gap: 4vmin; }
.br-ws .br-m { text-align: left; }

/* champion */
.champ { text-align: center; }
.champ .trophy { font-size: 16vmin; margin-bottom: 2vmin; }
.champ .label { font-size: 2em; font-weight: 700; color: var(--gold); text-transform: uppercase; letter-spacing: .14em; }
.champ { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; }
.champ .name { height: 42vh; margin: 2vmin auto; width: 92%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.champ .name span { display: block; font-weight: 800; letter-spacing: -.01em; line-height: 1.15; overflow-wrap: break-word; }
.champ .sub { font-size: 1.8em; color: var(--muted); }

.sc-wait { text-align: center; font-size: 2.4em; color: var(--muted); }

/* leader's controls on the big screen (sized for a finger, not the room) */
.hc-dot {
  position: fixed; right: 12px; bottom: 12px; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: var(--ink); opacity: .07; cursor: pointer; z-index: 40;
}
.hc-dot.on { opacity: .16; }
.hc-bar {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px;
  width: max-content; max-width: calc(100% - 24px); padding: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .22);
}
.hc-group { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.hc-note { font-weight: 700; padding: 0 10px; }
.hc-menu {
  position: fixed; right: 12px; bottom: 96px; z-index: 41; width: min(360px, calc(100% - 24px));
  max-height: calc(100% - 120px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .22);
}
.hc-menu-h { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 8px 10px 4px; }
.hc-menu button, .hc-menu a {
  display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left;
  min-height: 46px; align-items: center; padding: 0 12px; border: 0; border-radius: 10px;
  background: none; font-weight: 600; cursor: pointer; color: var(--ink); text-decoration: none;
}
.hc-menu button:active, .hc-menu a:active { background: var(--sunk); }
.hc-menu button span { color: var(--muted); font-weight: 500; font-size: 15px; }
.hc-menu .danger { color: var(--danger); }
.hc-menu a { color: var(--accent); }
.hc-menu p { padding: 4px 12px; margin: 0; }
.hc-menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.hc-pin { position: fixed; inset: 0; z-index: 42; display: grid; place-items: center; background: rgba(0, 0, 0, .35); padding: 16px; }
.hc-pin .panel { width: min(360px, 100%); margin: 0; }
.hc-pin input { text-align: center; font-size: 26px; letter-spacing: .3em; margin: 6px 0 12px; }

/* ------------------------------------------------------------ admin */

.page-admin #app {
  max-width: 860px; margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(40px + env(safe-area-inset-bottom));
}
.ad-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.ad-top h1 { font-size: 24px; margin: 0; }
.ad-top .right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px; color: var(--muted); }
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.panel h2 { font-size: 19px; }
.panel-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-h h2 { margin: 0; }
.live-badge { display: inline-block; background: var(--ok); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .08em; padding: 3px 8px; border-radius: 6px; margin-right: 8px; vertical-align: 2px; }

.seg { display: inline-flex; background: var(--sunk); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: none; min-height: 38px; padding: 0 14px; border-radius: 9px; font-weight: 600; font-size: 15px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.stack > * + * { margin-top: 14px; }

.ctl { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: var(--bg); }
.ctl-round { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.ctl-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; margin-bottom: 14px; }
.ctl-pair .e { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-weight: 700; font-size: 18px; text-align: center; overflow-wrap: anywhere; }
.ctl-pair .e.win { border-color: var(--gold); background: var(--gold-soft); }
.ctl-pair .e small { display: block; font-weight: 600; color: var(--muted); font-size: 14px; margin-top: 2px; }
.ctl-pair .vs { color: var(--muted); font-weight: 700; font-size: 13px; }
.ctl-status { font-size: 16px; margin-bottom: 12px; }
.ctl-status b { color: var(--ok); }
.ctl .btn.big { width: 100%; }
.ctl-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.ctl-list div { display: flex; justify-content: space-between; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-weight: 600; }
.ctl-list span { color: var(--muted); font-weight: 500; white-space: nowrap; }

.rounds { margin-top: 16px; }
.rounds h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 14px 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 12px; font-size: 15px; cursor: pointer; text-align: left; max-width: 100%; }
.chip.focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.chip.done { color: var(--muted); }
.chip.done b { color: var(--ink); }
.chip.waiting { color: var(--muted); font-style: italic; cursor: default; }
.chip i { font-style: normal; font-size: 12px; font-weight: 700; padding: 2px 6px; border-radius: 6px; margin-left: 6px; background: var(--sunk); color: var(--muted); }
.chip i.open { background: var(--ok); color: #fff; }
.chip i.tie { background: var(--gold); color: #fff; }

.blist { display: flex; flex-direction: column; gap: 10px; }
.bitem { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.bitem .t { font-weight: 700; }
.bitem .s { font-size: 14px; color: var(--muted); }
.bitem .row { flex-wrap: nowrap; }
.btn.share.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.small-note { font-size: 14px; margin: 12px 0 0; }

.field { display: block; }
.field > span { display: block; font-weight: 600; margin-bottom: 6px; }
.field small { display: block; color: var(--muted); margin-top: 6px; font-size: 14px; }
.pairs { display: grid; grid-template-columns: 1fr; gap: 12px; }
.pair textarea { min-height: 0; resize: none; overflow: hidden; padding: 10px 12px; }
.pair { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--bg); }
.pair .ctl-round { margin: 0 0 6px 2px; }
.pair label { display: flex; align-items: flex-start; gap: 8px; }
.pair label b { padding-top: 12px; }
.pair label + label { margin-top: 6px; }
.pair label b { width: 22px; text-align: right; color: var(--muted); font-size: 14px; flex: none; }
.grip { flex: none; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; color: var(--muted); font-weight: 800; letter-spacing: -.15em; padding: 10px 8px 10px 2px; }
.ctl-round .grip { padding: 4px 8px 4px 0; }
.ed-choice { border-radius: 10px; transition: background .15s, box-shadow .15s; }
.ed-choice + .ed-choice { margin-top: 6px; }
.ed-choice .pic-row { margin-left: 52px; }
.pair.dragging, .ed-choice.dragging { opacity: .5; }
.pair.drop, .ed-choice.drop { box-shadow: 0 0 0 3px var(--accent); background: var(--accent-soft); }
.err { color: var(--danger); font-weight: 600; }
.pin { max-width: 360px; margin: 12vh auto 0; text-align: center; }
.pin input { text-align: center; font-size: 28px; letter-spacing: .4em; margin: 12px 0; }

@media (max-width: 520px) {
  .ctl-pair { grid-template-columns: 1fr; }
  .ctl-pair .vs { text-align: center; }
  .bitem { flex-direction: column; align-items: stretch; }
  .bitem .row { justify-content: flex-end; }
}

/* Slides the leader designed: title, closing, and each choice's setting picture */
body.on-slide { background: #000; }
.slide { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #000; }
.slide img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.mv-card.mv-pic { padding: 0; overflow: hidden; background: #000; justify-content: center; }
.mv-pic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pic-row { margin: 6px 0 0 30px; }
.pic-slot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pic-slot img { height: 54px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--sunk); }
.field small.inline { display: inline; margin: 0; font-weight: 400; }

/* two-leagues editor: a league's name and slide above its semifinals */
.league-h { border-top: 2px solid var(--accent-soft); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }

/* ------------------------------------------------------------ play at home (brackets.chb.ca) */

.home-list {
  max-width: 640px; margin: 0 auto;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(40px + env(safe-area-inset-bottom));
}
.home-list h1 { font-size: 30px; }
.home-list .bitem { flex-direction: row; align-items: center; }
/* While playing, the page works like the big screen, with the bar always along the bottom */
.page-home.playing { overflow: hidden; }
.page-home.playing #app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; font-size: max(2.1vmin, 9px); }
/* The matchup fills the room the title leaves (the bar floats over it, and hides itself) */
.page-home .sc-body { align-items: stretch; }
.page-home .mv { height: 100%; display: flex; flex-direction: column; max-width: none; }
.page-home .mv-pair { height: auto; flex: 1; min-height: 0; }
.page-home .hc-bar { bottom: calc(10px + env(safe-area-inset-bottom)); }
.page-home .hc-note { color: var(--muted); }
.page-home .hc-bar { padding: 8px; gap: 8px; flex-wrap: nowrap; }
.page-home .hc-bar .btn { min-height: 44px; padding: 0 16px; font-size: 16px; white-space: nowrap; }
.page-home .hc-group { min-width: 0; }   /* two buttons (a league champion, then next) may stack */
.narrow-only { display: none; }
@media (max-width: 600px), (max-height: 500px) {   /* a phone, upright or sideways */
  .page-home .wide-only { display: none; }
  .page-home .narrow-only { display: block; }
  .page-home .hc-bar .btn[data-hc="undo"], .page-home .hc-bar .btn[data-hc="menu"] { padding: 0 12px; min-width: 44px; }
  .page-home .hc-note { padding: 0 4px; font-size: 15px; }
}
.page-home.playing #app { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
/* A phone on its side has little height to spare: the ••• button sits over the corner instead */
@media (orientation: landscape) and (max-height: 500px) {
  .page-home.playing #app { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .page-home .sc-top { padding-top: 1.2vmin; }
  .page-home .mv-round { margin-bottom: 1.5vmin; }
}
/* The bar's stand-in while it's hidden: tap it (or anywhere) to bring the bar back */
.home-dot {
  position: fixed; right: 14px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 40;
  width: 52px; height: 40px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font: 700 16px/1 inherit; letter-spacing: .05em;
  box-shadow: var(--shadow); opacity: .85; cursor: pointer;
}
body.on-slide .home-dot { opacity: .5; }
button.mv-pic { cursor: zoom-in; }
.tip { font-size: 15px; background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; }
.tip b { color: var(--ink); }
/* One setting picture, full screen */
.zoom { position: fixed; inset: 0; z-index: 60; background: #000; display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.zoom img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.zoom-tip {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: rgba(0, 0, 0, .65); color: #fff; font-size: 14px; padding: 8px 14px; border-radius: 16px;
  text-align: center; width: max-content; max-width: calc(100% - 32px); transition: opacity .6s;
}
.zoom-tip.faded { opacity: 0; }
/* Keep clear of the Dynamic Island (or notch): on a phone turned sideways it sits at the left or right edge */
.page-home.playing #app { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.page-home .slide, .zoom { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.home-list { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.home-dot { right: calc(14px + env(safe-area-inset-right)); }
.page-home .hc-bar { max-width: calc(100% - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)); }
button.mv-card { font: inherit; color: inherit; text-align: center; cursor: pointer; width: 100%; }
button.mv-card:hover { border-color: var(--accent); }
button.mv-card:active { transform: scale(.98); border-color: var(--accent); }
/* A phone held upright: the two choices one above the other */
@media (orientation: portrait) and (max-width: 820px) {
  .page-home .sc-top { padding-top: calc(2.2vmin + env(safe-area-inset-top)); }
  .page-home .sc-title { font-size: 2em; }
  .page-home .mv-round { font-size: 1.3em; margin-bottom: 2vmin; }
  .page-home .mv-pair { grid-template-columns: 1fr; grid-template-rows: 1fr auto 1fr; gap: 1.6vmin; }
  .page-home .mv-vs { font-size: 1.8em; }
  .page-home .mv-card { padding: 3vmin; border-radius: 3vmin; }
  .page-home .br { min-width: 0; font-size: .95em; }
}
