:root {
  color-scheme: light;
  --paper: #f5f8f5;
  --ink: #173335;
  --muted: #6b7d7a;
  --line: #cfdbd5;
  --sea: #dcebe5;
  --sea-deep: #286b68;
  --coral: #c84e34;
  --coral-soft: #f8e6df;
  --white: #fff;
  --display: "Barlow Condensed", Impact, sans-serif;
  --body: "DM Sans", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image: repeating-linear-gradient(0deg, transparent 0, transparent 31px, rgb(23 51 53 / 3%) 32px), repeating-linear-gradient(90deg, transparent 0, transparent 31px, rgb(23 51 53 / 2.5%) 32px);
  font-family: var(--body);
  font-size: 14px;
}

a { color: inherit; }

.topbar {
  min-height: 68px;
  padding: 0 clamp(22px, 6vw, 88px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.wordmark { font-weight: 700; text-decoration: none; letter-spacing: 0; }
.eyebrow, .section-bar, .share-label, .person-role, .saved-stamp {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
}

.page-shell { width: min(1050px, calc(100% - 44px)); margin: 0 auto; }
.page-intro { padding: 62px 0 34px; }
.eyebrow { margin: 0 0 12px; color: var(--sea-deep); display: flex; align-items: center; gap: 9px; }
.eyebrow-mark { width: 8px; height: 8px; background: var(--coral); display: inline-block; transform: rotate(45deg); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font: 600 64px/0.92 var(--display); letter-spacing: 0; }
.page-intro h1 span { color: var(--coral); }
.intro-copy { color: var(--muted); margin: 12px 0 0; }

.builder { border-top: 2px solid var(--ink); }
.draw-form { padding: 19px 0 0; }
.form-topline, .section-bar { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); }
.title-field { margin: 34px 0 28px; max-width: 540px; }
.field { display: flex; flex-direction: column; gap: 10px; }
.field > span { font-size: 12px; font-weight: 700; display: flex; justify-content: space-between; align-items: baseline; }
.field small { font-size: 9px; color: var(--muted); font-weight: 700; }
input, textarea { width: 100%; color: var(--ink); border: 1px solid var(--line); border-radius: 3px; background: rgb(255 255 255 / 72%); font: 500 14px var(--body); outline: none; }
input:focus, textarea:focus { border-color: var(--sea-deep); box-shadow: 0 0 0 2px rgb(40 107 104 / 12%); }
input { height: 46px; padding: 0 13px; }
textarea { min-height: 190px; padding: 13px; resize: vertical; line-height: 1.65; }
input::placeholder, textarea::placeholder { color: #96a6a1; }
.roster-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.form-bottom { display: flex; align-items: end; gap: 28px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.size-field { width: 250px; flex: 0 0 250px; }
.size-field input { width: 118px; }
.capacity-note { max-width: 330px; margin: 0 0 11px; color: var(--muted); font-size: 12px; }
.submit-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 0 48px; }
.button { min-height: 44px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; gap: 22px; border: 1px solid transparent; border-radius: 3px; text-decoration: none; font: 700 12px var(--body); cursor: pointer; }
.button-primary { color: var(--white); background: var(--sea-deep); }
.button-primary:hover { background: #1d5856; }
.button-secondary { background: transparent; border-color: var(--line); }
.button-secondary:hover { border-color: var(--ink); }
.error-box { margin: 18px 0; padding: 12px 16px; border-left: 3px solid var(--coral); background: var(--coral-soft); color: #803724; font-size: 13px; }
.error-box p { margin: 3px 0; }
.result-shell { padding-top: 55px; }
.result-heading { display: flex; justify-content: space-between; align-items: end; gap: 28px; padding-bottom: 28px; border-bottom: 2px solid var(--ink); }
.result-heading h1 { max-width: 650px; overflow-wrap: anywhere; }
.result-heading .intro-copy { margin-bottom: 0; }
.dot-separator { color: var(--coral); padding: 0 5px; }
.result-actions { display: flex; flex: 0 0 auto; gap: 8px; }
.share-strip { display: grid; grid-template-columns: 190px minmax(160px, 1fr) auto; gap: 22px; align-items: center; padding: 19px 0; border-bottom: 1px solid var(--line); }
.share-strip > div:first-child { display: flex; flex-direction: column; gap: 4px; }
.share-label { color: var(--sea-deep); }
.share-hint { color: var(--muted); font-size: 10px; }
.share-control { display: flex; gap: 7px; }
.share-control input { height: 38px; font-size: 11px; }
.copy-button { padding: 0 12px; border: 1px solid var(--line); border-radius: 3px; background: transparent; color: var(--ink); font: 700 11px var(--body); cursor: pointer; white-space: nowrap; }
.copy-button:hover { border-color: var(--sea-deep); }
.copy-status { min-width: 48px; color: var(--sea-deep); font-size: 11px; }
.teams-section { padding: 28px 0 38px; }
.team-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.team-card { min-width: 0; padding: 17px 19px 18px; border: 1px solid var(--line); border-top: 3px solid var(--sea-deep); border-radius: 4px; background: rgb(255 255 255 / 70%); }
.team-card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.team-card-top h2 { margin: 0; font: 600 25px/1 var(--display); }
.team-card-top > span { color: var(--muted); font-size: 11px; font-weight: 700; }
.captain-row { display: flex; flex-direction: column; gap: 5px; padding: 14px 0 10px; }
.person-role { color: var(--coral); }
.captain-row strong { overflow-wrap: anywhere; font-size: 14px; }
.member-list { list-style: none; margin: 0; padding: 0; }
.member-list li { padding: 7px 0; border-top: 1px solid #e5ece8; overflow-wrap: anywhere; }
.empty-team { margin: 9px 0 0; color: var(--muted); font-size: 12px; }
.overflow-section { padding: 22px 0 26px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.overflow-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; }
.overflow-heading .eyebrow { margin-bottom: 7px; color: var(--coral); }
.overflow-heading h2 { margin: 0; font: 600 34px/1 var(--display); }
.overflow-heading h2 span { color: var(--coral); }
.overflow-heading > p { margin: 0 0 3px; color: var(--muted); font-size: 12px; }
.overflow-list { display: flex; flex-wrap: wrap; gap: 7px; list-style: none; margin: 18px 0 0; padding: 0; }
.overflow-list li { padding: 8px 11px; border: 1px solid #e2b4a6; border-radius: 3px; background: var(--coral-soft); color: #803724; font-size: 12px; }
.no-overflow { margin: 15px 0 0; color: var(--sea-deep); font-size: 13px; }
.saved-stamp { margin: 16px 0 28px; color: var(--muted); }

@media (max-width: 700px) {
  .topbar { padding: 0 22px; }
  .page-intro { padding-top: 46px; }
  h1 { font-size: 55px; }
  .roster-grid, .team-grid { grid-template-columns: 1fr; }
  .roster-grid { gap: 22px; }
  .form-bottom { align-items: start; flex-direction: column; gap: 14px; }
  .capacity-note { margin: 0; }
  .submit-row { align-items: stretch; flex-direction: column; }
  .submit-row .button { align-self: flex-start; }
  .result-heading { align-items: start; flex-direction: column; }
  .result-actions { flex-wrap: wrap; }
  .share-strip { grid-template-columns: 1fr; gap: 10px; }
  .copy-status { min-height: 14px; }
  .overflow-heading { align-items: start; flex-direction: column; }
}

@media print {
  body { background: white; }
  .topbar, .result-actions, .share-strip { display: none; }
  .page-shell { width: 100%; }
  .result-shell { padding-top: 0; }
  .team-card { break-inside: avoid; background: white; }
}