:root {
  --bg: #f0f4fa;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0b5fff;
  --accent-ink: #fff;
  --hero: linear-gradient(135deg, #0a2540 0%, #153a6b 100%);
  --line: rgba(15, 23, 42, 0.1);
  --radius: 14px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: calc(16px + var(--safe-t)) 16px calc(24px + var(--safe-b));
}

.co-header {
  background: var(--hero);
  color: #e8f0ff;
  margin: -16px -16px 16px;
  padding: calc(18px + var(--safe-t)) 16px 18px;
  border-radius: 0 0 20px 20px;
  box-shadow: 0 12px 40px rgba(10, 37, 64, 0.25);
}

.co-header h1 {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

.co-header p {
  margin: 0 0 12px;
  font-size: 0.85rem;
  opacity: 0.9;
}

.co-nav a {
  color: #b8d4ff;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  margin-right: 14px;
}

.co-mode-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 16px;
  margin-bottom: 18px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.07);
}

.co-mode-heading {
  margin: 0 0 12px;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.35;
  color: var(--text);
  letter-spacing: -0.02em;
}

.co-mode-bar {
  display: flex;
  gap: 0;
  padding: 5px;
  border-radius: 16px;
  background: #cbd5e1;
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.12);
}

.co-mode-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  padding: 10px 12px;
  border-radius: 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #475569;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.12s ease;
}

.co-mode-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.co-mode-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.co-mode-btn-title {
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.co-mode-btn-sub {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.92;
  line-height: 1.2;
}

.co-mode-btn:not(.co-mode-btn--active) .co-mode-btn-sub {
  opacity: 0.85;
}

.co-mode-btn--active {
  background: var(--surface);
  color: var(--accent);
  box-shadow:
    0 2px 10px rgba(15, 23, 42, 0.12),
    0 1px 2px rgba(15, 23, 42, 0.06);
}

.co-mode-btn--active .co-mode-btn-title {
  color: #0b5fff;
}

.co-mode-btn--active .co-mode-btn-sub {
  color: #3b82f6;
  opacity: 1;
}

.co-mode-btn--girls.co-mode-btn--active {
  color: #c2185b;
  box-shadow:
    0 2px 12px rgba(194, 24, 91, 0.28),
    0 1px 2px rgba(15, 23, 42, 0.06);
}

.co-mode-btn--girls.co-mode-btn--active .co-mode-btn-title {
  color: #9d174d;
}

.co-mode-btn--girls.co-mode-btn--active .co-mode-btn-sub {
  color: #db2777;
}

.co-panel {
  margin-bottom: 8px;
}

.co-panel--girls.co-panel {
  padding-top: 4px;
  border-top: 3px solid rgba(255, 79, 163, 0.45);
}

.co-section-label {
  margin: 18px 0 8px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.co-secondary {
  width: 100%;
  margin-top: 6px;
  padding: 16px;
  font-size: 1.05rem;
  font-weight: 800;
  border: none;
  border-radius: 14px;
  background: #0f766e;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(15, 118, 110, 0.35);
}

.co-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.co-secondary--girls {
  background: #c2185b;
  box-shadow: 0 6px 20px rgba(194, 24, 91, 0.35);
}

.co-primary--girls {
  background: linear-gradient(135deg, #c2185b 0%, #ff4fa3 100%);
  box-shadow: 0 6px 20px rgba(194, 24, 91, 0.35);
}

.co-ovd-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #fafbfe;
}

.co-chip--girls {
  background: #ffe0f0;
  color: #9d174d;
  border: 1px solid #f8b3d8;
}

.co-field-wrap {
  position: relative;
  margin-bottom: 14px;
}

.co-field-wrap label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 6px;
}

.co-field-wrap input {
  width: 100%;
  font-size: 16px;
  padding: 14px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.co-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 4px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
  z-index: 10;
  display: none;
}

.co-suggest.open {
  display: block;
}

.co-suggest button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text);
}

.co-suggest button:last-child {
  border-bottom: none;
}

.co-suggest button:active {
  background: #f1f5f9;
}

.co-primary {
  width: 100%;
  margin-top: 6px;
  padding: 16px;
  font-size: 1.05rem;
  font-weight: 800;
  border: none;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(11, 95, 255, 0.35);
}

.co-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.co-note {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

#statusLine {
  display: block;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Results sheet */
.co-sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, visibility 0.2s;
}

.co-sheet.open {
  visibility: visible;
  opacity: 1;
}

.co-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.co-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(92dvh, 900px);
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.2);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  padding-bottom: var(--safe-b);
}

.co-sheet.open .co-sheet-panel {
  transform: translateY(0);
}

.co-sheet-head {
  flex-shrink: 0;
  padding: 16px 16px 10px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
}

.co-sheet-head h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
}

.co-close {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 12px;
  background: #f1f5f9;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
}

.co-sheet-sub {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

.co-chip-row {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.co-chip {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e0edff;
  color: #1e3a8a;
}

.co-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 20px;
  -webkit-overflow-scrolling: touch;
}

.co-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  background: #fafbfe;
}

.co-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 800;
}

.co-kpi {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.co-wlpill {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.82rem;
  background: #0a2540;
  color: #fff;
}

.co-divider {
  height: 1px;
  background: var(--line);
  margin: 10px 0;
}

.co-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 720px) {
  .co-split {
    grid-template-columns: 1fr 1fr;
  }
}

.co-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.co-list li {
  padding: 8px 10px;
  border-radius: 10px;
  margin-bottom: 6px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 0.88rem;
  line-height: 1.35;
}

.co-muted {
  color: var(--muted);
  font-size: 0.82rem;
}
