/* assets/css/main.css */

/* ─── Variables ─── */
:root {
  --red-50:  #fff1f0;
  --red-100: #ffe4e1;
  --red-200: #ffcdc8;
  --red-300: #ffaaa2;
  --red-400: #ff7b6e;
  --red-500: #f25c4d;
  --red-600: #e03a2a;
  --red-700: #bc2617;
  --red-800: #9b2218;
  --red-900: #7f1d1d;

  --ink:     #2a1a1a;
  --ink-mid: #5c3d3d;
  --ink-light: #9e7070;
  --paper:   #fdf8f6;
  --paper-2: #f5ede9;
  --paper-3: #ede0da;
  --white:   #ffffff;

  --font-sketch: 'Roboto', cursive;
  --font-body:   'Nunito', sans-serif;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 32px;

  --shadow-sm: 2px 3px 0 rgba(42,26,26,.10);
  --shadow-md: 4px 6px 0 rgba(42,26,26,.12);
  --shadow-lg: 6px 10px 0 rgba(42,26,26,.14);

  --border: 2px solid var(--ink);
  --border-light: 2px solid var(--paper-3);
}

/* Разрешаем выделение, но курсор всегда стрелка */
p, div, span {
    cursor: default;
    user-select: text; /* или auto */
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  cursor: default;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 27px,
      rgba(226,176,168,.18) 28px
    );
}
body.theme-dark {
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 27px,
      rgba(255,255,255,.04) 28px
    );
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font-body); }
input, textarea, select { font-family: var(--font-body); }

/* ─── Typography ─── */

h1,h2,h3,h4 { font-family: var(--font-sketch); line-height: 1.2; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.7rem); }
p  { line-height: 1.7; color: var(--ink-mid); }

/* ─── Layout ─── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.site-main  { flex: 1; }

/* ─── Header ─── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--white);
  border-bottom: var(--border);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: .8rem 1.5rem;
  display: flex; align-items: center; gap: 1.5rem;
}
.logo {
  display: flex; align-items: center; gap: .5rem;
  /*font-family: var(--font-sketch);*/
  font-size: 1.6rem; font-weight: 700;
  white-space: nowrap;
}
.logo em { color: var(--red-500); font-style: normal; }
.logo-sketch { font-size: 1.4rem; }

.main-nav { display: flex; gap: .25rem; flex: 1; justify-content: center; }
.nav-auth { display: none; gap: .6rem; }
.nav-link {
  padding: .45rem .9rem;
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: .9rem;
  transition: background .15s, color .15s;
  position: relative;
}
.nav-link:hover { background: var(--paper-2); color: var(--red-600); }
.nav-link.active { background: var(--red-100); color: var(--red-700); }
.nav-link.active::after {
  content: '';
  position: absolute; bottom: -2px; left: 30%; right: 30%;
  height: 3px; background: var(--red-500);
  border-radius: 2px;
}

.header-user { display: flex; align-items: center; gap: .75rem; }
.user-badge { display: flex; align-items: center; gap: .5rem; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-sketch); font-size: 1.1rem; font-weight: 700;
  color: white; border: var(--border); flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-weight: 700; font-size: .9rem; }
.user-id   { font-size: .7rem; color: var(--ink-light); }
.days-badge {
  background: var(--red-100); border: var(--border);
  font-family: var(--font-sketch); font-weight: 700;
  font-size: .95rem; color: var(--red-700);
  display: flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 .5rem;
  border-radius: 50%;
}
.days-badge.oval { border-radius: 20px; }

