/* Tavolingo lesson player (lezione.html). Builds on the tokens in styles.css + trattoria.css.
   Phrase cards are a framed chalkboard; quiz cards are paper with a gingham edge. */
.lesson-wrap { max-width: 760px; padding: 24px 0 64px; }
.player { outline: none; }
.player h1 { font-size: clamp(2.5rem, 6vw + 1rem, 3.6rem); }
.player h1:focus { outline: none; } /* programmatic focus target for screen readers, not interactive */

/* Lesson picker */
.picker { display: flex; gap: 8px; margin-bottom: 24px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: thin; }
.pick { display: inline-flex; align-items: center; gap: 8px; flex: none; min-height: 44px; padding: .4rem 1rem .4rem .45rem; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink-soft); font-size: .92rem; font-weight: 800; text-decoration: none; transition: border-color .2s, color .2s, background-color .2s, transform .2s var(--ease); }
.pick:hover { border-color: var(--line-strong); color: var(--ink); transform: translateY(-1px); }
.pick.is-current { background: var(--accent-soft); border-color: var(--red); color: var(--ink); }
.pick-num { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--line-strong); color: var(--ink); font-size: .85rem; font-weight: 800; transition: background-color .2s, color .2s; }
.pick.is-current .pick-num { background: var(--red); border-color: var(--red); color: #fff; }

/* Intro */
.intro { animation: enter .3s var(--ease) both; }
.it-title { margin-top: -.4rem; font: italic 700 1.2rem/1.3 var(--font-body); color: var(--accent); }
.intro-list { display: grid; gap: 10px; margin: 0 0 20px; padding: 0; list-style: none; }
.intro-list li { position: relative; padding-left: 34px; color: var(--ink-soft); }
.intro-list li::before { content: ""; position: absolute; left: 0; top: .55em; width: 22px; height: 9px; background: var(--squiggle) center / 100% 100% no-repeat; }

/* Progress: a little strip of tablecloth */
.progress { margin-bottom: 22px; }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: .86rem; font-weight: 800; color: var(--ink-soft); }
.progress-track { height: 14px; border-radius: 4px; background: var(--card); overflow: hidden; border: 1.5px solid var(--line-strong); }
.progress-fill { --gingham-check: 6px; display: block; height: 100%; transition: width .4s var(--ease);
  background:
    repeating-linear-gradient(90deg, var(--gingham-tint) 0 var(--gingham-check), transparent var(--gingham-check) calc(2 * var(--gingham-check))),
    repeating-linear-gradient(0deg, var(--gingham-tint) 0 var(--gingham-check), transparent var(--gingham-check) calc(2 * var(--gingham-check))),
    var(--gingham-base); }

