:root {
  --text: #333;
  --muted: #666;
  --border: #d4d4d4;
  --button: #e9e9e9;
  --hover: #777;
  --accent: #c03;
  --white: #fff;
  font-family: Verdana, Arial, Helvetica, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { background: var(--white); }
body { min-width: 320px; }
button, input { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(960px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 34px;
}

.hero {
  padding: 8px 0 22px;
  margin-bottom: 18px;
  border-bottom: 1px solid #dadada;
}
.hero .eyebrow, .hero-badge, .results-header .eyebrow { display: none; }
.hero h1 {
  margin: 0 0 6px;
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.05;
  color: var(--text);
}
.hero h1 br { display: none; }
.hero .intro { margin: 0; color: var(--muted); font-size: .96rem; line-height: 1.5; }

.panel, .create-panel, .results-section {
  padding: 18px 20px;
  margin-bottom: 18px;
  border: 1px solid #dadada;
  border-radius: 12px;
  background: var(--white);
}

.section-heading, .results-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding-bottom: 10px;
  margin-bottom: 18px;
  border-bottom: 1px solid #e5e5e5;
}
.section-heading > div { display: flex; align-items: center; gap: 8px; }
.step {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 8px;
  color: var(--white);
  background: var(--accent);
  font-size: .78rem;
  font-weight: 700;
}

.count-badge { padding: 5px 9px; border-radius: 999px; background: #f2f2f2; font-size: .8rem; }

.form-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1.1fr;
  gap: 15px;
  align-items: end;
}
.field { min-width: 0; }
.field > span:first-child, .field legend {
  display: block;
  margin-bottom: 8px;
  color: #555;
  font-size: .85rem;
  font-weight: 600;
}
.field input[type="text"] {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #c7c7c7;
  border-radius: 9px;
  background: var(--white);
}
.gender-field { margin: 0; padding: 0; border: 0; }
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 42px;
  overflow: hidden;
  border: 1px solid #c7c7c7;
  border-radius: 9px;
}
.segmented label { position: relative; display: grid; place-items: center; background: var(--button); font-size: .88rem; }
.segmented label + label { border-left: 1px solid #c7c7c7; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { width: 100%; height: 100%; display: grid; place-items: center; }
.segmented label:hover span { color: var(--white); background: var(--hover); }
.segmented input:checked + span { color: var(--white); background: var(--accent); font-weight: 700; }

.strength-label { display: flex !important; justify-content: space-between; align-items: center; }
.strength-label output {
  min-width: 32px;
  padding: 4px 7px;
  border-radius: 6px;
  color: var(--white);
  background: var(--hover);
  text-align: center;
}
input[type="range"] { width: 100%; accent-color: var(--accent); }
.range-labels { display: flex !important; justify-content: space-between; margin: 0 !important; color: var(--muted); font-size: .72rem !important; }

.btn, .delete-btn {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid #d2d2d2;
  border-radius: 9px;
  color: var(--text);
  background: var(--button);
  font-weight: 600;
}
.btn:hover, .delete-btn:hover, .number-control button:hover { color: var(--white); background: var(--hover); border-color: var(--hover); }
.add-btn, .btn-accent { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.add-btn { margin-top: 18px; }
.btn-accent { grid-column: 1 / -1; }

.message { min-height: 1.2em; margin: 10px 0 0; color: #a22; font-size: .85rem; }
.roster { display: grid; gap: 6px; }
.empty-state { padding: 24px; border: 1px dashed #bbb; border-radius: 12px; color: var(--muted); text-align: center; }
.person-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 9px;
}
.person-name { overflow-wrap: anywhere; font-weight: 600; }
.tag { padding: 5px 9px; border-radius: 7px; color: var(--text); background: var(--button); font-size: .72rem; font-weight: 700; }
.tag.strength { min-width: 42px; text-align: center; }
.icon-btn { width: 34px; height: 34px; border: 0; border-radius: 9px; color: #922b19; background: transparent; }
.icon-btn:hover { color: var(--white); background: var(--hover); }

.create-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin: 22px 0; }
.create-panel .step { margin-right: 8px; }
.create-panel h2 { display: inline; }
.create-panel p { margin: 10px 0 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.team-controls { display: grid; grid-template-columns: auto 135px; gap: 10px 16px; align-items: center; }
.team-controls > label { font-size: .85rem; font-weight: 600; }
.number-control {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  height: 42px;
  overflow: hidden;
  border: 1px solid #c7c7c7;
  border-radius: 9px;
}
.number-control button, .number-control input { border: 0; color: var(--text); background: var(--button); text-align: center; font-weight: 600; }
.number-control input { min-width: 0; background: var(--white); appearance: textfield; }
.number-control input::-webkit-inner-spin-button { appearance: none; }
.team-message { grid-column: 1 / -1; margin: 0; }

.results-section { margin-top: 0; }
.results-header > p { max-width: 430px; margin: 0; color: var(--muted); font-size: .88rem; }
.teams-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.team-card { overflow: hidden; border: 1px solid var(--border); border-radius: 12px; }
.team-card-header { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 11px 13px; border-bottom: 1px solid var(--border); background: var(--button); }
.team-card-header h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.team-score { font-size: .75rem; font-weight: 700; }
.team-list { list-style: none; margin: 0; padding: 5px 13px 10px; }
.team-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid #e5e5e5; }
.team-list li:last-child { border-bottom: 0; }
.member-meta { white-space: nowrap; color: var(--muted); font-size: .78rem; }
.team-summary { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 13px 12px; }
.team-summary span { padding: 4px 7px; border-radius: 6px; background: var(--button); font-size: .7rem; }

footer { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 18px 0 0; border-top: 1px solid #ccc; color: var(--muted); font-size: .83rem; }

button:focus-visible, input:focus-visible { outline: 3px solid rgba(204, 0, 51, .35); outline-offset: 2px; }

@media (max-width: 820px) {
  .form-grid, .create-panel { grid-template-columns: 1fr; }
  .team-message { grid-column: 1; }
}

@media (max-width: 580px) {
  .app-shell { width: min(100% - 20px, 960px); }
  .section-heading, .results-header, footer { align-items: flex-start; flex-direction: column; }
  .person-row { grid-template-columns: 1fr auto auto; }
  .person-row .icon-btn { grid-column: 3; grid-row: 1 / span 2; }
  .team-controls { grid-template-columns: 1fr; }
  .btn-accent { grid-column: 1; }
}
