/* Home page of the Hotdog API. Mobile first; no inline style anywhere (the CSP forbids it). */
:root {
  color-scheme: light dark;
  --bg: #fbf8f3;
  --surface: #ffffff;
  --text: #231f1a;
  --muted: #6b6258;
  --border: #e4dccf;
  --accent: #b8460e;
  --accent-text: #ffffff;
  --accent-soft: #fbe9dd;
  --good: #1b6e3c;
  --good-soft: #def3e5;
  --bad: #a42626;
  --bad-soft: #fbe3e3;
  --code-bg: #f3eee6;
  --get: #1b6e3c;
  --get-soft: #def3e5;
  --post: #1d5fa8;
  --post-soft: #e1edfa;
  --patch: #8a5a00;
  --patch-soft: #fbefc9;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17140f;
    --surface: #221d17;
    --text: #f1ebe0;
    --muted: #b3a999;
    --border: #3a3329;
    --accent: #f08a4b;
    --accent-text: #1b1208;
    --accent-soft: #3a2517;
    --good: #6fd391;
    --good-soft: #17301f;
    --bad: #ff9a9a;
    --bad-soft: #3a1b1b;
    --code-bg: #2b251d;
    --get: #6fd391;
    --get-soft: #17301f;
    --post: #8ab8f2;
    --post-soft: #17283c;
    --patch: #f0c25e;
    --patch-soft: #3a2f12;
  }
}
* { 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, sans-serif;
  overflow-wrap: break-word;
}
main { max-width: 1000px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 1.7rem; line-height: 1.15; margin: 0 0 8px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
p { margin: 0 0 12px; }
.card > p, .card > .guide, .intro .lead { max-width: 72ch; }
a { color: var(--accent); }
img { max-width: 100%; }
[hidden] { display: none !important; }
.lead { color: var(--muted); font-size: 1rem; margin-bottom: 24px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  min-width: 0;
}
label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type="text"], input[type="number"], select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
button, .button {
  min-height: 44px;
  padding: 8px 16px;
  font: inherit;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
button.secondary, .button.secondary { color: var(--text); background: transparent; border: 1px solid var(--border); }
button.small { min-height: 36px; padding: 4px 12px; font-size: .9rem; }
button.danger { color: var(--bad); background: transparent; border: 1px solid var(--border); }
button:disabled { opacity: .6; cursor: progress; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; }
.row > input { flex: 1 1 200px; min-width: 0; }
.row.top { margin-top: 12px; }
.inline-label { display: inline-flex; align-items: center; margin: 0; }
.hint { color: var(--muted); font-size: .9rem; margin-top: 8px; }
.notice { padding: 10px 14px; border-radius: 10px; margin: 12px 0; }
.notice.warn { background: var(--accent-soft); }
.notice.good { background: var(--good-soft); color: var(--good); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice p:last-child { margin-bottom: 0; }
.notice .tight { margin-bottom: 6px; }
.keybox {
  display: block;
  width: 100%;
  padding: 12px 14px;
  font: .95rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text);
  background: var(--code-bg);
  border: 1px dashed var(--border);
  border-radius: 10px;
  word-break: break-all;
  user-select: all;
}
code {
  font: .9rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 6px;
}
p code, li code { overflow-wrap: break-word; }
pre {
  margin: 8px 0;
  padding: 12px;
  max-width: 100%;
  overflow-x: auto;           /* long lines scroll inside the block, never the page */
  background: var(--code-bg);
  border-radius: 10px;
  font: .85rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
  tab-size: 2;
}
dl { display: grid; grid-template-columns: 1fr; gap: 2px; margin: 0; }
dt { color: var(--muted); font-size: .9rem; }
dd { margin: 0 0 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }
dd code { overflow-wrap: anywhere; }
.copy { min-height: 36px; padding: 2px 12px; font-size: .85rem; }

/* course request console */
.tag { display: inline-block; margin: 0 0 8px; padding: 1px 10px; border-radius: 999px; background: var(--accent-soft); font-size: .875rem; }
.vars { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 12px 0; }
.vars label { font-weight: 500; font-size: .92rem; margin-bottom: 4px; }
.tabs { display: flex; gap: 0; margin: 16px 0 0; overflow-x: auto; border-bottom: 1px solid var(--border); }
.tab {
  flex: 1 1 0;
  min-width: 0;
  font-size: .88rem;
  white-space: nowrap;
  overflow-wrap: normal;
  min-height: 44px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  padding: 8px 2px;
}
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.panel { padding-top: 12px; min-width: 0; }
.main-tabs { margin: 0 0 12px; }
.sub { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border); }
.how { margin: 16px 0 0; padding-left: 22px; color: var(--muted); }
.how li { margin-bottom: 4px; }
.intro .lead { margin-bottom: 16px; }
.result { margin-top: 12px; }
.preview { max-height: 14rem; overflow: auto; }
details { margin: 12px 0; }
summary { cursor: pointer; font-weight: 600; min-height: 36px; padding: 6px 0; }
details[open] > summary { margin-bottom: 4px; }
.statusline { font-weight: 600; margin-bottom: 6px; }
.statusline.ok { color: var(--good); }
.statusline.ko { color: var(--bad); }
.fields { list-style: none; margin: 8px 0; padding: 0; }
.fields li { padding: 8px 0; border-top: 1px solid var(--border); min-width: 0; }
.fields li:first-child { border-top: 0; }
.fields .label { color: var(--muted); font-size: .85rem; }
.fields .value { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; min-width: 0; }
.fields .value code, .fields .value pre { flex: 1 1 180px; min-width: 0; margin: 0; overflow-wrap: anywhere; }
.fields .value pre { white-space: pre-wrap; }

