/* "ПДД интерфейс" — colours and sizes measured from the pdd_educ window (1120 × 868 pt). */
body {
  --pw-red: #bc4139;
  --pw-page: #e0e0e0;
  --pw-blue: #3573be;
  --pw-sel: #bcdbf7;
  --pw-green: #508c46;
  --pw-gold: #fdf5aa;
  --pw-shadow: #c2c5c8;
  --pw-ink: #2c2c2c;
  --pw-bar: #ebebeb;
  --pw-bar-dark: #dfdfdf;
  --pw-ok: #3f7e2f;
  --pw-ok-big: #98ca98;
  --pw-bad: #8c241a;
  --pw-bad-big: #de8f8c;
  --pw-rules: #61768f;
  --pw-explain: #8a5e63;
  margin: 0;
  background: var(--pw-page);
  color: var(--pw-ink);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

/* Shell: red header 35pt, grey stage, red hint box, red footer 36pt. */
.pw-shell { min-height: 100vh; display: flex; flex-direction: column; position: relative; }
.pw-head, .pw-foot {
  background: var(--pw-red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.pw-head { height: 35px; font-size: 16px; box-shadow: 0 4px 0 var(--pw-shadow); position: relative; z-index: 1; }
.pw-foot { height: 36px; font-size: 16px; }
.pw-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 94px 16px 0;
  position: relative;
}
.pw-hint {
  align-self: center;
  width: 484px;
  height: 102px;
  box-sizing: border-box;
  max-width: calc(100% - 32px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: auto 0 73px;
  background: var(--pw-red);
  color: #fff;
  border: 6px solid #fff;
  box-shadow: 0 4px 0 var(--pw-shadow);
  padding: 0;
  text-align: center;
  font-size: 19px;
  letter-spacing: 0.02em;
  line-height: 32px;
}

/* Panels: 7pt white frame + 4pt grey shadow under it. Menu panel is 522pt wide. */
.pw-panel {
  background: #fff;
  border: 7px solid #fff;
  box-shadow: 0 4px 0 var(--pw-shadow);
}
.pw-cap {
  background: #fff;
  color: var(--pw-ink);
  font-size: 23px;
  line-height: 29px;
  padding: 0 0 0 6px;
}
.pw-list {
  background: var(--pw-blue);
  padding: 30px 0 14px;
  overflow: auto;
}
.pw-row {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: #fff;
  text-align: left;
  font: inherit;
  font-size: 21px;
  line-height: 33.5px;
  padding: 0 0 0 93px;
  cursor: pointer;
}
.pw-row.active { background: var(--pw-sel); color: var(--pw-ink); }
.pw-row.pw-gap { margin-top: 23.5px; }

.pw-menu { width: 536px; max-width: calc(100vw - 32px); box-sizing: border-box; }
.pw-menu .pw-list { height: 367px; padding: 30px 0 0; box-sizing: border-box; }
.pw-dim { min-height: 360px; }

/* Chapter screen: list 288pt wide at left, "Содержание главы" 478pt wide, green 175pt tall. */
/* Program: list x 119–421 y 121–729, info x 517–1001 y 121–332, hint over the list bottom. */
.pw-pick {
  width: 882px;
  max-width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: -8px;
}
.pw-chapters { width: 302px; flex: none; box-sizing: border-box; }
.pw-chapters .pw-list { height: 565px; padding: 0; }
.pw-chapters .pw-row { padding-left: 14px; line-height: 32px; font-size: 20px; }
.pw-chapters .pw-cap { font-size: 20px; }
.pw-about { width: 484px; flex: none; box-sizing: border-box; }
.pw-about .pw-cap { font-size: 20px; }
body[data-screen="pick"] .pw-hint { position: absolute; left: 50%; bottom: 111px; margin: 0; transform: translateX(-50%); }
.pw-green {
  background: var(--pw-green);
  color: #fff;
  height: 169px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 18px;
}
.pw-green h2 { margin: 0; font-size: 19px; font-weight: 400; color: #fff; line-height: 1.35; }
.pw-green p { margin: 14px 0 0; color: var(--pw-gold); font-size: 18px; }

/* Themed tickets: program panel x 262–858, y 164–520, caption 36pt, rows start at 230, text at x 358. */
.pw-themes { width: 596px; margin-top: 35px; }
.pw-themes .pw-cap { padding-left: 6px; line-height: 29px; }
.pw-themes .pw-list { height: 313px; padding-top: 30px; }
.pw-themes .pw-row { padding-left: 89px; }

/* Ticket number popup: green 436 × 88pt with white frame, laid over the list. Yellow tooltip above. */
.pw-popup {
  position: absolute;
  left: calc(50% - 56px);
  top: 279px;
  width: 448px;
  box-sizing: border-box;
  max-width: calc(100vw - 32px);
  height: 100px;
  background: var(--pw-green);
  color: #fff;
  border: 6px solid #fff;
  box-shadow: 0 4px 0 var(--pw-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 22px;
}
.pw-popup b { color: var(--pw-gold); font-weight: 400; min-width: 0.6em; }
.pw-tip {
  position: absolute;
  top: 61px;
  left: calc(50% - 175px);
  background: #fefad2;
  color: var(--pw-ink);
  border: 1px solid #c8c29a;
  padding: 2px 8px;
  font-size: 15px;
}
.pw-caret {
  display: inline-block;
  width: 12px;
  height: 3px;
  background: currentColor;
  align-self: flex-end;
  margin: 0 0 28px 2px;
  animation: pw-blink 1s steps(1) infinite;
}
.pw-popup .pw-caret { color: var(--pw-gold); }
@keyframes pw-blink { 50% { opacity: 0; } }

/* Question screen: white page, bar1 #dfdfdf 34pt, bar2 #ebebeb 42pt, footer #ebebeb 36pt. */
body[data-screen="quiz"] { background: #fff; }
.pw-quiz { min-height: 100vh; display: flex; flex-direction: column; background: #fff; position: relative; }
.pw-qbar {
  height: 34px;
  background: var(--pw-bar-dark);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 16px;
  font-size: 16px;
}
.pw-clock { font-size: 15px; letter-spacing: 0.04em; }
.pw-theme { text-align: right; padding-right: 150px; }
.pw-qsub {
  height: 42px;
  background: var(--pw-bar);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 16px;
  font-size: 16px;
}
.pw-caption { min-width: 230px; }
.pw-count { margin-left: auto; }
/* Program: 10 boxes 42pt wide, pitch 55.5pt, first at x=287, y 34–76; grey boxes have #d4d4d4 side lines. */
.pw-strip { display: flex; gap: 13.5px; position: absolute; left: 287px; top: 34px; height: 42px; }
.pw-strip span {
  width: 42px;
  height: 42px;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  background: var(--pw-bar);
  border-left: 1px solid #d4d4d4;
  border-right: 1px solid #d4d4d4;
  font-size: 17px;
}
.pw-strip span.now { background: #fff; }
.pw-strip span.empty { border-color: transparent; color: #8a8a8a; }
.pw-strip span.ok { background: var(--pw-ok-big); }
.pw-strip span.bad { background: var(--pw-bad-big); }
.pw-strip span.done { background: #c8d7e8; }

/* Program: text at y≈100, options at 227 / 273 (46pt pitch), "ВАШ ОТВЕТ" at 692. */
.pw-qtext { padding: 25px 40px 0; font-size: 21px; line-height: 22.5px; }
.pw-qmain { flex: 1; display: flex; gap: 40px; padding: 81px 40px 0; align-items: flex-start; }
/* Program: picture x 20–578 (558pt), answers from x≈626. */
.pw-qmain.has-img { padding-left: 20px; gap: 48px; padding-top: 73px; }
.pw-qimg { flex: none; width: 558px; max-width: 52%; }
.pw-qmain.has-img .pw-opts { padding-top: 8px; }
.pw-qimg img { width: 100%; height: auto; display: block; cursor: zoom-in; }
.pw-opts { flex: 1; display: flex; flex-direction: column; gap: 24px; }
.pw-opt {
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 20px;
  line-height: 22px;
  color: var(--pw-ink);
  padding: 0;
  cursor: pointer;
}
.pw-opt.right { color: var(--pw-ok); }
.pw-opt.wrong { color: var(--pw-bad); }
.pw-on::after { content: ". "; white-space: pre; }

/* "ВАШ ОТВЕТ" centred 30pt, verdict 50pt light green / light red, footer 36pt. */
.pw-qstatus {
  text-align: center;
  height: 112px;
  padding: 0;
  flex: none;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.pw-qstatus.ok { background: var(--pw-ok-big); }
.pw-qstatus.bad { background: var(--pw-bad-big); }
.pw-qstatus.taken { background: #8db0d9; }
.pw-answer {
  font-size: 29px;
  letter-spacing: 0.04em;
  color: var(--pw-ink);
  display: inline-flex;
  align-items: flex-end;
}
.pw-answer b { font-weight: 400; margin-left: 10px; min-width: 0.6em; }
.pw-answer .pw-caret { margin-bottom: 6px; }
.pw-verdict { font-size: 50px; font-weight: 400; letter-spacing: 0.02em; margin-top: 8px; line-height: 1.05; }
.pw-verdict.ok, .pw-verdict.bad, .pw-verdict.taken { color: #fff; }
.pw-qfoot.alert { background: #f4b84f; }
.pw-qfoot {
  height: 36px;
  background: var(--pw-bar);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  font-size: 17px;
  flex: none;
}
.pw-qfoot kbd {
  font-family: inherit;
  font-size: 14px;
  border: 1px solid #b5b5b5;
  border-radius: 4px;
  background: #fff;
  padding: 0 5px;
  margin-right: 2px;
}

/* Z = rules (#61768f), X = explanation (#8a5e63): bar 36pt, white body with icon, footer bar. */
.pw-over { flex: 1; display: flex; flex-direction: column; margin-top: 56px; }
.pw-over-bar, .pw-over-foot {
  color: #fff;
  height: 36px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 21px;
  flex: none;
}
.pw-over-foot { font-size: 18px; padding-left: 50px; }
.pw-rules .pw-over-bar, .pw-rules .pw-over-foot { background: var(--pw-rules); }
.pw-explain .pw-over-bar, .pw-explain .pw-over-foot { background: var(--pw-explain); }
.pw-over-foot kbd { font-family: inherit; border: 1px solid rgba(255, 255, 255, 0.7); border-radius: 4px; padding: 0 5px; margin: 0 4px; }
.pw-over-body { flex: 1; display: flex; gap: 40px; padding: 24px 40px 24px 16px; background: #fff; overflow: auto; }
.pw-over-icon { width: 160px; height: auto; flex: none; align-self: flex-start; }
.pw-over-text { font-size: 20px; line-height: 1.45; max-width: 860px; }
.pw-over-text p { margin: 0 0 14px; }
.pw-over-text .pw-chapter { text-align: center; text-transform: uppercase; }
.pw-over-text .term { color: #1d4ed8; cursor: pointer; }
.pw-over-text .blue { color: #1d4ed8; font-weight: 600; }
.pw-over-text .red { color: #c62828; font-weight: 600; }
.pw-over-text .green { color: #2e7d32; font-weight: 600; }
.pw-over-text .center { text-align: center; }
.pw-over-text .inline-sign { height: 64px; vertical-align: middle; }
.pw-over-text .term-note .comment { background: #f4f4f4; padding: 10px 12px; margin-top: 10px; }

/* Result table: blue 753pt wide, header row, light-blue selected row; stats below. */
/* Program: panel x 176–943, y 190–462; caption 36pt; gold column titles; selected row 30pt; stats inside. */
.pw-result { width: 767px; box-sizing: border-box; max-width: calc(100vw - 32px); margin-top: 61px; }
.pw-result .pw-cap { text-align: center; padding: 0; font-size: 20px; line-height: 29px; }
.pw-tblue { background: var(--pw-blue); color: #fff; padding: 0 0 14px; }
.pw-thead, .pw-trow {
  display: grid;
  grid-template-columns: 160px 152px 154px 1fr;
  padding-left: 40px;
  align-items: center;
  text-align: center;
}
.pw-thead { color: var(--pw-gold); font-size: 16px; height: 50px; }
.pw-tbody { max-height: 124px; overflow: auto; }
.pw-trow { width: 100%; border: 0; background: transparent; color: #fff; font: inherit; font-size: 17px; height: 30.5px; cursor: pointer; }
.pw-trow.active { background: var(--pw-sel); color: var(--pw-ink); }
.pw-stat-grid {
  display: grid;
  grid-template-columns: 464px 1fr;
  row-gap: 12px;
  padding: 26px 0 0 47px;
  font-size: 17px;
}
.pw-stat-grid b { color: var(--pw-gold); font-weight: 400; }
.pw-pass { position: absolute; top: 58px; left: 0; right: 0; text-align: center; font-size: 30px; }
.pw-pass.ok { color: var(--pw-ok); }
.pw-pass.bad { color: #c0392b; }

@media (max-width: 860px) {
  .pw-pick { flex-direction: column; align-items: center; }
  .pw-qmain { flex-direction: column; }
  .pw-qimg { max-width: 100%; }
  .pw-theme { padding-right: 0; }
}

/* Base (the custom interface stylesheet is gone). */
*, *::before, *::after { box-sizing: border-box; }
#app { margin: 0; padding: 0; }
button { font-family: inherit; }
[hidden] { display: none !important; }

/* Picture zoom. */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  color: #fff;
}
.lightbox img { max-width: min(92vw, 900px); max-height: 80vh; background: #fff; }
.lightbox-close { position: absolute; top: 1rem; right: 1rem; padding: 0.4rem 0.9rem; border: 0; background: #fff; cursor: pointer; }

/* Gear: small white button in the red header, right side. */
.pw-gear {
  position: fixed;
  top: 4px;
  right: 10px;
  z-index: 40;
  height: 27px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: transparent;
  color: #fff;
  font-size: 17px;
  cursor: pointer;
}
.pw-gear b { font-size: 14px; font-weight: 400; }
.pw-gear:hover { background: rgba(255, 255, 255, 0.15); }
body[data-screen="quiz"] .pw-gear { color: var(--pw-ink); border-color: #b5b5b5; }
body[data-screen="quiz"] .pw-gear:hover { background: #fff; }

/* Options / first-launch category popup, styled like the program's lists. */
.pw-options-layer {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(224, 224, 224, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
}
.pw-options { width: 420px; max-width: calc(100vw - 32px); }
.pw-options .pw-list { padding: 24px 0 18px; }
.pw-options .pw-row { padding-left: 110px; }
.pw-options-note { background: #fff; padding: 8px 6px 2px; font-size: 14px; color: #555; }
.pw-options-hint { margin: 0; }

/* Offline section of the options popup. */
.pw-offline-body { background: #fff; padding: 10px 6px 4px; display: flex; flex-direction: column; gap: 10px; }
.pw-offline-status { font-size: 15px; }
.pw-offline-bar { height: 8px; background: #e6e6e6; border-radius: 4px; overflow: hidden; }
.pw-offline-bar i { display: block; height: 100%; width: 0; background: var(--pw-green); transition: width 0.3s; }
.pw-offline-btn {
  font: inherit;
  font-size: 16px;
  padding: 10px 14px;
  border: 0;
  border-radius: 6px;
  background: var(--pw-blue);
  color: #fff;
  cursor: pointer;
}
.pw-offline .pw-options-note { padding: 0; }
