/* =====================================================================
   Describe the Picture: its own pieces, on top of /site.css.
   Rule 8 (controls never next to each other): every row of controls keeps 24px between them;
   lists (word cards, the self-check) keep 12px; "Clear all the boxes" sits alone on its own line.
   ===================================================================== */

/* the note on covers and the cover links are shared (site.css) */

/* ---------- the picture ---------- */
.pic { margin: 0; }
.pic-frame {
  position: relative; width: 100%; aspect-ratio: 3 / 2; overflow: hidden;
  border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface2);
  box-shadow: var(--shadow);
}
.pic-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pic-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-5); margin-top: var(--sp-3); }
.pic-tools .btn { min-height: 44px; }
.pic-labels { position: absolute; inset: 0; pointer-events: none; }
.pic-labels[hidden] { display: none; }
.pic-labels.show-one .pic-label:not(.is-one) { display: none; }
/* each label is a small tag just above its point, with a pointer down to it; pl-b below, pl-l left, pl-r right */
.pic-label {
  --t: translate(calc(-50% + var(--sx, 0px)), calc(-100% - 7px + var(--sy, 0px)));
  position: absolute; transform: var(--t);
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 3px; white-space: nowrap;
  background: rgba(13, 31, 53, 0.88); color: #fff; border-radius: var(--radius-pill);
  font-family: var(--font-body); font-size: 0.8125rem; font-weight: 600; line-height: 1.35;
}
.pic-label::after {
  content: ''; position: absolute; left: calc(50% - var(--sx, 0px)); bottom: -6px; transform: translateX(-50%);
  border: 6px solid transparent; border-bottom: 0; border-top-color: rgba(13, 31, 53, 0.88);
}
.pic-label b {
  display: inline-grid; place-items: center; min-width: 1.35rem; height: 1.35rem; padding: 0 3px; border-radius: 999px;
  background: #fff; color: var(--fg); font-size: 0.75rem; font-weight: 800;
}
.pic-label.pl-b { --t: translate(calc(-50% + var(--sx, 0px)), calc(7px + var(--sy, 0px))); }
.pic-label.pl-b::after { top: -6px; bottom: auto; border-top: 0; border-bottom: 6px solid rgba(13, 31, 53, 0.88); }
.pic-label.pl-l { --t: translate(calc(-100% - 7px + var(--sx, 0px)), calc(-50% + var(--sy, 0px))); }
.pic-label.pl-l::after { left: auto; right: -6px; top: calc(50% - var(--sy, 0px)); bottom: auto; transform: translateY(-50%); border: 6px solid transparent; border-right: 0; border-left-color: rgba(13, 31, 53, 0.88); }
.pic-label.pl-r { --t: translate(calc(7px + var(--sx, 0px)), calc(-50% + var(--sy, 0px))); }
.pic-label.pl-r::after { left: -6px; top: calc(50% - var(--sy, 0px)); bottom: auto; transform: translateY(-50%); border: 6px solid transparent; border-left: 0; border-right-color: rgba(13, 31, 53, 0.88); }
.pic-label.is-flash { animation: pic-flash 1.6s ease-out; z-index: 2; }
@keyframes pic-flash {
  0%, 60% { background: var(--gold); transform: var(--t) scale(1.25); }
  100% { transform: var(--t) scale(1); }
}
@media (prefers-reduced-motion: reduce) { .pic-label.is-flash { animation: none; background: var(--gold); } }
/* phones: numbers only on the picture; the word cards carry the same numbers */
@media (max-width: 639px) {
  .pic-label { padding: 1px; }
  .pic-label .lw { display: none; }
  .pic-label b { min-width: 1.25rem; height: 1.25rem; font-size: 0.75rem; }
}

/* the bigger picture */
.pic-dialog {
  width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; border: 0;
  background: #0f1923; color: #fff;
}
.pic-dialog::backdrop { background: rgba(8, 14, 20, 0.85); }
.pic-dialog[open] { display: grid; grid-template-rows: auto 1fr; }
.pic-dialog-bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5);
  padding: calc(8px + env(safe-area-inset-top, 0px)) var(--gutter) 8px;
}
.pic-dialog-title { font-family: var(--font-display); font-size: var(--fs-h3); font-weight: 700; }
.pic-dialog-body { display: grid; place-items: center; min-height: 0; padding: 0 var(--sp-2) calc(var(--sp-2) + env(safe-area-inset-bottom, 0px)); }
.pic-dialog .pic-frame { width: min(100%, calc((100dvh - 80px) * 1.5)); border: 0; }

