/* Lesson chrome only. Table geometry and artwork come from gameplay styles. */
.learning-app {
  overflow: auto;
  min-width: 0;
  background: var(--club-page-background);
}
.learn-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid #e1c99433;
}
.learn-header a,
#learn a {
  color: var(--gold);
}
.learn-header nav {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.language-choice {
  display: flex;
  align-items: center;
  gap: 8px;
}
.language-choice select {
  color: inherit;
  background: var(--club-paper);
  border: 1px solid #8eaa97;
  border-radius: 8px;
  min-height: 44px;
  padding: 6px;
}
#learn {
  max-width: 1440px;
  margin: auto;
  padding: 20px 16px 48px;
}
#learn h1 {
  font: var(--club-page-heading);
  letter-spacing: -0.035em;
  margin: 8px 0 16px;
}
/* Bound the lesson chooser like Home; the active table keeps its full width. */
#learn:has(.lesson-list) {
  max-width: 752px;
}
#learn:has(.lesson-list) > .course-intro {
  margin-bottom: 24px;
}
#learn:has(.lesson-list) > .instruction {
  margin-block: 24px 16px;
}
#learn .instruction p,
.course-intro p {
  line-height: 1.6;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--gold);
}
.course-intro {
  max-width: 720px;
  margin-bottom: 24px;
}
/* After the last lesson the course leads to a practice game: the same control, as a link. It
   keeps the button's teal on hover, where style.css would pale .primary under its cream label. */