/* samples, webhooks, tables */
.samples { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.sample {
  width: 96px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 400;
  font-size: .8rem;
  min-height: 0;
}
.sample img { display: block; width: 100%; height: 68px; object-fit: cover; border-radius: 6px; margin-bottom: 4px; }
.links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.links a { text-decoration: none; display: inline-flex; align-items: center; }
.hook { border-top: 1px solid var(--border); padding: 12px 0; }
.hook:first-of-type { border-top: 0; }
.hook-url { font-weight: 600; word-break: break-all; }
.hook-events { color: var(--muted); font-size: .85rem; }
.hook .row { margin-top: 8px; }
.hook button { min-height: 40px; padding: 4px 12px; font-size: .9rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: 6px 8px; border-top: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.badge { padding: 1px 8px; border-radius: 999px; font-size: .8rem; white-space: nowrap; }
.badge.succeeded { background: var(--good-soft); color: var(--good); }
.badge.failed { background: var(--bad-soft); color: var(--bad); }
.badge.pending { background: var(--accent-soft); }
.platforms { margin: 8px 0 0; padding-left: 20px; color: var(--muted); font-size: .92rem; }
.events { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 10px 0 4px; }
.events label { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; min-height: 36px; }
.events input { width: 20px; height: 20px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; min-height: 36px; margin: 8px 0 0; }
.check input { width: 20px; height: 20px; }
.verdict { font-weight: 600; }
footer { color: var(--muted); font-size: .9rem; margin-top: 24px; }

@media (min-width: 640px) {
  main { padding: 32px 20px 64px; }
  h1 { font-size: 2rem; }
  .card { padding: 20px; }
  .vars { grid-template-columns: 1fr 1fr; }
  .tab { flex: 0 1 auto; padding: 8px 18px; font-size: 1rem; }
  dl { grid-template-columns: max-content 1fr; gap: 8px 16px; }
  dd { margin: 0; }
  .sample { width: 104px; }
}
.top-gap { margin-top: 16px; }

/* the remaining quota, always in sight once there is a key */
.quota {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
  align-items: baseline;
  justify-content: center;
  padding: 6px 12px;
  font-size: .9rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.quota strong { font-size: 1.1rem; }
.quota-line { white-space: nowrap; }
.quota.low { background: var(--accent-soft); }
.quota.empty { background: var(--bad-soft); color: var(--bad); }
.quota-note { color: var(--muted); font-size: .85rem; }

/* the five sections do not fit on one line of a narrow phone: three by two */
@media (max-width: 479px) {
  .main-tabs { display: grid; grid-template-columns: repeat(3, 1fr); overflow: visible; border-bottom: 0; gap: 4px; }
  .main-tabs .tab { border: 1px solid var(--border); border-radius: 10px; font-size: .9rem; padding: 8px 4px; }
  .main-tabs .tab[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); }
}

kbd {
  font: .85rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: 1px 6px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* HTTP method badges */
.method {
  display: inline-block;
  min-width: 4.4em;
  padding: 2px 8px;
  border-radius: 6px;
  font: 700 .75rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: center;
  letter-spacing: .02em;
  color: var(--get);
  background: var(--get-soft);
}
.method.post { color: var(--post); background: var(--post-soft); }
.method.patch, .method.put { color: var(--patch); background: var(--patch-soft); }
.method.delete { color: var(--bad); background: var(--bad-soft); }

/* choosing a request: a list by section, like an API reference */
.reqlayout { display: block; margin-top: 16px; }
.picker { margin-bottom: 16px; min-width: 0; }
.picker-toggle { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; }
.picker-toggle-title { flex: 1 1 auto; min-width: 0; font-weight: 600; }
.picker-toggle-action { color: var(--accent); font-size: .9rem; white-space: nowrap; }
.picker-list { margin-top: 8px; }
.picker-section { margin: 0 0 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); overflow: hidden; }
.picker-section > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0;
  padding: 8px 12px;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.picker-section[open] > summary { margin: 0; border-bottom: 1px solid var(--border); }
.picker-section:first-child > summary { color: var(--accent); }
.picker-section .count { font-weight: 400; font-size: .8rem; }
.picker-note { margin: 0; padding: 8px 12px 0; color: var(--muted); font-size: .85rem; }
.pick {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  text-align: left;
  font-weight: 400;
  color: var(--text);
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0;
}
.pick + .pick { border-top: 1px solid var(--border); }
.pick:hover { background: var(--accent-soft); }
.pick[aria-current="true"] { background: var(--accent-soft); border-left-color: var(--accent); }
.pick .method { flex: none; min-width: 3.9em; margin-top: 2px; }
.pick-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pick-title { font-weight: 600; font-size: .92rem; line-height: 1.3; }
.pick-path { align-self: flex-start; max-width: 100%; padding: 0; background: transparent; color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; }

/* the chosen request */
.reqdetail { min-width: 0; }
.reqdetail:focus { outline: none; }
.req-title { font-size: 1.25rem; line-height: 1.25; margin: 0 0 6px; }
.req-summary { color: var(--muted); }
.stage { display: flex; align-items: center; gap: 10px; margin: 24px 0 10px; font-size: 1.05rem; }
.stage-num {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--accent-text);
  background: var(--accent);
  font-size: .9rem;
}
.reqbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.reqbar .method { padding: 6px 10px; font-size: .85rem; }
.reqbar-url { flex: 1 1 200px; min-width: 0; padding: 0; background: transparent; font-size: .95rem; overflow-wrap: anywhere; }
.reqbar button { flex: none; }
.body-preview { margin: 8px 0 0; }
#result-next { margin-top: 10px; }

/* step by step: the button is on the line of its step */
.guide { list-style: none; margin: 8px 0 12px; padding: 0; counter-reset: step; }
.gstep {
  position: relative;
  min-width: 0;
  margin: 0 0 8px;
  padding: 10px 12px 10px 52px;
  border: 1px solid var(--border);
  border-radius: 12px;
  counter-increment: step;
}
.gstep::before {
  content: counter(step);
  position: absolute;
  top: 10px;
  left: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 700;
  font-size: .9rem;
  color: var(--muted);
  background: var(--code-bg);
}
.gline { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; min-height: 28px; }
.gtext { flex: 1 1 240px; min-width: 0; margin: 0; }
.gactions { display: flex; flex-wrap: wrap; gap: 8px; }
.gextra { margin: 8px 0 0; }
.gstep.is-current { border-color: var(--accent); background: var(--accent-soft); }
.gstep.is-current::before { color: var(--accent-text); background: var(--accent); }
.gstep.is-done::before { content: "✓"; color: var(--good); background: var(--good-soft); }
.gstep.is-done .gtext { color: var(--muted); }
.gstep.is-todo .gtext { color: var(--muted); }
.gstep.is-todo .step-done, .gstep.is-done .step-done { display: none; }
.gstep.is-todo button:not(.secondary) { color: var(--text); background: transparent; border: 1px solid var(--border); }
.gstep.is-done button:not(.secondary) { color: var(--text); background: transparent; border: 1px solid var(--border); }
.guide .guide { margin-top: 4px; }

@media (min-width: 820px) {
  .reqlayout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 28px; align-items: start; }
  .picker { position: sticky; top: 56px; max-height: calc(100vh - 72px); overflow-y: auto; margin-bottom: 0; padding-right: 2px; }
  .picker-toggle { display: none; }
  .picker-list { margin-top: 0; }
}
@media (max-width: 819px) {
  .picker.collapsed .picker-list { display: none; }
}

