:root {
  color-scheme: light;
  --ink: #17343a;
  --muted: #64777b;
  --paper: #fffdf8;
  --panel: rgba(255, 255, 255, .86);
  --line: #dfe9e7;
  --teal: #0b6b68;
  --teal-dark: #075451;
  --teal-soft: #dff1ee;
  --coral: #e9785c;
  --gold: #e9b949;
  --danger: #b13c3c;
  --success: #16704d;
  --shadow: 0 18px 55px rgba(24, 67, 70, .12);
  --radius: 24px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #edf5f2; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: linear-gradient(145deg, #f7f4e9 0%, #edf7f4 46%, #e4f0ed 100%); }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.ambient { position: fixed; border-radius: 50%; filter: blur(10px); pointer-events: none; opacity: .45; }
.ambient-one { width: 360px; height: 360px; background: #f9c7a8; right: -160px; top: -120px; }
.ambient-two { width: 460px; height: 460px; background: #a9d9d2; left: -220px; bottom: -260px; }

.login-shell { min-height: 100vh; padding: 28px 18px; display: grid; place-items: center; position: relative; z-index: 1; }
.login-card { width: min(460px, 100%); padding: 42px; border: 1px solid rgba(255,255,255,.9); border-radius: 32px; background: rgba(255,255,255,.82); backdrop-filter: blur(18px); box-shadow: var(--shadow); }
.brand-mark { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; color: white; font-family: Georgia, serif; font-weight: 700; font-size: 32px; background: linear-gradient(145deg, var(--teal), #128a82); box-shadow: 0 12px 26px rgba(11,107,104,.25); }
.brand-mark.small { width: 42px; height: 42px; border-radius: 14px; font-size: 24px; }
.eyebrow { margin: 22px 0 7px; color: var(--teal); font-size: 12px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 13px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(34px, 6vw, 52px); line-height: 1.02; letter-spacing: -.03em; }
.lead { color: var(--muted); line-height: 1.6; }
.login-form { display: grid; gap: 16px; margin-top: 28px; }
.login-form label span { display: block; margin: 0 0 7px; font-weight: 700; font-size: 14px; }
input { width: 100%; min-height: 52px; padding: 0 15px; border: 1px solid #ccdcd9; border-radius: 14px; color: var(--ink); background: white; outline: none; transition: border-color .2s, box-shadow .2s; }
input:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(11,107,104,.11); }
.form-error { min-height: 20px; margin: -4px 0 0; color: var(--danger); font-size: 14px; }

.button { min-height: 46px; padding: 0 20px; border: 0; border-radius: 14px; font-weight: 800; transition: transform .16s, background .16s, box-shadow .16s; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button.primary { color: white; background: var(--teal); box-shadow: 0 10px 24px rgba(11,107,104,.19); }
.button.primary:hover { background: var(--teal-dark); }
.button.ghost { color: var(--teal); background: var(--teal-soft); }
.button.wide { width: 100%; }
.button.compact { min-height: 38px; padding: 0 14px; font-size: 13px; }

.app-shell { min-height: 100vh; position: relative; z-index: 1; }
.topbar { height: 74px; padding: 0 max(20px, calc((100vw - 1180px)/2)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(23,52,58,.08); background: rgba(255,253,248,.75); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0; border: 0; background: transparent; color: var(--ink); text-align: left; }
.brand strong, .brand small { display: block; }
.brand strong { font-family: Georgia, serif; font-size: 20px; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.user-label { color: var(--muted); font-size: 14px; }
.content { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 38px 0 64px; }

.hero { padding: 38px 42px; display: flex; gap: 28px; align-items: center; justify-content: space-between; border-radius: 30px; color: white; background: linear-gradient(125deg, #0b5c5a, #0d7c75 66%, #159087); box-shadow: var(--shadow); overflow: hidden; position: relative; }
.hero::after { content: "Ç Ğ İ Ö Ş Ü"; position: absolute; right: -15px; bottom: -24px; color: rgba(255,255,255,.07); font: 700 74px Georgia, serif; white-space: nowrap; }
.hero .eyebrow { color: #c8f1ea; margin-top: 0; }
.hero h1 { margin-bottom: 8px; font-size: clamp(32px, 5vw, 51px); }
.hero p { margin-bottom: 0; color: rgba(255,255,255,.78); }
.hero-button { min-width: 238px; min-height: 74px; display: grid; place-content: center; position: relative; z-index: 1; color: var(--ink) !important; background: #fff8e8 !important; box-shadow: 0 14px 34px rgba(0,0,0,.15) !important; }
.hero-button span, .hero-button small { display: block; }
.hero-button small { margin-top: 4px; color: #6a7775; font-weight: 600; }

.stats-grid { margin: 22px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat-card { padding: 22px; border: 1px solid rgba(23,52,58,.08); border-radius: 20px; background: var(--panel); box-shadow: 0 8px 28px rgba(24,67,70,.06); }
.stat-card span, .stat-card small, .stat-card strong { display: block; }
.stat-card span { color: var(--muted); font-size: 13px; font-weight: 700; }
.stat-card strong { margin: 8px 0 2px; font: 700 32px Georgia, serif; }
.stat-card small { color: #899a9b; }

.panel { margin-top: 22px; padding: 28px; border: 1px solid rgba(23,52,58,.08); border-radius: var(--radius); background: var(--panel); box-shadow: 0 12px 38px rgba(24,67,70,.07); }
.section-heading { margin-bottom: 20px; display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.section-heading .eyebrow { margin-top: 0; }
.section-heading h2 { margin: 0; font: 700 29px Georgia, serif; }
.length-switch { padding: 4px; display: flex; gap: 3px; border-radius: 12px; background: #edf3f1; }
.length-switch button { width: 42px; height: 34px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-weight: 800; }
.length-switch button.active { color: white; background: var(--teal); }
.topic-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.topic-card { min-height: 132px; padding: 19px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: #fff; text-align: left; transition: transform .18s, border-color .18s, box-shadow .18s; }
.topic-card:hover { transform: translateY(-2px); border-color: #9ecbc5; box-shadow: 0 12px 28px rgba(11,107,104,.10); }
.topic-card strong { font-size: 16px; }
.topic-card p { margin: 7px 0 14px; color: var(--muted); font-size: 13px; line-height: 1.42; }
.topic-card small { color: var(--teal); font-weight: 800; }
.weak-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.weak-card { padding: 17px; border-radius: 16px; background: #fff6ed; border: 1px solid #f1dcc9; }
.weak-card strong, .weak-card span { display: block; }
.weak-card span { margin-top: 7px; color: #9a5d45; font-size: 13px; }

.lesson-shell { width: min(760px, 100%); margin: 0 auto; }
.lesson-top { margin-bottom: 18px; }
.icon-button { width: 42px; height: 42px; margin-bottom: 17px; border: 0; border-radius: 50%; color: var(--ink); background: rgba(255,255,255,.8); font-size: 28px; line-height: 1; }
.lesson-meta { margin-bottom: 10px; display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; font-weight: 700; }
.progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: #dbe7e4; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), #28a997); transition: width .25s; }
.question-card { min-height: 490px; padding: clamp(25px, 5vw, 45px); display: flex; flex-direction: column; border: 1px solid rgba(23,52,58,.08); border-radius: 30px; background: rgba(255,255,255,.92); box-shadow: var(--shadow); }
.question-card .eyebrow { margin-top: 0; }
.question-card h2 { margin: 9px 0 9px; font: 700 clamp(25px, 4vw, 36px) Georgia, serif; line-height: 1.23; }
.question-hint { min-height: 24px; color: var(--muted); line-height: 1.5; }
.answer-area { flex: 1; margin-top: 20px; }
.choice-list { display: grid; gap: 10px; }
.choice-button { min-height: 55px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: white; text-align: left; font-weight: 700; transition: border-color .15s, background .15s; }
.choice-button:hover, .choice-button.selected { border-color: var(--teal); background: var(--teal-soft); }
.choice-button:disabled { cursor: default; }
.answer-input { min-height: 58px; font-size: 18px; }
.input-note { margin-top: 10px; color: var(--muted); font-size: 13px; }
.token-zone { min-height: 76px; padding: 13px; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; border: 2px dashed #bed3cf; border-radius: 16px; background: #f8fbfa; }
.token-zone.empty::before { content: "Нажимайте слова в нужном порядке"; color: #8ca09d; font-size: 14px; }
.token-bank { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.token { padding: 10px 13px; border: 1px solid #c8dad6; border-radius: 12px; color: var(--ink); background: white; font-weight: 800; }
.token.used { opacity: .35; }
.feedback { margin-top: 18px; padding: 16px 18px; border-radius: 16px; line-height: 1.45; }
.feedback.correct { color: #10563c; background: #e3f4ea; border: 1px solid #bde2cc; }
.feedback.wrong { color: #7d3434; background: #fff0ee; border: 1px solid #f0cbc5; }
.feedback strong, .feedback span { display: block; }
.feedback span { margin-top: 5px; font-size: 14px; }
.question-actions { margin-top: 21px; display: flex; justify-content: flex-end; }
.question-actions .button { min-width: 150px; }

.summary-shell { min-height: calc(100vh - 176px); display: grid; place-items: center; }
.summary-card { width: min(530px, 100%); padding: 42px; border-radius: 30px; background: rgba(255,255,255,.9); box-shadow: var(--shadow); text-align: center; }
.summary-ring { width: 120px; height: 120px; margin: 0 auto 22px; display: grid; place-items: center; border-radius: 50%; color: white; background: conic-gradient(var(--teal) var(--score, 0%), #dfe9e7 0); position: relative; }
.summary-ring::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: white; }
.summary-ring strong { position: relative; color: var(--ink); font: 700 25px Georgia, serif; }
.summary-card .eyebrow { margin-top: 0; }
.summary-card h2 { font: 700 34px Georgia, serif; }
.summary-card p { color: var(--muted); }
.summary-actions { margin-top: 25px; display: flex; justify-content: center; gap: 10px; }

@media (max-width: 860px) {
  .topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { align-items: flex-start; flex-direction: column; }
  .hero-button { width: 100%; }
  .weak-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .topbar { height: 64px; padding: 0 14px; }
  .user-label { display: none; }
  .content { width: min(100% - 22px, 1180px); padding: 20px 0 36px; }
  .login-card { padding: 30px 23px; }
  .hero { padding: 27px 23px; border-radius: 24px; }
  .hero::after { font-size: 49px; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat-card { padding: 15px 11px; border-radius: 16px; }
  .stat-card strong { font-size: 25px; }
  .stat-card span, .stat-card small { font-size: 11px; }
  .panel { padding: 20px 15px; border-radius: 20px; }
  .section-heading { align-items: flex-start; }
  .section-heading h2 { font-size: 25px; }
  .topic-grid { grid-template-columns: 1fr; }
  .topic-card { min-height: 112px; }
  .question-card { min-height: calc(100vh - 168px); padding: 26px 20px; border-radius: 23px; }
  .question-card h2 { font-size: 27px; }
  .question-actions .button { width: 100%; }
  .summary-card { padding: 32px 21px; }
  .summary-actions { flex-direction: column; }
  .summary-actions .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
