/*
 * TAG Legal Desk v2.1: practice points and "Something is wrong" (register J108, js/v21_practice_points.js).
 * J137 and J138 (28 Sep 2026): the practice level in the band, on each made up card and in the open job; the grouped
 * list of mistakes; what a catch can win (the server rolls it).
 * The desk's own tokens and glass (styles/desk.css), so Light, Dark, Eucalypt, Harbour and High contrast all follow.
 * Colour is never the only sign: every verdict carries a title and an icon, and the tally carries words as well as dots.
 * Only transform and opacity animate, and not at all with reduced motion.
 */

/* ---------- the button beside Send (practice only) ---------- */
.job-bar .pp-wrong { min-height: 56px; padding: 0 18px; border-radius: 16px; font-size: 1rem; color: var(--ink); flex: none; }
.job-bar .pp-wrong .ico { color: var(--warn); }
.job-bar .pp-wrong:hover { background: var(--glass-2); }
.pp-wrong-short { display: none; }
:root[data-theme="high_contrast"] .job-bar .pp-wrong { border: 2px solid #000; background: #fff; color: #000; }
:root[data-theme="high_contrast"] .job-bar .pp-wrong .ico { color: #000; }

/* ---------- the short list ---------- */
/* Something to read and choose from, so it sits on solid paper, not see-through glass. */
.pop.pp-pop { width: min(430px, calc(100vw - 24px)); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow: auto; overscroll-behavior: contain; background: var(--solid); }
.pp-form { display: grid; gap: 10px; }
.pp-form .pp-intro { margin: 0; color: var(--ink-2); font-size: .875rem; }
.pp-choices { margin: 0; padding: 0; border: 0; display: grid; gap: 4px; min-width: 0; }
.pp-choices legend { padding: 0; margin: 0 0 6px; font-size: 1rem; font-weight: 700; color: var(--ink); }
.pp-choice { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 8px 10px; border-radius: 12px; background: var(--solid); border: 1px solid var(--glass-rim); }
.pp-choice:hover { background: var(--solid-2); }
.pp-choice input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); cursor: pointer; }
.pp-choice label { flex: 1; min-width: 0; font-size: .9375rem; line-height: 1.35; color: var(--ink); cursor: pointer; }
.pp-choice:has(input:checked) { border-color: var(--brand-text); box-shadow: inset 3px 0 0 var(--brand-text); }
.pp-msg { margin: 0; min-height: 1.2em; font-weight: 700; font-size: .9375rem; color: var(--warn); }
.pp-msg:empty { min-height: 0; }
.pp-msg.pp-ok { color: var(--ok); }
.pp-explain { display: grid; gap: 8px; }
.pp-explain .pp-explain-now { font-weight: 700; color: var(--ink); }
:root[data-theme="high_contrast"] .pp-choice { border: 2px solid #000; background: #fff; }
:root[data-theme="high_contrast"] .pp-choice:has(input:checked) { box-shadow: inset 5px 0 0 #000; }

/* ---------- the verdict card: it stays until Got it ---------- */
.pp-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 84; }
.pp-verdict { position: fixed; z-index: 85; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100% - 32px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: auto;
  padding: 22px 24px 20px; border-radius: var(--r-card); display: grid; gap: 12px; box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-rim), var(--shadow-2), inset 5px 0 0 var(--pp-tone, var(--info)); }
