/* Practice sessions: top bar, exercise stage, answer options, feedback bar. */
/* The top bar (Back, or a session's close button and progress) stays at the top of the screen while you scroll */
.top{position:sticky; top:0; z-index:4; display:flex; align-items:center; gap:var(--s-3); min-height:60px; padding:var(--s-2) var(--gutter); background:var(--bg)}
@supports (animation-timeline: scroll()){
  /* a hairline under it once the page has scrolled */
  .top{animation:top-line linear both; animation-timeline:scroll(root); animation-range:0 24px}
  @keyframes top-line{from{box-shadow:0 1px 0 transparent} to{box-shadow:0 1px 0 var(--line)}}
}
.top .iconbtn{margin-left:-10px}
.prog{flex:1; height:6px; border-radius:var(--r-full); background:var(--surface-3); overflow:hidden}
.prog > span{display:block; height:100%; border-radius:inherit; background:var(--accent); transition:width var(--t-slow) var(--ease)}
.stage{flex:1; display:flex; flex-direction:column; gap:var(--s-5); padding:var(--s-4) var(--gutter) var(--s-6)}
.stage-head{display:flex; flex-direction:column; gap:var(--s-2)}
.title{font-size:var(--fs-2xl); font-weight:600; letter-spacing:-.02em; line-height:1.2}
.prompt{font-size:var(--fs-xl); font-weight:600; letter-spacing:-.015em}
.chars{font-family:var(--font-zh); font-size:var(--fs-lg); color:var(--ink-2); letter-spacing:.04em}
.panel{padding:var(--s-3) var(--s-4); border-radius:var(--r-box); background:var(--surface); box-shadow:var(--raise)}
.audiorow{display:flex; flex-wrap:wrap; gap:var(--s-2)}
.target-tone{display:flex; align-items:center; gap:var(--s-4)}
.target-tone .syl-b{font-size:var(--fs-3xl); line-height:1}
.target-tone .syl-n{font-size:var(--fs-xl)}
.target-tone .glyph{color:var(--ink)}

/* answer options */
.options{display:grid; gap:var(--s-2)}
.opt{position:relative; display:flex; align-items:center; justify-content:space-between; gap:var(--s-3); min-height:56px; padding:var(--s-3) var(--s-4); border:0; border-radius:var(--r-ctl); background:var(--surface); box-shadow:inset 0 0 0 1px var(--line-strong); text-align:left; font-weight:500; transition:box-shadow var(--t-fast), background-color var(--t-fast), color var(--t-fast)}
.opt:hover{box-shadow:inset 0 0 0 1px var(--ink-3)}
.opt[aria-pressed="true"]{box-shadow:inset 0 0 0 2px var(--ink)}
.opt .mark{display:inline-flex; opacity:0; transform:scale(.5); transition:opacity var(--t), transform var(--t) var(--ease)}
.opt.right{box-shadow:inset 0 0 0 2px var(--ink)}
.opt.wrong{box-shadow:inset 0 0 0 2px var(--accent); background:var(--accent-soft); color:var(--accent); animation:shake .35s ease-in-out}
.opt.right .mark, .opt.wrong .mark{opacity:1; transform:none}
.opt.is-on{background:var(--surface-2)}
.options.locked .opt{cursor:default}
.options.locked .opt:not(.right):not(.wrong){color:var(--ink-3); box-shadow:inset 0 0 0 1px var(--line)}
@keyframes shake{20%{transform:translateX(-5px)} 40%{transform:translateX(4px)} 60%{transform:translateX(-3px)} 80%{transform:translateX(2px)}}
.tonegrid{grid-template-columns:repeat(3, minmax(0,1fr))}
.tonegrid .opt{flex-direction:column; align-items:flex-start; justify-content:flex-start; gap:6px; padding:var(--s-3)}
.tonegrid .opt b{font-size:var(--fs-xl); font-weight:600; line-height:1}
.tonegrid .short{font-size:var(--fs-xs); color:var(--ink-2)}
.tonegrid .mark{position:absolute; top:10px; right:10px}
.opt.wrong .short, .opt.wrong .glyph{color:var(--accent)}
.options.locked .opt:not(.right):not(.wrong) .short{color:var(--ink-3)}

/* feedback bar */
.foot{position:sticky; bottom:0; display:flex; flex-wrap:wrap; align-items:center; gap:var(--s-3); min-height:76px; padding:var(--s-3) var(--gutter) calc(var(--s-3) + env(safe-area-inset-bottom)); background:var(--bg); box-shadow:0 -1px 0 var(--line); transition:background-color var(--t), color var(--t)}
.foot > .btn-quiet:first-child{margin-left:-12px}
.foot .foot-msg{flex:1; min-width:0; display:flex; align-items:center; gap:var(--s-3); font-weight:600; line-height:1.3}
.foot .foot-msg small{display:block; margin-top:2px; font-size:var(--fs-sm); font-weight:400; color:var(--ink-2)}
.foot .btn-primary{min-width:128px}
.foot.stacked .foot-msg{flex-basis:100%; order:-1}
.foot.stacked .btn-primary{margin-left:auto}
.foot.ok{background:var(--inv); color:var(--on-inv); box-shadow:none}
.foot.ok .foot-msg small, .foot.ok .btn-quiet{color:var(--on-ink-2)}
.foot.ok .btn-quiet:hover{background:transparent; color:var(--on-inv)}
.foot.bad{background:var(--accent-soft); box-shadow:none}
.foot.bad .foot-msg{color:var(--accent)}
.foot.ok .foot-msg, .foot.bad .foot-msg{animation:rise var(--t) var(--ease) both}

@media (max-width:380px){
  .syl-b{font-size:var(--fs-xl)}
  .tonegrid{grid-template-columns:repeat(2, minmax(0,1fr))}
}
.tip-card{display:flex; flex-direction:column; gap:var(--s-3)}
.tip-label{display:flex; align-items:center; gap:6px; font-size:var(--fs-sm); font-weight:600; color:var(--accent)}
.tip-text{font-size:var(--fs-lg); line-height:1.6}