/* ─── Buttons ─── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  background: var(--red-500); color: white;
  border: var(--border); border-radius: var(--radius-md);
  padding: .65rem 1.4rem; font-weight: 700; font-size: .95rem;
  box-shadow: var(--shadow-sm);
  transition: background .15s, box-shadow .15s;
}
.btn-primary:hover { background: var(--red-600); }
.btn-primary:active { box-shadow: none; }
.btn-primary:disabled { opacity: .5; pointer-events: none; }

.btn-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  background: transparent; color: var(--ink);
  border: var(--border); border-radius: var(--radius-md);
  padding: .65rem 1.4rem; font-weight: 700; font-size: .95rem;
  transition: background .15s, color .15s, box-shadow .15s;
}
.btn-outline:hover { background: var(--paper-2); }

.btn-ghost {
  background: transparent; border: none;
  color: var(--ink-mid); font-weight: 600; font-size: .9rem;
  padding: .4rem .7rem; border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
}
.btn-ghost:hover { background: var(--paper-2); color: var(--red-600); }

.btn-link { font-weight: 600; font-size: .9rem; color: var(--ink-mid); }
.btn-link:hover { color: var(--red-600); text-decoration: underline; }

.btn-lg { padding: .8rem 2rem; font-size: 1.1rem; }
.btn-icon {
  width: 44px; height: 44px; padding: 0;
  border-radius: 50%; font-size: 1.2rem;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ─── Cards ─── */
.card {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  transition: transform .15s, box-shadow .15s;
}

.card-flat { box-shadow: none; }
.card-flat:hover { transform: none; box-shadow: none; }

/* ─── Forms ─── */
.form-group { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.form-label { display: center; font-weight: 700; font-size: .9rem; color: var(--ink); }
.form-input {
  background: var(--paper);
  border: var(--border);
  border-radius: var(--radius-md);
  padding: .65rem 1rem;
  font-size: 1rem;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.form-input:focus {
  outline: none;
  border-color: var(--red-400);
  box-shadow: 0 0 0 3px var(--red-100);
}
.form-input::placeholder { color: var(--ink-light); }
.form-error { font-size: .82rem; color: var(--red-600); font-weight: 600; }
.form-hint  { font-size: .82rem; color: var(--ink-light); }

/* ─── Alerts ─── */
.alert {
  padding: .8rem 1.2rem;
  border-radius: var(--radius-md);
  border: 2px solid; margin-bottom: 1rem;
  font-size: .9rem; font-weight: 600;
}
.alert-error   { background: var(--red-50);  border-color: var(--red-300);  color: var(--red-800); }
.alert-success { background: #f0fdf4; border-color: #86efac; color: #166534; }
.alert-info    { background: #eff6ff; border-color: #93c5fd; color: #1e3a5f; }

/* ─── Footer ─── */
.site-footer {
  background: var(--paper-2);
  border-top: var(--border);
  margin-top: 8rem;
  padding: 5rem 3rem;
}
.footer-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 2rem;
  align-items: flex-start; justify-content: space-between;
}
.footer-brand { display: flex; flex-direction: column; gap: .5rem; }
.footer-brand .logo-text { font-family: var(--font-sketch); font-size: 1.4rem; font-weight: 700; }
.footer-brand p  { font-size: .88rem; max-width: 240px; }
.footer-links { display: flex; flex-direction: column; gap: .5rem; }
.footer-links a { font-size: .9rem; font-weight: 600; color: var(--ink-mid); }
.footer-links a:hover { color: var(--red-500); }
.footer-copy { font-size: .82rem; color: var(--ink-light); align-self: flex-end; }

/* ─── Landing ─── */
.hero {
  padding: 5rem 1.5rem 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 0%, var(--red-100) 0%, transparent 70%);
  z-index: 0;
}
.hero > * { position: relative; z-index: 1; }
.hero-title { margin-bottom: 1rem; }
.hero-title em { color: var(--red-500); font-style: normal; }
.hero-sub { font-size: 1.15rem; max-width: 540px; margin: 0 auto 2rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.hero-deco {
  margin-top: 3rem;
  display: flex; justify-content: center; gap: 2rem;
  flex-wrap: wrap;
}
.hero-flag-card {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem 2rem;
  box-shadow: var(--shadow-md);
  font-family: var(--font-sketch);
  font-size: 2rem;
  text-align: center;
  transition: transform .2s;
}
.hero-flag-card span { display: block; font-size: 1rem; font-family: var(--font-body); font-weight: 700; margin-top: .3rem; }
.hero-flag-card:hover { transform: rotate(-3deg) scale(1.05); }

.section { padding: 4rem 1.5rem; }
.section-title { text-align: center; margin-bottom: 2.5rem; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; max-width: 1000px; margin: 0 auto; }
.feature-card {
  background: var(--white); border: var(--border);
  border-radius: var(--radius-lg); padding: 2rem 1.5rem
}

.feature-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.feature-card h3 { margin-bottom: .5rem; }

/* ─── Auth Pages ─── */
.auth-wrap {
  min-height: 80vh; display: flex; align-items: center; justify-content: center;
  padding: 2rem 1.5rem;
}
.auth-card {
  background: var(--white); border: var(--border);
  border-radius: var(--radius-xl); padding: 2.5rem;
  width: 100%; max-width: 440px;
  box-shadow: var(--shadow-lg);
}
.auth-card h2 { margin-bottom: .5rem; }
.auth-card .sub { color: var(--ink-mid); margin-bottom: 1.5rem; font-size: .95rem; }
.auth-footer-link { text-align: center; margin-top: 1.2rem; font-size: .9rem; color: var(--ink-mid); }
.auth-footer-link a { color: var(--red-600); font-weight: 700; }
.checkbox-row { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--red-500); }
.checkbox-row label { font-size: .9rem; color: var(--ink-mid); }

/* ─── Language Selection ─── */
.lang-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; max-width: 980px; margin: 0 auto; }
/*.lang-card {
  background: var(--red-500); color: white; border: var(--border);
  border-radius: var(--radius-xl); padding: 2.5rem 1.5rem;
  text-align: center; cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform .15s, box-shadow .15s, background .15s;
  position: relative;
}*/

.lang-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 200px;  /* временно */
  height: 80px;  /* временно */
  background-color: var(--red-500);
  color: white;
  border-radius: 8px;
  padding: 0.55rem 1.4rem;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
  transition: transform 0.1s, box-shadow 0.1s, background-color 0.15s;
}