/* editable parameters */
.params-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 6px; }
.params-title { margin: 0; font-size: .95rem; }
button.link { min-height: 36px; padding: 4px 0; font-size: .9rem; font-weight: 500; color: var(--accent); background: transparent; text-decoration: underline; }
.field { min-width: 0; }
.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.field-head label { margin: 0; }
.where { color: var(--muted); font: .75rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.field .hint { margin-top: 4px; font-size: .82rem; }
.field select:disabled { color: var(--muted); }
.next .row { margin-top: 8px; }
.next .notice { margin: 10px 0 0; }

/* my data */
.data-controls { align-items: center; margin-top: 12px; }
.data-controls .check { margin: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 4px; }
.chip { padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); font-size: .9rem; }
.chip strong { font-size: 1rem; }
.block-title { margin: 28px 0 8px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 1.05rem; }
.feed { list-style: none; margin: 8px 0 0; padding: 0; }
.feed li { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--border); }
.feed li:first-child { border-top: 0; }
.feed-symbol { flex: none; width: 1.4em; text-align: center; font-weight: 700; color: var(--accent); }
.feed-text { flex: 1 1 auto; min-width: 0; }
.feed-time { flex: none; color: var(--muted); font-size: .82rem; }
.empty { padding: 14px; border: 1px dashed var(--border); border-radius: 12px; }
.empty p { margin-bottom: 10px; }
.row-actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.row-actions button { white-space: nowrap; }
td button.small { min-height: 32px; padding: 2px 10px; font-size: .85rem; }
tr.fresh td { animation: fresh 4s ease-out; }
@keyframes fresh { from { background: var(--accent-soft); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { tr.fresh td { animation: none; background: var(--accent-soft); } }
