:root {
  --ink: #101418;
  --ink-soft: #5f666c;
  --ink-faint: #8a9196;
  --paper: #f6f4ef;
  --paper-deep: #ebe8e1;
  --white: #fffefa;
  --coral: #ff654f;
  --coral-deep: #e6533f;
  --mint: #cfe8d9;
  --yellow: #f2cf77;
  --avatar-blue: #b7cef3;
  --avatar-violet: #c8b9e8;
  --avatar-rose: #e5b6d1;
  --avatar-slate: #9fb4d1;
  --avatar-cyan: #a4d8df;
  --avatar-plum: #cfbdd6;
  --line: rgba(16, 20, 24, 0.11);
  --shadow: 0 18px 45px rgba(16, 20, 24, 0.08);
  --bottom-nav-height: 46px;
  --display: "Fraunces", "Noto Serif SC", Georgia, serif;
  --sans: "DM Sans", "Noto Sans SC", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "DM Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html { background: #0e1214; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 5%, rgba(255, 101, 79, 0.1), transparent 22rem),
    #0e1214;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button { border: 0; cursor: pointer; }

.app-shell {
  width: 100%;
  max-width: 520px;
  min-height: 100svh;
  margin: 0 auto;
  background: var(--paper);
  position: relative;
  overflow-x: hidden;
  padding-bottom: calc(var(--bottom-nav-height) + 22px + env(safe-area-inset-bottom));
}

.topbar {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  color: var(--paper);
  background: var(--ink);
}
.brand-lockup { display: flex; align-items: center; gap: 10px; }
.brand-name { font: 600 12px/1 var(--mono); letter-spacing: .16em; }
.brand-mark { width: 19px; height: 18px; display: inline-flex; align-items: flex-end; gap: 3px; }
.brand-mark i { display: block; width: 4px; background: var(--coral); border-radius: 3px; }
.brand-mark i:nth-child(1) { height: 9px; opacity: .72; }
.brand-mark i:nth-child(2) { height: 14px; opacity: .88; }
.brand-mark i:nth-child(3) { height: 18px; }
.more-button, .close-button { background: transparent; color: inherit; }

.main-content { padding: 30px 20px 20px; }
.event-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.eyebrow { margin: 0 0 8px; color: var(--coral); font: 500 10px/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.eyebrow.muted { color: var(--ink-faint); }
.event-head .eyebrow { color: var(--ink-soft); }
.live-dot { width: 6px; height: 6px; display: inline-block; vertical-align: 1px; margin-right: 6px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 4px rgba(255,101,79,.12); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font: 700 clamp(30px, 8.5vw, 42px)/1.15 var(--sans); letter-spacing: -.02em; font-variant-numeric: lining-nums tabular-nums; }
h2 { margin-bottom: 0; font: 700 26px/1.06 var(--display); letter-spacing: -.04em; }
.more-button { width: 35px; height: 35px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; margin-top: 7px; }
.plus-glyph { color: var(--ink); font: 400 24px/1 var(--sans); transform: translateY(-1px); }

.overview-card { position: relative; overflow: hidden; margin-top: 26px; padding: 20px 19px 17px; border-radius: 18px; color: var(--paper); background: var(--ink); box-shadow: var(--shadow); }
.overview-card::after { content: ""; position: absolute; width: 180px; height: 180px; right: -65px; top: -92px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; box-shadow: 0 0 0 20px rgba(255,255,255,.02), 0 0 0 40px rgba(255,255,255,.018); }
.overview-topline, .overview-foot { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; }
.mono-label, .round-count, .tiny-note { color: rgba(246,244,239,.55); font: 500 10px/1 var(--mono); letter-spacing: .08em; }
.round-count { padding: 7px 9px; border: 1px solid rgba(255,255,255,.13); border-radius: 30px; color: rgba(246,244,239,.78); }
.overview-main { position: relative; z-index: 1; display: flex; align-items: flex-end; justify-content: space-between; margin: 24px 0 20px; }
.metric-label { margin-bottom: 9px; color: rgba(246,244,239,.52); font-size: 12px; }
.leader-line { display: flex; align-items: center; gap: 9px; }
.leader-avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: var(--ink); background: var(--avatar-bg, var(--paper-deep)); font-weight: 700; font-size: 12px; }
.leader-avatar.tie { color: var(--ink); background: var(--paper-deep); font-size: 10px; }
.leader-line strong { font: 700 23px/1 var(--display); }
.leader-record { color: rgba(246,244,239,.6); font-size: 12px; }
.progress-ring { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--coral) var(--progress, 67%), rgba(255,255,255,.12) 0); position: relative; }
.progress-ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--ink); }
.progress-ring span { position: relative; z-index: 1; font: 500 12px var(--mono); }
.overview-foot { padding-top: 14px; border-top: 1px solid rgba(255,255,255,.12); color: rgba(246,244,239,.58); font-size: 11px; }
.overview-avatars { display: flex; align-items: center; flex: none; isolation: isolate; }
.overview-avatars .player-avatar { position: relative; width: 24px; height: 24px; box-shadow: 0 0 0 3px var(--ink); }
.overview-avatars .player-avatar + .player-avatar { margin-left: -4px; }

