:root {
  --bg: #07080d;
  --ink: #f4f6fb;
  --muted: rgba(244, 246, 251, 0.66);
  --line: rgba(255, 255, 255, 0.1);
  --indigo: #4f55f1;
  --violet: #7a3ff2;
  --lime: #d6ff4a;
  --card: rgba(16, 18, 34, 0.88);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: Manrope, "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(880px 420px at 8% -8%, rgba(122, 63, 242, 0.38), transparent 60%),
    radial-gradient(720px 380px at 110% 0%, rgba(79, 85, 241, 0.32), transparent 55%),
    var(--bg);
}

img { max-width: 100%; height: auto; display: block; }

button, input, select { font: inherit; color: inherit; }

button { cursor: pointer; }

a { color: inherit; }

h1, h2, h3, p { overflow-wrap: break-word; }

.spine {
  position: fixed;
  z-index: 8;
  left: 10px;
  right: 10px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  display: flex;
  gap: 2px;
  padding: 6px;
  border-radius: 26px;
  background: rgba(8, 10, 20, 0.9);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.seal {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: rgba(244, 246, 251, 0.62);
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 7px 0 6px;
  border-radius: 18px;
}

.seal svg { width: 22px; height: 22px; display: block; }

.seal span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seal.is-on {
  color: #fff;
  background: linear-gradient(180deg, var(--indigo), var(--violet));
}

.stage {
  width: min(640px, 100%);
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(132px + env(safe-area-inset-bottom));
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  color: #c5c8ff;
}

h1 {
  font-family: Syne, Manrope, sans-serif;
  font-weight: 700;
  font-size: clamp(32px, 9vw, 56px);
  line-height: 0.94;
  letter-spacing: -0.045em;
  margin: 6px 0 8px;
}

h2 {
  font-family: Syne, Manrope, sans-serif;
  font-weight: 700;
  font-size: clamp(24px, 6vw, 34px);
  letter-spacing: -0.03em;
  margin: 22px 0 8px;
}

h3 { margin: 0; font-size: 16px; }

.lead, .quiet {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.quiet { font-size: 14px; }

.stack { display: grid; gap: 12px; margin-top: 16px; }

.hero, .hero-square {
  width: 100%;
  object-fit: cover;
  border-radius: 22px;
  border: 1px solid var(--line);
}

.hero { aspect-ratio: 3 / 2; }

.hero-square { aspect-ratio: 1; }

figure { margin: 0; }

figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.card, .member, .entry, .balance-row {
  min-width: 0;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(79, 85, 241, 0.14), rgba(255, 255, 255, 0.03));
}

.card { padding: 16px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 14px 0;
}

.stat {
  min-width: 0;
  text-align: center;
  padding: 8px 4px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.stat span {
  display: block;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat strong {
  font-size: clamp(14px, 4.2vw, 20px);
  font-variant-numeric: tabular-nums;
}

.play { display: grid; gap: 12px; }

.table-wrap { width: 100%; min-width: 0; }

#halo {
  display: block;
  margin: 0 auto;
  max-width: 100%;
}

.plaque {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
}

.plaque h2 { margin: 0; font-size: clamp(20px, 5vw, 28px); }

.plaque p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.rule {
  display: inline-flex;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(79, 85, 241, 0.22);
  color: #e6e7ff;
  font-size: 12px;
  letter-spacing: 0.03em;
}

.seats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.seat {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 4px;
  align-items: center;
  min-width: 0;
  padding: 6px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.seat.is-payer { border-color: rgba(214, 255, 74, 0.75); }

.step {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  background: var(--indigo);
  color: #fff;
  font-size: 22px;
  line-height: 1;
}

.seat.is-locked .step { opacity: 0.38; }

.seat-mid { min-width: 0; text-align: center; }

.seat-mid b, .member input, .entry h3, .balance-row span, .check span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-mid b { font-size: 14px; font-weight: 650; }

.seat-mid em {
  font-style: normal;
  font-variant-numeric: tabular-nums;
  color: var(--lime);
  font-size: 18px;
}

.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.cta, .ghost, .pill, .toggle {
  min-height: 48px;
  border-radius: 999px;
}

.cta {
  flex: 1 1 180px;
  border: 0;
  padding: 0 18px;
  background: #f4f6fb;
  color: #14151c;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ghost, .pill, .toggle {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: var(--ink);
  padding: 0 16px;
}

.pill.is-on, .toggle.is-on {
  background: #f4f6fb;
  color: #14151c;
  border-color: transparent;
}

.readout, .note {
  min-height: 3.2em;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.note { min-height: 1.4em; color: #ffb4c0; }

.note.ok { color: var(--lime); }

.form, .stack-form { display: grid; gap: 10px; min-width: 0; }

.field { display: grid; gap: 6px; min-width: 0; font-size: 13px; color: var(--muted); }

.row2 { display: grid; grid-template-columns: 1fr; gap: 10px; }

input, select {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #12141f;
  color: var(--ink);
  font-size: 16px;
}

.share-input { width: 72px; text-align: center; padding: 0 6px; }

.form.is-even .share-input, .form.is-custom .toggle { display: none; }

.joiner, .check, .person-add {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.person-add input { flex: 1 1 0; width: auto; min-width: 0; }

.toggle, .share-input { flex: 0 0 auto; }

.card .cta { margin-top: 14px; }

.joiner, .check {
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.joiner span, .check span { flex: 1 1 auto; }

.check input { width: 22px; height: 22px; min-height: 22px; flex: 0 0 auto; accent-color: var(--indigo); }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }

.entry { padding: 14px; }

.entry-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.entry-top strong { font-variant-numeric: tabular-nums; white-space: nowrap; }

.entry h3 { white-space: normal; overflow: visible; text-overflow: unset; }

.meta { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.entry-actions { display: flex; gap: 14px; }

.texty {
  background: none;
  border: 0;
  color: #c9cbff;
  min-height: 44px;
  padding: 8px 0;
}

.member {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
  padding: 12px;
}

.member .texty { grid-column: 2; min-height: 36px; padding-top: 0; }

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 30%, #b7baff, var(--tint, var(--indigo)) 62%, #2a2158);
  font-family: Syne, sans-serif;
  font-weight: 700;
}

.member input {
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  min-height: 32px;
  padding: 0;
  font-weight: 700;
}

.member input:focus { border-bottom-color: var(--indigo); outline: none; }

.role, .net { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.net.plus { color: var(--lime); }

.net.minus { color: #ffb4c0; }

.balance-head, .balance-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.balance-head {
  padding: 0 12px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.balance-row { padding: 12px 14px; margin-top: 8px; }

.balance-row b { font-variant-numeric: tabular-nums; white-space: nowrap; }

.people { display: grid; gap: 10px; }

.story p + p { margin-top: 10px; }

:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

@media (min-width: 640px) {
  .row2 { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 760px), (orientation: landscape) and (min-width: 640px) {
  .people { grid-template-columns: 1fr 1fr; }
  .play { grid-template-columns: minmax(0, 1.05fr) minmax(200px, 0.95fr); align-items: start; }
  .play-table { min-width: 0; }
}

@media (orientation: landscape) and (max-width: 959px) {
  .spine {
    top: 10px;
    bottom: 10px;
    left: 8px;
    right: auto;
    width: 72px;
    flex-direction: column;
    justify-content: center;
    border-radius: 24px;
  }
  .seal span { display: none; }
  .stage {
    width: auto;
    margin-left: 88px;
    padding: 12px 12px 16px 8px;
  }
}

@media (min-width: 960px) {
  .spine {
    top: 16px;
    bottom: 16px;
    left: 16px;
    right: auto;
    width: 96px;
    flex-direction: column;
    justify-content: center;
    border-radius: 32px;
  }
  .seal { flex: 0 0 auto; padding: 12px 0; }
  .stage {
    width: min(760px, calc(100% - 150px));
    margin: 0 0 0 128px;
    padding: 28px 8px 36px 12px;
  }
}

.check span, .balance-row span, .balance-head span, .joiner span {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

@media (max-width: 359px) {
  .seal { font-size: 9px; padding-left: 1px; padding-right: 1px; }
  .stats { gap: 4px; }
  .seat { grid-template-columns: 38px minmax(0, 1fr) 38px; }
  .step { width: 38px; height: 38px; }
}
