:root {
  --bg: #100e0c;
  --ink: #f4ece0;
  --muted: #b7ab9e;
  --faint: #8a7f73;
  --line: rgba(244, 236, 224, 0.16);
  --accent: #e36a45;
  --accent-deep: #c4512f;
  --paper: #f6f0e6;
  --paper-ink: #241c16;
  --paper-muted: #6f6256;
  --danger: #ffb4a8;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  font-family: "Outfit", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(880px 460px at 0% -10%, rgba(227, 106, 69, 0.2), transparent 58%),
    radial-gradient(720px 420px at 100% 0%, rgba(244, 236, 224, 0.07), transparent 46%),
    var(--bg);
}

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

button { cursor: pointer; }

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 72px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}

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

h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2.8rem, 6vw, 4.4rem);
  font-weight: 520;
  letter-spacing: -0.045em;
  line-height: 0.88;
}

.lede {
  max-width: 40rem;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.5;
}

.key-status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.92rem;
  padding-bottom: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(244, 236, 224, 0.04);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d7a15a;
}

.dot.on { background: #8fbf9f; }

.key-panel {
  margin-top: 28px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(244, 236, 224, 0.03);
}

.key-panel[hidden] { display: none; }

.key-copy h2 {
  margin: 0 0 6px;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.7rem;
  font-weight: 520;
}

.key-copy p {
  margin: 0;
  max-width: 42rem;
  color: var(--muted);
  line-height: 1.45;
}

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

.key-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #181512;
  padding: 14px 16px;
}

.key-row input:focus,
textarea:focus,
.button:focus-visible,
.text-button:focus-visible,
.styles button:focus-visible,
.segment button:focus-visible,
.drop:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hint, .file-meta, .detail-row p, .reading-meta {
  color: var(--faint);
  font-size: 0.92rem;
}

.hint a { color: var(--ink); }

code {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.92em;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 22px;
  margin-top: 22px;
  align-items: start;
}

.stage, .reading {
  border-radius: 28px;
  padding: 22px;
}

.stage {
  border: 1px solid var(--line);
  background: rgba(20, 17, 15, 0.72);
}

.reading {
  background: var(--paper);
  color: var(--paper-ink);
  box-shadow: var(--shadow);
  min-height: 540px;
  display: flex;
  flex-direction: column;
}

.section-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.section-label.paper { color: var(--paper-muted); }

.drop {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 320px;
  border: 1.5px dashed rgba(244, 236, 224, 0.28);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(244, 236, 224, 0.035), transparent 40%);
  overflow: hidden;
  cursor: pointer;
  text-align: center;
}

.drop.is-over {
  border-color: var(--accent);
  background: rgba(227, 106, 69, 0.08);
}

.drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.drop-empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 28px;
}

.drop-empty strong {
  font-size: 1.25rem;
  font-weight: 560;
}

.drop-empty span { color: var(--muted); }

.file-types {
  margin-top: 8px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.drop-mark {
  width: 54px;
  height: 54px;
  margin-bottom: 8px;
  border: 1.5px solid rgba(244, 236, 224, 0.4);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 8px, var(--accent) 8px 10px, transparent 11px),
    linear-gradient(var(--ink), var(--ink)) center 34px / 16px 1.5px no-repeat;
}

.drop img {
  width: 100%;
  max-height: 460px;
  object-fit: contain;
  background: #090807;
}

.file-meta {
  min-height: 1.2em;
  margin: 10px 2px 0;
}

.styles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.styles button,
.segment button,
.text-button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 8px 12px;
}

.styles button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.question {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.question span {
  color: var(--muted);
  font-size: 0.92rem;
}

.question em {
  color: var(--faint);
  font-style: normal;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #181512;
  padding: 12px 14px;
}

.detail-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
}

.segment {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.segment button { border: 0; }

.segment button[aria-pressed="true"] {
  background: rgba(244, 236, 224, 0.12);
}

.detail-row p { margin: 0; }

.form-error {
  margin: 14px 0 0;
  color: var(--danger);
  line-height: 1.4;
}

.button {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #2a120c;
  font-weight: 600;
  padding: 14px 18px;
}

.button:hover { background: #f07a56; }

.button:disabled,
.button[aria-busy="true"] {
  cursor: wait;
  opacity: 0.72;
}

.analyze {
  width: 100%;
  margin-top: 16px;
  padding: 16px 18px;
  font-size: 1.02rem;
}

.text-button {
  padding: 4px 10px;
  color: var(--ink);
}

.text-button.dark {
  color: var(--paper-ink);
  border-color: rgba(36, 28, 22, 0.18);
}

.reading-empty {
  margin: 12px 0 0;
  color: var(--paper-muted);
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.7rem;
  font-weight: 520;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.reading-text {
  margin-top: 8px;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.28rem;
  font-weight: 520;
  line-height: 1.45;
  letter-spacing: -0.02em;
  white-space: pre-wrap;
}

.reading-meta {
  margin: auto 0 0;
  padding-top: 22px;
  color: var(--paper-muted);
}

.about {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 28px;
  margin-top: 42px;
}

.about article {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.about h2 {
  margin: 0 0 8px;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.45rem;
  font-weight: 520;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.about p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

@media (max-width: 860px) {
  .page { width: min(100% - 24px, 1120px); padding-top: 24px; }
  .top { align-items: flex-start; flex-direction: column; gap: 14px; }
  .layout, .detail-row, .key-row { grid-template-columns: 1fr; display: grid; }
  .key-row { display: grid; }
  .reading { min-height: 0; }
  .about { grid-template-columns: 1fr; gap: 22px; }
  h1 { font-size: 3.4rem; }
}