/* ---------- word cards (one button: shows the word on the picture and says it) ---------- */
.wds { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: var(--sp-3); }
.wd {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--sp-3);
  width: 100%; min-height: 56px; padding: var(--sp-2) var(--sp-3); text-align: left; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--radius);
  color: var(--fg); font: inherit;
}
@media (hover: hover) { .wd:hover { border-color: var(--accent); } }
.wd:focus-visible { outline: 3px solid var(--accent-lt); outline-offset: 2px; }
.wd-n {
  display: inline-grid; place-items: center; min-width: 1.75rem; height: 1.75rem; border-radius: 999px;
  background: var(--fg); color: #fff; font-size: 0.8125rem; font-weight: 800;
}
.wd-en { display: block; font-family: var(--font-display); font-size: 1.25rem; font-weight: 800; line-height: 1.15; }
.wd-gl { display: block; font-size: var(--fs-label); color: var(--fg-muted); line-height: 1.35; }
.wd-play { color: var(--accent); font-size: 0.9rem; }
.wd.is-playing { border-color: var(--gold); }
.wd.is-playing .wd-play { color: var(--gold); }

/* ---------- the four parts of a description ---------- */
.parts { display: grid; gap: var(--sp-4); }
@media (min-width: 1024px) { .parts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.part { padding: var(--pad-card); background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--accent); border-radius: var(--radius-lg); }
.part > * + * { margin-top: var(--sp-2); }
.part-1 { border-top-color: var(--star-s); }
.part-2 { border-top-color: var(--star-t); }
.part-3 { border-top-color: var(--star-a); }
.part-4 { border-top-color: var(--star-r); }
.part-h { display: flex; align-items: baseline; gap: var(--sp-2); font-family: var(--font-display); font-size: var(--fs-h3); font-weight: 800; line-height: 1.2; }
.part-h .n { color: var(--fg-muted); }
.part-q { font-size: var(--fs-small); color: var(--fg-muted); }
.part ul { margin: 0; padding-left: 1.1em; }
.part li { margin: 2px 0; font-family: var(--font-serif); font-size: var(--fs-body); line-height: 1.45; }
.part li i { color: var(--fg-muted); }
.part-ex { font-family: var(--font-serif); font-style: italic; color: var(--fg); padding-left: var(--sp-3); border-left: 3px solid var(--border); }
.parts-line { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); font-family: var(--font-display); font-size: var(--fs-small); font-weight: 700; color: var(--fg-muted); }
.parts-line span { white-space: nowrap; }

/* ---------- the speaking timer and the recording ---------- */
.talk { padding: var(--pad-card); background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--radius-lg); }
.talk > * + * { margin-top: var(--sp-4); }
.talk-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-5); }
.talk-time { font-family: var(--font-display); font-size: clamp(2.5rem, 2rem + 2vw, 3.5rem); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.talk.is-running .talk-time { color: var(--accent); }
.talk-bar { height: 10px; border-radius: 5px; background: var(--surface2); overflow: hidden; }
.talk-fill { height: 100%; background: var(--gold); transform: scaleX(0); transform-origin: left; transition: transform 0.25s linear; }
.talk-rec { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 44px; cursor: pointer; font-size: var(--fs-small); }
.talk-rec input { width: 22px; height: 22px; accent-color: var(--accent); }
.talk-rec[hidden] { display: none; }
.talk-recnote { display: none; align-items: center; gap: var(--sp-2); font-size: var(--fs-small); color: var(--danger); font-weight: 600; }
.talk.is-recording .talk-recnote { display: inline-flex; }
.talk-recnote::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: rec-blink 1.2s infinite; }
@keyframes rec-blink { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .talk-recnote::before { animation: none; } }
.talk-msg { font-weight: 600; }
.talk-msg:empty { display: none; }
.talk-play { padding: var(--sp-3) var(--sp-4); background: var(--surface2); border-radius: var(--radius); }
.talk-play[hidden] { display: none; }
.talk-play audio { display: block; width: 100%; margin-top: var(--sp-2); }
.talk-play p { font-size: var(--fs-small); color: var(--fg-muted); margin: 0; }

/* ---------- the model description ---------- */
.model { padding: var(--pad-card); background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--success); border-radius: var(--radius-lg); }
.model > * + * { margin-top: var(--sp-4); }
.model-text p { font-family: var(--font-serif); font-size: var(--fs-body); line-height: 1.7; max-width: var(--measure); }
.model-text p + p { margin-top: var(--sp-3); }
.model-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-5); }
.play-stat { font-size: var(--fs-small); color: var(--fg-muted); }
.ph { border-radius: 3px; transition: background-color 0.2s; }
.show-phrases .ph { background: var(--tint-gold); box-shadow: inset 0 -2px 0 var(--gold); }
.notes { display: grid; gap: var(--sp-3); }
.note-card { padding: var(--sp-3) var(--sp-4); background: var(--surface2); border-radius: var(--radius); }
.note-card b { display: block; font-family: var(--font-display); font-size: var(--fs-h3); }
.note-card p { margin: 4px 0 0; font-size: var(--fs-small); }
.note-card i { font-family: var(--font-serif); }

