:root {
  color-scheme: dark;
  --bg: #0d1118;
  --panel: rgba(19, 25, 36, 0.92);
  --panel-strong: #121925;
  --line: rgba(124, 141, 168, 0.16);
  --text: #eef2ff;
  --muted: #a2afc5;
  --accent: #ff8b5d;
  --accent-dark: #ffb18c;
  --accent-soft: rgba(255, 139, 93, 0.14);
  --success-bg: rgba(39, 97, 59, 0.24);
  --success-text: #9be2b0;
  --error-bg: rgba(145, 52, 52, 0.22);
  --error-text: #ffb4b4;
  --neutral-bg: rgba(80, 92, 118, 0.18);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 139, 93, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(71, 116, 255, 0.16), transparent 24%),
    linear-gradient(180deg, #0f1420 0%, var(--bg) 52%, #090d13 100%);
}

button,
input,
textarea,
select {
  font: inherit;
}

.page-shell {
  width: min(100%, 960px);
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.hero {
  padding: 18px 4px 24px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.7rem);
  line-height: 0.95;
  max-width: 10ch;
}

.hero-copy {
  max-width: 38rem;
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.layout {
  display: grid;
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  padding: 18px;
}

.editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.section-heading h2,
.section-heading h3,
.list-header h3 {
  margin: 0;
}

.section-heading p,
.list-header span,
.status-box,
.stats,
.empty-state {
  color: var(--muted);
}

.section-heading.compact p {
  margin: 8px 0 0;
}

.upload-box,
.search-field input,
.add-card textarea,
.rule-selector select {
  width: 100%;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

.upload-box {
  display: grid;
  gap: 6px;
  padding: 22px 18px;
  margin-top: 16px;
  cursor: pointer;
}

.upload-box input {
  display: none;
}

.upload-title {
  font-weight: 700;
}

.upload-hint {
  font-size: 0.95rem;
  color: var(--muted);
}

.reload-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  padding: 10px 0 2px;
}

.reload-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.reload-label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.reload-name {
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

.primary-button,
.ghost-button,
.domain-delete,
.action-card {
  border: 0;
  border-radius: 16px;
  min-height: 48px;
  padding: 12px 16px;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

.primary-button {
  background: linear-gradient(135deg, #d76c49 0%, var(--accent) 100%);
  color: #fff;
  font-weight: 700;
}

.ghost-button {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
  border: 1px solid rgba(255, 139, 93, 0.18);
}

.compact-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 14px;
  white-space: nowrap;
}

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

.status-box {
  margin-top: 14px;
  border-radius: 18px;
  padding: 14px 16px;
  line-height: 1.45;
  background: var(--neutral-bg);
}

.status-box.success {
  background: var(--success-bg);
  color: var(--success-text);
}

.status-box.error {
  background: var(--error-bg);
  color: var(--error-text);
}

.rule-selector,
.scenario-panel,
.finish-panel {
  margin-top: 16px;
}

.rule-selector,
.search-field,
.add-card {
  display: grid;
  gap: 8px;
}

.rule-selector select,
.search-field input,
.add-card textarea {
  padding: 14px 16px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.stats-chip {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(162, 175, 197, 0.1);
}

.action-grid {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.action-card {
  display: grid;
  gap: 8px;
  text-align: left;
  min-height: 112px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(27, 35, 50, 0.96), rgba(18, 25, 37, 0.96));
  border: 1px solid var(--line);
}

.action-card.active {
  background: linear-gradient(135deg, #d76c49 0%, var(--accent) 100%);
  color: #fff;
}

.action-card.active .action-copy {
  color: rgba(255, 255, 255, 0.82);
}

.action-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.action-copy {
  color: var(--muted);
  line-height: 1.45;
}

.toolbar,
.domain-list-wrap {
  margin-top: 16px;
}

.toolbar {
  display: grid;
  gap: 10px;
}

.add-card {
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(28, 36, 53, 0.96), rgba(18, 25, 37, 0.96));
  border: 1px solid var(--line);
}

.list-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.domain-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 10px;
}

.domain-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border-radius: 18px;
  background: rgba(23, 31, 46, 0.92);
  border: 1px solid var(--line);
}

.domain-name {
  word-break: break-word;
  line-height: 1.35;
}

.domain-delete {
  min-height: 40px;
  padding-inline: 14px;
  background: rgba(255, 139, 93, 0.12);
  color: var(--accent-dark);
}

.empty-state {
  margin-top: 16px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(23, 31, 46, 0.82);
  border: 1px dashed var(--line);
}

.download-bar {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.download-bar .primary-button {
  width: 100%;
}

input,
textarea,
select {
  color: var(--text);
}

input::placeholder,
textarea::placeholder {
  color: #74819a;
}

.hidden {
  display: none !important;
}

@media (min-width: 720px) {
  .page-shell {
    padding: 28px 24px 56px;
  }

  .layout {
    grid-template-columns: 320px minmax(0, 1fr);
    align-items: start;
  }

  .upload-panel {
    position: sticky;
    top: 20px;
  }

  .toolbar {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (hover: hover) {
  .primary-button:hover,
  .ghost-button:hover,
  .domain-delete:hover,
  .action-card:hover {
    transform: translateY(-1px);
  }
}