.lang-card:hover {
  background-color: var(--red-900);
}

.lang-card:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}

.lang-card:disabled {
  opacity: 0.5;
  pointer-events: none;
}
/* Updated language cards layout */
.lang-card {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem 1.5rem;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: box-shadow .15s, background .15s, border-color .15s;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .8rem;
  min-height: 240px;
  width: 100%;
}
/*.lang-card:hover {
  box-shadow: var(--shadow-lg);
  background: var(--paper-2);
}*/
.lang-card:active { box-shadow: none; }
/*.lang-card { 
    height: fit-content;
    background: var(--red-500); color: white; border: var(--border);
    border-radius: var(--radius-xl); padding: 2.5rem 1.5rem;
    box-shadow: var(--shadow-md);
}*/
.lang-flag { font-size: 3rem; margin-bottom: .8rem; display: block; }
.lang-name { font-family: var(--font-sketch); font-size: 1.6rem; }

.lang-badge {
  position: absolute; top: .8rem; right: .8rem;
  background: var(--red-500); color: white;
  font-size: .72rem; font-weight: 700;
  padding: .2rem .5rem; border-radius: 20px;
}
.language-card .lang-title {
  color: black;
  font-family: var(--font-sketch);
  font-size: 1.5rem;
  font-weight: 700;
}
.language-card .lang-sub {
  font-size: .85rem;
  color: var(--ink-light);
}
.language-card .progress-lang-header { margin-bottom: .6rem; }
.language-card .language-actions {
  margin-top: .6rem;
}
.language-card .language-actions .btn-primary,
.language-card .language-actions .btn-outline {
  width: 100%;
  text-align: center;
  padding: .75rem 1.4rem;
}

/* ─── Mode Selection ─── */
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; max-width: 600px; margin: 0 auto; }
.mode-card {
  background: var(--white); border: var(--border);
  border-radius: var(--radius-xl); padding: 2.5rem 1.5rem;
  text-align: center; cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: box-shadow .15s, background .15s, border-color .15s;
}
.mode-card:hover { box-shadow: var(--shadow-lg); background: var(--paper-2); }
/* .mode-card:hover { transform: translate(-3px,-3px); box-shadow: var(--shadow-lg); } */
.mode-card.selected { background: var(--red-100); border-color: var(--red-500); }
.mode-icon { font-size: 3.5rem; margin-bottom: 1rem; display: block; }
.mode-card h3 { font-size: 1.4rem; margin-bottom: .4rem; }