/* ---------- questions (for working alone) ---------- */
.qs { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-5); counter-reset: q; }
.qs li { display: grid; gap: var(--sp-2); }
.qs .q-t { font-family: var(--font-serif); font-size: var(--fs-body); line-height: 1.5; }
.qs .q-t::before { counter-increment: q; content: counter(q) ". "; font-family: var(--font-display); font-weight: 800; color: var(--fg-muted); }
.qs .q-lv { display: inline-block; margin-left: 6px; font-family: var(--font-display); font-size: var(--fs-label); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold); }
.q-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-5); }

/* ---------- the self-check ---------- */
.selfcheck { padding: var(--pad-card); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.selfcheck > * + * { margin-top: var(--sp-3); }
.selfcheck ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); }
.selfcheck label { display: flex; align-items: flex-start; gap: var(--sp-3); min-height: 44px; padding: 8px 0; cursor: pointer; line-height: 1.45; }
.selfcheck input { flex: none; width: 22px; height: 22px; margin-top: 1px; accent-color: var(--success); }
.selfcheck-count { font-size: var(--fs-small); color: var(--fg-muted); }

/* ---------- reveal blocks ---------- */
.reveal-box[hidden] { display: none; }
.reveal-box { padding: var(--sp-3) var(--sp-4); border-left: 4px solid var(--success); background: var(--tint-success); border-radius: var(--radius); }
.reveal-box p { margin: 0; font-family: var(--font-serif); }
.reveal-box .box-label { margin-bottom: 4px; }

/* ---------- the front page: picture cards ---------- */
.pc-grid { display: grid; grid-template-columns: 1fr; gap: var(--sp-5); }
@media (min-width: 640px) { .pc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .pc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pc-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden; text-decoration: none; color: inherit;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-lg);
}
@media (hover: hover) { .pc-card:hover { border-color: var(--accent); color: inherit; } }
.pc-card:focus-visible { outline: 3px solid var(--accent-lt); outline-offset: 3px; }
.pc-thumb { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; background: var(--surface2); }
.pc-body { display: grid; gap: 4px; padding: var(--sp-3) var(--sp-4) var(--sp-4); }
.pc-card .sc-pill { top: var(--sp-2); right: var(--sp-2); background: var(--surface); }
.pc-line { font-size: var(--fs-small); color: var(--fg-muted); line-height: 1.45; }