#learn .course-progress a.primary {
  display: inline-block;
  background: var(--club-teal);
  min-height: 44px;
  padding: 12px 18px;
  border-radius: var(--club-control-radius);
  color: var(--club-paper);
  font-size: 1rem;
  font-weight: 800;
  text-decoration: none;
}
.lesson-list {
  display: grid;
  gap: 12px;
}
.lesson-list button,
.lesson-heading button,
.instruction button,
.lesson-inspection button {
  color: inherit;
  background: var(--club-page-choice);
  border: 1px solid #e1c99455;
  border-radius: 8px;
  min-height: 44px;
  padding: 10px 14px;
}
.instruction button.primary,
.lesson-inspection button.primary {
  background: var(--gold);
  color: #122f23;
}
.lesson-list button {
  display: flex;
  text-align: left;
  align-items: center;
  gap: 18px;
  padding: 20px;
  border-radius: var(--club-page-radius);
}
.lesson-list strong {
  font-size: 20px;
}
.lesson-list small {
  display: block;
  margin-top: 8px;
  color: var(--club-page-muted);
}
.lesson-list button > span:last-child {
  margin-left: auto;
  font-size: 13px;
  color: var(--gold);
  white-space: nowrap;
  flex-shrink: 0;
}
.number {
  font-size: 32px;
  color: var(--gold);
}
.lesson-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
#learn progress {
  width: 100%;
  height: 4px;
  accent-color: var(--gold);
  margin: 12px 0;
}
.lesson-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.instruction {
  border: 1px solid #e1c99433;
  border-radius: 12px;
  padding: 16px;
}
.answers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.feedback {
  color: var(--club-red);
  min-height: 24px;
}
.feedback.correct {
  color: var(--club-teal);
}
/* Before any attempt the line only says what to do; red is kept for a mistake. */
.feedback.pending {
  color: var(--club-help);
}
.step-controls {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.hint {
  color: var(--club-muted);
  font-size: 13px;
}
.lesson-table {
  min-width: 0;
}
.lesson-table .round-pill {
  flex-wrap: wrap;
}
.lesson-spotlight {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.lesson-table [data-inspect] {
  cursor: pointer;
}
.examples {
  display: flex;
  gap: 16px;
  margin: 12px 0;
}
.examples .face,
.lesson-inspection .face {
  display: inline-block;
  width: 44px;
}
.face img {
  width: 100%;
  display: block;
  filter: saturate(1.65) contrast(1.15);
}
.lesson-inspection {
  color: var(--club-ink);
  background: var(--club-paper);
  border: 1px solid var(--gold);
  border-radius: 14px;
  padding: 20px;
  width: min(560px, 94vw);
  max-height: 85dvh;
  overflow: auto;
}
.lesson-inspection::backdrop {
  background: #0009;
}
.lesson-inspection form {
  margin-top: 16px;
  text-align: right;
}
/* Keep the gameplay table at full available width, rather than squeezing a
   desktop table into a narrow tutorial column. */
@media (max-width: 800px) {
  #learn {
    padding: 12px 0 32px;
  }
  .learn-header {
    flex-wrap: wrap;
    font-size: 12px;
    padding: 12px;
  }
  .learn-header nav {
    gap: 10px;
  }
  .language-choice {
    font-size: 0;
  }
  .language-choice select {
    font-size: 13px;
  }
  .lesson-heading,
  .course-intro,
  .lesson-list {
    margin: 0 8px;
  }
  #learn:has(.lesson-list) {
    padding-inline: 16px;
  }
  #learn:has(.lesson-list) > :is(.course-intro, .lesson-list, .instruction) {
    margin-inline: 0;
  }
  .lesson-heading {
    font-size: 11px;
  }
  .lesson-heading button {
    padding: 6px;
    font-size: 12px;
  }
  .instruction {
    margin: 0 8px;
    padding: 12px;
  }
  .lesson-list button {
    padding: 14px;
    gap: 12px;
  }
  .lesson-list strong {
    font-size: 17px;
  }
  /* "✓ Complete · repeat" wraps inside its button instead of pushing past the screen edge. The
     column does not shrink below that, so "Start →" stays on one line, and Chinese breaks only
     at its spaces, so "再练习" stays whole. */
  .lesson-list button > span:last-child {
    white-space: normal;
    word-break: keep-all;
    text-align: right;
    max-width: 7em;
  }
}
.lesson-table .table-toolbar {
  display: flex;
}
.lesson-follow-up {
  position: relative;
}
/* Use the gameplay workspace as the table host, including its responsive height. */
.lesson-tools {
  display: flex;
  gap: 8px;
  align-items: center;
}
.lesson-table .table-toolbar {
  flex-wrap: wrap;
  gap: 8px;
}
.lesson-tools .sound-toggle {
  position: static;
}
/* Always read first, table second, response last, at every viewport width. */
.lesson-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.lesson-explanation,
.lesson-follow-up {
  width: min(100%, 760px);
  align-self: center;
  padding: 24px;
}
.lesson-welcome {
  color: var(--club-help);
  border-bottom: 1px solid #e1c99433;
  padding-bottom: 16px;
}
.lesson-direction {
  margin-top: 24px;
  color: var(--gold);
}
.lesson-table-heading {
  text-align: center;
  padding: 0 16px;
}
.lesson-table-heading p {
  margin: 6px 0;
}
.progress-help {
  color: var(--club-muted);
  font-size: 14px;
}
.lesson-follow-up h2 {
  font-size: 22px;
  line-height: 1.4;
}
.answers {
  display: grid;
  gap: 10px;
}
.answers button {
  text-align: left;
}
.lesson-table .own-melds > .meld[role='button'] {
  cursor: pointer;
}
@media (max-width: 800px) {
  .lesson-explanation,
  .lesson-follow-up {
    width: calc(100% - 16px);
    padding: 20px 16px;
    margin: 0 8px;
  }
}
.lesson-task {
  margin-top: 20px;
  padding: 16px;
  border-left: 3px solid var(--gold);
  background: #e1c9940d;
  border-radius: 0 8px 8px 0;
}
.lesson-task > strong {
  color: var(--gold);
}
.lesson-task p {
  font-size: 18px;
  font-weight: 600;
  margin: 8px 0;
}
.lesson-task small {
  color: var(--club-muted);
  line-height: 1.5;
  display: block;
}
.lesson-table-heading > p:last-child {
  font-size: 18px;
  font-weight: 600;
}
.winning-shape-guide {
  margin-top: 24px;
  border-top: 1px solid #e1c99433;
  padding-top: 16px;
}
.winning-shape-guide h2 {
  font-size: 22px;
  line-height: 1.4;
}
.shape-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.winning-shape-guide figure {
  margin: 0;
  padding: 12px;
  background: var(--club-paper);
  border-radius: 8px;
}
.winning-shape-guide figcaption {
  color: var(--gold);
  margin-bottom: 10px;
  font-weight: 600;
}
.winning-shape-guide .face {
  display: inline-block;
  width: 36px;
}
.winning-shape-guide .kong-example {
  margin-top: 16px;
}
.tile-family-guide {
  margin-top: 24px;
}
.tile-family-guide h2 {
  font-size: 22px;
  line-height: 1.4;
}
.family-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.family-groups figure {
  margin: 0;
  padding: 12px;
  border: 1px solid #e1c99433;
  border-radius: 8px;
  max-width: 100%;
}
.family-groups figcaption {
  color: var(--gold);
  margin-bottom: 12px;
  font-weight: 600;
}
.family-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.family-tiles > div {
  width: 60px;
  text-align: center;
}
.family-tiles .face {
  display: block;
  width: 36px;
  margin: 0 auto 6px;
}
.family-tiles small {
  display: block;
  line-height: 1.35;
  font-size: 12px;
}
.lesson-tools [hidden] {
  display: none;
}
.lesson-enlarged-tile {
  display: flex;
  justify-content: center;
  padding: 20px 0;
}
.lesson-enlarged-tile .face {
  width: 120px;
}

.beginner-start {
  margin-bottom: 12px;
}
.beginner-start .beginner-prompt {
  font-weight: 700;
}
.beginner-table.app-shell {
  max-width: none;
  padding: 0;
}
.beginner-controls {
  margin-top: 12px;
}
.beginner-controls .step-controls {
  flex-wrap: wrap;
  justify-content: flex-start;
}
.beginner-controls a.primary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--club-mustard);
  color: var(--club-ink) !important;
  font-weight: 700;
}
@media (max-width: 800px) {
  #learn:has(.beginner-start) {
    padding: 8px 6px 24px;
  }
  #learn .beginner-start h1 {
    font-size: 28px;
    margin: 4px 0 6px;
  }
  #learn .beginner-start p {
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 6px;
  }
  .beginner-table .table-toolbar {
    display: none;
  }
  .beginner-table .board.classic-table {
    min-height: 0;
  }
  .beginner-table .board.classic-table .portrait-table {
    height: 140px;
    min-height: 140px;
    overflow: clip;
  }
  .beginner-table .board.classic-table.hand-won .portrait-table {
    height: 320px;
    min-height: 320px;
  }
  body:has(.beginner-start) .learn-header {
    padding: 8px 12px;
    gap: 8px;
  }
  body:has(.beginner-start) .learn-header .club-brand {
    display: none;
  }
}
