:root {
  --theory-gold: #efb701;
  --theory-gold-dark: #7b5e00;
  --theory-cream: #fff8dc;
  --theory-ink: #262216;
  --theory-muted: #696253;
  --theory-line: #e8dfc5;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.kdl-theory-body { margin: 0; background: #f7f5ef; color: var(--theory-ink); }
.kdl-theory-page { min-height: 70vh; }
.kdl-theory-hero {
  height: 8px;
  min-height: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
  color: transparent;
  scroll-margin-top: 0;
}
.kdl-theory-hero-inner {
  height: 8px;
  min-height: 0;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  overflow: hidden;
  color: transparent;
  font-size: 1px;
  line-height: 1;
}
.kdl-theory-hero span,
.kdl-theory-hero h1,
.kdl-theory-hero p {
  margin: 0;
  padding: 0;
  color: transparent;
  font-size: 1px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: 0;
}
.kdl-theory-hero p { max-width: none; word-break: normal; }
.kdl-theory-shell { padding-top: 26px; padding-bottom: 64px; }
.kdl-theory-resume { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; border: 1px solid var(--theory-line); border-radius: 18px; background: #fff; }
.kdl-theory-resume div { min-width: 0; }
.kdl-theory-resume span { display: block; margin-bottom: 4px; color: var(--theory-gold-dark); font-size: 13px; font-weight: 900; }
.kdl-theory-resume strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.kdl-theory-resume button { min-height: 42px; padding: 0 16px; border: 1px solid #d6c994; border-radius: 12px; background: #fffdf5; color: #5c4700; font: inherit; font-weight: 800; cursor: pointer; }
.kdl-theory-tabs { position: sticky; top: var(--kdl-theory-tabs-top, 0px); scroll-margin-top: var(--kdl-theory-tabs-top, 0px); z-index: 4; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 18px 0; padding: 8px; border: 1px solid var(--theory-line); border-radius: 18px; background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }
.kdl-theory-tabs button { min-height: 50px; padding: 8px 10px; border: 0; border-radius: 12px; background: transparent; color: #575040; font: inherit; font-size: 15px; font-weight: 800; cursor: pointer; }
.kdl-theory-tabs button[aria-selected="true"] { background: var(--theory-gold); color: #2f2500; box-shadow: 0 7px 18px rgba(142,103,0,.18); }
.kdl-theory-progress { margin-bottom: 16px; padding: 0 2px; }
.kdl-theory-progress > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.kdl-theory-progress span { color: var(--theory-muted); font-size: 14px; font-weight: 800; }
.kdl-theory-progress strong { color: var(--theory-gold-dark); font-size: 15px; }
.kdl-theory-progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: #e8e2d2; }
.kdl-theory-progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--theory-gold); transition: width .22s ease; }
.kdl-theory-stage { min-height: 440px; }
.kdl-theory-card { min-height: 430px; padding: clamp(24px, 4vw, 42px); border: 1px solid var(--theory-line); border-radius: 26px; background: #fff; box-shadow: 0 16px 45px rgba(58,49,23,.08); }
.kdl-theory-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.kdl-theory-card-meta span { color: var(--theory-gold-dark); font-size: 14px; font-weight: 900; }
.kdl-theory-card-meta strong { display: inline-flex; align-items: center; justify-content: center; min-width: 46px; height: 32px; padding: 0 10px; border-radius: 999px; background: var(--theory-gold); color: #302600; font-size: 14px; }
.kdl-theory-card h2 { margin: 0 0 24px; font-size: 27px; line-height: 1.38; letter-spacing: -0.03em; word-break: keep-all; }
.kdl-theory-card-content { color: #413c31; }
.kdl-theory-card-content ul,
.kdl-theory-card-content ol { margin: 0; padding-left: 25px; }
.kdl-theory-card-content li { margin: 11px 0; font-size: 20px; line-height: 1.72; font-weight: 400; word-break: break-all; text-align: justify; text-justify: inter-character; }
.kdl-theory-card-content li::marker { color: var(--theory-gold-dark); font-weight: 900; }
.kdl-theory-card-image { margin: 0 0 24px; overflow: hidden; border: 1px solid var(--theory-line); border-radius: 18px; background: var(--theory-cream); }
.kdl-theory-card-image img { display: block; width: 100%; max-height: 430px; object-fit: contain; background: #fff; }
.kdl-theory-card-image figcaption { padding: 14px 16px; color: #625b4d; font-size: 15px; line-height: 1.65; }
.kdl-theory-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.kdl-theory-controls button { min-height: 54px; border: 0; border-radius: 15px; font: inherit; font-size: 17px; font-weight: 900; cursor: pointer; }
.kdl-theory-controls button:first-child { background: #e9e4d8; color: #443e32; }
.kdl-theory-controls #theoryNextButton { background: var(--theory-gold); color: #302600; }
.kdl-theory-controls button:disabled { opacity: .4; cursor: not-allowed; }
.kdl-theory-controls .kdl-theory-subject-start {
  grid-column: 1 / -1;
  width: 100%;
  background: #000;
  color: #fff;
}
.kdl-theory-controls .kdl-theory-subject-start:hover { filter: brightness(.97); }

.kdl-theory-live { position: fixed; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 820px) {
  .kdl-theory-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kdl-theory-card-content li { font-size: 19px; }
}
@media (max-width: 560px) {
  .kdl-theory-shell { padding-top: 20px; padding-bottom: 48px; }
  .kdl-theory-resume { align-items: stretch; flex-direction: column; }
  .kdl-theory-resume strong { white-space: normal; }
  .kdl-theory-resume button { width: 100%; }
  .kdl-theory-tabs { position: relative; grid-template-columns: 1fr; }
  .kdl-theory-tabs button { min-height: 46px; }
  .kdl-theory-stage { min-height: 390px; }
  .kdl-theory-card { min-height: 380px; padding: 24px 20px; border-radius: 21px; }
  .kdl-theory-card h2 { margin-bottom: 20px; font-size: 24px; }
  .kdl-theory-card-content li { font-size: 18px; line-height: 1.7; }
  .kdl-theory-controls button { min-height: 52px; font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .kdl-theory-progress-track span { transition: none; }
}
.kdl-theory-card-subheading {
  margin: 26px 0 10px;
  color: #6b5200;
  font-size: 18px;
  line-height: 1.45;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.kdl-theory-card-content > .kdl-theory-card-subheading:first-child { margin-top: 0; }
@media (max-width: 560px) {
  .kdl-theory-card-subheading { margin-top: 22px; font-size: 17px; }
}

