:root {
  --bg: #f8f7f4;
  --paper: #ffffff;
  --ink: #1f2328;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #0f766e;
  --quote: #f3f7fb;
  --code-bg: #0f172a;
  --code-fg: #e2e8f0;
  --font-body: "Charter", "Iowan Old Style", "Noto Serif", Georgia, serif;
  --font-sans: "IBM Plex Sans", "Noto Sans KR", system-ui, -apple-system, sans-serif;
}

html[data-font="ibm"] { --font-body: var(--font-sans); }
html[data-font="serif"] { --font-body: "Charter", "Iowan Old Style", "Noto Serif", Georgia, serif; }

html, body { margin: 0; padding: 0; }
body {
  background: linear-gradient(180deg, #fbfbfa, #f4f4f2 60%, #efefed);
  color: var(--ink);
  font-family: var(--font-body);
}

.txf-post, .txf-reader-content {
  max-width: 760px;
  margin: 42px auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
  padding: 34px 30px;
}

.txf-post header h1 {
  margin: 0 0 8px;
  font-size: 2rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.txf-post header p a { color: var(--accent); text-decoration: none; margin-right: 10px; }
.txf-post header p a:hover { text-decoration: underline; }
.txf-header { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 18px; }
.txf-authors { color: #374151; margin: 4px 0; }
.txf-date, .txf-keywords, .txf-corresponding { color: var(--muted); margin: 2px 0; font-size: .95rem; }
.txf-authors-list { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.txf-authors-list li { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; font-size: .92rem; background: #fcfcfd; }
.txf-author-email { font-size: .84rem; text-decoration: none; }
.txf-author-affiliation { display: block; width: 100%; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.txf-badge { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; border: 1px solid #cde2dc; color: #0f766e; background: #ecfdf5; border-radius: 999px; padding: 2px 6px; }

h1[data-txf-role], h2[data-txf-role], h3[data-txf-role], h4[data-txf-role] {
  margin-top: 1.4em;
  margin-bottom: 0.45em;
  letter-spacing: -0.01em;
}

p[data-txf-role="para"] {
  margin: 0.7em 0;
  line-height: 1.82;
  font-size: 1.08rem;
}

a { color: var(--accent); }
.txf-ref { font-family: ui-monospace, Menlo, monospace; font-size: .94em; }
.txf-cite { color: var(--muted); font-style: normal; }
.txf-cite-author, .txf-cite-year { color: var(--muted); font-style: normal; }

ul[data-txf-role="list"], ol[data-txf-role="list"] { line-height: 1.8; margin: .6em 0 1em 1.2em; }

table[data-txf-role="tabular"] {
  width: 100%;
  border-collapse: collapse;
  margin: 1.1em 0;
  font-size: .98rem;
  background: #fff;
}

table[data-txf-role="tabular"] td,
table[data-txf-role="tabular"] th {
  border: 1px solid var(--line);
  padding: 8px 10px;
}

section[data-txf-role="definition"],
section[data-txf-role="theorem"],
section[data-txf-role="assumption"],
section[data-txf-role="lemma"],
section[data-txf-role="corollary"],
section[data-txf-role="proposition"],
section[data-txf-role="remark"],
section[data-txf-role="example"],
section[data-txf-role="tcolorbox"] {
  margin: 1em 0;
  padding: 12px 14px;
  border: 1px solid #d9e4f0;
  background: #f8fbff;
  border-radius: 10px;
}

section[data-txf-role="proof"] {
  margin: 1em 0;
  padding: 12px 14px;
  border: 1px solid #dce7dc;
  background: #f7fcf7;
  border-radius: 10px;
}

figure[data-txf-role="figure"] { margin: 1.2em 0; }
figure[data-txf-role="figure"] img { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; }
figure[data-txf-role="figure"] figcaption { color: var(--muted); margin-top: .45em; }
.txf-figure-object { width: 100%; min-height: 520px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.txf-table-wrap { margin: 1.2em 0; }
.txf-table-wrap figcaption { color: var(--muted); margin-top: 6px; font-size: .92rem; }
.txf-figure-missing { border: 1px dashed #fca5a5; background: #fff1f2; color: #9f1239; border-radius: 8px; padding: 14px; }
.txf-latex-word { font-variant: small-caps; letter-spacing: .02em; }
.txf-upright { font-style: normal; }

.txf-math-inline {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 1em;
  line-height: inherit;
}

.txf-math-display {
  display: block;
  margin: 0.9em 0;
  padding: 8px 10px;
  border-left: 3px solid #c7d2fe;
  background: #f8fafc;
  font-family: "STIX Two Math", "Times New Roman", serif;
  max-width: 100%;
  overflow-x: auto;
}

.txf-math-display-inline {
  display: block;
  width: 100%;
}

.txf-math-display mjx-container[jax="CHTML"],
.txf-math-display mjx-container[display="true"] {
  max-width: 100% !important;
  width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}

.txf-math-display mjx-math {
  white-space: normal !important;
}

.txf-pagebreak {
  margin: 2rem 0;
  border: 0;
  border-top: 1px dashed #cbd5e1;
  position: relative;
  page-break-after: always;
  break-after: page;
}

.txf-pagebreak::after {
  content: "page break";
  position: absolute;
  top: -0.7rem;
  right: 0;
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--paper);
  padding-left: 8px;
}

pre[data-txf-role="code"], pre[data-txf-role="raw"] {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 12px;
  border-radius: 8px;
  overflow: auto;
}

@media (max-width: 840px) {
  .txf-post, .txf-reader-content {
    margin: 0;
    border-radius: 0;
    min-height: 100vh;
    padding: 22px 16px;
  }
}
