/* Learning surfaces: the rules guide, how points work and the round review. They share the
   home page's panel recipe (a red seal, a bold title, rows that share their edges) and the
   table's type, ink, paper and control tokens. The review's rules restate everything the
   older `.review` rules in style.css set, so those no longer decide anything. */
.learning-muted { color: var(--ink-soft); font-size: var(--text-caption); line-height: 1.55; }
.learning-seal {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 4px; rotate: -4deg;
  font: 24px/1 var(--ink-font); color: var(--on-seal); background: var(--seal);
  box-shadow: inset 0 0 0 1.5px var(--seal), inset 0 0 0 3px var(--on-seal);
}
.learning-callout {
  margin: 0 0 14px; padding: 12px 14px 12px 17px; border-radius: var(--radius-control);
  background: var(--paper); box-shadow: inset 3px 0 0 var(--seal); color: var(--ink);
}
.learning-callout strong { display: block; font-weight: 800; }
.learning-callout p { margin: 4px 0 0; }
.learning-cards { display: flex; gap: 5px; align-items: center; overflow: auto; padding: 4px 3px 8px; min-width: 0; }
.learning-cards .card { --cw: 40px; --ch: 57px; flex: none; margin: 0; }
.learning-pass { display: block; padding: 10px 0 12px; font-size: var(--text-body); font-weight: 700; color: var(--ink-soft); }

/* Disclosures are rows: a bold label, a chevron at the far edge, a line between them. */
:is(.learning-guide, .score-explanation, .learning-review) summary {
  display: flex; align-items: center; gap: 10px; min-height: var(--control-height); padding-block: 8px;
  cursor: pointer; list-style: none; font-size: var(--text-label); font-weight: 700; line-height: 1.3; color: var(--ink);
}
:is(.learning-guide, .score-explanation, .learning-review) summary::-webkit-details-marker { display: none; }
:is(.learning-guide, .score-explanation, .learning-review) summary::after {
  content: ""; flex: none; width: 7px; height: 7px; margin: 0 5px 3px auto; rotate: 45deg;
  border: solid var(--ink-soft); border-width: 0 1.5px 1.5px 0; transition: rotate var(--motion-control), margin var(--motion-control);
}
:is(.learning-guide, .score-explanation, .learning-review) details[open] > summary::after,
details.score-explanation[open] > summary::after { rotate: 225deg; margin-bottom: -3px; }
:is(.learning-guide, .score-explanation, .learning-review) summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- the rules guide ---------- */
.sheet.learning-sheet { width: min(560px, calc(100% - 24px)); }
.learning-sheet .sheet-head { position: sticky; top: -16px; z-index: 2; margin-inline: -4px; padding: 8px 4px; background: var(--panel); }
.learning-guide { text-align: left; font-size: 15px; line-height: 1.6; color: var(--ink); }
.learning-head { display: flex; align-items: center; gap: 12px; margin: 2px 0 12px; }
.learning-guide .learning-head h4 { margin: 0; font-size: 20px; line-height: 1.25; font-weight: 800; letter-spacing: 0; text-transform: none; color: var(--ink); }
.learning-guide > p { margin: 0 0 14px; }
.learning-guide > details { border-top: 1px solid var(--line); }
.learning-guide > details > :not(summary) { margin-inline: 0; }
.learning-guide > details[open] { padding-bottom: 10px; }
.learning-guide h5 { margin: 16px 0 2px; font-size: var(--text-label); font-weight: 800; color: var(--ink); }
.learning-guide details p { margin: 0 0 10px; font-size: var(--text-label); }
.learning-guide > .keyboard-instructions { margin: 0; padding-top: 12px; border-top: 1px solid var(--line); }
.learning-guide > .primary { width: 100%; min-height: 48px; margin-top: 14px; }
.combo-library { display: grid; margin: 0 0 6px; }
.combo { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; padding: 8px 0; border-top: 1px solid var(--line); }
.combo:first-child { border-top: 0; padding-top: 0; }
.combo .learning-cards { flex: none; width: 164px; gap: 0; padding: 4px 0; overflow: visible; }
.combo .learning-cards .card + .card { margin-left: -16px; }
/* A long example (shuangkou's three triples) overlaps closer, to keep to the same width. */
.combo .learning-cards:has(> .card:nth-child(7)) .card + .card { margin-left: -25px; }
.learning-guide .combo p { flex: 1 1 150px; margin: 0; font-size: var(--text-caption); line-height: 1.45; color: var(--ink-soft); }
.combo p strong { display: block; font-size: var(--text-label); font-weight: 800; color: var(--ink); }

