:root {
  --bg: #f4efe7;
  --panel: rgba(255, 251, 245, 0.9);
  --panel-border: rgba(93, 68, 48, 0.14);
  --ink: #23160b;
  --muted: #6b5a4a;
  --accent: #c45b2d;
  --accent-dark: #8f3612;
  --line: rgba(93, 68, 48, 0.18);
  --success: #1d6b43;
  --pending: #8f6a12;
  --shadow: 0 18px 60px rgba(70, 43, 19, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(240, 160, 96, 0.25), transparent 28%),
    linear-gradient(180deg, #f8f4ed 0%, var(--bg) 100%);
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.hero {
  margin-bottom: 28px;
}

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

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

h1 {
  max-width: 10ch;
  margin-bottom: 16px;
  font-size: clamp(2.6rem, 5vw, 4.8rem);
  line-height: 0.94;
}

.lead {
  max-width: 680px;
  font-size: 1.08rem;
  line-height: 1.6;
  color: var(--muted);
}

.panel {
  margin-top: 22px;
  padding: 24px;
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.grid {
  display: grid;
  gap: 16px;
}

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

.three-up {
  grid-template-columns: 1.1fr 1.1fr 0.8fr;
}

.field-block label,
.rule-card label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

input[type="file"],
input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdfa;
}

.summary-box,
.hint {
  color: var(--muted);
}

.summary-box {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  min-height: 52px;
}

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

.template-card {
  display: grid;
  gap: 6px;
  padding: 18px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
}

.template-card.active {
  border-color: rgba(143, 54, 18, 0.42);
  background: rgba(196, 91, 45, 0.14);
}

.template-card strong {
  font-size: 1.1rem;
}

.template-card span {
  color: var(--muted);
}

.rules-header,
.rule-top,
.results-head,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.rules-header {
  margin: 28px 0 18px;
}

.rules-header p,
.results-panel p {
  color: var(--muted);
}

#rules {
  display: grid;
  gap: 16px;
}

.rule-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
}

.rule-top {
  margin-bottom: 14px;
}

button {
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary,
.secondary,
.ghost {
  padding: 12px 18px;
}

.primary {
  color: white;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
}

.secondary {
  color: var(--accent-dark);
  background: rgba(196, 91, 45, 0.12);
}

.ghost {
  color: var(--muted);
  background: transparent;
}

.actions {
  margin-top: 24px;
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.92rem;
}

.pill.idle {
  color: var(--pending);
  background: rgba(143, 106, 18, 0.12);
}

.pill.running {
  color: var(--accent-dark);
  background: rgba(196, 91, 45, 0.14);
}

.pill.success {
  color: var(--success);
  background: rgba(29, 107, 67, 0.12);
}

.pill.error {
  color: #8d1c1c;
  background: rgba(141, 28, 28, 0.12);
}

.messages {
  margin: 18px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.messages li + li {
  margin-top: 8px;
}

@media (max-width: 820px) {
  .template-picker,
  .two-up,
  .three-up {
    grid-template-columns: 1fr;
  }

  .shell {
    width: min(100% - 20px, 1000px);
    padding-top: 28px;
  }

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

  h1 {
    max-width: none;
  }

  .rules-header,
  .results-head,
  .actions,
  .rule-top {
    align-items: flex-start;
    flex-direction: column;
  }
}
