:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #63727d;
  --line: #d9e1e6;
  --surface: #ffffff;
  --paper: #f7f9f6;
  --grass: #2f7d4a;
  --grass-dark: #225f39;
  --coral: #d9574f;
  --gold: #c3942f;
  --blue: #2f6f9f;
  --shadow: 0 18px 50px rgba(23, 32, 38, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(47, 125, 74, 0.11), transparent 36%),
    linear-gradient(315deg, rgba(47, 111, 159, 0.14), transparent 34%),
    var(--paper);
}

button,
input {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 750;
  letter-spacing: 0;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

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

.hero {
  min-height: 232px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 24px;
  align-items: center;
  padding: 34px 36px;
  color: #ffffff;
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.22) 0 2px, transparent 3px 100%),
    linear-gradient(126deg, rgba(21, 85, 51, 0.96), rgba(22, 73, 103, 0.96)),
    repeating-linear-gradient(90deg, rgba(255,255,255,.08) 0 1px, transparent 1px 84px);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.78rem;
  text-transform: uppercase;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.74);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 760px;
  font-size: clamp(2.5rem, 7vw, 5.8rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.lede {
  max-width: 720px;
  margin-top: 22px;
  color: rgba(255, 255, 255, 0.83);
  font-size: clamp(1rem, 2vw, 1.28rem);
  line-height: 1.58;
}

.hero-ball {
  width: 156px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  justify-self: end;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}

.hero-ball span {
  font-size: 5.4rem;
}

.support-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin-top: 18px;
  padding: 18px 20px;
  border: 1px solid rgba(217, 87, 79, 0.26);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff, #fff8f2);
  box-shadow: 0 10px 28px rgba(23, 32, 38, 0.07);
}

.support-card img {
  width: 68px;
  max-height: 82px;
  object-fit: contain;
}

.support-kicker {
  margin-bottom: 4px;
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.support-card h2 {
  font-size: 1.35rem;
  line-height: 1.15;
}

.support-card p:last-child {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.control-band,
.draft-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(420px, 1.2fr);
  gap: 18px;
  margin-top: 18px;
}

.draft-layout {
  grid-template-columns: minmax(520px, 1fr) minmax(360px, 0.45fr);
  align-items: start;
}

.setup-panel,
.status-panel,
.board-panel,
.results-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 28px rgba(23, 32, 38, 0.07);
}

.setup-panel,
.status-panel,
.board-panel {
  padding: 20px;
}

.results-panel {
  padding: 18px;
  position: sticky;
  top: 18px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-title h2 {
  font-size: 1.03rem;
}

.section-title h3 {
  font-size: 0.95rem;
}

.section-title span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 760;
}

.compact {
  margin-bottom: 10px;
}

.participant-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.participant-form input {
  min-width: 0;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
}

.participant-form button,
.primary {
  color: #fff;
  background: var(--grass);
}

.secondary {
  color: var(--ink);
  background: #e8eef1;
}

.danger {
  color: #fff;
  background: var(--coral);
}

.ghost {
  min-height: 34px;
  padding: 0 10px;
  color: var(--blue);
  background: transparent;
  border: 1px solid rgba(47, 111, 159, 0.28);
}

.participant-list {
  min-height: 108px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
  margin-top: 14px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.participant-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  height: 34px;
  padding: 0 8px 0 12px;
  border-radius: 999px;
  background: #eef5ef;
  color: var(--grass-dark);
  font-weight: 760;
}

.participant-chip.mine {
  background: #dff0e4;
  box-shadow: inset 0 0 0 1px rgba(47, 125, 74, 0.26);
}

.participant-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-participant {
  width: 22px;
  min-width: 22px;
  height: 22px;
  min-height: 22px;
  padding: 0;
  border-radius: 50%;
  color: var(--grass-dark);
  background: rgba(34, 95, 57, 0.12);
}

.setup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.metric-grid div {
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 12px;
  border-radius: 8px;
  background: #f2f6f7;
}

.metric-grid span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 720;
}

.metric-grid strong {
  font-size: 1.7rem;
}

.current-picker {
  min-height: 54px;
  display: flex;
  align-items: center;
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  color: #10321f;
  background: #e8f4eb;
  font-weight: 800;
  line-height: 1.4;
}

.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 10px;
}

.country-button {
  min-height: 64px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  box-shadow: 0 5px 12px rgba(23, 32, 38, 0.04);
}

.country-button:hover:not(:disabled) {
  border-color: rgba(47, 125, 74, 0.5);
  transform: translateY(-1px);
}

.country-button.selected {
  color: #ffffff;
  background: var(--grass);
  border-color: var(--grass);
}

.country-button.discarded {
  color: #7b4c12;
  background: #fff3d3;
  border-color: rgba(195, 148, 47, 0.36);
}

.flag {
  font-size: 1.7rem;
  line-height: 1;
}

.flag-image {
  width: 28px;
  height: 20px;
  display: block;
  border-radius: 3px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(23, 32, 38, 0.1);
  overflow: hidden;
}

.inline-flag svg {
  width: 100%;
  height: 100%;
  display: block;
}

.pick-pill .flag-image,
.discard-pill .flag-image {
  width: 21px;
  height: 15px;
}

.country-name {
  overflow-wrap: anywhere;
  white-space: normal;
  font-size: 0.93rem;
  line-height: 1.2;
}

.owner-columns {
  display: grid;
  gap: 12px;
}

.owner-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.owner-box.mine {
  border-color: rgba(47, 125, 74, 0.42);
  box-shadow: 0 0 0 2px rgba(47, 125, 74, 0.1);
}

.owner-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: #f1f5f5;
  font-weight: 820;
}

.owner-header span:last-child {
  color: var(--muted);
  font-size: 0.86rem;
}

.owner-picks {
  min-height: 44px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
}

.pick-pill,
.discard-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef5ef;
  color: var(--grass-dark);
  font-size: 0.86rem;
  font-weight: 750;
}

.discard-box {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid rgba(195, 148, 47, 0.35);
  border-radius: 8px;
  background: #fff8e6;
}

.discarded-countries {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.discard-pill {
  color: #7b4c12;
  background: #ffe9ae;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(18px);
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff;
  background: rgba(23, 32, 38, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  font-weight: 720;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 1040px) {
  .control-band,
  .draft-layout {
    grid-template-columns: 1fr;
  }

  .results-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 14px;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: 260px;
    padding: 26px 22px;
  }

  .hero-ball {
    width: 98px;
    justify-self: start;
  }

  .hero-ball span {
    font-size: 3.4rem;
  }

  .support-card {
    grid-template-columns: 58px minmax(0, 1fr);
    padding: 15px;
  }

  .support-card img {
    width: 54px;
    max-height: 66px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .participant-form {
    grid-template-columns: 1fr;
  }

  .setup-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .country-grid {
    grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  }
}