/* ─── Lesson / Task ─── */
.lesson-wrap { max-width: 700px; margin: 0 auto; padding: 2rem 1.5rem; }
.lesson-header {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 2rem;
}
.lesson-progress-bar {
  flex: 1; height: 14px;
  background: var(--paper-3); border: var(--border);
  border-radius: 20px; overflow: hidden;
}
.lesson-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red-400), var(--red-600));
  border-radius: 20px;
  transition: width .4s ease;
}
.lesson-hearts { display: flex; gap: .3rem; font-size: 1.2rem; }

.task-card {
  background: var(--white); border: var(--border);
  border-radius: var(--radius-xl); padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  min-height: 300px;
  display: flex; flex-direction: column;
}
.task-type-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--red-100); border: var(--border);
  border-radius: 20px; padding: .3rem .9rem;
  font-size: .82rem; font-weight: 700; color: var(--red-700);
  margin-bottom: 1.5rem; align-self: flex-start;
}
.task-prompt {
  font-family: var(--font-sketch);
  font-size: 1.8rem; text-align: center;
  margin-bottom: 1.5rem; flex: 1;
  display: flex; align-items: center; justify-content: center;
}
.task-word {
  font-size: 2.8rem; color: var(--red-700);
  border-bottom: 3px solid var(--red-300);
  padding-bottom: .2rem;
}

/* Multiple choice */
.mc-options { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.mc-option {
  background: var(--paper); border: var(--border);
  border-radius: var(--radius-md); padding: .9rem 1.2rem;
  font-size: 1rem; font-weight: 600; text-align: left;
  transition: background .1s, border-color .1s, transform .1s;
}
.mc-option:hover:not(:disabled) { background: var(--red-50); border-color: var(--red-400); transform: translate(-1px,-1px); }
.mc-option.correct { background: #f0fdf4; border-color: #22c55e; color: #166534; }
.mc-option.wrong   { background: var(--red-50); border-color: var(--red-500); color: var(--red-800); }

/* Text input task */
.task-input-area { display: flex; flex-direction: column; gap: .8rem; }
.task-text-input {
  font-family: var(--font-sketch);
  font-size: 1.4rem;
  background: var(--paper);
  border: var(--border); border-radius: var(--radius-md);
  padding: .8rem 1rem; resize: vertical; min-height: 70px;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.task-text-input:focus { outline: none; border-color: var(--red-400); box-shadow: 0 0 0 3px var(--red-100); }

/* Voice button */
.voice-input-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}
.voice-input-stack .task-text-input {
  max-width: 520px;
}
.voice-or {
  font-size: .85rem;
  color: var(--ink-light);
}
.voice-btn {
  width: 64px; height: 64px;
  border-radius: 50%; font-size: 1.8rem;
  background: var(--red-500); color: white;
  border: var(--border); box-shadow: var(--shadow-md);
  transition: transform .1s, box-shadow .1s, background .1s;
  display: flex; align-items: center; justify-content: center;
  align-self: center;
}
.voice-btn:hover { background: var(--red-600); box-shadow: var(--shadow-lg); }
.voice-btn.recording { background: var(--red-700); animation: pulse 1s infinite; }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(224,58,42,.4); }
  50%      { box-shadow: 0 0 0 10px rgba(224,58,42,0); }
}
.voice-transcript {
  background: var(--paper); border: var(--border);
  border-radius: var(--radius-md); padding: .8rem 1rem;
  font-family: var(--font-sketch); font-size: 1.3rem;
  min-height: 50px; color: var(--ink);
}

/* Sketch pad */
.sketch-container {
  position: relative; border: var(--border);
  border-radius: var(--radius-md); overflow: hidden;
  background: var(--white); margin-bottom: .8rem;
}
.sketch-canvas { display: block; touch-action: none; cursor: crosshair; }
.sketch-tools {
  display: flex; gap: .5rem; padding: .6rem;
  background: var(--paper-2); border-top: var(--border);
  flex-wrap: wrap; align-items: center;
}
.sketch-color {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
  transition: transform .1s;
}
.sketch-color:hover, .sketch-color.active { transform: scale(1.3); border-color: var(--ink); }
.sketch-size { width: 80px; accent-color: var(--red-500); }
.camera-btn {
  position: absolute; bottom: .6rem; right: .6rem;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--red-500); color: white;
  border: var(--border); font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm); z-index: 5;
  transition: background .1s, transform .1s;
}
.camera-btn:hover { background: var(--red-600); transform: scale(1.1); }

