/* Language school (js/overlays/language.js)
   The modal uses the math skins (.skin-notebook paper, .skin-classroom board from screens.css) and some math
   pieces (.math-h, .math-p, .math-label, .seg, .math-progress, .math-stars, .math-reward, .ml-*). */

.lang-modal .modal-body { padding-bottom: 22px; }
.lang { display: flex; flex-direction: column; gap: 14px; padding-left: 40px; }

/* -------------------------------------------------- setup */
.lang-intro { display: flex; align-items: center; gap: 14px; }
.lang-intro .math-p { font-size: 16px; }
.lang-teacher { width: 66px; height: 96px; flex: none; margin: -8px 0 -6px; }
.lang-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; }
.lang-opt { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lang-opt .math-label { min-width: 0; }
.lang-seg { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; height: 54px; min-width: 112px; line-height: 1.1; }
.lang-seg small { font-size: 12px; font-weight: 700; opacity: .7; }
.seg.lang-count { height: 54px; }

.lang-levels { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.lang-level {
  position: relative; min-height: 86px; padding: 8px 4px; border: 0; border-radius: 20px; background: rgba(255, 255, 255, .92); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .07); transition: transform .12s, background .2s;
}
.lang-level .ico { color: var(--lc); margin-bottom: 2px; }
.lang-level b { font-size: 14px; font-weight: 800; line-height: 1.12; text-align: center; letter-spacing: -.01em; }
.lang-level small { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.lang-level:active { transform: scale(.94); }
.lang-level.on { background: var(--lc); color: #fff; box-shadow: 0 6px 16px rgba(30, 40, 80, .18); }
.lang-level.on .ico, .lang-level.on small { color: #fff; }
.lang-level.on small { opacity: .88; }
.lang-level.fit::after { content: ''; position: absolute; top: 8px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 2px #fff; }
.lang-level.on.fit::after { background: #fff; box-shadow: none; }
.lang-level.extra { box-shadow: inset 0 0 0 2px var(--lc); }
.lang-level.extra.on { box-shadow: 0 6px 16px rgba(30, 40, 80, .18); }

.lang-card {
  display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; border-radius: 24px; color: var(--ink);
  background: rgba(255, 255, 255, .92); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06), 0 4px 12px rgba(30, 40, 80, .06);
}
.lang-card .ml-cls sup { font-size: .65em; }
.lang-pill { margin-left: auto; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; background: rgba(10, 132, 255, .12); color: var(--blue); }
.lang-ex { gap: 6px; font-size: 18px; font-weight: 800; }
.lang-ex .pic { flex: none; }
.lang-ex b + b { margin-left: 2px; }
.lx-to { display: inline-grid; place-items: center; color: var(--ink-3); }
.lx-blank { display: inline-grid; place-items: center; min-width: 22px; height: 26px; padding: 0 4px; border-radius: 7px; color: rgba(10, 132, 255, .7); background: rgba(10, 132, 255, .1); box-shadow: inset 0 0 0 2px rgba(10, 132, 255, .35); font-size: 15px; }
.lang-go { display: flex; justify-content: center; gap: 14px; margin-top: 4px; flex-wrap: wrap; }

/* -------------------------------------------------- playing */
.lang-top { display: flex; align-items: center; gap: 14px; }
.lang-play { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: center; min-height: min(52vh, 420px); }
.lang-play.stack { grid-template-columns: minmax(0, 1fr); justify-items: center; align-content: center; gap: 22px; }
.lang-q { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; min-width: 0; }
.lang-a { min-width: 0; width: 100%; display: flex; justify-content: center; }
.lang-ask { font-size: clamp(18px, 2.8vmin, 23px); font-weight: 800; color: var(--ink-2); letter-spacing: -.01em; }
.lang-pic {
  width: clamp(150px, 27vmin, 230px); height: clamp(150px, 27vmin, 230px); flex: none; display: grid; place-items: center; border-radius: 40px;
  background: #fff; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .05), 0 6px 18px rgba(30, 40, 80, .08);
}
.lang-pic .pic { width: 84%; height: 84%; }
.lang-pic.two { width: auto; display: flex; gap: 0; padding: 0 14px; }
.lang-pic.two .pic { width: clamp(110px, 19vmin, 160px); height: clamp(110px, 19vmin, 160px); }
.stack .lang-pic { width: clamp(120px, 20vmin, 170px); height: clamp(120px, 20vmin, 170px); }
.stack .lang-pic.two { width: auto; }
.stack .lang-pic.two .pic { width: clamp(96px, 16vmin, 136px); height: clamp(96px, 16vmin, 136px); }
.lang-tag { padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; background: rgba(10, 132, 255, .12); color: var(--blue); }
.lang-main { font-weight: 800; color: var(--ink); overflow-wrap: anywhere; }
.lang-main.word { font-size: clamp(40px, 7vmin, 64px); letter-spacing: .01em; line-height: 1.15; }
.lang-main.word.big, .stack .lang-main.word { font-size: clamp(52px, 10vmin, 92px); }
.lang-main.letter { font-size: clamp(110px, 22vmin, 180px); line-height: 1; }
.lang-letter { display: inline-grid; place-items: center; min-width: 1.15em; padding: .04em .1em .08em; border-radius: .22em; background: #fff; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .05), 0 6px 18px rgba(30, 40, 80, .08); color: #FF5C9A; }
.lang-main.sentence { font-size: clamp(28px, 4.8vmin, 44px); line-height: 1.45; max-width: 900px; }
.lang-main.hint { font-size: clamp(30px, 5.2vmin, 46px); color: var(--ink-2); }
.lang-hidden { visibility: hidden; }
.lang-hl { color: #FF5C9A; }
.lang-blank {
  display: inline-flex; align-items: center; justify-content: center; min-width: 1.4em; padding: 0 .18em; border-radius: .26em; vertical-align: baseline;
  line-height: 1.2; background: rgba(10, 132, 255, .1); color: rgba(10, 132, 255, .5); box-shadow: inset 0 0 0 3px rgba(10, 132, 255, .35);
  transition: background .2s, color .2s;
}
.sentence .lang-blank { min-width: 2.6em; }
.lang-blank.right { background: var(--green); color: #fff; box-shadow: none; animation: bump .5s cubic-bezier(.3, 1.8, .5, 1); }
.lang-blank.shown { background: #FFE27A; color: #6B4E00; box-shadow: none; }

/* answer buttons */
.lang-choices { display: grid; gap: 14px; width: 100%; max-width: 460px; }
.lang-choices.words, .lang-choices.picwords { grid-template-columns: minmax(0, 1fr); }
.lang-choices.letters, .lang-choices.pics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lang-choices.two { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 400px; }
.stack .lang-choices { max-width: 900px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lang-choice {
  min-height: 88px; padding: 8px 18px; border: 0; border-radius: 26px; background: #fff; color: var(--ink);
  font-size: clamp(26px, 4.4vmin, 38px); font-weight: 800; letter-spacing: -.01em; line-height: 1.15;
  display: flex; align-items: center; justify-content: center; gap: 14px; overflow-wrap: anywhere;
  box-shadow: 0 4px 0 rgba(30, 40, 80, .12), inset 0 0 0 1px rgba(0, 0, 0, .06); transition: transform .1s, background .2s, color .2s, opacity .25s;
}
.lang-choice:active { transform: translateY(2px) scale(.97); box-shadow: 0 1px 0 rgba(30, 40, 80, .12); }
.lang-choices.long .lang-choice { font-size: clamp(21px, 3.3vmin, 28px); }
.letters .lang-choice { aspect-ratio: 1; padding: 0; font-size: clamp(56px, 10vmin, 86px); }
.pics .lang-choice { aspect-ratio: 1; padding: 10px; }
.pics .lang-choice .pic { width: 100%; height: 100%; }
.picwords .lang-choice { justify-content: flex-start; min-height: 92px; padding: 8px 20px 8px 10px; }
.picwords .lang-choice .pic { width: 74px; height: 74px; flex: none; }
.two .lang-choice { min-height: 130px; font-size: clamp(44px, 8vmin, 64px); }
.lang-choice.right { background: var(--green); color: #fff; box-shadow: 0 4px 0 #23964A; animation: bump .5s cubic-bezier(.3, 1.8, .5, 1); }
.lang-choice.wrong { background: #FFE3E1; color: var(--red); animation: shake .4s ease; }
.lang-choice.shown { background: #FFE27A; color: #6B4E00; box-shadow: 0 0 0 4px rgba(255, 178, 30, .55); animation: bump .5s cubic-bezier(.3, 1.8, .5, 1); }
.lang-choice.dim:not(.wrong) { opacity: .45; }
.lang-choice[disabled] { cursor: default; }

/* letter tiles */
.lang-slots { display: flex; gap: 10px; justify-content: center; }
.lang-slot {
  width: clamp(58px, 9.5vmin, 80px); height: clamp(66px, 10.5vmin, 90px); border-radius: 18px; display: grid; place-items: center;
  font-size: clamp(38px, 6.6vmin, 56px); font-weight: 800; color: var(--ink); background: rgba(10, 132, 255, .08); box-shadow: inset 0 0 0 3px rgba(10, 132, 255, .3);
}
.lang-slot.on { background: #fff; box-shadow: 0 3px 0 rgba(30, 40, 80, .12), inset 0 0 0 1px rgba(0, 0, 0, .06); animation: bump .4s cubic-bezier(.3, 1.8, .5, 1); }
.lang-slots.right .lang-slot { background: var(--green); color: #fff; box-shadow: none; }
.lang-slot.shown { background: #FFE27A; color: #6B4E00; box-shadow: none; }
.lang-tiles { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; max-width: 460px; }
.lang-tile {
  width: clamp(80px, 12.5vmin, 104px); height: clamp(80px, 12.5vmin, 104px); border: 0; border-radius: 26px; background: #FFE9A8; color: #6B4E00;
  font-size: clamp(44px, 7.6vmin, 64px); font-weight: 800; display: grid; place-items: center;
  box-shadow: 0 5px 0 #E8C25A, inset 0 0 0 1px rgba(0, 0, 0, .04); transition: transform .1s, opacity .2s;
}
.lang-tile:active { transform: translateY(3px) scale(.96); box-shadow: 0 2px 0 #E8C25A; }
.lang-tile.used { visibility: hidden; }
.lang-tile.wrong { background: #FFE3E1; color: var(--red); box-shadow: 0 5px 0 #F5B5B0; animation: shake .4s ease; }

.lang-msg { min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 22px; font-weight: 800; text-align: center; }
.lang-msg.good { color: var(--green); }
.lang-msg.try { color: var(--orange); }
.lang-msg.show { color: var(--ink-2); }

/* -------------------------------------------------- classroom board */
.skin-classroom .lang-ask, .skin-classroom .lang-main, .skin-classroom .lang-main.hint { color: #F4F6F0; }
.skin-classroom .lang-main .lang-letter { color: #FF5C9A; }
.skin-classroom .lang-hl { color: #FFE27A; }
.skin-classroom .lang-tag { background: rgba(255, 255, 255, .16); color: #fff; }
.skin-classroom .lang-blank { background: rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .7); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .45); }
.skin-classroom .lang-blank.right { background: var(--green); color: #fff; box-shadow: none; }
.skin-classroom .lang-blank.shown { background: #FFE27A; color: #6B4E00; box-shadow: none; }
.skin-classroom .lang-slot { background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .45); color: #fff; }
.skin-classroom .lang-slot.on { background: #fff; color: var(--ink); }
.skin-classroom .lang-slots.right .lang-slot { background: var(--green); color: #fff; }
.skin-classroom .lang-slot.shown { background: #FFE27A; color: #6B4E00; }
.skin-classroom .lang-msg.good { color: #9BFFB0; }
.skin-classroom .lang-msg.try { color: #FFD08A; }
.skin-classroom .lang-msg.show { color: #F4F6F0; }
.skin-classroom .lang-level, .skin-classroom .lang-card { background: rgba(255, 255, 255, .95); }
.skin-classroom .lang-level.on { background: var(--lc); }
.skin-classroom .lang-level.extra:not(.on) { box-shadow: inset 0 0 0 3px var(--lc); }
.skin-classroom .seg { background: rgba(255, 255, 255, .95); }
.skin-classroom .seg.on { background: var(--blue); }
.skin-classroom .lang-choice.dim:not(.wrong) { opacity: .55; }

/* -------------------------------------------------- smaller screens */
@media (max-width: 900px) {
  .lang { padding-left: 34px; }
  .lang-levels { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lang-play { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .stack .lang-choices, .lang-choices.words, .lang-choices.picwords { grid-template-columns: minmax(0, 1fr); }
}
@media (max-height: 640px) {
  .lang-pic { width: 130px; height: 130px; }
  .lang-play { min-height: 0; }
  .lang-choice { min-height: 72px; }
}

/* -------------------------------------------------- Notebook: choose Math or Language (js/overlays/school.js) */
.school-modal { width: min(720px, calc(100vw - 32px)); }
.school-pick { display: flex; flex-direction: column; gap: 16px; padding-bottom: 6px; }
.school-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.school-card {
  position: relative; min-height: 200px; padding: 18px 16px 16px; border: 0; border-radius: 28px; color: var(--ink); text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px;
  background: linear-gradient(170deg, #fff 0%, #F6F8FC 100%);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--sc) 26%, transparent), 0 8px 22px rgba(30, 40, 80, .10);
  transition: transform .14s ease, box-shadow .2s ease;
}
.school-card:active { transform: scale(.96); }
.school-card.last::after { content: ''; position: absolute; top: 14px; right: 14px; width: 11px; height: 11px; border-radius: 50%; background: var(--sc); box-shadow: 0 0 0 3px #fff; }
.sc-art { flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; border-radius: 20px; padding: 10px; background: color-mix(in srgb, var(--sc) 12%, #fff); }
.sc-sum, .sc-words { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 34px; color: var(--ink); }
.sc-sum i, .sc-words i { font-style: normal; color: var(--sc); display: inline-flex; }
.sc-sum .q { color: #fff; background: var(--sc); border-radius: 12px; padding: 0 12px; }
.sc-words { font-size: 28px; }
.sc-words svg { width: 54px; height: 54px; }
.sc-name { display: inline-flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 800; color: var(--sc); }
.sc-name span { color: var(--ink); }
.school-card small { font-size: 15px; font-weight: 600; color: var(--ink-2); }
@media (max-width: 560px) { .school-grid { grid-template-columns: 1fr; } .school-card { min-height: 150px; } }
