:root {
  color-scheme: light;
  --ink: #20344a;
  --muted: #5d7487;
  --paper: #fbfcf8;
  --white: #fff;
  --sky: #8ed6ea;
  --sky-soft: #e8f7fa;
  --leaf: #2e9d79;
  --leaf-soft: #e2f4ec;
  --coral: #e65d70;
  --gold: #f3c84b;
  --violet: #b34827;
  --violet-dark: #87391f;
  --line: #d8e3e5;
  --soft-line: #e8eeee;
  font-family: "Avenir Next", Avenir, "Segoe UI", ui-rounded, system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); }
button, a { font: inherit; }
button { color: inherit; }
a { color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid #d94b5c; outline-offset: 3px; }
h1, h2, h3, p { overflow-wrap: anywhere; }

/* Header */
.site-header {
  position: relative;
  z-index: 5;
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 30px;
  padding: 0 clamp(18px, 5vw, 72px);
  border-bottom: 1px solid var(--soft-line);
  background: #fff;
}
.brand { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; background: var(--gold); color: #763c48; font-size: 22px; font-weight: 900; }
.brand-name { color: var(--ink); font-size: 16px; font-weight: 900; letter-spacing: -.035em; line-height: 1.05; }
.brand-name small { display: block; margin-top: 4px; color: #688093; font-size: 10px; font-weight: 750; letter-spacing: .015em; }
.top-nav { display: flex; gap: 28px; margin-left: auto; }
.top-nav a { color: #466074; font-size: 13px; font-weight: 750; text-decoration: none; }
.top-nav a:hover { color: var(--violet-dark); }
.progress-button { display: inline-flex; min-height: 42px; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid #d9e9ec; border-radius: 8px; background: var(--sky-soft); color: var(--ink); font-size: 12px; font-weight: 800; cursor: pointer; }
.progress-button span { color: #b38011; font-size: 17px; }
.progress-button b { display: grid; min-width: 23px; height: 23px; place-items: center; border-radius: 50%; background: #fff; color: #76571a; }
.player-button { display: inline-flex; min-height: 44px; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid #eed39a; border-radius: 8px; background: #fff5dd; color: #493e24; font-size: 12px; font-weight: 800; cursor: pointer; }
.player-button:hover { border-color: #d6ac55; background: #fff0c9; }
.player-avatar-wrap { position: relative; display: grid; width: 28px; height: 28px; place-items: center; }
.player-avatar { font-size: 21px; line-height: 1; }
.player-avatar-wrap i { position: absolute; top: -6px; right: -4px; font-size: 12px; font-style: normal; }
.player-button b { display: flex; align-items: center; gap: 3px; color: #8b6014; }

/* Opening scene */
.hero { position: relative; display: grid; min-height: 490px; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); align-items: center; gap: 30px; overflow: hidden; padding: 46px clamp(22px, 8vw, 116px) 0; background: var(--sky); color: var(--ink); }
.hero::after { position: absolute; right: -6%; bottom: 0; left: -6%; height: 80px; border-radius: 50% 50% 0 0 / 42% 42% 0 0; background: #32bd93; content: ""; }
.hero-copy { position: relative; z-index: 2; align-self: center; max-width: 550px; padding-bottom: 55px; }
.eyebrow { margin: 0 0 12px; color: #406781; font-size: 12px; font-weight: 800; line-height: 1.4; }
.hero .eyebrow { display: inline-block; margin-bottom: 17px; padding: 7px 12px; border-radius: 4px; background: #e8f7fa; }
.hero h1 { margin: 0; color: var(--ink); font-size: clamp(50px, 6vw, 78px); font-weight: 900; letter-spacing: -.07em; line-height: .98; }
.hero h1 em { color: var(--violet-dark); font-style: normal; }
.hero-lede { max-width: 440px; margin: 19px 0 22px; color: #34556d; font-size: 16px; font-weight: 650; line-height: 1.55; }
.primary-link { display: inline-flex; min-height: 50px; align-items: center; gap: 18px; padding: 0 20px; border: 0; border-radius: 8px; background: var(--violet); color: white; text-decoration: none; font-size: 14px; font-weight: 850; box-shadow: 0 4px 0 var(--violet-dark); transition: transform .16s ease, box-shadow .16s ease; }
.primary-link:hover { transform: translateY(2px); box-shadow: 0 2px 0 var(--violet-dark); }
.primary-link span { font-size: 19px; }
.hero-small { margin: 17px 0 0; color: #42647b; font-size: 12px; font-weight: 750; }
.world-progress { max-width: 340px; margin-top: 26px; }
.world-progress-label { display: flex; justify-content: space-between; gap: 12px; color: #365b72; font-size: 11px; }
.world-progress-label strong { color: var(--ink); font-size: 12px; font-weight: 900; }
.world-progress-track { height: 10px; overflow: hidden; margin-top: 7px; border: 2px solid rgba(255,255,255,.45); border-radius: 20px; background: #d8f1f4; }
.world-progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--leaf); transition: width .3s ease; }
.hero-art { position: relative; z-index: 1; width: min(100%, 630px); align-self: end; justify-self: center; }
.hero-art img { display: block; width: 100%; height: auto; }
.hero-speech { position: absolute; top: 7%; right: 1%; padding: 9px 13px; border: 2px solid var(--ink); border-radius: 13px 13px 13px 3px; background: #fff; color: var(--ink); font-size: 12px; font-weight: 850; transform: rotate(3deg); }

/* Quest catalogue */
.game-section { max-width: 1280px; margin: 0 auto; padding: 58px clamp(18px, 5vw, 64px) 76px; }
.section-intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 23px; }
.section-intro .eyebrow { margin-bottom: 7px; }
.section-intro h2, .how-heading h2 { margin: 0; color: var(--ink); font-size: clamp(34px, 4vw, 48px); font-weight: 900; letter-spacing: -.06em; line-height: 1.04; }
.section-note { max-width: 250px; margin: 0 0 3px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.class-picker-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 13px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.picker-label, .filter-label { color: var(--ink); font-size: 12px; font-weight: 850; }
.class-picker { display: inline-flex; gap: 6px; }
.class-picker button { display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid #d6dfdc; border-radius: 50%; background: #fff; color: #526b78; font-size: 15px; font-weight: 800; cursor: pointer; transition: background .15s ease, transform .15s ease; }
.class-picker button:hover { transform: translateY(-1px); border-color: #a3b7ae; color: var(--ink); }
.class-picker button[aria-pressed="true"] { border-color: #e0a632; background: var(--gold); color: #3f371d; box-shadow: inset 0 -2px 0 rgba(111,75,11,.16); }
.grade-caption { color: #4d6874; font-size: 13px; }
.filter-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 22px 0 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 7px; }
.filter-chip { min-height: 42px; padding: 0 14px; border: 1px solid #d7e2e3; border-radius: 6px; background: transparent; color: #425d6c; font-size: 12px; font-weight: 750; cursor: pointer; }
.filter-chip:hover { border-color: #879fa7; }
.filter-chip.is-active { border-color: var(--ink); background: var(--ink); color: #fff; }
.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; gap: 20px; }
.game-card { display: flex; min-width: 0; min-height: 440px; flex-direction: column; overflow: hidden; border: 1px solid #d7e0de; border-radius: 14px; background: #fff; transition: border-color .18s ease, transform .18s ease; }
.game-card:hover { transform: translateY(-3px); border-color: #78989a; }
.game-card--featured { grid-column: 1 / -1; min-height: 344px; flex-direction: row; }
.card-visual { position: relative; display: grid; min-height: 218px; flex: 0 0 auto; place-items: center; overflow: hidden; padding: 0; background: var(--visual); }
.card-visual::before { display: none; }
.card-visual::after { position: absolute; inset: 55% 0 0; background: linear-gradient(0deg, rgba(13,30,47,.5), transparent); content: ""; pointer-events: none; }
.game-art { position: relative; z-index: 1; display: block; width: 100%; max-width: none; height: 218px; object-fit: cover; transition: transform .4s cubic-bezier(.2,.7,.2,1); }
.game-card:hover .game-art { transform: scale(1.035); }
.game-card--featured .card-visual { width: 53%; min-height: 344px; }
.game-card--featured .game-art { height: 100%; min-height: 344px; object-fit: cover; }
.visual-ribbon { position: absolute; z-index: 2; bottom: 13px; left: 15px; max-width: calc(100% - 30px); overflow: hidden; padding: 7px 10px; border: 1px solid rgba(255,255,255,.42); border-radius: 4px; background: rgba(20,39,55,.74); color: #fff; font-size: 11px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.card-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; padding: 20px 20px 18px; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.subject-label { display: inline-flex; align-items: center; gap: 7px; color: var(--subject); font-size: 12px; font-weight: 850; }
.subject-label::before { width: 8px; height: 8px; border-radius: 50%; background: currentColor; content: ""; }
.duration-label { color: #687a83; font-size: 11px; text-align: right; }
.card-copy h3 { margin: 12px 0 8px; color: var(--ink); font-size: clamp(21px, 2vw, 25px); font-weight: 850; letter-spacing: -.035em; line-height: 1.14; }
.game-card--featured .card-copy h3 { max-width: 520px; font-size: clamp(29px, 3.6vw, 43px); }
.card-copy p { margin: 0; color: #4e6571; font-size: 14px; line-height: 1.52; }
.card-bottom { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 20px; }
.grade-range { color: #596f78; font-size: 12px; font-weight: 750; }
.card-award { margin-left: auto; color: #6f6340; font-size: 12px; font-weight: 800; }
.card-award.is-earned { color: #91680f; }
.play-button { display: inline-flex; min-height: 44px; align-items: center; gap: 9px; margin-left: auto; padding: 0 15px; border: 0; border-radius: 6px; background: var(--violet-dark); color: #fff; font-size: 13px; font-weight: 850; cursor: pointer; }
.play-button:hover { background: var(--violet-dark); }
.play-button span { font-size: 14px; }
.empty-state { grid-column: 1/-1; padding: 32px 18px; border: 1px dashed #b9cacc; border-radius: 8px; color: var(--muted); text-align: center; }

/* Build a playable round from a theme and grade */
.builder-section { display: grid; max-width: 1120px; grid-template-columns: minmax(230px, .78fr) minmax(0, 1.22fr); align-items: center; gap: clamp(28px, 5vw, 64px); margin: 0 auto 64px; padding: 42px clamp(20px, 4vw, 44px); border: 1px solid #d5e6dd; border-radius: 12px; background: #eaf5ee; }
.builder-copy .eyebrow { margin-bottom: 9px; color: #317e69; }
.builder-copy h2 { margin: 0; color: var(--ink); font-size: clamp(30px, 3.6vw, 43px); font-weight: 900; letter-spacing: -.06em; line-height: 1.05; }
.builder-copy > p:last-child { max-width: 390px; margin: 13px 0 0; color: #476d65; font-size: 13px; line-height: 1.6; }
.builder-form { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(115px, .6fr); gap: 12px; padding: 19px; border: 1px solid #d9e5dc; border-radius: 9px; background: #fff; }
.builder-field { display: grid; min-width: 0; gap: 6px; }
.builder-field span { color: #3e5668; font-size: 12px; font-weight: 800; }
.builder-field input, .builder-field select { width: 100%; min-height: 46px; padding: 0 11px; border: 1px solid #ccd9da; border-radius: 5px; background: #fff; color: var(--ink); font: inherit; font-size: 14px; }
.builder-field input::placeholder { color: #7d8d94; }
.builder-field input:focus, .builder-field select:focus { border-color: var(--violet); outline: 3px solid rgba(179,72,39,.2); }
.builder-topic-field { grid-column: 1 / -1; }
.builder-submit { display: inline-flex; min-height: 45px; align-items: center; justify-content: center; gap: 12px; padding: 0 17px; border: 0; border-radius: 6px; background: var(--violet); color: #fff; font-size: 12px; font-weight: 850; cursor: pointer; }
.builder-submit:hover { background: var(--violet-dark); }
.builder-submit span { font-size: 17px; }
.builder-status { align-self: center; margin: 0; color: #607783; font-size: 10px; line-height: 1.4; }
.custom-theme-note { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; margin: 22px 0 8px; color: #51458e; font-size: .96rem; font-weight: 650; }
.custom-theme-note span { color: #81799c; font-size: .68rem; letter-spacing: .12em; }

/* Short orientation strip */
.how-section { display: grid; grid-template-columns: minmax(230px, .8fr) 1.2fr; gap: 54px; padding: 50px clamp(20px, 8vw, 115px); background: #e8f5ef; }
.how-heading { max-width: 450px; }
.how-heading .eyebrow { color: #317e69; }
.how-heading h2 { font-size: clamp(30px, 3.6vw, 42px); }
.how-heading > p:last-child { color: #476d65; font-size: 13px; line-height: 1.6; }
.how-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: start; }
.how-step { min-height: 122px; padding: 11px 10px 0 0; border-top: 2px solid #9dcdbd; }
.step-number { color: #29785f; font-size: 11px; font-weight: 900; }
.how-step h3 { margin: 15px 0 5px; color: var(--ink); font-size: 14px; font-weight: 900; }
.how-step p { margin: 0; color: #4f706b; font-size: 11px; line-height: 1.5; }
.site-footer { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px clamp(18px, 5vw, 72px); border-top: 1px solid var(--soft-line); background: #fff; }
.brand-footer .brand-mark { width: 30px; height: 30px; font-size: 18px; }
.brand-footer .brand-name { font-size: 13px; }
.site-footer p, .site-footer > span { margin: 0; color: #647b88; font-size: 10px; font-weight: 650; }

/* Shared game controls */
dialog { color: var(--ink); }
.game-dialog, .progress-dialog { width: min(860px, calc(100vw - 24px)); max-height: min(92vh, 900px); padding: 0; border: 1px solid #d2e1e5; border-radius: 14px; background: #f3f2ec; box-shadow: 0 18px 70px rgba(22, 49, 70, .24); }
.game-dialog::backdrop, .progress-dialog::backdrop { background: rgba(23, 43, 62, .68); }
.dialog-shell, .progress-dialog-inner { max-height: min(92vh, 900px); overflow-y: auto; padding: clamp(18px, 4vw, 32px); }
.dialog-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.dialog-kicker { color: #54758a; font-size: 12px; font-weight: 800; }
.icon-button { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid #d5e0e4; border-radius: 8px; background: #fff; font-size: 23px; line-height: 1; cursor: pointer; }
.icon-button:hover { background: #e8f2f4; }
.dialog-scene { position: relative; height: 178px; overflow: hidden; margin-top: 14px; border-radius: 8px; background: #253b50; }
.dialog-scene::after { position: absolute; inset: 35% 0 0; background: linear-gradient(0deg, rgba(16,31,45,.78), transparent); content: ""; }
.dialog-scene img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 46%; }
.dialog-scene span { position: absolute; z-index: 1; bottom: 13px; left: 16px; color: #fff; font-size: 12px; font-weight: 800; text-shadow: 0 1px 5px rgba(0,0,0,.35); }
.game-dialog h2, .progress-dialog h2 { margin: 10px 0 4px; color: var(--ink); font-size: clamp(26px, 5vw, 39px); font-weight: 900; letter-spacing: -.055em; line-height: 1.08; }
.dialog-subtitle { margin: 0 0 18px; color: #4d6471; font-size: 14px; line-height: 1.5; }
.game-panel { overflow: hidden; padding: clamp(18px, 3vw, 28px); border: 1px solid #d8d7ce; border-radius: 10px; background: #fffefa; }
.game-progress-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #4c6572; font-size: 13px; font-weight: 750; }
.progress-track { height: 7px; overflow: hidden; margin: 8px 0 18px; border-radius: 8px; background: #e2ebed; }
.progress-fill { width: 0; height: 100%; border-radius: inherit; background: #d6763a; transition: width .3s ease; }
.rocket-run { position: relative; display: flex; height: 42px; align-items: center; justify-content: space-between; margin: -6px 0 15px; padding: 0 8px; }
.rocket-run::before { position: absolute; top: 21px; right: 16px; left: 16px; border-top: 2px dashed #c6dce2; content: ""; }
.rocket-stop { position: relative; z-index: 1; width: 13px; height: 13px; border: 2px solid #9cb6bf; border-radius: 50%; background: #fff; }
.rocket-stop.is-reached { border-color: var(--leaf); background: #bce9d5; }
.rocket-runner { position: absolute; z-index: 2; top: 0; font-size: 25px; line-height: 1; transition: left .3s ease; }
.question-text { margin: 0 0 18px; color: var(--ink); font-size: clamp(20px, 4vw, 28px); font-weight: 850; line-height: 1.28; letter-spacing: -.035em; }
.answer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.answer-choice { min-height: 60px; padding: 13px 16px; border: 1px solid #d7ddd9; border-radius: 7px; background: #fff; color: var(--ink); font-size: 15px; font-weight: 700; line-height: 1.4; text-align: left; cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.answer-choice:hover:not(:disabled) { transform: translateY(-1px); border-color: #957848; background: #fffaf0; }
.answer-choice:disabled { cursor: default; opacity: .7; }
.answer-choice.is-correct { border-color: #5cb48e; background: #e3f5eb; color: #24674f; opacity: 1; }
.answer-choice.is-wrong { border-color: #d96a76; background: #fff0ef; color: #933d49; opacity: 1; }
.game-feedback { min-height: 32px; margin: 12px 0 0; color: #4e6672; font-size: 13px; line-height: 1.5; }
.game-feedback.is-correct { color: #276f52; font-weight: 850; }
.game-feedback.is-wrong { color: #963d49; }
.game-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 12px; }
.action-button { min-height: 44px; padding: 0 17px; border: 0; border-radius: 7px; background: var(--violet); color: #fff; font-size: 12px; font-weight: 850; cursor: pointer; }
.action-button:hover { background: var(--violet-dark); }
.action-button.secondary { background: #e1ebee; color: var(--ink); }
.action-button.secondary:hover { background: #d3e2e6; }
.finish-panel { padding: 30px 20px; border: 1px solid #d9e8df; border-radius: 10px; background: #f3faf5; text-align: center; }
.finish-icon { font-size: 54px; line-height: 1; }
.finish-panel h3 { margin: 13px 0 6px; color: var(--ink); font-size: 27px; font-weight: 900; letter-spacing: -.04em; }
.finish-panel p { max-width: 430px; margin: 0 auto; color: #5d7482; font-size: 12px; line-height: 1.55; }
.finish-panel .reward-earned { margin-top: 12px; color: #865716; font-size: 16px; font-weight: 900; }
.finish-panel .new-title-note { margin-top: 8px; color: #315f4b; font-size: 14px; font-weight: 850; }
.finish-stars { margin: 13px 0 17px; color: #ad7e10; font-size: 26px; letter-spacing: 3px; }
.rook-layout { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(190px, .72fr); align-items: center; gap: 20px; }
.chess-board { display: grid; width: min(100%, 360px); aspect-ratio: 1; grid-template-columns: repeat(6, 1fr); overflow: hidden; border: 5px solid #456ba8; border-radius: 10px; }
.chess-square { display: grid; min-width: 0; place-items: center; padding: 0; border: 0; background: #dce6f7; font-size: clamp(21px, 5vw, 38px); cursor: pointer; }
.chess-square:nth-child(12n+2), .chess-square:nth-child(12n+4), .chess-square:nth-child(12n+6), .chess-square:nth-child(12n+7), .chess-square:nth-child(12n+9), .chess-square:nth-child(12n+11) { background: #a9bfeb; }
.chess-square.is-legal { box-shadow: inset 0 0 0 3px #e5b530; }
.chess-square.is-candy { background-color: #f7dc83; }
.chess-square.is-rook { color: #29466e; text-shadow: 0 2px 0 #fff; }
.rook-side { display: flex; flex-direction: column; align-items: start; gap: 10px; }
.rook-instruction { margin: 0; color: var(--ink); font-size: 15px; font-weight: 850; line-height: 1.4; }
.rook-coordinate { color: #526f84; font-size: 10px; font-weight: 800; }
.rook-feedback { min-height: 34px; margin: 0; color: #5c7181; font-size: 11px; line-height: 1.5; }
.rook-side .progress-track { width: 100%; }
.memory-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.memory-card { position: relative; display: grid; min-height: 92px; place-items: center; padding: 9px; border: 1px solid #284766; border-radius: 8px; background: #294766; color: #f7d985; font-size: 16px; font-weight: 850; line-height: 1.25; text-align: center; cursor: pointer; transition: background .15s ease; }
.memory-card:hover:not(:disabled) { background: #4e70b9; }
.memory-card.is-open { border-color: #b8c8e7; background: #fff; color: var(--ink); }
.memory-card.is-match { border-color: #68b28f; background: #e3f5eb; color: #276b50; }
.memory-card:disabled { cursor: default; }
.memory-hint { margin: 0 0 13px; color: #5d7483; font-size: 11px; line-height: 1.45; }
.eco-layout { display: grid; grid-template-columns: minmax(150px, .72fr) 1.28fr; align-items: stretch; gap: 14px; }
.eco-object { display: grid; min-height: 190px; place-items: center; align-content: center; gap: 8px; border: 1px solid #d1e6d9; border-radius: 9px; background: #edf7ef; text-align: center; }
.eco-object-icon { font-size: 52px; line-height: 1; }
.eco-object b { color: var(--ink); font-size: 13px; }
.eco-bins { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.eco-bin { display: grid; min-height: 88px; place-items: center; gap: 4px; padding: 8px; border: 2px solid transparent; border-radius: 8px; color: #fff; font-size: 13px; font-weight: 800; cursor: pointer; }
.eco-bin span { font-size: 22px; }
.eco-bin:nth-child(1) { background: #278c69; }
.eco-bin:nth-child(2) { background: #456ba8; }
.eco-bin:nth-child(3) { background: #bd7039; }
.eco-bin:nth-child(4) { background: #6255a1; }
.eco-bin:hover { filter: brightness(.93); }
.eco-bin.is-wrong { border-color: #a52334; outline: 2px solid #edb0b3; }
.eco-bin.is-correct { border-color: #fff; outline: 2px solid #277e60; }
.eco-footnote { margin: 12px 0 0; color: #687f87; font-size: 9px; line-height: 1.45; }
.progress-lede { color: #5c7381; font-size: 12px; line-height: 1.55; }
.progress-summary { display: flex; gap: 9px; margin: 18px 0; }
.summary-tile { flex: 1; padding: 13px; border: 1px solid #d8e4e5; border-radius: 8px; background: #fff; }
.summary-tile b { display: block; color: var(--ink); font-size: 22px; }
.summary-tile span { color: #647a86; font-size: 10px; font-weight: 750; }
.progress-list { display: grid; gap: 7px; }
.progress-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #d8e4e5; border-radius: 8px; background: #fff; }
.progress-row-icon { font-size: 22px; }
.progress-row-copy { flex: 1; min-width: 0; }
.progress-row-copy b { display: block; font-size: 12px; }
.progress-row-copy span { color: #647a86; font-size: 10px; }
.progress-row-stars { color: #947014; white-space: nowrap; font-size: 13px; }
.progress-empty { padding: 20px 12px; color: #617782; text-align: center; font-size: 12px; }
.reset-progress { margin-top: 15px; padding: 8px 0; border: 0; background: transparent; color: #874b51; text-decoration: underline; font-size: 10px; cursor: pointer; }

/* Player profile and cosmetic shop */
.player-dialog { width: min(900px, calc(100vw - 24px)); max-height: min(92vh, 940px); padding: 0; border: 1px solid #d4ddd8; border-radius: 14px; background: #f7f6f0; color: var(--ink); box-shadow: 0 18px 70px rgba(22,49,70,.24); }
.player-dialog::backdrop { background: rgba(23,43,62,.68); }
.player-shell { max-height: min(92vh, 940px); overflow-y: auto; padding: clamp(18px, 4vw, 32px); }
.player-hero { display: flex; align-items: center; gap: 18px; margin-top: 15px; padding: 20px; border: 1px solid #cfdfd5; border-radius: 10px; background: #e8f2e9; }
.player-avatar-large { position: relative; display: grid; width: 86px; height: 86px; flex: 0 0 auto; place-items: center; border: 3px solid #fff; border-radius: 50%; background: #f5d478; box-shadow: 0 0 0 1px #cfb45f; }
.player-avatar-large span { font-size: 49px; line-height: 1; }
.player-avatar-large i { position: absolute; top: -8px; right: -4px; font-size: 27px; font-style: normal; }
.player-identity { min-width: 0; }
.player-identity .eyebrow { margin-bottom: 5px; color: #427461; }
.player-identity h2 { margin: 0; color: var(--ink); font-size: clamp(25px, 4vw, 36px); font-weight: 850; letter-spacing: -.04em; line-height: 1.08; }
.equipped-title { margin: 8px 0 0; color: #875120; font-size: 14px; font-weight: 800; }
.player-level { display: grid; min-width: 76px; height: 76px; flex: 0 0 auto; align-content: center; justify-items: center; margin-left: auto; border: 2px solid #e0b542; border-radius: 50%; background: #fff8da; }
.player-level span { color: #746033; font-size: 10px; font-weight: 750; }
.player-level b { color: #4b411e; font-size: 27px; line-height: 1.05; }
.player-stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 9px; }
.player-stat { padding: 12px 15px; border: 1px solid #d9dfdb; border-radius: 7px; background: #fff; }
.player-stat b { display: block; color: #263e50; font-size: 22px; }
.player-stat b span { color: #a76c11; }
.player-stat small { color: #58707a; font-size: 12px; }
.player-message { min-height: 38px; margin: 8px 0; padding: 10px 13px; border-left: 3px solid #d5a53a; background: #fff7df; color: #614d23; font-size: 13px; line-height: 1.45; }
.player-xp { margin: 12px 0 24px; }
.player-xp > div:first-child { display: flex; justify-content: space-between; gap: 12px; color: #4c6670; font-size: 12px; }
.player-xp > div:first-child b { color: #344b57; }
.player-xp-track { height: 11px; overflow: hidden; margin-top: 7px; border-radius: 8px; background: #dce5df; }
.player-xp-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: #4d9b73; transition: width .25s ease; }
.player-section { margin-top: 24px; }
.player-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.player-section-heading .eyebrow { margin-bottom: 3px; color: #687d76; font-size: 11px; }
.player-section-heading h3 { margin: 0; color: #263e50; font-size: 24px; font-weight: 850; letter-spacing: -.03em; }
.section-count, .shop-note { color: #58707a; font-size: 12px; }
.title-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.title-card { display: flex; min-width: 0; align-items: center; gap: 10px; padding: 12px; border: 1px solid #d8dfdb; border-radius: 8px; background: #fff; }
.title-card.is-locked { background: #f0f1ed; }
.title-card.is-equipped { border-color: #d6ad49; background: #fff8e4; }
.title-icon { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #edf3ef; font-size: 22px; }
.title-card > div { min-width: 0; flex: 1; }
.title-card b, .title-card small { display: block; }
.title-card b { color: #2d4757; font-size: 13px; }
.title-card small { margin-top: 3px; color: #64777d; font-size: 11px; line-height: 1.35; }
.title-equip { min-height: 44px; flex: 0 0 auto; padding: 0 10px; border: 1px solid #d9e0dd; border-radius: 5px; background: #f5f8f5; color: #355c4c; font-size: 11px; font-weight: 800; cursor: pointer; }
.title-equip:not(:disabled):hover { border-color: #68947a; background: #e6f2e8; }
.title-equip:disabled { color: #725b21; }
.title-lock { margin-left: auto; font-size: 17px; }
.shop-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.shop-card { display: grid; min-width: 0; grid-template-columns: 52px minmax(0,1fr); align-items: center; gap: 8px 12px; padding: 12px; border: 1px solid #d8dfdb; border-radius: 8px; background: #fff; }
.shop-card.is-owned { border-color: #b8d1bf; background: #f7fbf6; }
.shop-art { display: grid; width: 50px; height: 50px; grid-row: span 2; place-items: center; border-radius: 8px; background: #edf2eb; font-size: 30px; }
.shop-card-copy { min-width: 0; }
.shop-card-copy b { color: #2d4757; font-size: 13px; }
.shop-card-copy p { margin: 3px 0 0; color: #64777d; font-size: 11px; line-height: 1.35; }
.shop-action { min-height: 44px; grid-column: 2; justify-self: start; padding: 0 12px; border: 0; border-radius: 5px; background: #a84c28; color: #fff; font-size: 12px; font-weight: 850; cursor: pointer; }
.shop-action:not(:disabled):hover { background: #87391f; }
.shop-action:disabled { background: #e5e9e5; color: #596c6d; cursor: default; }
.shop-shortage { grid-column: 2; color: #84632a; font-size: 10px; }
.player-storage-note { margin: 20px 0 0; color: #667a80; font-size: 11px; }

@media (max-width: 960px) {
  .site-header { gap: 18px; padding-inline: 24px; }
  .top-nav { gap: 14px; }
  .hero { min-height: 430px; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); padding-inline: 5vw; }
  .hero h1 { font-size: clamp(48px, 6.5vw, 70px); }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .game-card { min-height: 410px; }
  .game-card--featured { grid-column: 1 / -1; min-height: 310px; }
  .game-card--featured .card-visual, .game-card--featured .game-art { min-height: 310px; }
  .how-section { grid-template-columns: 1fr; gap: 22px; }
}
@media (max-width: 620px) {
  .site-header { min-height: 64px; gap: 10px; padding: 0 13px; }
  .brand { gap: 7px; }
  .brand-mark { width: 32px; height: 32px; font-size: 19px; }
  .brand-name { font-size: 13px; }
  .brand-name small { font-size: 9px; }
  .top-nav { display: none; }
  .progress-button { min-height: 42px; margin-left: auto; gap: 4px; padding: 0 7px; font-size: 10px; }
  .progress-button-label, .player-button-label { display: none; }
  .player-button { min-height: 42px; gap: 5px; padding: 0 7px; font-size: 10px; }
  .player-avatar-wrap { width: 24px; height: 24px; }
  .player-avatar { font-size: 18px; }
  .hero { min-height: 0; grid-template-columns: 1fr; gap: 0; padding: 34px 20px 0; }
  .hero-copy { padding-bottom: 0; }
  .hero h1 { font-size: clamp(49px, 12vw, 68px); }
  .hero-lede { max-width: 430px; margin: 15px 0 18px; font-size: 15px; }
  .hero-small { margin-top: 13px; font-size: 11px; }
  .world-progress { max-width: 100%; margin-top: 18px; }
  .hero-art { width: min(430px, 100%); margin: 7px auto -2px; }
  .hero-speech { top: 5%; right: 0; padding: 7px 10px; font-size: 10px; }
  .game-section { padding: 42px 15px 54px; }
  .section-intro { align-items: start; flex-direction: column; gap: 8px; margin-bottom: 17px; }
  .section-intro h2 { font-size: 37px; }
  .section-note { font-size: 12px; }
  .class-picker-wrap { gap: 7px 11px; padding: 10px 0; }
  .picker-label { flex-basis: 100%; }
  .class-picker { width: 100%; justify-content: space-between; }
  .class-picker button { width: clamp(40px, 11vw, 46px); height: clamp(40px, 11vw, 46px); }
  .grade-caption { flex-basis: 100%; }
  .filter-row { align-items: start; flex-direction: column; gap: 8px; margin-top: 18px; }
  .filters { gap: 6px; }
  .filter-chip { min-height: 42px; padding-inline: 12px; font-size: 11px; }
  .game-grid { grid-template-columns: 1fr; gap: 15px; }
  .game-card, .game-card--featured { min-height: 0; flex-direction: column; border-radius: 12px; }
  .card-visual, .game-card--featured .card-visual { width: 100%; min-height: 205px; }
  .game-art, .game-card--featured .game-art { height: 205px; min-height: 205px; }
  .visual-ribbon { bottom: 12px; left: 12px; max-width: calc(100% - 24px); font-size: 11px; }
  .card-copy { padding: 17px 16px 16px; }
  .card-meta { align-items: center; flex-direction: row; gap: 8px; }
  .subject-label { font-size: 11px; }
  .duration-label { font-size: 10px; text-align: right; }
  .card-copy h3, .game-card--featured .card-copy h3 { margin: 10px 0 7px; font-size: 23px; }
  .card-copy p { font-size: 13px; line-height: 1.48; }
  .card-bottom { gap: 9px; padding-top: 15px; }
  .grade-range, .card-award { font-size: 11px; }
  .play-button { min-height: 44px; padding-inline: 14px; font-size: 12px; }
  .builder-section { grid-template-columns: 1fr; gap: 20px; margin: 0 15px 45px; padding: 26px 17px; }
  .builder-copy h2 { font-size: 34px; }
  .builder-form { gap: 10px; padding: 13px; }
  .builder-form { grid-template-columns: 1fr 1fr; }
  .builder-topic-field { grid-column: 1 / -1; }
  .builder-submit { grid-column: 1 / -1; }
  .builder-status { grid-column: 1 / -1; }
  .how-section { gap: 17px; padding: 39px 20px; }
  .how-heading h2 { font-size: 33px; }
  .how-heading > p:last-child { font-size: 12px; }
  .how-steps { grid-template-columns: 1fr; gap: 12px; }
  .how-step { min-height: 0; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 0 8px; padding-top: 9px; }
  .how-step h3 { margin: 0 0 3px; }
  .how-step p { grid-column: 2; }
  .site-footer { min-height: auto; flex-wrap: wrap; padding: 14px; }
  .site-footer p { order: 3; flex-basis: 100%; }
  .site-footer > span { display: none; }
  .answer-grid { grid-template-columns: 1fr; }
  .rook-layout, .eco-layout { grid-template-columns: 1fr; }
  .chess-board { width: min(100%, 340px); margin: 0 auto; }
  .rook-side { gap: 8px; }
  .memory-board { gap: 6px; }
  .memory-card { min-height: 72px; padding: 6px; font-size: 13px; }
  .eco-layout { gap: 9px; }
  .eco-object { min-height: 112px; }
  .eco-object-icon { font-size: 40px; }
  .eco-bin { min-height: 72px; }
  .progress-summary { gap: 5px; }
  .summary-tile { padding: 10px 8px; }
  .summary-tile b { font-size: 18px; }
  .progress-dialog, .game-dialog { max-height: 94vh; }
  .dialog-scene { height: 138px; }
  .player-dialog { max-height: 94vh; }
  .player-shell { padding: 16px; }
  .player-hero { gap: 12px; padding: 14px; }
  .player-avatar-large { width: 68px; height: 68px; }
  .player-avatar-large span { font-size: 39px; }
  .player-avatar-large i { font-size: 22px; }
  .player-level { min-width: 60px; height: 60px; }
  .player-level b { font-size: 22px; }
  .player-stat-grid { gap: 6px; }
  .player-stat { padding: 10px 8px; }
  .player-stat b { font-size: 19px; }
  .player-stat small { font-size: 10px; }
  .title-grid, .shop-grid { grid-template-columns: 1fr; }
  .shop-note { text-align: right; }
}
@media (min-width: 621px) and (max-width: 760px) {
  .top-nav { display: none; }
}
@media (max-width: 380px) {
  .site-header { gap: 6px; padding-inline: 8px; }
  .brand-name small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Класс по ссылке учителя: кнопка рейтинга, вход по имени, таблица класса. */
.rating-button { display: inline-flex; min-height: 42px; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid #ecd9a3; border-radius: 8px; background: #fff6dc; color: var(--ink); font-size: 12px; font-weight: 800; cursor: pointer; }
.rating-button[hidden] { display: none; }
.class-dialog { width: min(560px, calc(100vw - 24px)); }
.class-form { display: grid; gap: 14px; margin-top: 18px; }
.class-form .builder-field input { font-size: 18px; min-height: 52px; }
.class-hint { margin: 0; color: #5c7381; font-size: 13px; line-height: 1.5; }
.class-error { margin: 0; color: #9b2c2c; font-size: 13px; font-weight: 700; }
.class-switch { justify-self: start; padding: 4px 0; border: 0; background: transparent; color: #37588f; font-size: 13px; font-weight: 700; text-decoration: underline; cursor: pointer; }
.class-form .action-button { min-height: 50px; font-size: 15px; }
.class-pin { display: inline-block; margin: 6px 0 10px; padding: 10px 22px; border: 2px dashed #b38011; border-radius: 12px; background: #fff6dc; color: #5b4310; font-size: 40px; font-weight: 900; letter-spacing: .25em; }
.rating-list { display: grid; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.rating-row { display: grid; grid-template-columns: 34px 44px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #dfe7e2; border-radius: 10px; background: #fff; }
.rating-row.is-me { border-color: var(--violet); box-shadow: 0 0 0 2px rgba(179, 72, 39, .15); }
.rating-place { color: #7b8b92; font-size: 15px; font-weight: 900; text-align: center; }
.rating-row:nth-child(1) .rating-place { color: #b38011; font-size: 20px; }
.rating-hero { position: relative; display: grid; width: 40px; height: 40px; place-items: center; border-radius: 50%; background: #f3f2ec; font-size: 22px; }
.rating-hero i { position: absolute; top: -8px; left: 50%; font-size: 16px; font-style: normal; transform: translateX(-50%); }
.rating-name { min-width: 0; }
.rating-name b { display: block; overflow: hidden; color: var(--ink); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.rating-name small { color: #667a80; font-size: 11px; }
.rating-score { color: #5b4310; font-size: 15px; font-weight: 900; white-space: nowrap; }
@media (max-width: 620px) { .rating-button-label { display: none; } }
