:root {
  --bg: #101410;
  --card: #181d18;
  --card-2: #20261f;
  --line: #313a32;
  --text: #edf3ea;
  --muted: #9aab9e;
  --lime: #d6f25c;
  --ink: #17200a;
  --danger: #ff8d7a;
  --ok: #b7e0c2;
  --warn: #f0c36a;
  --run: #9fd0ff;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(214, 242, 92, 0.08), transparent 55%),
    var(--bg);
}

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

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--lime);
  color: var(--ink);
  cursor: pointer;
}

button:disabled { opacity: 0.6; cursor: wait; }

button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #121712;
  padding: 10px 12px;
}

:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

.noscript {
  margin: 16px;
  padding: 12px 14px;
  background: var(--card);
  border-radius: 12px;
}

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate-card { width: min(420px, 100%); }

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}

.card-head, .top, .row, .brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top, .card-head { justify-content: space-between; }

.top { margin-bottom: 18px; }

.brand { align-items: center; }

.mark {
  width: 18px;
  height: 18px;
  background: var(--lime);
  clip-path: polygon(0 0, 100% 0, 100% 68%, 68% 100%, 0 100%);
}

.sub, .eyebrow, .meta, .empty, .lede { color: var(--muted); }

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1, h2 { margin: 0; font-weight: 600; }

h1 { font-size: 32px; }

h2 { font-size: 20px; }

.lede { margin: 8px 0 16px; line-height: 1.45; }

label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.gate-card button, .key-form button { margin-top: 0; }

.gate-card button { margin-top: 14px; }

.form-error { color: var(--danger); margin: 8px 0; }

.layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.example-card { grid-column: 1 / -1; }

.key-form { margin: 14px 0; }

.row { align-items: stretch; }

.row > input { flex: 1; }

.reveal {
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 12px;
  background: var(--card-2);
  border: 1px solid var(--line);
}

.reveal p { margin: 0 0 8px; }

.reveal textarea {
  width: 100%;
  min-height: 64px;
  resize: none;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 10px;
}

.keys { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.key {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.mono { font-family: var(--mono); font-weight: 500; }

.gate-card button[type="submit"] { width: 100%; margin-top: 14px; }

.meta { margin: 4px 0 0; font-size: 13px; }

.key button { flex: none; align-self: center; }

.example {
  margin: 0;
  overflow: auto;
  padding: 12px;
  border-radius: 12px;
  background: #101510;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre;
}

.journal { min-width: 0; }

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; min-width: 720px; table-layout: fixed; }

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th { color: var(--muted); font-size: 13px; font-weight: 500; }

tbody tr { cursor: pointer; }

tbody tr:hover td, tr.open td { background: #222922; }

.clip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.answer .clip { display: block; }

.time { display: grid; gap: 2px; }

.duration { color: var(--muted); font-size: 12px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.queued { color: var(--warn); }
.running { color: var(--run); }
.done { color: var(--ok); }
.error { color: var(--danger); }

.answer { display: grid; gap: 2px; }

.detail td { cursor: default; background: #141914; }

.detail-grid { display: grid; gap: 12px; padding: 6px 4px 10px; }

.detail-grid h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); font-weight: 500; }

.preview, .error-text {
  margin: 0;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
}

.error-text { color: var(--danger); }

.preview-image {
  max-width: min(100%, 640px);
  max-height: 360px;
  object-fit: contain;
  border-radius: 8px;
}

.file-link { color: var(--lime); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .example-card { grid-column: auto; }
  .shell { width: min(100% - 24px, 1180px); }
  .row { flex-wrap: wrap; }
  .table-wrap { overflow: visible; }
  table, tbody, tr, td { display: block; width: auto; min-width: 0; }
  table { table-layout: auto; }
  thead { display: none; }
  tbody tr { padding: 8px 0 10px; }
  td { border: 0; padding: 2px 0; }
  .clip { white-space: normal; }
}

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