/* Feedback overlay */
.task-feedback {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(253,248,246,.96);
  border-radius: var(--radius-xl);
  z-index: 10; gap: .8rem;
}
.feedback-icon { font-size: 4rem; }
.feedback-text { font-family: var(--font-sketch); font-size: 2rem; }
.feedback-text.correct { color: #16a34a; }
.feedback-text.wrong   { color: var(--red-600); }
.feedback-answer { font-size: .95rem; color: var(--ink-mid); text-align: center; max-width: 400px; }

/* ─── Progress Page ─── */
.progress-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.progress-lang-card {
  background: var(--white); border: var(--border);
  border-radius: var(--radius-xl); padding: 1.8rem;
  box-shadow: var(--shadow-md);
}
.progress-lang-header { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.2rem; }
.progress-lang-flag { font-size: 2rem; }
.xp-bar { height: 10px; background: var(--paper-3); border: var(--border); border-radius: 20px; overflow: hidden; margin: .4rem 0; }
.xp-fill { height: 100%; background: linear-gradient(90deg, var(--red-300), var(--red-600)); border-radius: 20px; }
.stat-row { display: flex; justify-content: space-between; font-size: .88rem; color: var(--ink-mid); margin-top: .3rem; }

/* ─── Achievements ─── */
.achievements-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.2rem; }
.achievement-card {
  background: var(--white); border: var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem;
  text-align: center; box-shadow: var(--shadow-sm);
  opacity: .45;
  transition: opacity .2s, transform .15s, box-shadow .15s;
}
.achievement-card.earned { opacity: 1; }
.achievement-icon { font-size: 2.5rem; margin-bottom: .6rem; }
.achievement-name { font-family: var(--font-sketch); font-size: 1.1rem; margin-bottom: .3rem; }
.achievement-desc { font-size: .8rem; color: var(--ink-light); }

/* ─── Leaderboard ─── */
.leaderboard-table { width: 100%; border-collapse: collapse; }
.leaderboard-table th {
  text-align: left; padding: .6rem 1rem;
  font-size: .82rem; font-weight: 700; color: var(--ink-light);
  border-bottom: var(--border);
}
.leaderboard-table td { padding: .8rem 1rem; border-bottom: 2px solid var(--paper-3); }
.lb-rank { font-family: var(--font-sketch); font-size: 1.3rem; font-weight: 700; }
.lb-rank-1 { color: #f59e0b; }
.lb-rank-2 { color: #9ca3af; }
.lb-rank-3 { color: #a16207; }
.lb-user { display: flex; align-items: center; gap: .7rem; }
.lb-avatar { width: 32px; height: 32px; border-radius: 50%; border: var(--border); display: flex; align-items: center; justify-content: center; font-family: var(--font-sketch); font-weight: 700; color: white; font-size: .95rem; flex-shrink: 0; }
.lb-xp { font-family: var(--font-sketch); font-size: 1.2rem; font-weight: 700; color: var(--red-600); }
.lb-me td { background: var(--red-50); }

/* ─── XP bar next level ─── */
.level-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--red-500); color: white;
  font-size: .82rem; font-weight: 700;
  padding: .2rem .7rem; border-radius: 20px; border: var(--border);
}

/* ─── Lesson Complete ─── */
.lesson-complete {
  text-align: center; padding: 3rem 1.5rem;
}
.big-emoji { font-size: 5rem; margin-bottom: 1rem; }
.score-ring {
  width: 120px; height: 120px;
  border-radius: 50%;
  background: conic-gradient(var(--red-500) var(--score-pct, 0%), var(--paper-3) 0%);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem;
  border: var(--border);
  box-shadow: var(--shadow-md);
}
.score-inner {
  width: 90px; height: 90px;
  border-radius: 50%; background: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-sketch); font-size: 1.8rem; font-weight: 700;
  border: var(--border);
}