/* ---------- 3 Nov, the top-tier panel ---------- */
/* the talk box stays on screen while it runs (E7) */
.talk.is-running { position: sticky; top: 0; z-index: 6; box-shadow: var(--shadow); }
.talk-parts { list-style: none; margin: var(--sp-2) 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
@media (min-width: 640px) { .talk-parts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.talk-parts li { margin: 0; padding: 4px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); font-family: var(--font-display); font-size: var(--fs-label); font-weight: 700; color: var(--fg-muted); line-height: 1.3; }
.talk-parts li.is-now { border-color: var(--gold); background: var(--tint-gold); color: var(--fg); }
.talk-parts li.is-done { color: var(--success); border-color: var(--success); }
.talk-save { display: grid; gap: var(--sp-3); margin-top: var(--sp-3); }
.talk-save p { margin: 0; }
.talk-save-note { font-size: var(--fs-label); color: var(--fg-muted); }
.talk-dict { display: block; }
.talk-counts { margin-top: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: var(--radius); background: var(--surface2); font-family: var(--font-body); font-size: var(--fs-small); }
.talk-counts-sum { margin: 0; font-weight: 600; }
.talk-heard { margin-top: var(--sp-2); }
.talk-heard summary { cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; color: var(--accent); font-family: var(--font-display); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.talk-heard p { margin-top: var(--sp-2); font-family: var(--font-serif); color: var(--fg-muted); }
/* the questions asked in turn */
.ask-all { display: grid; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.ask-all p { margin: 0; }
.ask-all-stat { font-family: var(--font-body); font-size: var(--fs-small); font-weight: 600; color: var(--fg); }
.ask-all-stat:empty { display: none; }
.qs li.is-now { background: var(--tint-gold); border-radius: var(--radius-sm); }
.model-auto-note { margin-bottom: var(--sp-3); }
/* a tap on the picture opens it bigger (C8) */
.pic-frame[role="button"] { cursor: zoom-in; }
.pic-frame[role="button"]:focus-visible { outline: 3px solid var(--accent-lt); outline-offset: 2px; }
.pic-hint { font-size: var(--fs-label); color: var(--fg-muted); margin-top: var(--sp-2); }


/* ---------- 4 Nov: the panel's pass (C8, C11, E3, E4, F10) ---------- */
.wds .wcard .wcard-ico { background: var(--fg); color: var(--bg); border-radius: 50%; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; }
.wds .wcard .wd-n { font-family: var(--font-display); font-size: 0.95rem; font-weight: 800; line-height: 1; }
.wcard.is-playing { border-color: var(--gold); }
.wstrip { display: none; }
@media (max-width: 639px) {
  .wstrip { display: flex; gap: var(--sp-2); overflow-x: auto; scroll-snap-type: x mandatory; position: sticky; top: 0; z-index: 3; padding: var(--sp-2) 0; margin-top: var(--sp-3); background: var(--bg); -webkit-overflow-scrolling: touch; }
  .wchip { flex: none; scroll-snap-align: start; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px 0 6px; border: 1.5px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--fg); font-family: var(--font-display); font-size: 1rem; font-weight: 700; white-space: nowrap; cursor: pointer; }
  .wchip b { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--fg); color: var(--bg); font-size: 0.8rem; }
  .wchip.is-playing, .wchip.is-flash { border-color: var(--gold); background: var(--tint-gold); }
  .pic-label b { font-size: 13px; width: 22px; height: 22px; line-height: 22px; }
  .parts-line { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
}
.pic-frame { position: relative; }
.pic-expand { position: absolute; top: 8px; right: 8px; z-index: 2; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.92); color: var(--fg); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.pic-expand .ico { width: 22px; height: 22px; }
.pic-expand:hover { background: #fff; border-color: var(--accent); color: var(--accent); }
.pic-dialog .pic-expand { display: none; }
.practice { margin-top: var(--flow); }
.practice .pick-set { display: grid; gap: var(--sp-4); }
.q-ans-row { margin: var(--sp-2) 0 0; }
.q-ans { margin-top: var(--sp-2); }
.phrase-ticks ul { grid-template-columns: 1fr; }
@media (min-width: 640px) { .phrase-ticks ul { grid-template-columns: 1fr 1fr; } }
.talk-prev { padding: var(--sp-3) var(--sp-4); background: var(--surface2); border-radius: var(--radius); margin-top: var(--sp-3); }
.talk-prev[hidden] { display: none; }
.talk-prev p { font-size: var(--fs-small); color: var(--fg-muted); margin: 0; }
.talk-prev audio { display: block; width: 100%; margin-top: var(--sp-2); }
.feedback-lines p { margin-top: var(--sp-3); }
.feedback-lines p:first-of-type { margin-top: var(--sp-2); }
.share-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
.share-box { font: inherit; min-height: 44px; padding: 0 var(--sp-3); border: 1.5px solid var(--border-strong); border-radius: var(--radius); width: 100%; }
.clear-note { margin-top: var(--sp-3); }


/* ---------- the second panel (4 Nov): A8, C4, D9 ---------- */
.wd-n { color: var(--bg); }
.pic-label b { color: #0D1F35; }
/* the bigger picture is bigger: on a portrait phone it is twice the width, swiped and pinched */
.pic-dialog { overflow: auto; touch-action: pinch-zoom pan-x pan-y; -webkit-overflow-scrolling: touch; }
.pic-dialog-hint { font-size: var(--fs-small); color: var(--fg-muted); margin: 0 0 var(--sp-2); display: none; }
@media (orientation: portrait) and (max-width: 639px) {
  .pic-dialog .pic-frame { width: 200vw; max-width: none; }
  .pic-dialog-hint { display: block; }
}
/* the four parts in the talk box are not buttons */
.talk-parts li { border: 0; background: none; padding: 2px 0; font-weight: 600; color: var(--fg-muted); }
.talk-parts li.is-now { color: var(--accent); }
.talk-parts li.is-done { color: var(--success); }
.talk-rec, .talk-dict { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: start; }
.talk-rec input, .talk-dict input { margin-top: 2px; }
/* the chips strip has a fade at its edge, so the row reads as scrolling (D9) */
@media (max-width: 639px) {
  .wstrip { mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent); -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent); padding-right: 48px; }
}
.pic-frame[role="button"] { cursor: zoom-in; }

/* spacing (5 Nov, site.css 9): the picture keeps the slide's gap above it; its tools and the talk parts keep the box rhythm */
.slide > * + .pic { margin-top: var(--flow); }
.pic-tools { margin-top: var(--sp-4); }
.talk-parts { margin-top: var(--sp-3); }
