:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f0f0ec;
  --text: #1c1c21;
  --muted: #5d5e66;
  --border: #e2e2dd;
  --accent: #2a57c4;
  --accent-ink: #ffffff;
  --accent-soft: #e9effc;
  --warn-bg: #fff3df;
  --warn: #7f4b00;
  --ok-bg: #e5f4ea;
  --ok: #1b6236;
  --err-bg: #fde8e8;
  --err: #9b1c1c;
  --radius: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316;
    --surface: #1b1c20;
    --surface-2: #24252a;
    --text: #ececef;
    --muted: #a3a4ad;
    --border: #2f3036;
    --accent: #7ea2ff;
    --accent-ink: #0e1220;
    --accent-soft: #1f2a45;
    --warn-bg: #3a2a10;
    --warn: #f5c77a;
    --ok-bg: #133022;
    --ok: #86d9a5;
    --err-bg: #3b1717;
    --err: #ffaaaa;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
}
a { color: var(--accent); }
img { max-width: 100%; display: block; }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }

.top { background: var(--surface); border-bottom: 1px solid var(--border); }
.top-row { display: flex; align-items: center; gap: 12px; height: 56px; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.tag { color: var(--muted); font-size: 14px; border-left: 1px solid var(--border); padding-left: 12px; }

.hero { padding: 32px 0 16px; }
.hero h1 { font-size: clamp(26px, 5vw, 36px); line-height: 1.2; margin: 0 0 8px; }
.hero p { color: var(--muted); margin: 0; max-width: 62ch; }

.tabs { display: flex; gap: 4px; margin-top: 16px; }
.tabs button {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border); border-bottom: none;
  background: var(--surface-2); color: var(--muted);
  padding: 10px 18px; border-radius: var(--radius) var(--radius) 0 0;
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 20px;
}
label { font-weight: 600; display: block; margin-bottom: 6px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
input[type="url"] {
  flex: 1 1 260px; min-width: 0;
  font: inherit; padding: 11px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text);
}
input[type="url"]:focus-visible, button:focus-visible, a:focus-visible, .drop:focus-within {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
button.primary, .btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; border-radius: 10px;
  padding: 10px 18px; background: var(--accent); color: var(--accent-ink);
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
button.primary:disabled { opacity: .6; cursor: wait; }
.btn.ghost, button.ghost {
  background: transparent; color: var(--accent); border-color: var(--border);
  padding: 6px 10px; font-size: 14px; border-radius: 8px; font-weight: 600; cursor: pointer;
}
.hint { color: var(--muted); font-size: 14px; margin: 8px 0 0; }

.drop {
  display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center;
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 36px 16px; cursor: pointer; margin: 0; font-weight: 400;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop span { color: var(--muted); font-size: 14px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.status { margin: 16px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); }
.status.error { background: var(--err-bg); color: var(--err); }
.status.busy::before {
  content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin-top: 16px;
}
.card h2 { font-size: 18px; margin: 0 0 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

.facts { display: grid; grid-template-columns: minmax(110px, 180px) 1fr; gap: 8px 16px; margin: 0; }
.facts dt { color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts small { color: var(--muted); display: block; font-size: 13px; }
@media (max-width: 520px) {
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 10px; }
}

.clues { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.clues li { padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); overflow-wrap: anywhere; }
.clues li.warn { background: var(--warn-bg); color: var(--warn); }
.clues li.ok { background: var(--ok-bg); color: var(--ok); }
.clues li a { color: inherit; }

.frames { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.frame { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); display: flex; flex-direction: column; }
.frame img { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #000; }
.frame .meta { padding: 8px 10px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.frame .label { font-size: 13px; color: var(--muted); }
.engines { display: flex; flex-wrap: wrap; gap: 6px; }

details { margin-top: 12px; }
summary { cursor: pointer; color: var(--accent); font-weight: 600; }
pre.desc { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); padding: 12px; border-radius: 10px; font: inherit; font-size: 14px; max-height: 320px; overflow: auto; }

.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

.info { margin: 32px 0; color: var(--text); }
.info h2 { font-size: 18px; margin: 20px 0 8px; }
.info ol, .info ul { padding-left: 20px; margin: 0; display: grid; gap: 6px; }
.info li { color: var(--muted); }
.info b { color: var(--text); }

.foot { border-top: 1px solid var(--border); color: var(--muted); font-size: 14px; padding: 18px 0 28px; }