/* ─── Mobile Nav ─── */
.nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; padding: 4px; cursor: pointer;
}
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--ink); border-radius: 2px; transition: all .2s; }

/* ─── Loading spinner ─── */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--paper-3);
  border-top-color: var(--red-500);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Sketch doodles ─── */
.doodle-border {
  position: relative;
}
.doodle-border::after {
  content: '';
  position: absolute; inset: -4px;
  border: 2px solid var(--paper-3);
  border-radius: inherit;
  pointer-events: none;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .main-nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: calc(100% + .5rem);
    left: 1rem;
    right: 1rem;
    background: var(--white);
    border: var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    gap: .35rem;
    box-shadow: var(--shadow-md);
  }
  .main-nav.open { display: flex; }
  .main-nav .nav-link {
    padding: .6rem .9rem;
    border-radius: var(--radius-md);
  }
  .main-nav .nav-link.active::after { display: none; }
  .main-nav .btn-primary,
  .main-nav .btn-outline {
    width: 100%;
    justify-content: center;
  }
  .nav-auth {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    padding-top: .8rem;
    margin-top: .6rem;
    border-top: 2px solid var(--paper-3);
  }
  .nav-toggle { display: flex; }
  .header-inner {
    position: relative;
  }

  .nav-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
  }
  .mode-grid { grid-template-columns: 1fr; }
  .mc-options { grid-template-columns: 1fr; }
  .task-card { padding: 1.5rem; }
  .hero { padding: 3rem 1rem 2.5rem; }
}

/* ─── Кнопки отключения режима (голос/письмо) ─── */
.disable-mode-row {
  display: flex;
  justify-content: center;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 2px dashed var(--paper-3);
}

