:root {
  --page-bg: linear-gradient(180deg, #d9eff6 0%, #f7f3dd 100%);
  --card-bg: rgba(255, 252, 241, 0.94);
  --panel-bg: #fff8dc;
  --border: #177e97;
  --border-soft: rgba(23, 126, 151, 0.18);
  --text: #1d2a33;
  --muted: #5f6f78;
  --accent: #c53d13;
  --accent-dark: #8a2c10;
  --accent-soft: rgba(197, 61, 19, 0.14);
  --shadow: 0 24px 60px rgba(17, 45, 56, 0.14);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--page-bg);
}

button,
input {
  font: inherit;
}

.page-shell {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 18px 14px 28px;
}

.app-card {
  background: var(--card-bg);
  border: 4px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  backdrop-filter: blur(6px);
}

.hero {
  margin-bottom: 18px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.05;
}

.intro {
  width: min(100%, 680px);
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.4;
}

#password-form {
  display: grid;
  gap: 14px;
}

.panel {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--panel-bg);
}

.panel-wins {
  background:
    linear-gradient(180deg, rgba(197, 61, 19, 0.06), rgba(197, 61, 19, 0.02)),
    var(--panel-bg);
}

legend {
  padding: 0 10px;
  font-weight: 700;
  color: var(--accent-dark);
  line-height: 1.2;
}

.legend-kicker {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.team-option {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0;
  cursor: pointer;
}

.team-option input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.team-option span {
  width: 100%;
  padding: 10px 12px 10px 40px;
  border: 2px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: #fffdf4;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.team-option strong,
.team-option small {
  display: block;
}

.team-option strong {
  font-size: 0.95rem;
  line-height: 1.15;
}

.team-option small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.1;
  letter-spacing: 0.02em;
}

.team-option span::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: #ffffff;
  transform: translateY(-50%);
}

.team-option.is-checkbox span::before {
  border-radius: 6px;
}

.team-option input:focus-visible + span {
  outline: 3px solid rgba(21, 138, 166, 0.24);
  outline-offset: 2px;
}

.team-option input:checked + span {
  border-color: var(--accent);
  background: linear-gradient(135deg, #fff7e9, #ffe8d4);
  box-shadow: 0 10px 24px rgba(197, 61, 19, 0.12);
  transform: translateY(-1px);
}

.team-option input:checked + span::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 4px #fff4ee;
}

.team-option.is-disabled {
  cursor: not-allowed;
}

.team-option.is-disabled span {
  border-color: rgba(29, 42, 51, 0.12);
  background: rgba(255, 255, 255, 0.48);
  color: rgba(29, 42, 51, 0.45);
  box-shadow: none;
}

.team-option.is-disabled span::before {
  border-color: rgba(29, 42, 51, 0.25);
  background: rgba(255, 255, 255, 0.8);
}

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

.button {
  min-width: 152px;
  padding: 11px 14px;
  border: 2px solid var(--accent-dark);
  border-radius: 999px;
  background: linear-gradient(180deg, #da4a1c, var(--accent));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(197, 61, 19, 0.18);
  transition: transform 140ms ease, background 140ms ease, opacity 140ms ease, box-shadow 140ms ease;
}

.button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(138, 44, 16, 0.24);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.button-secondary {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(138, 44, 16, 0.38);
  color: var(--accent-dark);
  box-shadow: none;
}

.button-secondary:hover:not(:disabled) {
  background: rgba(255, 244, 238, 0.92);
}

.result-card {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(23, 126, 151, 0.08), rgba(255, 255, 255, 0.8));
  border: 1px solid var(--border-soft);
}

.result-label {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.status-message {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.password-output {
  display: block;
  overflow-wrap: anywhere;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: #14222a;
  color: #f6d76d;
  font-family: "Courier New", monospace;
  font-size: clamp(1.2rem, 3.6vw, 1.7rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
}

.noscript-message {
  margin-top: 12px;
  color: var(--accent-dark);
  text-align: center;
}

@media (max-width: 640px) {
  .page-shell {
    padding: 12px 10px 20px;
  }

  .app-card {
    padding: 14px;
    border-radius: 22px;
  }

  .panel {
    padding: 10px;
  }

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

  .actions {
    flex-direction: column;
  }

  .button {
    width: 100%;
  }
}
