:root {
  --bg: #0b1010;
  --bg-soft: #111a19;
  --panel: linear-gradient(180deg, rgba(18, 27, 29, 0.92), rgba(12, 18, 20, 0.94));
  --panel-border: rgba(84, 196, 119, 0.24);
  --panel-border-soft: rgba(255, 255, 255, 0.08);
  --text: #f1f3ee;
  --muted: #9cab9f;
  --accent: #78d89a;
  --accent-strong: #d3ff67;
  --warning: #ffb85b;
  --shadow: rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top center, rgba(120, 216, 154, 0.14), transparent 22%),
    radial-gradient(circle at bottom center, rgba(211, 255, 103, 0.07), transparent 25%),
    linear-gradient(180deg, #0f1717 0%, var(--bg) 100%);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.page-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 26px 22px 34px;
}

.top-band {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.network-pill,
.status-pod {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(12, 18, 19, 0.86);
  box-shadow: 0 14px 40px var(--shadow);
}

.network-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 0 14px rgba(120, 216, 154, 0.65);
}

.status-pod {
  gap: 14px;
}

.status-pod-label,
.status-pod-time {
  color: var(--muted);
  font-size: 12px;
}

.status-pod strong[data-state="ok"] {
  color: var(--accent);
}

.status-pod strong[data-state="bad"] {
  color: #ff9696;
}

.hero-banner {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
  padding: 24px;
  border-radius: 22px;
  background:
    linear-gradient(120deg, rgba(18, 28, 31, 0.96), rgba(16, 23, 24, 0.94)),
    var(--panel);
  border: 1px solid rgba(120, 216, 154, 0.2);
  box-shadow: 0 26px 80px var(--shadow);
}

.eyebrow,
.section-tag {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.1rem, 4vw, 3.5rem);
  line-height: 0.95;
}

.lede,
.card-head p,
.field-hint,
.presets-card p,
.apply-box p {
  color: var(--muted);
}

.hero-summary {
  display: grid;
  gap: 14px;
}

.hero-stat,
.deck-card,
.apply-box {
  border-radius: 18px;
  border: 1px solid var(--panel-border-soft);
  background: var(--panel);
  box-shadow: 0 20px 60px var(--shadow);
}

.hero-stat {
  padding: 18px;
}

.hero-stat span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-actions,
.button-row,
.inline-field {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 18px;
}

.column-stack {
  display: grid;
  gap: 18px;
}

.deck-card {
  padding: 18px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 16px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field-grid-single {
  grid-template-columns: 1fr;
}

.field,
.swatch-field {
  display: grid;
  gap: 8px;
}

.field span,
.swatch-field span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(7, 12, 13, 0.72);
  color: var(--text);
}

input[type="color"] {
  height: 54px;
  padding: 6px;
}

.inline-field input {
  flex: 1;
}

.primary-button,
.ghost-button {
  border-radius: 999px;
  padding: 11px 16px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.primary-button {
  border: none;
  color: #102012;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.ghost-button {
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.compact-button {
  white-space: nowrap;
}

.wide-button {
  min-width: 180px;
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.subdued-row {
  margin-top: 14px;
}

.tight-row {
  align-items: center;
}

.channel-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.channel-chip {
  height: 10px;
  border-radius: 999px;
}

.channel-chip-display { background: #ff705a; }
.channel-chip-marking { background: #6178ff; }
.channel-chip-flank { background: #62f077; }
.channel-chip-body { background: #f0ef57; }
.channel-chip-underbelly { background: #61dfe8; }
.channel-chip-iris { background: #ffffff; }

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.apply-box {
  margin-top: 16px;
  padding: 16px;
}

.viewer-card {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  min-height: 380px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.05), transparent 18%),
    linear-gradient(160deg, rgba(120, 216, 154, 0.08), rgba(13, 23, 24, 0.22));
}

#previewCanvas {
  display: block;
  width: 100%;
  height: 400px;
}

.viewer-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 12, 13, 0.38);
  color: var(--muted);
  pointer-events: none;
}

.status-banner {
  margin: 16px 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.status-banner[data-state="ok"] {
  border-color: rgba(120, 216, 154, 0.28);
  background: rgba(120, 216, 154, 0.08);
}

.status-banner[data-state="bad"] {
  border-color: rgba(255, 150, 150, 0.28);
  background: rgba(255, 120, 120, 0.08);
}

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

.legend-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.legend-item code {
  margin-left: auto;
  color: var(--muted);
}

.legend-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.presets-list {
  display: grid;
  gap: 10px;
}

.preset-item,
.preset-empty {
  padding: 12px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.preset-item {
  display: grid;
  gap: 10px;
}

.preset-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.preset-meta span {
  color: var(--muted);
  font-size: 13px;
}

.preset-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preset-swatch {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

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

@media (max-width: 1080px) {
  .hero-banner,
  .main-grid {
    grid-template-columns: 1fr;
  }
}

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

  .top-band,
  .card-head,
  .hero-actions,
  .auth-box,
  .button-row {
    flex-direction: column;
    align-items: stretch;
  }

  .field-grid,
  .swatch-grid,
  .legend,
  .channel-strip {
    grid-template-columns: 1fr;
  }
}