.btn-disable-mode {
  background: transparent;
  border: 2px dashed var(--ink-light);
  border-radius: var(--radius-md);
  color: var(--ink-light);
  font-size: .8rem;
  font-weight: 600;
  font-family: var(--font-body);
  padding: .4rem 1rem;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.btn-disable-mode:hover {
  border-color: var(--red-400);
  color: var(--red-600);
  background: var(--red-50);
  border-style: solid;
}

/* Голосовая кнопка — фиксированный размер чтобы не прыгала */
.voice-transcript {
  width: 100%;
  text-align: center;
  min-height: 44px;
  background: var(--paper);
  border: var(--border);
  border-radius: var(--radius-md);
  padding: .6rem 1rem;
  font-family: var(--font-sketch);
  font-size: 1.2rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── OAuth / Social Login ─── */
.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  margin-bottom: 1.2rem;
}

.btn-oauth {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .65rem 1.2rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: .95rem;
  border: var(--border);
  cursor: pointer;
  text-decoration: none;
  transition: transform .1s, box-shadow .1s, background .1s;
  box-shadow: var(--shadow-sm);
}
.btn-oauth:hover {
  background: #4792CC;
}

.btn-google {
  background: #fff;
  color: var(--ink);
}
.btn-google:hover { background: #D4D4D4; }

/* Telegram виджет вписываем в наш стиль */
.btn-telegram {
  background: #54a9eb;
  color: black;
  border-color: #000000;
}
/* Переопределяем стандартную кнопку Telegram widget */
.btn-telegram iframe { border-radius: 0px; }

.oauth-divider {
  display: flex;
  align-items: center;
  gap: .8rem;
  color: var(--ink-light);
  font-size: .82rem;
  margin: .8rem 0;
}

/* Added account UI */
.theme-dark {
  --red-50:  #2b1d1a;
  --red-100: #3a2621;
  --red-200: #4a2f29;
  --ink: #f8ece8;
  --ink-mid: #d4c0ba;
  --ink-light: #9c8882;
  --paper: #1f1715;
  --paper-2: #2a201d;
  --paper-3: #43342f;
  --white: #2d221f;
  --border: 2px solid #f4ddd6;
  --border-light: 2px solid #5a4741;
  --shadow-sm: 2px 3px 0 rgba(0,0,0,.28);
  --shadow-md: 4px 6px 0 rgba(0,0,0,.32);
  --shadow-lg: 6px 10px 0 rgba(0,0,0,.36);
}

.page-shell { padding: 2.5rem 1.5rem; }
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.stack-list { display: flex; flex-direction: column; gap: 1rem; }
.summary-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:1rem; margin-bottom:2.5rem; }
.summary-card { text-align:center; }
.summary-card-accent { background:var(--red-500); color:#fff; border-color:var(--red-700); }
.summary-card-value { font-family:var(--font-sketch); font-size:2.4rem; font-weight:700; color:var(--red-600); }
.summary-card-accent .summary-card-value,
.summary-card-accent .summary-card-label { color:#fff; }
.summary-card-label { font-size:.85rem; color:var(--ink-light); }
.lesson-row {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.header-user { position: relative; margin-left: auto; }
.header-dropdown {
  position: relative;
  display:flex;
  align-items:center;
  padding-bottom: 14px;
  margin-bottom: -14px;
}
.user-menu-dropdown { gap: .55rem; }
.header-icon-btn,
.user-badge {
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .15rem;
}
.header-icon-btn {
  width: 42px;
  height: 42px;
  justify-content: center;
  border-radius: 50%;
  background: var(--paper);
  border: var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
}
.notification-dot {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--red-600);
  color: #fff;
  border: var(--border);
  font-size: .7rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 2px);
  right: 0;
  width: min(360px, calc(100vw - 2rem));
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1rem;
  display: none;
  z-index: 120;
}
.header-dropdown.open .dropdown-menu { display: block; }
.header-dropdown:hover .dropdown-menu { display: block; }
.dropdown-profile { width: 260px; }
.dropdown-header,
.dropdown-footer {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.75rem;
}
.dropdown-header { padding-bottom:.75rem; border-bottom:2px solid var(--paper-3); margin-bottom:.75rem; }
.dropdown-footer { padding-top:.75rem; border-top:2px solid var(--paper-3); margin-top:.75rem; }
.dropdown-list { display:flex; flex-direction:column; gap:.45rem; }
.dropdown-item {
  display:flex;
  flex-direction:column;
  gap:.25rem;
  padding:.7rem .8rem;
  border-radius: var(--radius-md);
  transition: background .15s;
}
.dropdown-item:hover { background: var(--paper); }
.dropdown-item-title { font-weight:700; }
.dropdown-item-text { font-size:.85rem; color:var(--ink-mid); line-height:1.4; }
.dropdown-empty { color:var(--ink-light); font-size:.9rem; padding:.3rem 0; }
.dropdown-item-danger { color: var(--red-700); }

.settings-grid,
.friends-columns,
.support-grid,
.admin-grid,
.profile-sections {
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:1.5rem;
}
.settings-span-2 { grid-column: 1 / -1; }
.inline-form,
.compact-form,
.language-row-actions,
.social-actions {
  display:flex;
  align-items:end;
  gap:.75rem;
  flex-wrap:wrap;
}
.compact-form .form-input { min-width: 180px; }
.social-links-grid { display:flex; flex-direction:column; gap:1rem; }
.social-link-item,
.friend-card-mini,
.device-row,
.ticket-row,
.profile-language-row {
  background: var(--paper);
  border: var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  flex-wrap:wrap;
}
/*.friend-card-link { transition:transform .12s, box-shadow .12s; }
.friend-card-link:hover { background: var(--red-900) } */

.friend-card-link {
  background: var(--red-500); color: white;
  border: var(--border); border-radius: var(--radius-md);
  padding: .50rem 1.3rem; font-weight: 650; font-size: .85rem;
  box-shadow: var(--shadow-sm);
  transition: transform .1s, box-shadow .1s, background .15s;
}
.friend-card-link:hover { background: var(--red-900); }
.friend-card-link:active { transform: translate(1px,1px); box-shadow: none; }
.friend-card-link:disabled { opacity: .5; pointer-events: none; }

.friends-list-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:1rem; margin-top:1rem; }
.status-chip {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.35rem;
  background: var(--red-100);
  border: var(--border);
  border-radius: 999px;
  padding: .3rem .8rem;
  font-size: .8rem;
  font-weight: 700;
  color: var(--red-700);
}
.social-bound { opacity:.7; }
.toggle-inline { display:flex; align-items:center; gap:.5rem; font-size:.9rem; }
.danger-link { color: var(--red-700); }
.friends-widget { height: fit-content; }
/* .friends-widget {
  text-align:center;
  padding:3rem;
  max-width:720px;
  margin:0 auto;
}
*/
.friends-widget-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:1rem;
  margin-bottom:1rem;
}
.progress-social-layout {
  display:grid;
  grid-template-columns:minmax(0, 1.6fr) minmax(300px, .9fr);
  gap:1.5rem;
  align-items:start;
}
.notification-card-full {
  display:flex;
  flex-direction:column;
  gap:.45rem;
}
.notification-card-title { font-weight:700; }
.notification-card-meta { display:flex; align-items:center; justify-content:space-between; gap:1rem; flex-wrap:wrap; }
/*.empty-state {
  text-align:center;
  padding:3rem;
  max-width:720px;
  margin:0 auto;
}
*/

