@import url("https://fonts.googleapis.com/css2?family=Fraunces:wght@600;700&family=JetBrains+Mono:wght@400;600&family=Spline+Sans:wght@400;600&display=swap");

:root {
  color-scheme: light;
  --ink: #122226;
  --muted: #4b5d63;
  --paper: #f6f1e8;
  --surface: #ffffff;
  --line: rgba(18, 34, 38, 0.14);
  --accent: #e07a3d;
  --accent-strong: #b1521b;
  --teal: #2f6f72;
  --shadow: 0 16px 40px rgba(18, 34, 38, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Spline Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, #f6efe6 0%, #eef6f2 45%, #f4efe3 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(18, 34, 38, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.35;
  pointer-events: none;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.hero {
  padding: 28px 32px;
  border-radius: 24px;
  background: linear-gradient(140deg, #fff8ec, #f8f8f6 60%, #edf6f2 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: rise 0.7s ease both;
}

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

h1 {
  font-family: "Fraunces", "Times New Roman", serif;
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 3rem);
  margin: 0 0 8px;
}

.lede {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 640px;
}

.status-row {
  display: flex;
  gap: 16px;
  align-items: center;
  font-weight: 600;
  color: var(--teal);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(47, 111, 114, 0.18);
}

.status[data-state="busy"]::before {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(224, 122, 61, 0.18);
}

.status[data-state="error"]::before {
  background: #b0352c;
  box-shadow: 0 0 0 4px rgba(176, 53, 44, 0.18);
}

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

.grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.1fr);
  gap: 20px;
  margin-top: 28px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(18, 34, 38, 0.08);
  animation: rise 0.7s ease both;
}

.panel:nth-of-type(1) {
  animation-delay: 0.06s;
}

.panel:nth-of-type(2) {
  animation-delay: 0.12s;
}

.panel:nth-of-type(3) {
  animation-delay: 0.18s;
}

.panel:nth-of-type(4) {
  animation-delay: 0.24s;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

h2 {
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 1.2rem;
  margin: 0;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(47, 111, 114, 0.12);
  color: var(--teal);
  font-weight: 600;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  font-weight: 600;
}

.field input,
.field select,
textarea {
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
  background: #fbfbf9;
}

.field input:focus,
.field select:focus,
textarea:focus {
  outline: 2px solid rgba(224, 122, 61, 0.25);
  border-color: rgba(224, 122, 61, 0.6);
}

.field-inline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
}

.controls {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  font-family: "JetBrains Mono", "SFMono-Regular", monospace;
  line-height: 1.45;
  background: #f9f6f0;
}

.hint {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

button {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

button.primary {
  background: var(--accent);
  color: #fffaf3;
  box-shadow: 0 8px 18px rgba(224, 122, 61, 0.35);
}

button.primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(224, 122, 61, 0.4);
}

button.ghost {
  background: #f0eee7;
  color: var(--accent-strong);
}

.results-panel {
  grid-column: 1 / -1;
}

.results-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 12px;
}

.results {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: auto;
  max-height: 60vh;
  background: #fffefc;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}

th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(18, 34, 38, 0.08);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #f7f3ea;
  font-weight: 700;
}

.error {
  display: none;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(176, 53, 44, 0.08);
  border: 1px solid rgba(176, 53, 44, 0.3);
  color: #7a2720;
  font-family: "JetBrains Mono", "SFMono-Regular", monospace;
  white-space: pre-wrap;
}

.error.show {
  display: block;
}

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

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }

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

  .results-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