/* ---------- how points work ---------- */
.score-explanation { grid-column: 1 / -1; margin-block: 12px 0; text-align: left; font-size: var(--text-label); line-height: 1.55; color: var(--ink); border-top: 1px solid var(--line); }
.learning-sheet .score-explanation { margin: 0; border-top: 0; }
.learning-sheet .score-explanation > summary { display: none; } /* the sheet's own title says it */
.score-explanation p { margin: 8px 0; }
.score-explanation > p:first-of-type { margin-top: 0; }
.score-explanation h4 { margin: 18px 0 4px; font-size: var(--text-label); font-weight: 800; letter-spacing: 0; text-transform: none; color: var(--ink); }
.score-explanation details { border-top: 1px solid var(--line); margin-top: 12px; }
.score-factors {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 12px 0 0;
  border-radius: var(--radius-panel); box-shadow: 0 0 0 1px var(--line); overflow: hidden; background: var(--panel);
}
/* Shuangkou's: the outcome, the winners' biggest bomb (none in a draw), and the points. */
.score-factors.teams { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.score-factors > div { display: flex; flex-direction: column; justify-content: space-between; gap: 8px; min-width: 0; padding: 10px 10px 9px; }
.score-factors > div + div { box-shadow: inset 1px 0 0 var(--line); }
.score-factors span { font-size: var(--text-micro); font-weight: 600; line-height: 1.3; color: var(--ink-soft); overflow-wrap: anywhere; }
.score-factors strong { font: 600 26px/1 var(--rank-font); font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.score-factors .score-stake { background: var(--ink); }
.score-factors .score-stake :is(span, strong) { color: var(--paper); }
.score-calculation { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.score-calculation > div { min-width: 0; display: grid; gap: 2px; }
.score-calculation strong { font-weight: 800; }
.score-calculation span { font-size: var(--text-caption); font-variant-numeric: tabular-nums; }
.score-calculation small { font-size: var(--text-caption); color: var(--ink-soft); line-height: 1.4; }
.score-calculation > b { flex: none; font: 600 26px/1 var(--rank-font); font-variant-numeric: tabular-nums; }
.score-calculation.is-you { background: var(--paper); border-radius: var(--radius-control); }
/* 百变's bomb pay: one line per bomb of 6 lines or more */
.score-contrib { margin: 4px 0 0; padding-left: 18px; font-size: var(--text-caption); line-height: 1.5; }

/* ---------- the round review ---------- */
.modal.learning-review {
  display: flex; flex-direction: column; gap: 0; overflow: hidden; width: min(880px, 100%); max-width: 880px;
  height: min(820px, 100%); padding: 18px 22px 16px; text-align: left; /* one height at every step: nothing jumps */
}
.learning-review .rhead { display: flex; align-items: center; gap: 12px; flex: none; min-height: 44px; margin: 0 0 14px; }
.learning-review .rhead-text { flex: 1; min-width: 0; }
.learning-review .rhead h3 { margin: 0; font-size: 21px; line-height: 1.2; font-weight: 800; letter-spacing: 0; color: var(--ink); }
.learning-review .rhead p { margin: 2px 0 0; font-size: var(--text-caption); line-height: 1.4; color: var(--ink-soft); }
.learning-review .rhead button.icon { flex: none; align-self: flex-start; width: 44px; height: 44px; min-height: 44px; font-size: 26px; font-weight: 400; }
.learning-review .review-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; margin-inline: -2px; padding: 2px 4px 14px 2px; scrollbar-gutter: stable; }
.learning-review h4 { margin: 18px 0 4px; font-size: var(--text-label); font-weight: 800; letter-spacing: 0; text-transform: none; color: var(--ink); }

/* Whose decisions, then the moments worth another look. */
.learning-review .review-overview { display: flex; flex-wrap: wrap; align-items: center; gap: 0 14px; padding: 0 0 14px; }
.learning-review .review-scope { display: inline-flex; max-width: 100%; }
.learning-review .review-summary { margin: 0; padding-block: 6px; font-size: var(--text-caption); line-height: 1.4; color: var(--ink-soft); }
.learning-review .review-scope button { flex: 1 1 0; min-height: 44px; padding: 8px 16px; font-size: var(--text-label); font-weight: 700; }
.learning-review .review-scope button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.learning-review .review-overview > h4 { flex-basis: 100%; margin: 10px 0 8px; font-size: var(--text-label); font-weight: 800; color: var(--ink); }
.learning-review .review-overview > p.learning-muted { flex-basis: 100%; margin: 6px 0 0; }
.review-moments { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 6px; flex-basis: 100%; min-width: 0; }
.learning-review .review-moments .moment {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "step label tag" "step name tag";
  align-items: center; gap: 0 10px; min-width: 0; min-height: 52px; padding: 6px 10px 6px 6px;
  border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--panel); box-shadow: none;
  text-align: left; white-space: nowrap; font-weight: 400;
}
.learning-review .review-moments .moment[aria-pressed="true"] { border-color: var(--ink); background: var(--paper); box-shadow: inset 0 0 0 1px var(--ink); }
.moment-step {
  grid-area: step; display: grid; place-items: center; width: 34px; height: 38px; border-radius: var(--radius-small);
  background: var(--paper); font: 600 19px/1 var(--rank-font); font-variant-numeric: tabular-nums; color: var(--ink);
}
.moment[aria-pressed="true"] .moment-step { background: var(--ink); color: var(--paper); }
.moment-text { display: contents; }
.moment-text > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.moment-text strong { grid-area: label; align-self: end; font-size: var(--text-label); font-weight: 800; line-height: 1.3; color: var(--ink); }
.moment-text span { grid-area: name; align-self: start; font-size: var(--text-caption); line-height: 1.35; color: var(--ink-soft); }
.moment > .severity { grid-area: tag; }
.learning-review .severity {
  flex: none; display: inline-flex; align-items: center; padding: 2px 7px; border: 1px solid currentColor; border-radius: 4px;
  font-size: var(--text-micro); font-weight: 800; line-height: 1.3; white-space: nowrap; color: var(--ink-soft);
}
.learning-review .severity.mistake { color: var(--ink); }
.learning-review .severity.blunder { color: var(--alert); border-width: 1.5px; }

/* The decision on show: who played, what, how it rated; then what the coach preferred. */
.learning-decision { padding: 16px 18px 18px; border-radius: var(--radius-panel); background: var(--panel); box-shadow: 0 0 0 1px var(--line), 0 14px 32px -24px rgba(31, 59, 143, 0.45); }
.decision-heading { display: grid; gap: 4px; margin-bottom: 10px; }
.decision-who { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--text-label); font-weight: 700; color: var(--ink); }
.learning-review .rseat .who .disc, .decision-who .disc { flex: none; width: 24px; height: 24px; }
.learning-review .rname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.learning-review .tag, .learning-review .rseat .who .tag { flex: none; padding: 1px 7px; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: var(--text-micro); font-weight: 700; line-height: 1.5; }
.decision-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.decision-title h3 { margin: 0; font-size: 26px; line-height: 1.15; font-weight: 800; letter-spacing: 0; color: var(--ink); }
.decision-context { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; margin: 0 0 12px; font-size: var(--text-caption); line-height: 1.45; color: var(--ink-soft); }
.decision-context .learning-cards { padding: 2px 0; }
.decision-context .card { --cw: 30px; --ch: 43px; }
.short-hands { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: -4px 0 12px; font-size: var(--text-caption); font-weight: 700; color: var(--alert); }
.decision-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.decision-move { min-width: 0; padding: 12px 14px 2px; border-radius: var(--radius-control); box-shadow: inset 0 0 0 1px var(--line); }
.decision-move:only-child { grid-column: 1 / -1; }
.decision-move.suggested { background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--ink); }
.decision-label { display: block; font-size: var(--text-caption); font-weight: 600; color: var(--ink-soft); }
.decision-move.suggested .decision-label { font-weight: 800; color: var(--ink); }
.decision-move > strong { display: block; margin: 1px 0 6px; font-size: var(--text-body); font-weight: 800; }
.decision-move .card { --cw: 49px; --ch: 70px; }
.learning-review .decision-remaining { border-top: 1px solid var(--line); }
.learning-review .decision-remaining > summary { min-height: 40px; font-size: var(--text-caption); font-weight: 600; color: var(--ink-soft); }
.learning-review .decision-remaining .card { --cw: 30px; --ch: 43px; }
.learning-review .decision-remaining .learning-cards { gap: 0; }
.learning-review .decision-remaining .learning-cards .card + .card { margin-left: -9px; }
.decision-lesson h4 { margin: 18px 0 4px; font-size: var(--text-body); font-weight: 800; color: var(--ink); }
.decision-lesson > p { margin: 0 0 12px; font-size: 15px; line-height: 1.6; }
.decision-lesson .learning-callout { margin: 0; font-size: 15px; line-height: 1.55; }
.decision-verdict { margin: 12px 0 0; font-size: var(--text-label); line-height: 1.5; color: var(--ink-soft); }
.learning-review .tryrow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; margin-top: 14px; }
.learning-review .tryrow > button { flex: 1 1 0; min-height: 44px; }
.learning-review .tryrow > .primary { flex-basis: 100%; min-height: 48px; }
.learning-decision > details { border-top: 1px solid var(--line); }
.learning-decision > .tryrow + details { margin-top: 14px; }
.learning-decision > details[open] { padding-bottom: 6px; }
.model-estimate, .learning-simulation { font-size: var(--text-caption); line-height: 1.6; }
.model-estimate p, .learning-simulation > p { margin: 0 0 8px; }
.model-equation { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.learning-simulation .decision-comparison { margin-top: 4px; }
.learning-story { min-width: 0; padding: 10px 12px; border-radius: var(--radius-control); background: var(--paper); }
.learning-story > strong { font-size: var(--text-caption); font-weight: 800; }
.learning-story ol { margin: 6px 0 0; padding-left: 20px; }
.learning-story li { margin-block: 3px; }
.learning-story p { margin: 6px 0 0; font-weight: 700; }

/* Trying the decision again: the hand as buttons, then check it. */
.practice-prompt { margin: 0; font-size: var(--text-label); line-height: 1.5; }
.practice-hand { display: flex; flex-wrap: nowrap; gap: 4px; overflow-x: auto; padding: 14px 4px 10px; }
.review-pick { flex: none; min-width: 36px; min-height: 0; padding: 0; border: 0; border-radius: 5px; background: transparent; box-shadow: none; }
.review-pick .card { --cw: 36px; --ch: 52px; margin: 0; pointer-events: none; }
.review-pick[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 2px; transform: translateY(-6px); }
.review-pick:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.practice-result { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-control); background: var(--paper); font-size: var(--text-label); line-height: 1.55; }
.practice-result p { margin: 2px 0 0; }

