/* Organizer: one thumb-friendly column; tabs at the bottom. */
body {
  min-height: 100vh;
  background: radial-gradient(ellipse 90% 40% at 50% -5%, rgba(27,122,86,.28), transparent 70%), var(--ink);
  padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
}
.bar {
  position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(11,19,17,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ivory); text-decoration: none; }
.brand b { font-family: var(--f-display); font-weight: 400; font-size: 18px; }
.banner { background: #4a1f19; color: #ffd8d0; padding: 10px 16px; font-size: 14px; border-bottom: 1px solid #7a3328; }
.page { max-width: 640px; margin: 0 auto; padding: 16px; }
h1 { font-family: var(--f-display); font-weight: 400; font-size: 28px; line-height: 1.05; margin: 0 0 14px; }
h2.label { margin: 22px 0 8px; }

.card { background: var(--ink-2); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 14px; display: grid; gap: 14px; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field legend { padding: 0; margin-bottom: 6px; }
input:not([type=radio]), select, textarea {
  width: 100%; background: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 12px; font-size: 17px; min-height: 48px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--chalk); outline: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn {
  display: inline-flex; justify-content: center; align-items: center; gap: 8px;
  min-height: 46px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--ink-3); font-weight: 600; font-size: 16px;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brass); border-color: var(--brass); color: #1b1305; }
.btn.danger { color: #ffc7bd; border-color: rgba(239,122,106,.5); background: rgba(239,122,106,.08); }
.btn.big { min-height: 56px; font-size: 18px; width: 100%; }
.link { background: none; border: 0; color: var(--muted); padding: 0; font-family: var(--f-label); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-size: 14px; margin-bottom: 8px; min-height: 32px; }

.seg { display: flex; background: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: grid; place-items: center; min-height: 42px; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg input:checked + span { background: var(--felt); color: var(--ivory); box-shadow: inset 0 0 0 1px var(--felt-hi); }
.seg input:focus-visible + span { outline: 2px solid var(--chalk); }
.seg.small { margin-bottom: 14px; }
.seg.small span { min-height: 36px; }

.stepper { display: grid; grid-template-columns: 46px 1fr 46px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--ink); }
.stepper button { background: var(--ink-3); border: 0; font-size: 22px; min-height: 48px; }
.stepper input { border: 0; border-radius: 0; text-align: center; font-family: var(--f-display); font-size: 20px; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }

.saved { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.saved .open { width: 100%; text-align: left; display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--ink-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.saved b { display: block; font-size: 17px; }
.saved small { color: var(--muted); }

.thead { margin-bottom: 14px; }
.thead h1 { margin-bottom: 8px; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-label); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--ink-3); border: 1px solid var(--line); }
.chip.st-live { border-color: var(--felt-hi); color: #bff0d6; }
.chip.st-finished { border-color: var(--brass); color: #ffe5a3; }

.addrow { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.paste { margin-top: 10px; }
.paste summary { color: var(--chalk); cursor: pointer; padding: 8px 0; font-weight: 600; }
.paste[open] { display: grid; gap: 8px; }
.hint { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.players { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.players li { display: flex; align-items: center; gap: 10px; background: var(--ink-2); border: 1px solid var(--line); border-radius: 12px; padding: 6px 6px 6px 12px; min-height: 52px; }
.players .n { color: var(--muted); font-family: var(--f-label); width: 2ch; text-align: right; }
.players .nm { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.players input { flex: 1; min-height: 40px; padding: 6px 10px; }
.iconbtn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--ink-3); flex: none; font-size: 17px; }
.iconbtn.del { color: #ffb4a8; }
.sticky { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); padding-top: 14px; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }

.group h2.label:first-child { margin-top: 4px; }
.mlist { display: grid; gap: 8px; }
.mcard { width: 100%; text-align: left; background: var(--ink-2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; display: grid; gap: 4px; }
.mcard.ready { border-color: rgba(95,211,154,.5); }
.mcard .top { display: flex; justify-content: space-between; font-family: var(--f-label); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-size: 13px; color: var(--muted); }
.mcard .top .tb { color: #072315; background: var(--ok); padding: 0 8px; border-radius: 5px; }
.mcard .top .tb.wait { color: var(--ivory); background: var(--ink-3); }
.mcard .row { display: flex; justify-content: space-between; gap: 10px; font-size: 17px; font-weight: 600; }
.mcard .row .s { font-family: var(--f-display); }
.mcard .row.w { color: #ffe5a3; }
.mcard .row.l { color: var(--muted); font-weight: 500; }
.mcard .row.tbd { color: var(--muted); font-style: italic; font-weight: 500; }

.champ { text-align: center; padding: 18px; border-radius: 16px; margin-bottom: 14px; background: radial-gradient(ellipse at 50% 0, rgba(216,178,90,.3), transparent 70%), var(--felt-dark); border: 1px solid var(--brass); }
.champ b { display: block; font-family: var(--f-display); font-weight: 400; font-size: 30px; color: #ffe5a3; overflow-wrap: anywhere; }

.mini { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px 10px; }
.mini .bracket { --gap: 22px; --col-min: 168px; --m-size: 14px; --h-size: 12px; width: max-content; }
.mini .m { cursor: pointer; }

.code { text-align: center; justify-items: center; }
.bigcode { font-family: var(--f-display); font-size: clamp(40px, 13vw, 64px); letter-spacing: .12em; color: var(--brass); line-height: 1.1; }
.steps { text-align: left; margin: 0; padding-left: 20px; color: var(--muted); }
.steps b { color: var(--ivory); overflow-wrap: anywhere; }
.stat { margin: 0; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(18,29,26,.97); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabs button { background: none; border: 0; padding: 8px 2px 10px; min-height: 60px; display: grid; justify-items: center; gap: 2px; font-size: 13px; font-weight: 600; color: var(--muted); }
.tabs .ico { font-size: 16px; }
.tabs button[aria-current="page"] { color: var(--brass); }

.sheet { border: 1px solid var(--line); background: var(--ink-2); color: var(--ivory); border-radius: 18px; padding: 18px; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); }
.sheet::backdrop { background: rgba(0,0,0,.6); }
.sheet form { display: grid; gap: 12px; }
.sheet .label { margin: 0; }
.sheet .hint { margin: 0; }
.score { display: grid; gap: 10px; }
.srow { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; background: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.srow .who { font-weight: 700; font-size: 18px; overflow-wrap: anywhere; }
.srow .who button { display: block; margin-top: 6px; font-size: 13px; min-height: 32px; padding: 4px 10px; }
.srow .stepper { grid-template-columns: 44px 56px 44px; }
.srow.lead { border-color: var(--brass); }
.err { color: #ffb4a8; margin: 0; min-height: 1.2em; font-size: 15px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.actions .btn { flex: 1 1 auto; }
.ctitle { font-weight: 700; font-size: 18px; margin: 0; }
.affected { margin: 0; padding-left: 20px; color: var(--muted); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom, 0px)); z-index: 40; background: var(--ivory); color: #111; padding: 10px 16px; border-radius: 12px; font-weight: 600; max-width: calc(100vw - 32px); box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.toast.bad { background: #ffd3cb; }
@media (prefers-reduced-motion: no-preference) { .toast { animation: rise .2s ease-out; } }
@keyframes rise { from { transform: translate(-50%, 10px); opacity: 0; } }

/* Account */
.bar-r { display: flex; align-items: center; gap: 10px; min-width: 0; }
.acct { color: var(--ivory); text-decoration: none; font-weight: 600; font-size: 14px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct:hover { border-color: var(--muted); }
a.btn { text-decoration: none; color: inherit; }
a.btn.primary { color: #1b1305; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.promo-acct { gap: 8px; }
.promo-acct b { font-size: 18px; }
.promo-acct .hint { margin: 0; }
.saved li { display: flex; gap: 8px; align-items: center; }
.saved li > .open { flex: 1; min-width: 0; }
.saved li.empty { color: var(--muted); display: block; padding: 14px; text-align: left; border: 1px dashed var(--line); border-radius: 14px; }
.link.inline { display: inline; margin: 0; min-height: 0; color: var(--chalk); font-size: inherit; text-transform: none; letter-spacing: 0; font-family: inherit; text-decoration: underline; }
#ownerText a { color: var(--chalk); }
.nextcard { border-color: var(--brass); background: radial-gradient(ellipse at 50% 0, rgba(216,178,90,.18), transparent 70%), var(--ink-2); }
.roster { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 12px; }
.roster li { break-inside: avoid; padding: 4px 0; border-bottom: 1px solid var(--line); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster li.out { color: var(--muted); font-weight: 500; text-decoration: line-through; }
.roster li.champ { color: #ffe5a3; }
.roster li.champ::before { content: "★ "; }
.mini .bracket.free .pair { flex: 0 1 auto; }
.mini .bracket.free .col-body { justify-content: flex-start; }