/* Phrase card: a framed chalkboard; quiz card: paper with a gingham edge */
.phrase-card, .quiz-card { position: relative; overflow: hidden; padding: 30px 20px 24px; border-radius: 8px; }
.phrase-card { margin: 8px; box-shadow: 0 0 0 2px var(--wood-dark), 0 0 0 8px var(--wood), 0 0 0 9px var(--wood-dark), 0 30px 50px -22px rgba(0, 0, 0, .7); }
.quiz-card { padding-top: 42px; background: var(--card); border: 1.5px solid var(--line); box-shadow: var(--shadow-lg); }
@media (min-width: 600px) { .phrase-card { padding: 44px 40px 32px; } .quiz-card { padding: 56px 36px 32px; } }
.term { display: inline-block; margin-bottom: 12px; padding: 3px 12px; border-radius: 6px; border: 2px solid var(--chalk-yellow); color: var(--chalk-yellow); font: 800 1.05rem/1.4 var(--font-body); letter-spacing: .1em; }
.phrase { margin-bottom: 14px; overflow-wrap: anywhere; hyphens: auto; }
.phon { display: inline-block; margin: 0 0 10px; padding: 4px 12px; border-radius: 8px; border: 1.5px dashed var(--basil); color: var(--basil); font-weight: 800; letter-spacing: .03em; }
.english { font-size: 1.15rem; color: var(--ink-soft); margin-bottom: 20px; }
.practice { display: flex; flex-wrap: wrap; gap: 10px; }
.phrase-card .btn-soft { box-shadow: none; }
.phrase-card .btn-soft:hover { border-color: var(--chalk); background: rgba(244, 241, 232, .08); }
.btn.is-listening { border-color: var(--bad); color: var(--bad); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--bad) 22%, transparent); } }
.speech-status { min-height: 1.5em; margin: 10px 0 0; font-size: .95rem; font-weight: 700; }
.speech-status:empty { margin: 0; min-height: 0; }
.speech-status.is-ok { color: var(--ok); }
.speech-status.is-close { color: var(--warn); }
.speech-status.is-bad, .speech-status.is-warn { color: var(--bad); }
.speech-status.is-info { color: var(--ink-soft); }
.example { margin-top: 24px; padding: 16px 18px; border-radius: 10px; border: 2px dashed var(--line); }
.example .ex-it { margin: 0; font: 400 1.7rem/1.15 var(--font-hand); text-shadow: var(--chalk-shadow); }
.example .ex-en { margin: 4px 0 12px; color: var(--ink-soft); }
/* Sommelier's tip: a paper note pinned to the board */
.tip { position: relative; margin-top: 26px; padding: 20px 18px 16px; border-radius: 3px; background: var(--card); box-shadow: 0 14px 22px -14px rgba(0, 0, 0, .7); transform: rotate(-.6deg); }
.tip::before { content: ""; position: absolute; top: -10px; left: 24px; width: 64px; height: 20px; background: rgba(236, 226, 200, .8); transform: rotate(-4deg); }
.tip strong { display: block; margin-bottom: 4px; color: var(--accent); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; }
.tip p { margin: 0; }
.step-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }
.step-nav .btn { flex: 1 1 0; }
.step-nav.end { justify-content: flex-end; }
@media (min-width: 600px) { .step-nav .btn { flex: 0 0 auto; min-width: 160px; } }
.kbd-hint { display: none; margin-top: 14px; text-align: center; font-size: .86rem; color: var(--ink-soft); }
@media (hover: hover) and (min-width: 760px) { .kbd-hint { display: block; } }

/* Quiz */
.question { font-size: clamp(1.9rem, 3vw + 1.2rem, 2.6rem) !important; margin-bottom: 20px; }
.options { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.option { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 12px 16px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); font: 700 1rem/1.4 var(--font-body); text-align: left; cursor: pointer; transition: border-color .2s, background-color .2s, transform .2s var(--ease), box-shadow .2s var(--ease); }
.option:not([disabled]):hover { border-color: var(--red); transform: translateX(3px); box-shadow: var(--shadow); }
.option[disabled] { cursor: default; }
.option[disabled]:not(.is-correct):not(.is-wrong) { opacity: .6; }
.opt-mark { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--line-strong); color: var(--ink); font-weight: 800; font-size: .9rem; transition: background-color .2s, color .2s, border-color .2s; }
.option:not([disabled]):hover .opt-mark { border-color: var(--red); color: var(--accent); }
.option.is-correct { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--bg)); }
.option.is-correct .opt-mark { background: var(--ok); border-color: var(--ok); color: var(--bg); }
.option.is-wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--bg)); animation: shake .3s var(--ease); }
.option.is-wrong .opt-mark { background: var(--bad); border-color: var(--bad); color: var(--bg); }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.feedback p { margin: 18px 0 0; padding: 14px 16px; border-radius: 10px; animation: enter .25s var(--ease) both; }
.feedback .is-ok { background: color-mix(in srgb, var(--ok) 12%, transparent); }
.feedback .is-bad { background: color-mix(in srgb, var(--bad) 10%, transparent); }

/* Result */
.result { text-align: center; }
.score { margin: 8px 0 28px; color: var(--ink-soft); font-size: 1.1rem; }
.score-num { display: grid; place-items: center; width: 190px; height: 150px; margin: 8px auto 6px; background: var(--scribble) center / 100% 100% no-repeat; color: var(--accent); font: 400 clamp(3.6rem, 13vw, 4.6rem)/1 var(--font-hand); transform: rotate(-4deg); }
.result-cta { position: relative; overflow: hidden; margin-bottom: 24px; padding: 36px 20px 28px; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.result-cta h2 { font-size: 2.4rem; }
.result-cta p { color: var(--ink-soft); max-width: 46ch; margin-inline: auto; }
.result-cta .cta-row { justify-content: center; margin-bottom: 0; }
@media (prefers-reduced-motion: reduce) { .score-num, .tip { transform: none; } }