.view-panel { margin-top: 33px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 17px; }
.text-button { padding: 0; color: var(--coral-deep); background: transparent; font-size: 12px; font-weight: 700; }
.round-list { display: grid; gap: 12px; }
.round-block { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--white); box-shadow: 0 8px 18px rgba(16,20,24,.025); }
.round-block.is-open { border-color: rgba(255,101,79,.38); box-shadow: 0 10px 22px rgba(255,101,79,.08); }
.round-block.is-current { border-color: rgba(255,101,79,.65); box-shadow: inset 0 0 0 1px rgba(255,101,79,.65), 0 10px 22px rgba(255,101,79,.08); }
.round-header-wrap { display: flex; align-items: center; min-width: 0; padding: 0 8px 0 16px; }
.round-header { flex: 1; min-width: 0; display: flex; align-items: center; padding: 16px 0 14px; color: var(--ink); background: transparent; text-align: left; }
.round-meta { display: flex; align-items: center; gap: 10px; min-width: 0; }
.round-number { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: var(--paper); background: var(--ink); font: 500 12px var(--mono); }
.round-block.is-open .round-number { color: var(--ink); background: var(--coral); }
.round-info { min-width: 0; }
.round-title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-bottom: 3px; }
.round-title { display: block; white-space: nowrap; font-weight: 700; font-size: 14px; }
.round-subtitle { display: block; color: var(--ink-faint); font: 10px var(--mono); }
.round-status { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; color: #33704c; font-size: 10px; font-weight: 700; }
.round-status.pending { color: #89641d; }
.round-status .status-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.round-toggle-button { flex: none; align-self: stretch; display: grid; place-items: center; width: 44px; min-height: 44px; padding: 0; color: var(--ink-soft); background: transparent; touch-action: manipulation; }
.round-toggle-icon { width: 12px; height: 8px; pointer-events: none; transition: transform .2s ease; }
.round-block.is-open .round-toggle-icon { transform: rotate(180deg); }
.round-toggle-button:active { color: var(--coral-deep); }
.round-header:focus-visible, .round-toggle-button:focus-visible { outline: 2px solid var(--coral-deep); outline-offset: -3px; border-radius: 8px; }
.round-lock-button { flex: none; margin: 0 4px 0 8px; padding: 7px 9px; border: 1px solid rgba(16,20,24,.14); border-radius: 20px; color: var(--ink-soft); background: var(--paper); font-size: 10px; font-weight: 700; }
.round-lock-button:hover { border-color: var(--coral); color: var(--coral-deep); }
.round-lock-button.is-locked { color: var(--paper); border-color: var(--ink); background: var(--ink); }
.match-list { display: none; padding: 0 14px 14px; }
.round-block.is-open .match-list { display: grid; gap: 8px; }
.match-card { padding: 13px 12px 11px; border-radius: 12px; background: var(--paper); }
.match-top { display: flex; align-items: center; margin-bottom: 10px; }
.match-index { color: var(--ink-faint); font: 10px var(--mono); }
.players-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 6px; }
.player-chip { min-width: 0; display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; }
.player-chip > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.player-chip:last-child { justify-content: flex-end; text-align: right; }
.player-avatar { flex: none; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; color: var(--ink); font: 700 10px var(--mono); background: var(--avatar-bg, var(--avatar-blue)); }
/* Keep saved tournament accents compatible with the dedicated avatar palette. */
:is(.player-avatar, .leader-avatar):is(.blue, .yellow) { --avatar-bg: var(--avatar-blue); }
:is(.player-avatar, .leader-avatar):is(.violet, .coral) { --avatar-bg: var(--avatar-violet); }
:is(.player-avatar, .leader-avatar):is(.rose, .mint) { --avatar-bg: var(--avatar-rose); }
:is(.player-avatar, .leader-avatar):is(.slate, .lavender) { --avatar-bg: var(--avatar-slate); }
:is(.player-avatar, .leader-avatar):is(.cyan, .sky) { --avatar-bg: var(--avatar-cyan); }
:is(.player-avatar, .leader-avatar):is(.plum, .peach) { --avatar-bg: var(--avatar-plum); }
.versus { color: var(--ink-faint); font: 10px var(--mono); }
.break-controls { display: flex; align-items: center; }
.break-button { flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; color: var(--ink-soft); background: transparent; touch-action: manipulation; }
.break-button svg { width: 22px; height: 22px; opacity: .4; pointer-events: none; transition: opacity .16s ease; }
.break-ball-body { fill: transparent; stroke: currentColor; stroke-width: 1.4; }
.break-ball-center { fill: var(--paper); }
.break-button[aria-pressed="true"] { color: var(--ink); }
.break-button[aria-pressed="true"] svg { opacity: 1; }
.break-button[aria-pressed="true"] .break-ball-body { fill: currentColor; }
.break-button[aria-pressed="true"] .break-ball-center { fill: var(--white); }
.break-button[aria-pressed="false"]:hover:not(:disabled) svg { opacity: .7; }
.break-button:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; border-radius: 50%; }
.break-button:disabled { cursor: not-allowed; }
@media (max-width: 360px) {
  .players-row .player-chip { gap: 3px; }
  .players-row .player-avatar { width: 20px; height: 20px; }
}
.result-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 5px; margin-top: 11px; }
.result-button { min-height: 28px; padding: 0 4px; border: 1px solid rgba(16,20,24,.12); border-radius: 7px; color: var(--ink-soft); background: var(--white); font-size: 10px; transition: all .16s ease; }
.result-button:hover { border-color: var(--coral); }
.result-button:disabled { cursor: not-allowed; opacity: .62; }
.result-button:disabled:hover { border-color: rgba(16,20,24,.12); }
.result-button.is-selected { color: var(--paper); border-color: var(--ink); background: var(--ink); }
.result-button.draw.is-selected { color: var(--ink); border-color: var(--yellow); background: var(--yellow); }

