:root {
  color-scheme: light dark;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--tg-theme-bg-color, #f8fafc);
  color: var(--tg-theme-text-color, #172331);
  --muted: var(--tg-theme-hint-color, #52647a);
  --surface: var(--tg-theme-secondary-bg-color, #edf2f7);
  --accent: var(--tg-theme-link-color, #174d8e);
  --button: var(--tg-theme-button-color, #225f9e);
  --button-text: var(--tg-theme-button-text-color, #fff);
  --code-bg: #131d2a;
  --code-text: #e7eef6;
  --code-keyword: #c5b5ff;
  --code-string: #a5e0ac;
  --code-number: #ffd29b;
  --code-comment: #a7b5c7;
}

@media (prefers-color-scheme: dark) {
  :root {
    background: var(--tg-theme-bg-color, #151d28);
    color: var(--tg-theme-text-color, #edf2f9);
    --surface: var(--tg-theme-secondary-bg-color, #222d3b);
    --muted: var(--tg-theme-hint-color, #b7c3d3);
    --accent: var(--tg-theme-link-color, #a1caff);
  }
}

* { box-sizing: border-box; }
body { margin: 0; }
main {
  max-width: 760px;
  margin: 0 auto;
  padding: max(18px, var(--tg-content-safe-area-inset-top, 0px)) 16px
    max(28px, var(--tg-content-safe-area-inset-bottom, 0px));
}
.answer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 0 16px;
}
h1 { margin: 0; font-size: clamp(22px, 6vw, 32px); line-height: 1.22; overflow-wrap: anywhere; }
h2, h3, h4 { line-height: 1.28; margin: 1.3em 0 0.45em; }
p, ul, ol { margin: 0 0 1em; }
article { min-width: 0; font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; }
article p { white-space: pre-line; }
article ul, article ol { padding-inline-start: 24px; }
li + li { margin-top: 6px; }
button {
  border: 0;
  border-radius: 8px;
  padding: 9px 13px;
  min-height: 40px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  background: var(--button);
  color: var(--button-text);
  cursor: pointer;
}
button:focus-visible, pre:focus-visible, .table-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
#status { color: var(--muted); }
.notice { background: var(--surface); border-radius: 8px; padding: 11px 13px; line-height: 1.5; }
code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 0.92em; }
p code, li code, td code, th code { background: var(--surface); border-radius: 4px; padding: 2px 4px; }
.code-block {
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid #354358;
  border-radius: 10px;
  margin: 0 0 20px;
  min-width: 0;
}
.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px 6px 12px;
  border-bottom: 1px solid #354358;
  font-size: 13px;
  color: var(--code-comment);
}
.code-toolbar button { background: #263a50; color: #f1f6fc; }
pre {
  margin: 0;
  padding: 12px;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  white-space: pre;
  overflow-wrap: normal;
  tab-size: 4;
  font-size: 14px;
  line-height: 1.52;
}
pre code { font-size: inherit; }
.keyword { color: var(--code-keyword); }
.string { color: var(--code-string); }
.number { color: var(--code-number); }
.comment { color: var(--code-comment); }
.table-scroll { overflow-x: auto; max-width: 100%; margin: 0 0 18px; }
table { border-collapse: collapse; min-width: 100%; }
th, td { padding: 8px 10px; text-align: start; border-bottom: 1px solid var(--surface); }
th { background: var(--surface); }
.clipboard-buffer { position: fixed; inset: 0 auto auto 0; width: 1px; height: 1px; opacity: 0; }
