/* Listening practice, ear drills & dictation tools. Loaded after styles.css. */
.pr-hero { padding-bottom: 24px; }
.pr-section { max-width: 760px; margin: 0 auto; padding: 8px 16px 64px; }
.pr-h2-gap { margin-top: 40px; }

.pr-steps { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; counter-reset: step; }
.pr-steps li { counter-increment: step; padding: 14px; background: var(--ink); border: 2px solid var(--lavender); border-radius: var(--radius-md); font-size: 14px; color: var(--text-soft); line-height: 1.45; box-shadow: 3px 4px 0 var(--void); }
.pr-steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: 7px; border-radius: 50%; background: var(--yellow); color: var(--ink); font-size: 13px; font-weight: 900; }
.pr-steps strong { color: var(--white); }

.pr-score { position: sticky; top: 72px; z-index: 8; display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 12px 18px; border-radius: 8px; background: var(--void); border: 2px solid var(--yellow); color: var(--text-soft); font-size: 15px; box-shadow: 0 8px 24px rgba(18, 8, 38, .45); }
.pr-score[hidden] { display: none; }
.pr-score strong { color: var(--yellow); font-weight: 800; }

.pr-list { list-style: none; display: grid; gap: 14px; }
.pr-item { padding: 16px; background: var(--ink); border: 2px solid var(--lavender); border-radius: var(--radius-md); scroll-margin: 128px; box-shadow: 3px 4px 0 var(--void); }
.pr-item[data-graded="understood"] { border-color: var(--green-on-dark); }
.pr-item[data-graded="missed"], .pr-item[data-graded="partial"] { border-color: var(--amber-on-dark); }
.pr-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pr-num { flex: none; width: 28px; text-align: center; font-weight: 800; color: var(--lavender); font-variant-numeric: tabular-nums; }
.pr-play, .pr-slow { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; font: 700 16px var(--font-body); cursor: pointer; }
.pr-play { border: 2px solid var(--void); background: var(--yellow); color: var(--ink); box-shadow: 2px 3px 0 var(--void); }
.pr-play:hover, .pr-play[data-playing="true"] { background: var(--white); color: var(--ink); }
.pr-slow { background: var(--violet-deep); color: var(--white); border: 2px solid var(--lavender); }
.pr-slow:hover, .pr-slow[data-playing="true"] { border-color: var(--yellow); color: var(--yellow); }
.pr-play .i-stop, .pr-play[data-playing="true"] .i-play { display: none; }
.pr-play[data-playing="true"] .i-stop { display: inline; }
.pr-result { margin-left: auto; font-size: 14px; font-weight: 800; color: var(--text-soft); }
.pr-item[data-graded="understood"] .pr-result { color: var(--green-on-dark); }
.pr-item[data-graded="missed"] .pr-result, .pr-item[data-graded="partial"] .pr-result { color: var(--amber-on-dark); }

/* A sentence with a speaker video: the portrait video on the left, the controls beside it. */
.pr-item[data-media="video"] { display: grid; grid-template-columns: 96px minmax(0, 1fr); column-gap: 14px; align-items: start; }
.pr-media { position: relative; grid-row: 1 / span 2; }
.pr-video { display: block; width: 100%; height: auto; aspect-ratio: 9 / 16; object-fit: cover; border: 2px solid var(--lavender); border-radius: 12px; background: var(--void); cursor: pointer; box-shadow: 2px 3px 0 var(--void); }
.pr-playing .pr-video, .dc-card:has(.dc-play [data-playing="true"]) .pr-video { border-color: var(--yellow); }
.pr-media .pr-num { position: absolute; top: 6px; left: 6px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--void); color: var(--yellow); font-size: 13px; }
.pr-item[data-media="video"] > .pr-row, .pr-item[data-media="video"] > .pr-actions { grid-column: 2; }
.pr-item[data-media="video"] > .pr-row .pr-result { margin-left: 0; flex-basis: 100%; }
.pr-item[data-media="video"] > .pr-reveal { grid-column: 1 / -1; padding-left: 0; }