.empty-state { height: fit-content; }

.profile-hero {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1.5rem;
  flex-wrap:wrap;
  margin-bottom:1.5rem;
}
.profile-hero-main { display:flex; align-items:center; gap:1rem; flex-wrap:wrap; }
.profile-avatar-large {
  width:88px;
  height:88px;
  border-radius:50%;
  border: var(--border);
  display:flex;
  align-items:center;
  justify-content:center;
  color:#fff;
  font-size:2rem;
  font-weight:700;
  font-family:var(--font-sketch);
}
.profile-handle { font-size:1rem; color:var(--ink-light); }
.profile-meta-row { display:flex; align-items:center; gap:.6rem; flex-wrap:wrap; margin-top:.75rem; }
.telegram-link-wrap { min-height: 50px; display:flex; align-items:center; }
.log-box {
  background: #120f0e;
  color: #f4ddd6;
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: Consolas, monospace;
  font-size: .82rem;
  max-height: 380px;
  overflow: auto;
}

@media (max-width: 980px) {
  .settings-grid,
  .friends-columns,
  .support-grid,
  .admin-grid,
  .profile-sections,
  .progress-social-layout {
    grid-template-columns: 1fr;
  }
  .settings-span-2 { grid-column: auto; }
}

@media (max-width: 768px) {
  body { background-size: auto 28px; }
  .page-shell { padding: 1.5rem 1rem; }
  .header-inner {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    padding-right: 4.5rem;
  }
  .header-user {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .is-guest .header-user { display: none; }
  .user-menu-dropdown {
    width: 100%;
    justify-content: space-between;
  }
  .user-badge { flex: 1; justify-content: flex-start; }
  .days-badge { min-width: 42px; }
  .dropdown-menu {
    position: fixed;
    left: 1rem;
    right: 1rem;
    top: 5rem;
    width: auto;
    max-width: none;
  }
  .main-nav {
    top: calc(100% + .5rem);
    left: 1rem;
    right: 1rem;
    border: var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    z-index: 90;
  }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inline-form,
  .compact-form,
  .language-row-actions,
  .social-actions,
  .device-row,
  .ticket-row,
  .friend-card-mini,
  .profile-hero {
    align-items: stretch;
  }
  .inline-form > *,
  .compact-form > *,
  .language-row-actions > *,
  .social-actions > * {
    width: 100%;
  }
  .form-input,
  .btn-primary,
  .btn-outline { width: 100%; }
}

@media (max-width: 560px) {
  .container { padding: 0 1rem; }
  .summary-grid { grid-template-columns: 1fr; }
  .progress-grid,
  .friends-list-grid,
  .features-grid,
  .lang-grid { grid-template-columns: 1fr; }
  .lesson-row,
  .progress-lang-card,
  .card,
  .auth-card,
  .task-card { padding: 1.2rem; }
  .footer-inner { flex-direction: column; }
}
.oauth-divider::before,
.oauth-divider::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--paper-3);
  border-radius: 2px;
}
