/* GED-style practice test. Builds on kp.css (quiz card, options, timer, dim bars). */
.ged-app {
  min-height: 60vh;
}
.ged-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.ged-intro,
.ged-review {
  padding: clamp(24px, 4vw, 36px) clamp(20px, 4vw, 30px);
}
.ged-intro {
  margin-bottom: 24px;
}
.ged-h1 {
  font-size: clamp(24px, 3.4vw, 30px);
  margin: 8px 0 12px;
}
.ged-h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 16px;
}
.ged-lead {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  margin: 0 0 18px;
}
.ged-note {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 12px;
}
.ged-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 18px;
  margin: 0 0 20px;
  padding: 18px 20px;
  background: var(--surface-sunk);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 14.5px;
  line-height: 1.6;
}
.ged-facts dt {
  font-weight: 700;
}
.ged-facts dd {
  margin: 0;
}
.ged-notice {
  font-size: 14.5px;
  line-height: 1.65;
  margin-bottom: 18px;
}
.ged-hint-toggle {
  margin-bottom: 20px;
}
.ged-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* Top bar during the test */
.ged-bar {
  position: sticky;
  top: 0;
  z-index: 20;
}
.ged-bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 14px;
}
.ged-bar-row + .ged-bar-row {
  margin-top: 8px;
}
.ged-tools {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ged-timer.is-low {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}
.ged-flag.is-on {
  background: var(--lantern-soft);
  border-color: var(--lantern-ink);
}
.ged-q-section {
  padding-top: 8px;
}

/* Question */
.ged-stem {
  font-weight: 500;
}
.ged-stem b {
  font-weight: 700;
}
.ged-table {
  margin: 14px 0 0;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 15px;
}
.ged-table th,
.ged-table td {
  border: 1px solid var(--line-strong);
  padding: 6px 14px;
  text-align: center;
}
.ged-table th {
  background: var(--surface-sunk);
}
.ged-drop {
  font: inherit;
  font-size: 0.92em;
  padding: 3px 6px;
  margin: 2px 2px;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  max-width: 100%;
}
.ged-fill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
}
.ged-fill input {
  width: 9em;
  font: inherit;
  font-family: var(--font-mono);
  padding: 10px 12px;
  border: 1.5px solid var(--ink);
  border-radius: var(--r-md);
  background: var(--surface);
}
.ged-slots,
.ged-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.ged-slot,
.ged-tile {
  min-width: 64px;
  min-height: 44px;
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 16px;
  border-radius: 10px;
  cursor: pointer;
}
.ged-slot {
  border: 2px dashed var(--line-strong);
  background: var(--surface-sunk);
}
.ged-slot.is-filled {
  border-style: solid;
  border-color: var(--ink);
  background: var(--lantern-soft);
}
.ged-tile {
  border: 1.5px solid var(--ink);
  background: var(--surface);
  box-shadow: 2px 2px 0 var(--ink);
}
.ged-tile:disabled {
  opacity: 0.35;
  box-shadow: none;
  cursor: default;
}
.ged-grid {
  display: block;
  width: min(100%, 340px);
  height: auto;
  margin: 0 0 12px;
  cursor: crosshair;
  touch-action: manipulation;
}
.ged-grid .gl {
  stroke: var(--line-strong);
  stroke-width: 0.6;
}
.ged-grid .ax {
  stroke: var(--ink);
  stroke-width: 1.6;
}
.ged-grid .tk {
  font: 10px var(--font-mono);
  fill: var(--text-muted);
  text-anchor: middle;
}
.ged-grid .tk-y {
  text-anchor: end;
}
.ged-grid .pt {
  fill: var(--lantern);
  stroke: var(--ink);
  stroke-width: 2;
}
.ged-xy {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
}
.ged-xy select {
  font: inherit;
  padding: 4px 6px;
}
.ged-hint {
  margin-top: 14px;
  padding: 12px 16px;
  border-left: 4px solid var(--lantern);
  background: var(--lantern-soft);
  border-radius: 8px;
  font-size: 14.5px;
  line-height: 1.6;
}
.ged-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
}
.ged-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 22px;
}
.ged-pal {
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  position: relative;
}
.ged-pal.is-done {
  background: var(--paper-2);
  border-color: var(--ink-3, var(--line-strong));
}
.ged-pal.is-here {
  border: 2px solid var(--ink);
  font-weight: 700;
}
.ged-pal.is-flag::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lantern);
}
.ged-pal-review {
  font-family: var(--font-body);
}

