:root {
  color-scheme: light;
  --bg: #f8f5ef;
  --surface: rgba(255, 253, 248, 0.86);
  --surface-solid: #fffdf8;
  --text: #211f1c;
  --muted: #746d62;
  --line: rgba(53, 47, 39, 0.12);
  --accent: #c96442;
  --accent-strong: #a74f33;
  --accent-soft: #f5dfd4;
  --shadow: 0 24px 70px rgba(55, 45, 31, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --font: "Inter", "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171513;
  --surface: rgba(31, 29, 25, 0.84);
  --surface-solid: #211f1b;
  --text: #f3eee6;
  --muted: #b9afa2;
  --line: rgba(243, 238, 230, 0.13);
  --accent: #e18a66;
  --accent-strong: #f0a27f;
  --accent-soft: rgba(225, 138, 102, 0.14);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(201, 100, 66, 0.18), transparent 28rem),
    radial-gradient(circle at bottom right, rgba(140, 112, 74, 0.14), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  transition: background-color 180ms ease, color 180ms ease;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.nav-bar,
.hero-grid,
.content-grid,
.panel-heading,
.card-actions,
.meta-row {
  display: flex;
}

.nav-bar {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 52px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--accent-strong);
  font-weight: 700;
}

.theme-toggle,
.ghost-button,
.small-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 15px;
}

.theme-toggle:hover,
.ghost-button:hover,
.small-button:hover {
  transform: translateY(-1px);
  border-color: rgba(201, 100, 66, 0.42);
}

.hero {
  padding: 8px 0 28px;
}

.hero-grid {
  align-items: end;
  justify-content: space-between;
  gap: 28px;
}

.hero-copy {
  max-width: 720px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 12px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 18px;
  font-size: clamp(2.65rem, 8vw, 5.7rem);
  line-height: 0.95;
  letter-spacing: -0.07em;
}

.hero-description {
  max-width: 590px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.8;
}

.stat-card,
.panel,
.lineup-card {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.stat-card {
  min-width: 184px;
  padding: 22px;
  border-radius: var(--radius-lg);
}

.stat-label,
.stat-caption,
.card-time,
.code-label {
  color: var(--muted);
  font-size: 0.88rem;
}

.stat-card strong {
  display: block;
  margin: 8px 0 2px;
  font-size: 3rem;
  letter-spacing: -0.06em;
}

.content-grid {
  align-items: flex-start;
  gap: 22px;
}

.form-panel {
  position: sticky;
  top: 22px;
  width: 38%;
  min-width: 330px;
}

.list-panel {
  flex: 1;
}

.panel {
  padding: 24px;
  border-radius: var(--radius-xl);
}

.panel-heading {
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.panel-heading h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.field {
  display: grid;
  gap: 9px;
  margin-bottom: 17px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  color: var(--text);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input {
  height: 48px;
  padding: 0 15px;
}

textarea {
  resize: vertical;
  min-height: 190px;
  padding: 14px 15px;
  line-height: 1.65;
}

input:focus,
textarea:focus {
  border-color: rgba(201, 100, 66, 0.78);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.primary-button {
  width: 100%;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #fffaf5;
  padding: 14px 18px;
  font-weight: 700;
  transition: transform 160ms ease, background 160ms ease;
}

.primary-button:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.ghost-button {
  padding: 8px 13px;
}

.search-field {
  width: min(380px, 100%);
}

.list-heading {
  align-items: end;
}

.message {
  min-height: 24px;
  margin-bottom: 10px;
  color: var(--accent-strong);
  font-size: 0.92rem;
  font-weight: 600;
}

.lineup-list {
  display: grid;
  gap: 14px;
}

.lineup-card {
  padding: 18px;
  border-radius: var(--radius-lg);
}

.meta-row {
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 15px;
}

.lineup-title {
  margin-bottom: 6px;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}

.code-box {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.code-preview {
  overflow: hidden;
  max-height: 5.5em;
  margin: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.code-preview.expanded {
  max-height: none;
}

.card-actions {
  flex-wrap: wrap;
  gap: 8px;
}

.small-button {
  padding: 8px 12px;
}

.danger-button {
  color: #b8422f;
}

.empty-state {
  padding: 42px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 1.6rem;
}

.hidden,
.sr-only {
  display: none !important;
}

@media (max-width: 860px) {
  .page-shell {
    width: min(100% - 24px, 680px);
    padding-top: 18px;
  }

  .nav-bar {
    margin-bottom: 34px;
  }

  .hero-grid,
  .content-grid,
  .panel-heading,
  .list-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .stat-card,
  .form-panel {
    width: 100%;
    min-width: 0;
  }

  .form-panel {
    order: 2;
    position: static;
  }

  .list-panel {
    order: 1;
  }

  .panel {
    padding: 20px;
    border-radius: 22px;
  }

  h1 {
    letter-spacing: -0.055em;
  }
}

@media (max-width: 520px) {
  .page-shell {
    width: min(100% - 18px, 460px);
  }

  .theme-toggle span:last-child {
    display: none;
  }

  .meta-row {
    flex-direction: column;
  }

  .card-actions .small-button {
    flex: 1 1 calc(50% - 8px);
  }
}
