:root {
  color-scheme: light;
  --bg: #f4efe6;
  --card: rgba(255, 251, 243, 0.86);
  --line: rgba(18, 44, 51, 0.13);
  --ink: #17323a;
  --muted: #5a737a;
  --accent: #bf5a36;
  --accent-dark: #8f2f1d;
  --success: #27785e;
  --danger: #9d2f2a;
  --mono: "Cascadia Code", Consolas, "Liberation Mono", monospace;
  --sans: "Segoe UI Variable Text", "Aptos", "Trebuchet MS", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(191, 90, 54, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(23, 50, 58, 0.10), transparent 30%),
    linear-gradient(145deg, var(--bg), #fbf7f0 56%, #efe2c4);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(23, 50, 58, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 50, 58, 0.035) 1px, transparent 1px);
  background-size: 24px 24px;
}

.wrap {
  position: relative;
  width: min(1180px, calc(100vw - 28px));
  margin: 18px auto 28px;
  display: grid;
  gap: 16px;
}

.panel, .card {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 18px 44px rgba(32, 40, 47, 0.12);
  backdrop-filter: blur(8px);
}

.panel { border-radius: 24px; padding: 22px; }
.card { border-radius: 20px; padding: 16px; }

.hero {
  position: relative;
  overflow: hidden;
  padding: 28px;
}

.hero::after {
  content: "";
  position: absolute;
  top: -70px;
  right: -70px;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(191, 90, 54, 0.20), transparent 70%);
}

.eyebrow {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1, h2 { margin: 0; font-weight: 760; letter-spacing: 0.01em; }
h1 { max-width: 800px; font-size: clamp(30px, 4.5vw, 48px); line-height: 1.05; }
h2 { font-size: 22px; }

p { margin: 0; color: var(--muted); line-height: 1.62; }
.hero p { max-width: 840px; margin-top: 12px; }

.notice {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(23, 50, 58, 0.075);
  color: var(--muted);
  font-size: 13px;
}

.notice strong { color: var(--ink); }

.flow-tip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border-color: rgba(191, 90, 54, 0.34);
  background:
    linear-gradient(135deg, rgba(191, 90, 54, 0.18), rgba(255, 251, 243, 0.90)),
    var(--card);
  box-shadow: 0 18px 44px rgba(191, 90, 54, 0.16);
}

.flow-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  color: #fff9f1;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.flow-tip strong {
  display: block;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.42;
}

.flow-tip p { margin-top: 4px; }

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: 16px;
}

.panel-head, .preview-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid rgba(23, 50, 58, 0.10);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--muted);
  font-size: 13px;
}

.pill strong { color: var(--ink); }

.drop {
  position: relative;
  overflow: hidden;
  border: 1.5px dashed rgba(23, 50, 58, 0.19);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.70), rgba(255, 247, 233, 0.88));
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.drop.drag {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(191, 90, 54, 0.18);
}

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

textarea {
  display: block;
  width: 100%;
  min-height: 370px;
  padding: 20px 20px 48px;
  border: 0;
  outline: none;
  resize: vertical;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.58;
}

textarea::placeholder { color: rgba(23, 50, 58, 0.46); }

.drop-tip {
  position: absolute;
  right: 14px;
  bottom: 12px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(23, 50, 58, 0.08);
  color: var(--muted);
  font-size: 12px;
}

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

.field { display: grid; gap: 8px; color: var(--muted); font-size: 13px; }

select, .filebox, .toggle {
  min-height: 46px;
  border: 1px solid rgba(23, 50, 58, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.80);
  color: var(--ink);
}

select { width: 100%; padding: 10px 14px; }

.filebox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}

.filebox > span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: var(--muted);
}

.toggle input { width: 16px; height: 16px; accent-color: var(--accent); }

.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

button:hover:not(:disabled) { transform: translateY(-1px); }
button:disabled { cursor: not-allowed; opacity: 0.55; transform: none; box-shadow: none; }

.primary {
  color: #fff9f1;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 14px 28px rgba(191, 90, 54, 0.24);
}

.secondary, .ghost, .mini {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(23, 50, 58, 0.14);
}

.ghost { min-height: 36px; color: var(--muted); }
.mini { min-height: 30px; padding: 0 12px; border-radius: 10px; flex: 0 0 auto; }

.error {
  min-height: 22px;
  margin-top: 14px;
  color: var(--danger);
  font-size: 14px;
  white-space: pre-wrap;
}

.side { display: grid; align-content: start; gap: 14px; }

.card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--accent-dark);
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.72;
}

code { font-family: var(--mono); color: var(--ink); }

.preview-panel { padding: 0; overflow: hidden; }

.preview-head {
  align-items: center;
  margin: 0;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(23, 50, 58, 0.09);
  background: rgba(255, 247, 233, 0.72);
}

.preview-head small { display: block; margin-top: 4px; color: var(--muted); }

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

pre {
  min-height: 420px;
  max-height: 68vh;
  margin: 0;
  padding: 18px;
  overflow: auto;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.54), rgba(248, 244, 236, 0.88));
  color: #143039;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.62;
  white-space: pre-wrap;
  word-break: break-word;
}

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

@media (max-width: 680px) {
  .wrap { width: min(100vw - 16px, 100%); margin: 10px auto 16px; }
  .panel, .hero { padding: 18px; border-radius: 20px; }
  .controls { grid-template-columns: 1fr; }
  .button-row { grid-template-columns: 1fr; }
  .notice { align-items: flex-start; border-radius: 18px; }
  .flow-tip { grid-template-columns: 1fr; gap: 10px; }
  .flow-badge { justify-self: start; }
  textarea { min-height: 290px; }
  .preview-head { align-items: flex-start; flex-direction: column; }
}