/* Review before submit */
.ged-review-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.ged-review-list button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  font-size: 14px;
}
.ged-review-list button:not(.is-done) {
  border-color: var(--danger);
  background: var(--danger-soft);
}
.ged-review-list button.is-flag span::after {
  content: " ●";
  color: var(--lantern);
}
.ged-confirm-text {
  font-size: 15.5px;
  line-height: 1.65;
}
.ged-between-time {
  margin: 0 0 8px;
}

/* Formula sheet */
.ged-modal-box {
  max-width: 640px;
  max-height: 86vh;
  overflow: auto;
}
.ged-formulas h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 16px 0 4px;
}
.ged-formulas p {
  font-size: 14px;
  line-height: 1.75;
  margin: 0;
}

/* Calculator */
/* Wide screens: in the free space right of the question column. Narrower:
   docked at the bottom, and the page gets room so nothing hides under it. */
.ged-calc {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1400;
  width: 260px;
  padding: 12px;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--r-md);
  box-shadow: 4px 4px 0 var(--ink);
}
.ged-calc-head {
  cursor: move;
  touch-action: none;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
}
.ged-calc-x {
  border: 0;
  background: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.ged-calc-screen {
  display: block;
  min-height: 44px;
  padding: 10px;
  margin-bottom: 8px;
  font: 18px var(--font-mono);
  text-align: right;
  word-break: break-all;
  background: var(--surface-sunk);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}
.ged-calc-keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.ged-calc-keys button {
  height: 40px;
  font: 16px var(--font-mono);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}
.ged-calc-keys button.is-eq {
  grid-column: 1 / -1;
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* Results */
.ged-score {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 24px;
  margin: 0 0 8px;
}
.ged-score span {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 18px;
}
.ged-next {
  margin: 0;
  padding-left: 20px;
  line-height: 1.75;
  font-size: 15px;
}
.ged-results {
  display: grid;
  gap: 8px;
}
.ged-res summary {
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 15px;
}
.ged-res-state {
  font-weight: 700;
}
.ged-res.is-right .ged-res-state {
  color: oklch(0.5 0.12 150);
}
.ged-res.is-wrong .ged-res-state,
.ged-res.is-blank .ged-res-state {
  color: var(--danger);
}
.ged-res-topic {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
}
.ged-res-body {
  padding-top: 10px;
  font-size: 15px;
  line-height: 1.7;
}
.ged-res-body p {
  margin: 8px 0 0;
}
.ged-res-body p > span:first-child {
  font-weight: 700;
}

@media (min-width: 1460px) {
  .ged-calc {
    top: 150px;
    bottom: auto;
  }
}
@media (max-width: 640px) {
  .ged-facts {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .ged-facts dd {
    margin-bottom: 8px;
  }
  .ged-calc {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }
  .ged-calc-keys button {
    height: 34px;
  }
  .ged-calc-screen {
    min-height: 38px;
    padding: 7px 10px;
  }
  .ged-nav .kp-btn {
    flex: 1;
  }
}

/* Town workbench: one header row (name, part and clock while timed, 任务, ×). */
.ged-head[hidden],
.ged-head-meta[hidden] {
  display: none;
}
.ged-head {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  box-sizing: border-box;
  padding: 8px 14px 8px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.ged-head-name {
  min-width: 0;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.ged-head-meta {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
}
/* The header carries part and clock, so the in-page bar keeps only question tools and
   scrolls with the content instead of stacking a second sticky bar. */
html.kp-workbench .ged-bar {
  position: static;
}
html.kp-workbench .ged-bar-row:first-child {
  display: none;
}
html.kp-workbench .ged-bar-row + .ged-bar-row {
  margin-top: 0;
}
html.kp-workbench .ged-bar:not(:has(.ged-bar-row + .ged-bar-row)) {
  display: none;
}
@media (max-width: 560px) {
  .ged-head {
    gap: 8px;
    min-height: 52px;
    padding: 6px 10px 6px 16px;
  }
  .ged-head-name {
    font-size: 16px;
  }
  .ged-head-part {
    display: none;
  }
}