.pr-actions { display: none; gap: 10px; margin-top: 12px; padding-left: 38px; flex-wrap: wrap; }
.pr-item[data-media="video"] > .pr-actions { padding-left: 0; }
.pr-js .pr-actions { display: flex; }
.pr-js .pr-actions[hidden] { display: none; }
.pr-understood, .pr-reveal-btn, .pr-done { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; font: 700 15px var(--font-body); cursor: pointer; }
.pr-understood { border: 0; background: var(--green); color: var(--white); box-shadow: 2px 3px 0 var(--void); }
.pr-understood:hover { filter: brightness(1.08); }
.pr-reveal-btn { background: var(--violet-deep); color: var(--white); border: 2px solid var(--lavender); }
.pr-reveal-btn:hover { border-color: var(--yellow); color: var(--yellow); }

.pr-reveal { margin-top: 12px; padding-left: 38px; }
.pr-reveal > summary { font-size: 14px; font-weight: 700; color: var(--yellow); cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; }
.pr-js .pr-reveal > summary { display: none; }
.pr-js .pr-reveal:not([open]) { display: none; }
.pr-es { font-size: 20px; font-weight: 700; line-height: 1.75; color: var(--white); }
.pr-w { display: inline; padding: 1px 3px; border: 0; border-radius: 6px; background: none; color: inherit; font: inherit; text-decoration: underline dotted var(--lavender); text-underline-offset: 5px; cursor: pointer; }
.pr-w:hover { background: rgba(255, 255, 255, .14); }
.pr-w[aria-pressed="true"] { background: var(--orange); color: var(--void); font-weight: 800; text-decoration-color: transparent; }
.pr-w.future { opacity: .4; }
.pr-hit { background: var(--orange); color: var(--void); border-radius: 6px; padding: 1px 6px; font-weight: 800; }
.pr-gloss { min-height: 24px; margin-top: 6px; font-size: 15px; color: var(--yellow); font-weight: 700; }
.pr-gloss:empty { min-height: 0; }
.pr-en { margin-top: 8px; font-size: 16px; color: var(--text-soft); }
.pr-en[hidden] { display: none; }
.pr-en-btn { margin-top: 8px; min-height: 44px; padding: 0 16px; border: 1.5px solid var(--lavender); border-radius: 999px; background: var(--violet-deep); color: var(--white); font: 700 14px var(--font-body); cursor: pointer; }
.pr-en-btn:hover { border-color: var(--yellow); color: var(--yellow); }
.pr-en-btn[hidden] { display: none; }
.pr-done { display: none; margin-top: 12px; border: 0; background: var(--yellow); color: var(--ink); font-weight: 800; box-shadow: -2px -2px 0 var(--pink), 4px 5px 0 var(--void); }
.pr-js .pr-done { display: inline-flex; }
.pr-js .pr-done[hidden] { display: none; }
.pr-reveal-review .pr-en-btn { display: none; }
.pr-reveal-review .pr-en[hidden] { display: block; }

.pr-verdict { margin-top: 24px; padding: 26px; border-radius: var(--radius-lg); background: var(--paper); color: var(--paper-text); text-align: center; box-shadow: var(--shadow-riso-dark); }
.pr-verdict :focus-visible { outline-color: var(--violet); }
.pr-verdict[hidden] { display: none; }
.pr-verdict-text { font-size: 20px; font-weight: 800; color: var(--ink); }
.pr-verdict-links { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.pr-verdict-links a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 20px; border-radius: 999px; background: var(--paper-tint); border: 2px solid var(--paper-border); color: var(--ink); font-weight: 700; }
.pr-verdict[data-move="next"] .pr-verdict-links a:last-child, .pr-verdict[data-move="prev"] .pr-verdict-links a:first-child { background: var(--yellow); color: var(--ink); border-color: var(--ink); box-shadow: -2px -2px 0 var(--pink), 4px 5px 0 var(--ink); font-weight: 800; }
.pr-verdict-app { margin: 16px auto 0; max-width: 480px; font-size: 15px; color: var(--paper-muted); }
.pr-verdict .hero-cta { justify-content: center; margin-top: 18px; }
.pr-noscript { margin-top: 16px; font-size: 14px; color: var(--text-soft); text-align: center; }
.pr-noscript[hidden] { display: none; }