.standings-card { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--white); }
.standing-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) 50px 50px; align-items: center; min-height: 65px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.standing-row:last-child { border-bottom: 0; }
.standing-rank { color: var(--ink-faint); font: 500 12px var(--mono); }
.standing-rank.top { color: var(--coral-deep); font-weight: 700; }
.standing-player { display: flex; align-items: center; gap: 8px; min-width: 0; }
.standing-player strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.standing-record { color: var(--ink-soft); font: 10px var(--mono); }
.standing-points { text-align: right; }
.standing-points strong { display: block; font: 700 18px var(--display); }
.standing-points small { display: block; margin-top: 1px; color: var(--ink-faint); font-size: 9px; }
.standing-head { display: grid; grid-template-columns: 32px minmax(0, 1fr) 50px 50px; padding: 10px 24px; color: var(--ink-faint); border-bottom: 1px solid var(--line); font: 10px var(--mono); }
.standing-head span:last-child { text-align: right; }
.ranking-note { margin-top: 13px; color: var(--ink-faint); font-size: 11px; line-height: 1.5; text-align: center; }

.app-shell:has(.history-view:not(.is-hidden)) { display: flex; flex-direction: column; }
.app-shell:has(.history-view:not(.is-hidden)) .topbar { flex-shrink: 0; }
.main-content:has(.history-view:not(.is-hidden)) { display: flex; flex: 1; flex-direction: column; }
.history-view { display: flex; flex: 1; flex-direction: column; margin-top: 0; }
.history-view .section-heading { margin-bottom: 12px; }
.history-view .text-button { min-height: 44px; flex-shrink: 0; }
.history-note { margin-bottom: 23px; color: var(--ink-soft); font-size: 12px; }
.history-note:empty { display: none; }
.history-list { display: grid; gap: 14px; }
.history-list:empty { display: none; }
.history-card { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--white); }
.history-summary { display: block; padding: 18px; cursor: pointer; list-style: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.history-summary::-webkit-details-marker, .history-round > summary::-webkit-details-marker { display: none; }
.history-date { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink-soft); font: 11px/1.5 var(--mono); }
.history-status { flex-shrink: 0; color: #8d631c; font: 500 11px/1.5 var(--sans); }
.history-status.is-complete { color: #38674d; }
.history-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.history-title-row > strong { min-width: 0; font-size: 20px; line-height: 1.4; overflow-wrap: anywhere; }
.history-chevron { flex: none; width: 20px; height: 20px; fill: none; stroke: var(--ink-soft); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.history-card[open] > summary .history-chevron, .history-round[open] > summary .history-chevron { transform: rotate(180deg); }
.history-meta, .history-players { display: block; margin-top: 7px; color: var(--ink-soft); font-size: 12px; line-height: 1.7; }
.history-players { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; }
.history-result { display: flex; align-items: baseline; gap: 9px; margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.6; }
.history-result > span:first-child { color: var(--ink-soft); flex-shrink: 0; }
.history-result > strong { min-width: 0; overflow-wrap: anywhere; }
.history-detail-label { margin-left: auto; color: var(--coral-deep); white-space: nowrap; font-size: 11px; }
.history-card[open] .history-detail-label { display: none; }
.history-detail { padding: 0 18px 18px; border-top: 1px solid var(--line); }
.history-detail h3 { margin: 18px 0 7px; font-size: 14px; }
.history-rule { margin-bottom: 12px; color: var(--ink-soft); font-size: 11px; }
.history-detail .standings-card { border-radius: 10px; }
.history-detail .standing-head, .history-detail .standing-row { grid-template-columns: 25px minmax(0, 1fr) 60px 35px; }
.history-detail .standing-player { gap: 5px; }
.history-detail .standing-player strong { white-space: normal; overflow-wrap: anywhere; font-size: 12px; }
.history-detail .standing-row { padding-top: 10px; padding-bottom: 10px; }
.history-detail .player-avatar { width: 22px; height: 22px; }
.history-detail .history-rounds-title { margin-top: 24px; }
.history-round { border-bottom: 1px solid var(--line); }
.history-round:last-child { border-bottom: 0; }
.history-round > summary { display: flex; align-items: center; gap: 8px; min-height: 48px; cursor: pointer; list-style: none; font-size: 12px; font-weight: 600; }
.history-round > summary > span:nth-child(2) { margin-left: auto; color: var(--ink-soft); font-size: 11px; font-weight: 400; }
.history-matches { padding-bottom: 8px; }
.history-match { display: grid; grid-template-columns: minmax(0, 1fr) minmax(60px, auto); align-items: baseline; gap: 12px; padding: 10px 0; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.history-match > strong { text-align: right; font-size: 11px; }
.history-match .is-pending { color: var(--ink-soft); font-weight: 400; }
.history-content:has(.history-empty:not(.is-hidden)) { display: flex; flex: 1; flex-direction: column; border-top: 1px solid var(--line); }
/* Share spare height above and below the whole empty state, slightly favoring the bottom. */
.history-content:has(.history-empty:not(.is-hidden))::before { content: ""; flex: .85 0 32px; }
.history-content:has(.history-empty:not(.is-hidden))::after { content: ""; flex: 1.15 0 32px; }
.history-empty { flex-shrink: 0; padding: 0 25px; text-align: center; }
.history-empty-icon { width: 48px; height: 48px; margin-bottom: 18px; fill: none; stroke: var(--ink-soft); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.history-icon-back { fill: var(--paper-deep); stroke: var(--ink-faint); }
.history-icon-page { fill: var(--white); }
.history-icon-trophy { stroke: var(--coral-deep); }
.history-icon-lines { stroke: var(--ink-faint); }
.history-empty h3 { margin: 0 0 12px; font-size: 17px; }
.history-empty p { max-width: 280px; margin: 0 auto 18px; color: var(--ink-soft); font-size: 13px; line-height: 1.9; }
.history-storage-note { margin: 24px 0 0; color: var(--ink-soft); font-size: 11px; text-align: center; }
.history-empty:not(.is-hidden) + .history-storage-note { flex-shrink: 0; margin-top: 48px; }
.history-summary:focus-visible, .history-round > summary:focus-visible { outline: 2px solid var(--coral-deep); outline-offset: -3px; border-radius: 8px; }
.history-view button:focus-visible, .nav-item:focus-visible { outline: 2px solid var(--coral-deep); outline-offset: 3px; border-radius: 4px; }
.history-delete-dialog { width: min(360px, calc(100% - 40px)); max-height: 90svh; margin: auto; padding: 24px; overflow: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow); }
.history-delete-dialog::backdrop { background: rgba(10,13,15,.54); }
.history-delete-dialog h2 { font: 700 20px/1.4 var(--sans); letter-spacing: 0; }
.history-delete-name { margin: 14px 0 8px; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.history-delete-description { margin-bottom: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.8; }
.history-delete-error { margin: 12px 0 0; color: #a12b20; font-size: 12px; line-height: 1.6; }
.history-delete-error:empty { display: none; }
.history-delete-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 24px; }
.history-delete-actions button { min-height: 44px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.history-delete-cancel { border: 1px solid var(--line); color: var(--ink); background: var(--white); }
.history-delete-confirm { color: var(--white); background: #ad3428; }
.history-delete-actions button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.finish-banner { position: relative; overflow: hidden; margin-top: 32px; padding: 25px 20px 20px; border-radius: 17px; background: var(--coral); }
.finish-banner::after { content: ""; position: absolute; pointer-events: none; width: 220px; height: 220px; border: 1px solid rgba(16,20,24,.12); border-radius: 50%; right: -100px; top: -70px; box-shadow: 0 0 0 19px rgba(16,20,24,.04), 0 0 0 39px rgba(16,20,24,.035); }
.finish-confetti { position: absolute; right: 23px; top: 24px; color: var(--paper); font-size: 27px; transform: rotate(16deg); }
.finish-banner .eyebrow { color: rgba(16,20,24,.58); }
.finish-banner h2 { margin-bottom: 8px; }
.finish-banner p:not(.eyebrow) { position: relative; z-index: 1; color: #30201b; font-size: 12px; line-height: 1.6; }
.primary-button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 48px; padding: 0 16px; border-radius: 11px; color: var(--paper); background: var(--ink); font-weight: 700; font-size: 12px; transition: transform .18s ease, box-shadow .18s ease; }
.primary-button:hover { box-shadow: 0 7px 16px rgba(16,20,24,.18); transform: translateY(-1px); }
.finish-banner .primary-button { position: relative; z-index: 1; margin-top: 20px; }
.save-result-button { justify-content: center; font-size: 14px; }
.save-result-button:disabled { cursor: wait; opacity: .75; }
.save-result-button:focus-visible { outline: 3px solid var(--white); outline-offset: 3px; }
.podium-strip { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 20px 0 16px; }
.podium-item { min-width: 0; padding: 14px 8px; border: 1px solid rgba(16,20,24,.06); border-radius: 12px; color: var(--ink); background: var(--white); text-align: center; }
.podium-rank { display: inline-flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 3px; min-height: 28px; margin-bottom: 12px; padding: 3px 6px; border-radius: 6px; font-size: 11px; line-height: 1.4; font-weight: 700; }
.podium-rank svg { flex: none; width: 16px; height: 20px; }
.podium-rank > span { white-space: nowrap; }
.podium-rank-1 { color: #785016; background: #f8edcb; }
.podium-rank-2 { color: #48566a; background: #eaf0f5; }
.podium-rank-3 { color: #864528; background: #f7e7db; }
.podium-name { display: block; font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.podium-score { display: flex; align-items: baseline; justify-content: center; gap: 3px; margin-top: 10px; }
.podium-score b { font: 500 25px/1.2 var(--mono); font-variant-numeric: tabular-nums; }
.podium-score > span { color: #50585f; font-size: 11px; }
.podium-record { display: block; margin-top: 5px; color: #50585f; font-size: 11px; line-height: 1.6; }

.bottom-nav { position: fixed; z-index: 20; bottom: 0; left: 50%; display: grid; grid-template-columns: repeat(3, 1fr); width: min(520px, 100%); height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom)); padding: 0 16px env(safe-area-inset-bottom); border-top: 1px solid rgba(16,20,24,.09); background: rgba(246,244,239,.94); backdrop-filter: blur(16px); transform: translateX(-50%); }
.nav-item { display: grid; place-items: center; min-height: 44px; padding: 0; color: var(--ink-faint); background: transparent; font-size: 12px; line-height: 1.4; }
.nav-item.is-active { color: var(--coral-deep); font-weight: 700; }

html.modal-open { overflow: hidden; overscroll-behavior: none; }
html.modal-open body { position: fixed; top: var(--modal-scroll-top); left: 0; width: 100%; padding-right: var(--modal-scrollbar-width); overflow: hidden; }
.modal-backdrop { position: fixed; z-index: 40; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding: 0; background: rgba(10,13,15,.54); opacity: 0; visibility: hidden; transition: opacity .22s ease, visibility .22s ease; }
.modal-backdrop.is-open { opacity: 1; visibility: visible; }
.modal-sheet { width: min(520px, 100%); max-height: 90svh; overflow: auto; overscroll-behavior: contain; padding: 12px 20px calc(24px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; background: var(--paper); transform: translateY(22px); transition: transform .24s cubic-bezier(.2,.75,.25,1); }
.modal-backdrop.is-open .modal-sheet { transform: translateY(0); }
.sheet-handle { width: 34px; height: 4px; margin: 0 auto 20px; border-radius: 99px; background: rgba(16,20,24,.16); }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; }
.close-button { width: 30px; height: 30px; border-radius: 50%; color: var(--ink-soft); font-size: 25px; line-height: 1; }
.field-label { display: flex; justify-content: space-between; margin: 0 0 8px; color: var(--ink); font-size: 12px; font-weight: 700; }
.field-label span { color: var(--ink-faint); font-weight: 400; }
.text-input { width: 100%; margin-bottom: 18px; padding: 13px 12px; border: 1px solid var(--line); border-radius: 10px; outline: none; color: var(--ink); background: var(--white); font-size: 14px; transition: border .18s ease, box-shadow .18s ease; }
.text-input:focus { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(255,101,79,.13); }
.textarea { resize: vertical; line-height: 1.6; }
.participant-editor { display: grid; gap: 8px; max-height: 226px; overflow: auto; padding-right: 2px; }
.participant-row { display: flex; align-items: center; gap: 9px; padding: 7px 9px 7px 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--white); transition: border .18s ease, box-shadow .18s ease; }
.participant-row:focus-within { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(255,101,79,.11); }
.participant-number { flex: none; color: var(--ink-faint); font: 10px var(--mono); }
.participant-input { width: 100%; min-width: 0; padding: 5px 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 14px; }
.remove-participant { flex: none; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; color: var(--ink-faint); background: transparent; font-size: 18px; line-height: 1; }
.remove-participant:hover { color: var(--coral-deep); background: #ffe4df; }
.remove-participant:disabled { cursor: not-allowed; opacity: .28; }
.add-participant-button { display: flex; align-items: center; gap: 5px; width: 100%; margin: 9px 0 19px; padding: 10px 11px; border: 1px dashed rgba(255,101,79,.45); border-radius: 10px; color: var(--coral-deep); background: rgba(255,101,79,.045); font-size: 12px; font-weight: 700; }
.add-participant-button span { font-size: 16px; line-height: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-submit { justify-content: center; margin-top: 4px; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(var(--bottom-nav-height) + 14px + env(safe-area-inset-bottom)); padding: 11px 15px; border-radius: 99px; color: var(--paper); background: var(--ink); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: all .22s ease; font-size: 12px; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.is-hidden { display: none !important; }
.section-enter { animation: rise .5s both cubic-bezier(.2,.75,.25,1); }
.delay-1 { animation-delay: .06s; }
.delay-2 { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }

@media (min-width: 600px) {
  .app-shell { box-shadow: 0 0 80px rgba(0,0,0,.35); }
  .bottom-nav { border-right: 1px solid rgba(16,20,24,.09); border-left: 1px solid rgba(16,20,24,.09); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
