:root {
  color-scheme: light;
  --paper: #f9f8f3;
  --ink: #182d24;
  --muted: #526257;
  --green: #154837;
  --line: #e3e6da;
  --white: #fffefa;
  --gold: #f6ce70;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 3px solid #a7651b; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
svg { display: block; width: 22px; height: 22px; flex-shrink: 0; }
.container, .top-inner { max-width: 1200px; margin-inline: auto; padding-inline: 32px; }
.topbar { background: var(--white); border-bottom: 1px solid var(--line); }
.top-inner { min-height: 74px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; width: fit-content; font-size: 1.53rem; letter-spacing: -.065em; font-weight: 800; }
.brand-icon { width: 36px; height: 36px; display: grid; place-items: center; background: var(--green); color: #fff; border-radius: 11px; margin-right: 9px; }
.brand-dot { color: #a46925; }
nav { display: flex; gap: 5px; align-items: center; }
nav a { padding: 9px 14px; border-radius: 9px; font-size: .94rem; font-weight: 650; color: var(--muted); white-space: nowrap; }
nav a:hover, nav a[aria-current] { background: #e9efe5; color: var(--green); }
.streak { justify-self: end; display: flex; align-items: center; gap: 7px; border: 1px solid #f0e0bf; background: #fff5df; color: #764917; border-radius: 100px; padding: 7px 11px; font-weight: 700; white-space: nowrap; }
.streak svg { width: 17px; height: 17px; }
main { padding-top: 36px; min-height: 75vh; }
.hero { position: relative; isolation: isolate; overflow: hidden; display: grid; grid-template-columns: 58% 42%; min-height: 355px; color: #fffdf1; background: #153f30; border-radius: 25px; }
.hero-copy { z-index: 1; padding: 43px 0 43px 49px; align-self: center; }
.hero h1, .page-title, .section-title, .prompt-word { font-family: Georgia, 'Times New Roman', serif; letter-spacing: -.048em; }
.hero h1 { font-size: clamp(2.64rem, 5.4vw, 4.45rem); line-height: 1.01; font-weight: 700; }
.hero h1 span { color: var(--gold); }
.hero p { max-width: 405px; color: #e2eee3; margin-block: 18px 25px; line-height: 1.58; }
.hero-art { position: absolute; z-index: -1; inset: 0 0 0 45%; overflow: hidden; background: radial-gradient(ellipse at 67% 65%, #326149, #153f30 75%); }
.hero-art img { width: 100%; height: 100%; object-fit: cover; object-position: center 53%; display: block; }
.hero-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg,#153f30 0%,transparent 32%); }
.hero-vocab { position: absolute; right: 26px; bottom: 22px; display: flex; align-items: center; gap: 10px; background: #fffdf0; color: var(--ink); border-radius: 11px; padding: 8px 13px; font-size: .9rem; }
.hero-vocab strong { font-size: 1.05rem; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid transparent; background: var(--green); color: #fff; min-height: 44px; padding: 10px 17px; border-radius: 10px; font-weight: 700; }
.button:hover { filter: brightness(1.12); }
.button svg { width: 18px; height: 18px; }
.button.gold { background: var(--gold); color: #263123; }
.button.secondary { color: var(--green); background: var(--white); border-color: #cdd8cb; }
.button:disabled { cursor: default; opacity: .55; }
.progress-panel { margin-top: 21px; background: var(--white); border: 1px solid var(--line); border-radius: 16px; display: grid; grid-template-columns: minmax(200px, 2fr) minmax(140px, 1fr) auto; padding: 18px 22px; align-items: center; gap: 24px; }
.progress-stat { display: flex; align-items: center; gap: 12px; }
.progress-stat p { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.progress-stat strong { font-size: 1.02rem; }
.mini-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; color: #1c5d42; background: #e5f0e5; flex-shrink: 0; }
.mini-icon.amber { color: #80521e; background: #f9efd8; }
.progress-track { background: #e8ede3; height: 6px; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress-track span { height: 100%; display: block; background: #397859; border-radius: inherit; }
.progress-stat:first-child > div { flex: 1; max-width: 310px; }
.progress-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.stats-account { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-block: 16px; }
.stats-grid, .stats-topics { display: grid; gap: 12px; }
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats-grid > div, .stats-topic { padding: 14px; border: 1px solid var(--line); background: var(--white); border-radius: 12px; }
.stats-grid strong, .stats-grid span { display: block; }
.stats-grid strong { font-size: clamp(1.4rem, 5vw, 2.3rem); overflow-wrap: anywhere; }
.stats-grid span, .stats-topic p span { color: var(--muted); }
.stats-topics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats-topic p { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; }
.profile-head, .study-level, .mistake-callout { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 20px; }
.profile-head > div { min-width: 0; overflow-wrap: anywhere; }
.study-level { background: #eaf0e3; border: 1px solid #dce6d7; padding: clamp(12px, 3vw, 24px); border-radius: 16px; margin-bottom: 12px; }
.study-level > div { min-width: 0; overflow-wrap: anywhere; }
.study-level > div:last-child { flex: 1 1 230px; max-width: 370px; }
.study-level p, .mistake-callout p { color: var(--muted); line-height: 1.45; }
.study-level .progress-track + p { margin-top: 7px; font-size: .9rem; }
.study-level h2 { margin-top: 3px; }
.mistake-callout { padding: clamp(12px, 3vw, 20px); background: var(--white); border: 1px solid var(--line); border-radius: 14px; margin-top: 16px; }
.mistake-callout h2 { font-size: 1.2rem; }
.mistake-callout p { margin-top: 5px; }
.mistake-games { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 16px; }
.mistake-word { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; overflow-wrap: anywhere; }
.mistake-word p { color: var(--muted); }
.empty-mistakes { margin-top: 16px; }
.needs-login .topbar, .needs-login .footer { display: none; }
.needs-login main { display: flex; align-items: center; min-height: 100vh; padding-block: 30px; }
.auth-layout { width: 100%; max-width: 900px; margin-inline: auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); background: var(--white); border: 1px solid var(--line); overflow: hidden; border-radius: 22px; }
.auth-content { padding: clamp(16px, 4vw, 42px); min-width: 0; }
.auth-content .brand { margin-bottom: 18px; }
.auth-content .page-title { font-size: clamp(2rem, 5vw, 3.5rem); }
.auth-form { display: grid; gap: 7px; margin-top: 19px; }
.auth-form input { width: 100%; min-width: 0; }
.auth-form label { font-weight: 700; margin-top: 6px; }
.auth-form small { line-height: 1.4; }
.auth-feedback { color: #872e1d; font-size: .94rem; line-height: 1.45; }
.auth-feedback:empty { display: none; }
.auth-form .button, .auth-switch { margin-top: 5px; width: 100%; }
.auth-switch { margin-top: 9px; }
.auth-art { min-width: 0; position: relative; background: #153f30; }
.auth-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.section { margin-top: 37px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 17px; }
.section-title { font-size: clamp(1.85rem, 3.4vw, 2.55rem); line-height: 1.06; }
.section-head p, .page-intro { color: var(--muted); margin-top: 7px; line-height: 1.5; }
.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.game-card { color: var(--ink); text-align: left; display: flex; flex-direction: column; align-items: flex-start; border: 1px solid var(--line); border-radius: 16px; padding: 17px; background: var(--white); min-height: 171px; transition: transform .15s, box-shadow .15s; }
.game-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px #25382a12; }
.game-card h3 { font-size: 1.09rem; margin-top: 14px; }
.game-card p { color: var(--muted); line-height: 1.4; font-size: .93rem; margin-top: 5px; }
.mint { background: #e5f1e9; color: #275c43; }
.peach { background: #fff0dd; color: #8a521a; }
.lilac { background: #eee9fb; color: #5b4690; }
.blue { background: #e6eff7; color: #395d80; }
.rose { background: #f7e8e5; color: #85493d; }
.sand { background: #f2ecd7; color: #705514; }
.topic-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.topic-card { border: 1px solid var(--line); border-radius: 13px; background: var(--white); padding: 13px 15px; display: flex; text-align: left; align-items: center; gap: 12px; color: var(--ink); }
.topic-card:hover { border-color: #8da993; }
.topic-card small { display: block; margin-top: 3px; color: var(--muted); font-size: .87rem; }
.topic-emoji { font-size: 1.55rem; width: 36px; text-align: center; }
.footer { margin-top: 50px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-block: 23px; color: var(--muted); font-size: .9rem; }
.footer .brand { color: var(--ink); font-size: 1.14rem; }
.page-title { font-size: clamp(2.5rem, 6vw, 4rem); }
.filters { display: flex; flex-wrap: wrap; gap: 12px; margin-block: 24px; }
input, select { min-height: 44px; border: 1px solid #cfdacc; background: var(--white); color: var(--ink); border-radius: 9px; padding: 10px 13px; }
input[type=search] { flex: 1; min-width: min(100%, 230px); }
select { appearance: none; padding-right: 38px; background-image: linear-gradient(45deg,transparent 50%,#365848 50%),linear-gradient(135deg,#365848 50%,transparent 50%); background-position: calc(100% - 18px) 49%,calc(100% - 13px) 49%; background-size: 5px 5px; background-repeat: no-repeat; }
.word-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin-top: 12px; }
.word-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); background: var(--white); border-radius: 12px; overflow-wrap: anywhere; }
.word-row p, .muted { color: var(--muted); }
.icon-button { border-radius: 8px; border: 1px solid var(--line); background: var(--white); color: var(--green); padding: 8px; }
.icon-button svg { width: 19px; height: 19px; }
.lesson { max-width: 680px; margin: auto; }
.lesson-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 13px; }
.lesson .progress-track { margin-bottom: 18px; }
.exercise { border: 1px solid var(--line); border-radius: 20px; background: var(--white); padding: clamp(16px, 4vw, 30px); text-align: center; }
.exercise h1 { font-size: 1.5rem; }
.exercise .picture { font-size: 5rem; line-height: 1.25; margin: 15px auto 5px; }
.prompt-word { font-size: clamp(2rem, 8vw, 3.5rem); line-height: 1.16; overflow-wrap: anywhere; margin-block: 6px 13px; }
.exercise .controls { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 9px; margin-top: 13px; }
.answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 16px; }
.choice, .pair { background: #f8f9f4; border: 1px solid #d6e1d6; color: var(--ink); border-radius: 10px; min-height: 50px; padding: 10px; font-weight: 700; overflow-wrap: anywhere; }
.choice:hover:not(:disabled), .pair:hover:not(:disabled) { background: #e6efe5; }
.correct, .pair.matched { background: #e1f1df; color: #145530; border-color: #7eaa80; }
.incorrect { background: #fae5dd; color: #872e1d; border-color: #d9a098; }
.pair.selected { border-color: #41785e; background: #e5eee7; box-shadow: inset 0 0 0 1px #41785e; }
.feedback { min-height: 1.5em; margin-top: 13px; font-weight: 700; overflow-wrap: anywhere; }
.typing-form { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.typing-form input { min-width: 0; flex: 1; }
.keyboard { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 10px; }
.keyboard button { min-width: 30px; min-height: 34px; border: 1px solid var(--line); border-radius: 6px; background: #f5f7f1; color: var(--ink); padding: 3px; }
.keyboard button:disabled { opacity: .5; }
.pair-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.pair-columns > div { display: grid; gap: 7px; }
.letter-slots, .letter-bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.letter-slots { margin-block: 18px 14px; }
.letter-slot { display: grid; place-items: center; flex: 0 0 44px; min-height: 44px; padding: 0; border-radius: 9px; font-size: 1.25rem; font-weight: 750; color: var(--ink); }
.letter-slot.empty { background: #f3f5ef; border: 2px dashed #cdd8cc; }
.letter-slot.filled { border: 1px solid #adc8b8; background: #e0eee4; }
.letter-slot.tile { border: 1px solid #e1cb97; background: #fff1d4; }
.letter-slot.tile:not(:disabled):hover { background: #f6ce70; }
.letter-slot.used { opacity: .38; }
.room-game { max-width: 1070px; margin: auto; }
.room-game .page-intro { margin-bottom: 19px; }
.room-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(205px, 240px); align-items: start; gap: 15px; }
.room-play, .room-list { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 12px; min-width: 0; }
.room-toolbar, .room-target { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.room-toolbar { justify-content: space-between; margin-bottom: 11px; }
.room-target strong { font-size: 1.16rem; overflow-wrap: anywhere; }
.room-target .icon-button { min-width: 44px; min-height: 44px; display: grid; place-items: center; }
.room-view { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 10px; background: #e9ecda; }
.room-view.zoomed { overflow: auto; overscroll-behavior-inline: contain; }
.room-view.zoomed .room-stage { width: 180%; }
.room-stage { position: relative; width: 100%; }
.room-stage img { display: block; width: 100%; height: auto; user-select: none; }
.room-object { position: absolute; left: var(--x); top: var(--y); width: var(--w); height: var(--h); padding: 0; border: 0; border-radius: 8px; background: transparent; touch-action: manipulation; }
.room-object[data-room-object="ковёр"] { clip-path: polygon(10% 2%, 85% 2%, 100% 100%, 0 100%); }
.room-object[data-room-object="стол"] { clip-path: polygon(6% 0, 92% 0, 100% 30%, 99% 37%, 94% 40%, 94% 97%, 88% 99%, 79% 40%, 16% 40%, 8% 98%, 2% 99%, 6% 40%, 0 34%, 0 25%); }
.room-object[data-room-object="лампа"] { clip-path: polygon(18% 0, 76% 0, 100% 25%, 97% 31%, 62% 31%, 62% 86%, 84% 93%, 85% 100%, 23% 100%, 18% 92%, 41% 86%, 41% 31%, 2% 31%, 0 25%); }
.room-view.zoomed .room-object { touch-action: auto; }
.room-object.found { box-shadow: inset 0 0 0 2px #eff9c1; background: #24644824; cursor: default; }
.room-object.missed { box-shadow: inset 0 0 0 2px #ffbb9e; background: #ac442626; }
.room-object:focus-visible { outline: 3px solid #fff4ba; outline-offset: -3px; }
.room-tip { margin-top: 8px; font-size: .88rem; }
.room-feedback { margin-top: 9px; min-height: 1.5em; font-weight: 650; overflow-wrap: anywhere; }
.room-miss { color: #872e1d; }
.room-list h2 { font-size: 1.05rem; margin: 2px 0 11px; }
.room-words { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.room-word { text-align: left; min-width: 0; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line); background: #f8f9f4; color: var(--ink); font-weight: 650; overflow-wrap: anywhere; }
.room-word:hover:not(:disabled), .room-word[aria-pressed="true"] { border-color: #6d9c81; background: #e6efe5; }
.room-word.found { color: #2e694a; background: #eff8e9; cursor: default; }
.room-replay { margin-top: 12px; }
.exercise .page-intro { margin-bottom: 15px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 820px) {
  .container, .top-inner { padding-inline: 21px; }
  .hero-copy { padding-left: 32px; }
  .game-grid, .word-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .progress-panel { gap: 13px; }
  .progress-actions { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 560px) {
  .container, .top-inner { padding-inline: 14px; }
  .top-inner { grid-template-columns: 1fr auto; gap: 9px; padding-block: 10px; }
  nav { grid-column: 1 / -1; grid-row: 2; gap: 2px; }
  nav a { padding: 7px 10px; }
  main { padding-top: 18px; }
  .hero { display: block; min-height: 0; }
  .hero-copy { position: relative; padding: 24px 20px 12px; }
  .hero-art { position: relative; inset: auto; height: 198px; }
  .hero-art::after { background: linear-gradient(180deg,#153f30 0%, transparent 35%); }
  .hero-vocab { right: 12px; bottom: 11px; }
  .progress-panel { grid-template-columns: 1fr; padding: 13px; }
  .progress-stat:first-child > div { max-width: none; }
  .progress-panel .button { width: fit-content; }
  .progress-actions { flex-direction: row; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-topics { grid-template-columns: minmax(0, 1fr); }
  .auth-layout { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
  .needs-login main { padding-block: 12px; align-items: start; }
  .game-card { padding: 12px; }
  .topic-card { padding: 9px; gap: 4px; }
  .word-grid { grid-template-columns: 1fr; }
  .game-card, .topic-card, .button, .lesson-head > *, .progress-stat > div, .filters > * { min-width: 0; overflow-wrap: anywhere; }
  .button, .icon-button, nav a { min-height: 44px; }
  nav a { display: grid; align-items: center; }
  .game-card h3 { line-height: 1.22; }
  .filters > input, .filters > select, .filters > .button { flex: 1 1 100%; max-width: 100%; }
  .letter-slots, .letter-bank { gap: 5px; }
  .room-layout { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .room-words { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .room-play, .room-list { padding: 8px; border-radius: 12px; }
  .room-object { border-radius: 4px; }
  .typing-form input { flex: 1 1 100%; }
  .keyboard { gap: 5px; }
  .keyboard button { min-width: 37px; min-height: 40px; }
}
@media (max-width: 350px) {
  .container, .top-inner { padding-inline: 10px; }
  .top-inner { column-gap: 5px; grid-template-columns: minmax(0, 1fr) auto; }
  .top-inner .brand { font-size: 1.27rem; }
  .brand-icon { width: 30px; height: 30px; margin-right: 6px; }
  .streak { font-size: .875rem; gap: 4px; padding-inline: 7px; }
  nav { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, .8fr); }
  nav a { text-align: center; padding: 6px 3px; white-space: normal; overflow-wrap: anywhere; }
  .hero-copy { padding: 20px 13px 11px; }
  .hero h1 { font-size: clamp(1.9rem, 11vw, 2.5rem); overflow-wrap: anywhere; }
  .hero-art { height: clamp(128px, 52vw, 175px); }
  .hero-vocab { right: 8px; bottom: 8px; }
  .progress-panel { padding: 10px; }
  .stats-grid > div, .stats-topic { padding: 9px; overflow-wrap: anywhere; }
  .mistake-word { gap: 6px; }
  .mistake-word .icon-button { padding: 5px; }
  .auth-content { padding: 12px; }
  .game-grid, .topic-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .game-card { min-height: 0; }
  .game-card h3 { margin-top: 8px; }
  .word-row { grid-template-columns: auto minmax(0, 1fr) auto; padding: 8px; gap: 6px; }
  .word-row .topic-emoji { width: 30px; font-size: 1.25rem; }
  .page-title { font-size: clamp(1.9rem, 11vw, 2.5rem); overflow-wrap: anywhere; }
  .exercise { padding: 11px; }
  .button { padding-inline: 10px; }
  .letter-slot { flex-basis: 40px; min-height: 44px; }
  .room-toolbar { gap: 5px; }
  .room-toolbar > .button { width: 100%; }
  .room-words { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