/* Hub cards */
.pr-cards-title { max-width: var(--max); margin: 16px auto 0; font-family: var(--font-display); font-size: clamp(28px, 4vw, 38px); font-weight: 900; text-transform: uppercase; line-height: 1.14; color: var(--white); text-align: center; }
.pr-cards-sub { max-width: 660px; margin: 10px auto 24px; color: var(--text-soft); text-align: center; }
.pr-cards-sub a { color: var(--yellow); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.pr-cards { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; max-width: var(--max); margin: 0 auto; }
.pr-section:has(.pr-cards) { max-width: var(--max); }
.pr-card { display: flex; flex-direction: column; gap: 14px; padding: 22px; background: var(--ink); border: 2px solid var(--lavender); border-radius: var(--radius-lg); box-shadow: var(--shadow-ink); }
.pr-card-top { display: flex; align-items: baseline; gap: 10px; }
.pr-card-level { font-family: var(--font-display); font-size: 40px; font-weight: 900; line-height: 1; color: var(--yellow); }
.pr-card-name { font-weight: 800; font-size: 19px; color: var(--white); }
.pr-card-desc { font-size: 15px; color: var(--text-soft); line-height: 1.5; }
.pr-card-sample { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border-radius: var(--radius-md); background: var(--violet-deep); border: 1.5px solid rgba(214, 194, 255, .3); }
.pr-card-sample p { font-size: 15px; font-weight: 700; line-height: 1.45; color: var(--white); }
.pr-card-en { font-weight: 500; color: var(--text-soft); }
.pr-card-go { margin-top: auto; align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 999px; background: var(--yellow); color: var(--ink); font-weight: 800; box-shadow: -3px -3px 0 var(--pink), 4px 5px 0 var(--void); transition: transform .15s, box-shadow .15s; }
.pr-card-go:hover { transform: translate(-1px, -1px); box-shadow: -4px -4px 0 var(--pink), 5px 6px 0 var(--void); }
.pr-card-go:focus-visible { outline-color: var(--white); }

@media (min-width: 720px) {
  .pr-item:not([data-media="video"]):has(> .pr-actions:not([hidden])) { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
  .pr-item:not([data-media="video"]):has(> .pr-actions:not([hidden])) > .pr-row { flex: 1 1 auto; }
  .pr-item:not([data-media="video"]):has(> .pr-actions:not([hidden])) > .pr-actions { margin-top: 0; padding-left: 0; margin-left: auto; }
  .pr-item:not([data-media="video"]):has(> .pr-actions:not([hidden])) > .pr-reveal { width: 100%; }
  /* Wider screens: a bigger video, with the transcript beside it for the karaoke. */
  .pr-item[data-media="video"] { grid-template-columns: 132px minmax(0, 1fr); column-gap: 20px; }
  .pr-item[data-media="video"] > .pr-media { grid-row: 1 / span 3; }
  .pr-item[data-media="video"] > .pr-reveal { grid-column: 2; margin-top: 14px; }
}

@media (max-width: 600px) {
  .pr-steps { grid-template-columns: 1fr; gap: 8px; }
  .pr-steps li { padding: 10px 14px; font-size: 14px; }
  .pr-score { top: 64px; font-size: 14px; padding: 10px 14px; }
  .pr-actions, .pr-reveal { padding-left: 0; }
  .pr-item { padding: 14px; }
  .pr-play, .pr-slow { padding: 0 14px; }
  .pr-cards { grid-template-columns: 1fr; }
}

/* Dictation tool (/spanish-dictation/) */
.dc-card { padding: 24px; background: var(--ink); border: 2px solid var(--lavender); border-radius: var(--radius-lg); box-shadow: var(--shadow-ink); }
/* The tool is laid out from the first paint (no shift when the module script runs); only a browser
   with scripting off swaps it for the notice. */
.dc-card > * { display: flex; }
.dc-card > .dc-input { display: block; }
.dc-card > [hidden], .dc-card > .pr-noscript { display: none; }
@media (scripting: none) {
  .dc-card.dc-card > :not(.pr-noscript) { display: none; } /* doubled class: beats the layout rules below */
  .dc-card > .pr-noscript { display: block; }
}
.dc-levels { flex-wrap: wrap; gap: 8px; }
.dc-level { min-width: 54px; min-height: 44px; padding: 0 16px; border: 2px solid var(--lavender); border-radius: 999px; background: var(--violet-deep); font: 800 16px var(--font-body); color: var(--white); cursor: pointer; }
.dc-level[aria-pressed="true"] { background: var(--yellow); border-color: var(--void); color: var(--ink); box-shadow: 2px 3px 0 var(--void); }
.dc-top { min-height: 1.6em; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 14px; font-weight: 700; color: var(--text-soft); flex-wrap: wrap; }
.dc-play { gap: 10px; margin-top: 12px; flex-wrap: wrap; }
/* A sentence with a speaker video: stacked under 900px (the video as tall as fits with the
   Check button still on screen), two columns from 900px, like the level test card. */
.dc-card > .dc-media { justify-content: center; margin-top: 14px; }
.dc-media .pr-video { width: auto; height: clamp(180px, calc(100svh - 612px), 420px); }
@media (min-width: 900px) {
  .pr-section:has(.dc-card) { max-width: 860px; }
  .dc-card.dc-has-video { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 32px; align-content: start; }
  .dc-card.dc-has-video > * { grid-column: 2; }
  .dc-card.dc-has-video > .dc-media { grid-column: 1; grid-row: 1 / span 9; align-self: start; margin-top: 0; }
  .dc-card.dc-has-video > .dc-top { margin-top: 14px; }
  .dc-media .pr-video { height: clamp(460px, calc(100vh - 240px), 520px); }
}
.dc-input { width: 100%; margin-top: 14px; padding: 14px 16px; border: 2px solid var(--ink); border-radius: var(--radius-md); background: var(--paper); font: 600 19px/1.5 var(--font-body); color: var(--paper-text); resize: none; }
.dc-input::placeholder { color: var(--paper-muted); }
.dc-input:focus { outline: 3px solid var(--yellow); outline-offset: 2px; }
.dc-keys { flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.dc-key { min-width: 44px; min-height: 44px; border: 1.5px solid var(--lavender); border-radius: 10px; background: var(--violet-deep); color: var(--white); font: 700 18px var(--font-body); cursor: pointer; }
.dc-key:hover:not(:disabled) { border-color: var(--yellow); color: var(--yellow); }
.dc-key:disabled { opacity: .45; cursor: default; }
.dc-actions { gap: 12px; margin-top: 22px; flex-wrap: wrap; }
#dcCheck { background: var(--yellow); color: var(--ink); font-weight: 800; box-shadow: -3px -3px 0 var(--pink), 5px 6px 0 var(--void); }
.dc-result { flex-direction: column; margin-top: 18px; padding: 18px; border-radius: var(--radius-md); background: var(--paper); color: var(--paper-text); border: 2px solid var(--yellow); }
.dc-words { font-size: 20px; font-weight: 700; line-height: 1.8; color: var(--paper-text); }
.dc-ok { color: var(--green-on-light); }
.dc-accent { color: var(--amber-on-light); text-decoration: underline wavy rgba(154, 65, 11, .65); text-underline-offset: 4px; }
.dc-wrong { color: var(--red-on-light); background: rgba(166, 27, 27, .12); border-radius: 4px; padding: 0 4px; }
.dc-missed { color: var(--red-on-light); text-decoration: line-through; text-decoration-color: rgba(166, 27, 27, .7); }
.dc-extra { font-size: 14px; color: var(--paper-muted); margin-top: 6px; }
.dc-extra:empty { display: none; }
.dc-result .pr-en { color: var(--paper-muted); margin-top: 8px; }
.dc-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; font-weight: 700; }
.dc-actions [hidden] { display: none; }

@media (max-width: 600px) { .dc-card { padding: 16px; } .dc-card > .dc-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); } .dc-level { min-width: 0; } .dc-keys { gap: 6px; } .dc-key { min-width: 44px; min-height: 44px; padding: 0; } }

/* Connected-speech drills (/spanish-listening-drills/) */
.dr-spotlight { display: grid; gap: 12px; margin-top: 18px; }
.dr-spot { padding: 16px 18px; border-radius: var(--radius-md); background: var(--ink); border: 2px solid var(--lavender); box-shadow: 3px 4px 0 var(--void); }
.dr-spot-es { font-size: 19px; font-weight: 700; line-height: 1.55; color: var(--white); }
.dr-spot-note { margin-top: 6px; font-size: 14px; color: var(--text-soft); }
.dr-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; list-style: none; }
.dr-stats li { padding: 6px 12px; border-radius: 8px; background: var(--ink); border: 1.5px solid var(--lavender); font-size: 13px; font-weight: 700; color: var(--yellow); }
.lt-samples { margin-top: 16px; padding: 14px 18px; border-radius: var(--radius-md); background: var(--ink); border: 2px solid var(--lavender); box-shadow: 3px 4px 0 var(--void); }
.lt-samples summary { font-weight: 700; color: var(--yellow); cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.lt-samples ul { margin: 10px 0 0 18px; display: grid; gap: 8px; font-size: 14px; line-height: 1.55; color: var(--text-soft); }
.lt-samples strong { color: var(--white); }
