/* Data Table Detective: the Evidence Desk inside the practice shell's stage. The evidence sheet and the notebook are
 * paper (fixed ink colors in both themes); the desk behind them darkens in dark mode. Play-area text is 18 px or larger
 * (16 px only for the model-data stamp and graph ticks, which are drawn at 16 px). Tap targets are 48 px or larger. */
.dtd { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr); gap: 14px; padding: 12px 14px; overflow: hidden;
  color: #1d2433; font-size: 18px; line-height: 1.35;
  background: radial-gradient(120% 90% at 20% 0%, #35618f 0%, #24476d 55%, #1a3552 100%);
  --dtd-ink: #1d2433; --dtd-soft: #4a5468; --dtd-line: #c3cbd8; --dtd-blue: #1a5fb4; --dtd-mark: #b25e00; --dtd-mark-bg: #ffe9a8; --dtd-ok: #1f7a44; --dtd-ok-bg: #e3f6e8; --dtd-bad: #b42318; --dtd-bad-bg: #fde7e4; }
html[data-theme="dark"] .dtd { background: radial-gradient(120% 90% at 20% 0%, #223a57 0%, #152941 55%, #0d1b2d 100%); }
.dtd *, .dtd *::before, .dtd *::after { box-sizing: border-box; }
.dtd p, .dtd h3 { margin: 0; }
.dtd button { font: inherit; color: inherit; touch-action: manipulation; }
.dtd :focus-visible { outline: 3px solid #ffb000; outline-offset: 2px; box-shadow: 0 0 0 6px #1d2433; }

/* ── evidence sheet ── */
.dtd-sheet { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 8px; border-radius: 10px 10px 14px 14px; background: #fffdf7;
  border-top: 10px solid #c79a5b; box-shadow: 0 2px 0 #b9ad96, 0 10px 22px rgba(0, 0, 0, .35); }
.dtd-head { display: flex; gap: 14px; align-items: flex-start; }
.dtd-picwrap { flex: none; width: 220px; height: 150px; }
.dtd-pic { display: block; width: 220px; height: 150px; }
.dtd-headtext { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.dtd-tabs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dtd-tab { padding: 1px 12px; border-radius: 6px; background: #1d2433; color: #fff; font-size: 16px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.dtd-stamp { padding: 0 10px; border: 2px dashed #8a3324; border-radius: 6px; color: #8a3324; font-size: 16px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; transform: rotate(-2deg); }
.dtd-stamp--real { border-color: #1f6b3a; color: #1f6b3a; }
.dtd-title { font-size: 22px; line-height: 1.2; font-weight: 800; color: var(--dtd-ink); }
.dtd-story { font-size: 18px; line-height: 1.3; color: var(--dtd-ink); }
.dtd-data { position: relative; min-height: 0; }
.dtd-data--graph { flex: 1 1 260px; min-height: 260px; }
.dtd-data--table { flex: 0 1 auto; }
.dtd-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.dtd-tip { flex: 1 1 200px; min-width: 0; font-size: 18px; color: var(--dtd-soft); }
.dtd-tip.is-key { padding: 4px 10px; border-radius: 8px; border: 2px solid var(--dtd-ok); background: var(--dtd-ok-bg); color: #0f4a27; font-weight: 700; }
.dtd-about { flex: 0 0 auto; font-size: 18px; color: var(--dtd-soft); }
.dtd-about-btn { display: inline-flex; align-items: center; min-height: 48px; padding: 0 6px; border: 0; background: none; cursor: pointer; font-weight: 700; color: var(--dtd-blue) !important; text-decoration: underline; }
.dtd-about-btn[aria-expanded="true"]::after { content: " ▲"; text-decoration: none; }
/* opened by the student: a note card over the lower part of the sheet (it never leaves the sheet, so nothing is clipped) */
.dtd-about-panel { position: absolute; left: 10px; right: 10px; bottom: 62px; z-index: 5; max-height: calc(100% - 84px); overflow-y: auto; padding: 10px 12px 6px; border-radius: 12px; border: 2px solid var(--dtd-blue); background: #fff; box-shadow: 0 8px 22px rgba(0, 0, 0, .3); }
.dtd-about-panel p { padding: 0 0 6px; font-size: 18px; line-height: 1.35; color: var(--dtd-ink); }
.dtd-about-story { display: none; }

/* table */
.dtd-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 20px; color: var(--dtd-ink); border: 2px solid #51647a; border-radius: 10px; overflow: hidden; background: #fff; }
.dtd-table th { padding: 8px 12px; text-align: left; vertical-align: bottom; font-size: 18px; line-height: 1.2; font-weight: 800; color: #fff; background: var(--dtd-blue); }
.dtd-table th + th { border-left: 1px solid rgba(255, 255, 255, .45); }
.dtd-table td { height: 50px; padding: 0 12px; border-top: 1px solid var(--dtd-line); font-variant-numeric: tabular-nums; }
.dtd-table tbody tr:nth-child(even) td { background: #f3f6fa; }
.dtd-table td.dtd-x { width: 38%; }
.dtd-table td + td { border-left: 1px solid var(--dtd-line); }
.dtd-th-mark, .dtd-td-mark { width: 60px; padding: 0 !important; text-align: center; }
.dtd-table tbody tr[data-row] { cursor: pointer; }
.dtd.is-locked .dtd-table tbody tr[data-row] { cursor: default; }
.dtd-mark { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 10px; border: 2px solid #8a93a1; background: #fff; color: #6b7686; cursor: pointer; }
.dtd-mark:hover:not(:disabled) { background: #fff6dc; border-color: var(--dtd-mark); color: var(--dtd-mark); }
.dtd-mark[aria-pressed="true"] { background: var(--dtd-mark); border-color: #6b3a00; color: #fff; }
.dtd-mark:disabled { cursor: default; opacity: .75; }
.dtd-table tr.is-marked td { background: var(--dtd-mark-bg) !important; font-weight: 800; box-shadow: inset 0 3px 0 var(--dtd-mark), inset 0 -3px 0 var(--dtd-mark); }
.dtd-table tr.is-hint td.dtd-x { outline: 3px dashed var(--dtd-mark); outline-offset: -5px; font-weight: 800; }
.dtd-table tr.is-key td { background: var(--dtd-ok-bg) !important; font-weight: 800; box-shadow: inset 0 3px 0 var(--dtd-ok), inset 0 -3px 0 var(--dtd-ok); }
.dtd-y { white-space: nowrap; }
.dtd-delta { display: inline-block; margin-left: 12px; padding: 0 9px; border-radius: 999px; font-size: 18px; font-weight: 800; border: 2px solid; background: #fff; }
.dtd-delta--up { color: #0f4a27; border-color: var(--dtd-ok); }
.dtd-delta--down { color: #7a1710; border-color: var(--dtd-bad); border-style: dashed; }
.dtd-delta--same { color: #1d2433; border-color: #51647a; border-style: dotted; }
.dtd-delta--key { color: #0f4a27; border-color: var(--dtd-ok); }

/* graph: the SVG is drawn at the box's pixel size; a 48 px button sits on every dot */
.dtd-graph { display: block; position: absolute; left: 0; top: 0; }
.dtd-dot { position: absolute; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 24px; background: transparent; cursor: pointer; }
.dtd-dot:hover:not(:disabled) { background: rgba(255, 176, 0, .28); }
.dtd-dot:disabled { cursor: default; }

/* ── notebook ── */
.dtd-note { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: 14px; background: #f6f8fc; border-left: 10px solid #39424f;
  box-shadow: 0 2px 0 #aab3c0, 0 10px 22px rgba(0, 0, 0, .35); overflow-y: auto; }
.dtd-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.dtd-step { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 2px 4px; border-radius: 10px; border: 2px solid #aab3c0; background: #fff; color: var(--dtd-soft); font-size: 18px; line-height: 1.15; font-weight: 700; text-align: center; }
.dtd-step-n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #dfe4ec; color: var(--dtd-ink); font-size: 16px; font-weight: 800; }
.dtd-step.is-on { border-color: var(--dtd-blue); background: var(--dtd-blue); color: #fff; }
.dtd-step.is-on .dtd-step-n { background: #fff; color: var(--dtd-blue); }
.dtd-step.is-done { border-color: var(--dtd-ok); color: #0f4a27; }
.dtd-step.is-done .dtd-step-n { background: var(--dtd-ok); color: #fff; }
.dtd-field { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.dtd-q { font-size: 22px; line-height: 1.25; font-weight: 800; color: var(--dtd-ink); }
.dtd-q b { color: var(--dtd-blue); }
.dtd-choices { display: flex; flex-direction: column; gap: 10px; }
.dtd-choice { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 14px; text-align: left; border-radius: 12px; border: 2px solid #6b7686; background: #fff; color: var(--dtd-ink);
  font-size: 20px; line-height: 1.25; font-weight: 700; cursor: pointer; box-shadow: 0 2px 0 #aab3c0; }
.dtd-choices--long .dtd-choice { font-size: 18px; font-weight: 600; }
.dtd-choice:hover:not(:disabled) { background: #eaf2fd; border-color: var(--dtd-blue); }
.dtd-choice-dot { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2.5px solid #6b7686; background: #fff; }
.dtd-choice-t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dtd-choice-mark { flex: none; width: 28px; text-align: center; font-size: 22px; font-weight: 900; }
.dtd-choice[aria-checked="true"] { border-color: var(--dtd-blue); border-width: 3px; background: #dcebff; box-shadow: 0 2px 0 var(--dtd-blue); }
.dtd-choice[aria-checked="true"] .dtd-choice-dot { border-color: var(--dtd-blue); background: radial-gradient(circle, var(--dtd-blue) 0 46%, #fff 52%); }
.dtd-choice:disabled { cursor: default; opacity: 1; color: var(--dtd-ink); }
.dtd.is-locked .dtd-choice:not([aria-checked="true"]):not(.is-right) { color: #4a5468; box-shadow: none; }
.dtd-choice.is-right { border: 3px solid var(--dtd-ok); background: var(--dtd-ok-bg); color: #0f4a27; }
.dtd-choice.is-right .dtd-choice-mark { color: var(--dtd-ok); }
.dtd-choice.is-wrong { border: 3px dashed var(--dtd-bad); background: var(--dtd-bad-bg); color: #6e1814; }
.dtd-choice.is-wrong .dtd-choice-mark { color: var(--dtd-bad); }
.dtd-msg { min-height: 0; font-size: 18px; font-weight: 700; color: var(--dtd-bad); }
.dtd-msg:empty { display: none; }
.dtd-aloud { align-self: flex-start; margin-top: auto; min-height: 48px; padding: 6px 14px; border-radius: 999px; border: 2px solid #6b7686; background: #fff; font-size: 18px; cursor: pointer; }
.dtd-aloud[aria-pressed="true"] { border-color: var(--dtd-blue); background: #dcebff; }

/* ── Briefing: the worked example ── */
.dtd-example { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; padding: 12px; border-radius: 12px; background: #fffdf7; color: #1d2433; border: 1px solid #c3cbd8; }
.dtd-example .dtd-pic { flex: none; }
.dtd-example .dtd-table { flex: 1 1 280px; width: auto; max-width: 420px; --dtd-ink: #1d2433; --dtd-line: #c3cbd8; --dtd-blue: #1a5fb4; --dtd-mark: #b25e00; --dtd-mark-bg: #ffe9a8; }
.dtd-example .dtd-table td.dtd-x { width: 50%; }
.dtd-ex-arrow { float: right; font-weight: 900; color: #b25e00; }

/* a five- or six-row table: a compact header (small picture, the story moves into "About this data") so every row fits */
@media (min-width: 901px) {
  .dtd--long .dtd-picwrap { width: 132px; height: 90px; overflow: hidden; border-radius: 8px; }
  .dtd--long .dtd-pic { width: 132px; height: 90px; }
  .dtd--long .dtd-pic text { display: none; }
  .dtd--long .dtd-story { display: none; }
  .dtd--long .dtd-about-story { display: block; }
}
/* ── smaller desktops ── */
@media (max-width: 1180px) and (min-width: 901px) {
  .dtd { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; padding: 10px; }
  .dtd-sheet { padding: 10px 10px 6px; }
  .dtd-picwrap { width: 132px; height: 90px; overflow: hidden; border-radius: 8px; }
  .dtd-pic { width: 132px; height: 90px; }
  .dtd-pic text { display: none; }
  .dtd-story { display: none; }
  .dtd-about-story { display: block; }
  .dtd-title { font-size: 20px; }
  .dtd-note { padding: 10px; gap: 8px; }
  .dtd-steps { display: flex; }
  .dtd-step { flex: 0 0 auto; flex-direction: row; gap: 6px; padding: 4px 6px; border-radius: 999px; }
  .dtd-step.is-on { flex: 1 1 auto; justify-content: center; }
  .dtd-step:not(.is-on) .dtd-step-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .dtd-q { font-size: 20px; }
  .dtd-choice { font-size: 18px; min-height: 52px; padding: 6px 10px; gap: 8px; }
  .dtd-choices { gap: 8px; }
  .dtd-choice-mark { width: 20px; }
  .dtd-table th { padding: 6px 8px; }
  .dtd-table td { padding: 0 8px; }
  .dtd-th-mark, .dtd-td-mark { width: 54px; }
  .dtd--long .dtd-picwrap { display: none; }
}
/* ── tablet portrait and phones: one column, the page scrolls ── */
@media (max-width: 900px) {
  .dtd { position: relative; inset: auto; display: flex; flex-direction: column; overflow: visible; padding: 10px; }
  .dtd-head { flex-wrap: wrap; }
  .dtd-data--graph { flex: none; height: 340px; }
  .dtd-note { overflow: visible; }
  .dtd-aloud { margin-top: 0; }
  .dtd-about.is-open { flex: 1 0 100%; }
  .dtd-about-panel { position: static; max-height: none; margin-top: 4px; box-shadow: none; }
}
@media (max-width: 520px) {
  .dtd-head { flex-direction: column; align-items: stretch; gap: 8px; }
  .dtd-picwrap { margin: 0 auto; }
  .dtd-steps { display: flex; }
  .dtd-step { flex: 0 0 auto; flex-direction: row; gap: 6px; padding: 4px 6px; border-radius: 999px; }
  .dtd-step.is-on { flex: 1 1 auto; justify-content: center; }
  .dtd-step:not(.is-on) .dtd-step-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .dtd-table { font-size: 18px; }
  .dtd-table th, .dtd-table td { padding-left: 8px; padding-right: 8px; }
  .dtd-th-mark, .dtd-td-mark { width: 54px; }
  .dtd-delta { margin-left: 6px; padding: 0 6px; }
}
@media (prefers-reduced-motion: no-preference) {
  .dtd-choice, .dtd-mark { transition: background .12s, border-color .12s; }
  .dtd.is-revealed .dtd-tip.is-key { animation: dtd-pop .25s ease-out; }
  @keyframes dtd-pop { from { transform: scale(.97); opacity: .4; } to { transform: none; opacity: 1; } }
}

/* seven-row tables (a real week of weather): 48 px rows (still full tap targets) and a tighter header */
.dtd--xlong .dtd-table td { height: 48px; }
.dtd--xlong .dtd-table th { padding: 6px 10px; }
