:root {
  --ink-950: #171412;
  --ink-700: #4f4742;
  --ink-500: #756b64;
  --paper-50: #fbf6ef;
  --paper-100: #f3ece2;
  --paper-200: #e6dac8;
  --line: #c7b8a0;
  --accent: #1f4f46;
  --accent-2: #9e2f23;
  --success-bg: #dcfce7;
  --success-fg: #14532d;
  --error-bg: #fee2e2;
  --error-fg: #7f1d1d;
  --muted-bg: #ece8e1;
  --muted-fg: #4b5563;
  --shadow: 0 14px 40px rgba(33, 26, 20, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink-950);
  font-family: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.72), transparent 42%),
    radial-gradient(circle at 80% 4%, rgba(255, 243, 210, 0.45), transparent 38%),
    repeating-linear-gradient(135deg, rgba(139, 100, 70, 0.06) 0 2px, transparent 2px 10px),
    linear-gradient(165deg, #efe4d2, #f8f1e7 42%, #f5efe6);
}

.container {
  max-width: 1100px;
  margin: 28px auto 52px;
  padding: 0 18px;
}

.hero {
  margin: 2px 0 18px;
  padding: 22px 22px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(170deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.46)),
    linear-gradient(90deg, rgba(31, 79, 70, 0.12), rgba(158, 47, 35, 0.06));
  box-shadow: var(--shadow);
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  font-weight: 600;
}

h1 {
  margin: 0;
  font-family: "Cormorant Garamond", "Noto Serif TC", Georgia, serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--ink-700);
  font-size: 0.98rem;
}

.section-note {
  margin: 2px 0 12px;
  color: var(--ink-500);
  font-size: 0.85rem;
  line-height: 1.4;
}

code {
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-size: 0.92em;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(31, 79, 70, 0.11);
  color: #11372f;
}

.panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.7)),
    var(--paper-50);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-top: 14px;
  box-shadow: 0 8px 20px rgba(33, 26, 20, 0.08);
  content-visibility: auto;
  contain-intrinsic-size: 1px 480px;
}

.panel h2 {
  margin: 0 0 12px;
  font-family: "Cormorant Garamond", "Noto Serif TC", Georgia, serif;
  font-size: clamp(1.08rem, 2vw, 1.4rem);
  letter-spacing: 0.02em;
}

#output_title {
  margin: 10px 0 8px;
  font-size: 1rem;
  letter-spacing: 0.03em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

label {
  display: block;
  font-size: 13px;
  color: var(--ink-700);
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  margin-top: 6px;
  border: 1px solid #b9a78b;
  border-radius: 8px;
  padding: 9px;
  color: var(--ink-950);
  font: inherit;
  background: #fffefb;
  transition: box-shadow 150ms ease, border-color 150ms ease, transform 120ms ease;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 79, 70, 0.18);
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

button {
  border: 1px solid #b9a78b;
  background: #fffefb;
  color: var(--ink-950);
  border-radius: 999px;
  padding: 9px 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 150ms ease, background 150ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(50, 37, 20, 0.14);
}

button.primary {
  background: linear-gradient(160deg, #1f4f46, #163d36);
  color: #eef9f7;
  border-color: #163d36;
}

button.primary:hover {
  background: linear-gradient(160deg, #245d52, #18443c);
}

.lang-switch {
  width: auto;
  min-width: 72px;
  padding: 7px 12px;
}

pre#status,
#tool_plan_summary {
  white-space: pre-wrap;
  border-radius: 10px;
  padding: 10px;
  min-height: 42px;
}

pre#status {
  background: #102229;
  color: #d8f5ef;
}

#tool_plan_summary {
  background: #241f1b;
  color: #f8e8cf;
}

.source-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
  background: var(--paper-100);
}

.table-wrap {
  overflow-x: auto;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffefb;
}

#exec_table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#exec_table th,
#exec_table td {
  border-bottom: 1px solid #e8ddcc;
  text-align: left;
  padding: 9px;
  vertical-align: top;
}

#exec_table th {
  background: #f4ede3;
  color: #2f2925;
  position: sticky;
  top: 0;
  z-index: 1;
}

.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
}

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

.status-failed {
  background: var(--error-bg);
  color: var(--error-fg);
}

.status-skipped {
  background: var(--muted-bg);
  color: var(--muted-fg);
}

.log-block {
  background: #111827;
  color: #d1d5db;
  border-radius: 6px;
  padding: 8px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
}

details > summary {
  cursor: pointer;
  color: var(--accent-2);
  font-weight: 600;
}

.reveal {
  opacity: 0;
  transform: translateY(10px);
  animation: reveal-up 520ms ease forwards;
}

.reveal:nth-of-type(1) { animation-delay: 40ms; }
.reveal:nth-of-type(2) { animation-delay: 80ms; }
.reveal:nth-of-type(3) { animation-delay: 120ms; }
.reveal:nth-of-type(4) { animation-delay: 160ms; }
.reveal:nth-of-type(5) { animation-delay: 200ms; }
.reveal:nth-of-type(6) { animation-delay: 240ms; }
.reveal:nth-of-type(7) { animation-delay: 280ms; }
.reveal:nth-of-type(8) { animation-delay: 320ms; }
.reveal:nth-of-type(9) { animation-delay: 360ms; }

@keyframes reveal-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .container {
    margin-top: 18px;
    padding: 0 12px;
  }

  .hero {
    padding: 16px;
  }

  .panel {
    padding: 12px;
  }

  button {
    width: 100%;
  }

  .lang-switch {
    width: auto !important;
  }
}

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