html {
  overflow-x: hidden;
  scroll-padding-top: 84px;
}

body {
  line-height: 1.55;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button,
.level-tab,
.ptab,
.flash-btn,
.grammar-options button,
.match-item {
  min-height: 42px;
}

input,
select,
textarea {
  max-width: 100%;
}

.nav {
  min-height: 64px;
}

.site-strip,
.shop-strip-inner {
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}

@media (min-width: 641px) and (max-width: 900px) {
  .skill-radar-wrap { transform: scale(.9); transform-origin: center; }
  .rl-right { right: -24px; }
  .rl-left { left: -24px; }
  .rl-bot-r { right: -26px; }
  .rl-bot-l { left: -26px; }
}

.eng-hero {
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, .7fr);
  align-items: center;
  gap: 28px clamp(24px, 5vw, 72px);
  margin: 24px auto 16px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(135deg, var(--bg2), var(--surface));
}

.eng-hero-content { min-width: 0; }
.eng-title { font-size: clamp(2rem, 4.5vw, 3.2rem); }
.eng-subtitle { max-width: 52ch; }
.skill-radar-wrap { justify-self: center; }
.rl-right { right: -24px; }
.rl-left { left: -24px; }
.rl-bot-r { right: -26px; }
.rl-bot-l { left: -26px; }

.hero-stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-width: 560px;
}

.hstat {
  min-width: 0;
  padding: 12px 10px;
  border-radius: 10px;
  background: var(--surface);
}

.section {
  padding: 40px 0;
  border-top: 1px solid var(--border);
}

.sec-header {
  margin-bottom: 24px;
  text-align: left;
}

.sec-sub { margin-left: 0; }

.site-strip {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}

.level-tabs {
  position: sticky;
  top: 64px;
  z-index: 20;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
}

.eng-title,
.sec-title,
.quiz-q,
.typing-word,
.grammar-q-box {
  overflow-wrap: anywhere;
}

.units-grid,
.words-grid,
.videos-grid,
.match-grid {
  min-width: 0;
}

.unit-card,
.word-card,
.practice-card,
.ai-chat-wrap,
.ai-chat-sidebar,
.ai-chat-main {
  min-width: 0;
}

.match-item {
  overflow-wrap: anywhere;
  word-break: normal;
}

.quiz-opt,
.grammar-options button,
.flash-btn {
  touch-action: manipulation;
}

.modal-overlay {
  overscroll-behavior: contain;
}

@media (max-width: 640px) {
  html {
    scroll-padding-top: 72px;
  }

  .container {
    padding-right: 14px;
    padding-left: 14px;
  }

  .eng-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    margin: 14px 12px 8px;
    padding: 24px 18px;
  }

  .skill-radar-wrap { display: none; }
  .hero-stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section { padding: 30px 0; }
  .level-tabs { top: 56px; }

  .hero-stats-row {
    flex-wrap: wrap;
  }

  .flash-controls {
    max-width: 100%;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: center;
  }

  .flash-btn {
    flex: 1 1 90px;
    min-width: 0;
    white-space: normal;
  }

  .hstat {
    flex: 1 1 72px;
  }

  .limit-bar-inner {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .match-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 380px) {
  .units-grid,
  .words-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .match-grid {
    gap: 6px;
  }

  .match-item {
    padding-right: 8px;
    padding-left: 8px;
  }

  .practice-card {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