.pp-verdict.pp-good { --pp-tone: var(--ok); }
.pp-verdict.pp-bad { --pp-tone: var(--danger); }
.pp-verdict.pp-warn { --pp-tone: var(--warn); }
.pp-v-head { display: flex; align-items: center; gap: 12px; }
.pp-v-head h2 { margin: 0; font-size: 1.25rem; line-height: 1.3; color: var(--ink); }
.pp-v-ico { flex: none; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--pp-tone, var(--info)); background: color-mix(in srgb, var(--pp-tone, var(--info)) var(--tint-alpha), transparent); }
.pp-v-body { display: grid; gap: 8px; }
.pp-v-body p { margin: 0; font-size: 1rem; line-height: 1.5; color: var(--ink); }
.pp-v-body .pp-v-tally { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--glass-rim); font-size: .9375rem; font-weight: 700; color: var(--ink-2); }
.pp-v-row { display: flex; justify-content: flex-end; }
.pp-v-row .pp-got { min-width: 140px; }
:root[data-theme="high_contrast"] .pp-verdict { background: #fff; border: 3px solid #000; box-shadow: inset 8px 0 0 #000; }
:root[data-theme="high_contrast"] .pp-v-ico { color: #000; background: #fff; border: 2px solid #000; }
:root[data-theme="high_contrast"] .pp-v-body .pp-v-tally { border-top: 2px solid #000; color: #000; }
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduced"]) .pp-verdict { animation: pp-in 200ms var(--ease-out) both; }
  :root:not([data-motion="reduced"]) .pp-scrim { animation: pp-fade 160ms var(--ease-out) both; }
}
:root[data-motion="full"] .pp-verdict { animation: pp-in 200ms var(--ease-out) both; }
@keyframes pp-in { from { opacity: 0; transform: translate(-50%, calc(-50% + 10px)); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes pp-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- the tally in the practice band ---------- */
.pband .pp-tally { display: inline-flex; align-items: center; gap: 8px; min-height: 24px; padding: 0 10px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--practice) 40%, transparent);
  background: var(--solid); color: var(--practice); font: inherit; font-size: .75rem; font-weight: 700; letter-spacing: normal; text-transform: none; cursor: pointer; }
.pband .pp-tally:hover { background: var(--solid-2); }
.pp-t-short { display: none; }
.pp-t-nextshort { display: none; font-weight: 600; color: var(--ink-2); }
.pp-t-next { font-weight: 600; color: var(--ink-2); }
.pp-dots { display: inline-flex; gap: 3px; }
.pp-dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--practice); background: transparent; }
.pp-dot.on { background: var(--practice); }
/* J152: half a job towards the next point (a job done with the practice "i" opened). */
.pp-dot.half { background: linear-gradient(90deg, var(--practice) 50%, transparent 50%); }
:root[data-theme="high_contrast"] .pband .pp-tally { border: 2px solid #000; color: #000; background: #fff; }
:root[data-theme="high_contrast"] .pp-dot { border-color: #000; }
:root[data-theme="high_contrast"] .pp-dot.on { background: #000; }
:root[data-theme="high_contrast"] .pp-dot.half { background: linear-gradient(90deg, #000 50%, #fff 50%); }
:root[data-theme="high_contrast"] .pp-t-next { color: #000; }
:root[data-theme="high_contrast"] .pp-t-nextshort { color: #000; }

/* ---------- phone width ---------- */
@media (max-width: 599px) {
  .job-bar .pp-wrong { flex: 1 1 auto; padding: 0 14px; }
  .pp-verdict { padding: 18px 16px 16px; }
  .pp-v-row .pp-got { flex: 1; }
  .pband .pp-t-next { display: none; }
  /* The long words go, but "x of 5" stays beside the dots. */
  .pband .pp-t-nextshort { display: inline; }
  /* Big enough to tap. */
  .pp-form .row .btn, .pp-explain .row .btn { min-height: 44px; }
}
@media (max-width: 419px) {
  .job-bar .pp-wrong-long { display: none; }
  .job-bar .pp-wrong-short { display: inline; }
  .pband .pp-t-long { display: none; }
  .pband .pp-t-short { display: inline; }
}

/* ---------- J137: the practice level (the band, the cards, the open job) ---------- */
.pband .pp-level { display: inline-flex; align-items: center; gap: 8px; min-height: 24px; padding: 0 10px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--practice) 40%, transparent);
  background: var(--solid); color: var(--practice); font: inherit; font-size: .75rem; font-weight: 700; letter-spacing: normal; text-transform: none; cursor: pointer; }
.pband .pp-level:hover { background: var(--solid-2); }
.pp-l-hint { font-weight: 600; color: var(--ink-2); max-width: 42ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-card-tier { display: inline-flex; align-items: center; min-height: 20px; padding: 0 8px; border-radius: 999px; font-size: .6875rem; font-weight: 700; line-height: 1.2;
  color: var(--practice); background: var(--solid); border: 1px solid color-mix(in srgb, var(--practice) 45%, transparent); }
.card .pp-card-tier.on-card { margin-top: 6px; }
.job-top .pp-card-tier.on-job { flex: none; margin-left: 8px; min-height: 28px; font-size: .75rem; }
.pp-card-tier[data-tier="5"], .pp-card-tier[data-tier="6"] { border-width: 2px; }
:root[data-theme="high_contrast"] .pband .pp-level, :root[data-theme="high_contrast"] .pp-card-tier { border: 2px solid #000; color: #000; background: #fff; }
:root[data-theme="high_contrast"] .pp-l-hint { color: #000; }

/* ---------- J138: the grouped list, found picks, the levels and the odds ---------- */
.pp-choices .pp-group { margin: 8px 0 2px; font-size: .75rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--ink-2); }
.pp-choices .pp-group:first-of-type { margin-top: 0; }
.pp-choice.is-found { opacity: .7; border-style: dashed; }
.pp-choice.is-found label { text-decoration: line-through; text-decoration-thickness: 1px; }
.pp-levels { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: .875rem; color: var(--ink); }
.pp-levels li.on { font-weight: 700; color: var(--practice); }
.pp-odds { width: 100%; border-collapse: collapse; font-size: .8125rem; color: var(--ink); }
.pp-odds caption { text-align: left; font-weight: 700; padding-bottom: 4px; color: var(--ink-2); }
.pp-odds th, .pp-odds td { padding: 4px 6px; border-bottom: 1px solid var(--glass-rim); text-align: left; font-weight: 400; }
.pp-odds thead th { font-weight: 700; }
.pp-odds td { text-align: right; font-variant-numeric: tabular-nums; }
:root[data-theme="high_contrast"] .pp-choice.is-found { border: 2px dashed #000; }
:root[data-theme="high_contrast"] .pp-levels li.on { color: #000; text-decoration: underline; }
:root[data-theme="high_contrast"] .pp-odds th, :root[data-theme="high_contrast"] .pp-odds td { border-bottom: 1px solid #000; color: #000; }
@media (max-width: 899px) { .pp-l-hint { display: none; } }
@media (max-width: 599px) { .pband .pp-level { padding: 0 8px; } }
/* Fix round (28 Sep 2026): at phone width the band keeps only the level's name ("Old Growth") beside the tally, and the
   band may wrap (styles\desk.css); "Practice level:" stays in the button's screen reader name. */
.pp-l-name { white-space: nowrap; }
@media (max-width: 599px) { .pband .pp-l-pre { display: none; } .pband .pp-level { max-width: 100%; } }