/* Every hand, one row per seat, the acting seat's cards raised. */
.learning-review .review-hands { margin-top: 14px; border-top: 1px solid var(--line); }
.learning-review .review-hands + .score-explanation { margin-top: 0; }
.learning-review .rseats { display: flex; flex-direction: column; gap: 0; padding-bottom: 6px; }
.learning-review .rseat { display: grid; grid-template-columns: minmax(0, 180px) minmax(0, 1fr); align-items: center; gap: 0 12px; padding: 4px 8px; border-radius: 0; box-shadow: 0 -1px 0 var(--line); }
.learning-review .rseat:first-child { box-shadow: none; }
.learning-review .rseat.acting { border-radius: var(--radius-control); background: var(--paper); box-shadow: none; }
.learning-review .rseat.acting + .rseat { box-shadow: none; }
.learning-review .rseat .who { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; font-size: var(--text-label); font-weight: 700; white-space: nowrap; }
.learning-review .rcount { margin-left: auto; padding-left: 4px; font: 600 16px/1 var(--rank-font); font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.learning-review .rhand { min-width: 0; flex-wrap: nowrap; overflow: auto hidden; padding: 12px 3px 6px; overscroll-behavior-x: contain; touch-action: pan-x pinch-zoom; }
.learning-review .rhand .card { --cw: 33.6px; --ch: 48px; }
.learning-review .rhand .card + .card { margin-left: -12px; }
.learning-review .rhand .card.play { transform: translateY(-9px); box-shadow: 0 0 0 2px var(--accent), 0 6px 12px rgba(0, 0, 0, 0.25); }

/* The footer: the step, a bar for every move of the round, and the way through it. */
.learning-review .review-footer {
  flex: none; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px 14px;
  margin: 0; padding-top: 12px; border-top: 1px solid var(--line);
}
.learning-review .review-footer .step { display: block; min-width: 3.4em; min-height: 0; margin: 0; font: 600 20px/1 var(--rank-font); font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }
.review-strip { display: flex; align-items: flex-end; gap: 2px; height: 30px; min-width: 0; padding-bottom: 7px; }
.review-strip i { position: relative; flex: 1 1 0; min-width: 1px; max-width: 14px; height: calc(var(--h) * 100%); border-radius: 1px; background: var(--ink-faint); }
.review-strip i.other { opacity: 0.4; }
.review-strip i.inaccuracy { background: var(--ink-soft); }
.review-strip i.mistake { background: var(--ink); }
.review-strip i.blunder { background: var(--seal); }
.review-strip i.cur::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 5px; height: 5px; border-radius: 50%; translate: -50% 0; background: var(--ink); }
.learning-review .review-footer .buttons { display: flex; flex-wrap: nowrap; align-items: stretch; gap: 8px; margin: 0; }
.learning-review .review-footer .buttons button { flex: none; min-height: 44px; padding: 10px 16px; }
.learning-review .review-footer .next-moment { white-space: normal; line-height: 1.15; text-align: center; text-wrap: balance; }

#hand .card:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; z-index: 5; }
