:root {
  --ink: #17221d;
  --muted: #657169;
  --paper: #f6f3eb;
  --surface: #fffdf8;
  --line: #dddcd3;
  --green: #38684f;
  --green-dark: #274c3a;
  --green-pale: #dce9df;
  --orange: #df7e3a;
  --radius: 20px;
  --shadow: 0 16px 40px rgba(37, 58, 46, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 0%, rgba(220, 233, 223, 0.7), transparent 28rem),
    var(--paper);
  font-family: Inter, Avenir, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

html[dir="rtl"] body {
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.site-header {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--green);
  border-radius: 10px 10px 10px 3px;
  font-size: 1.1rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.language-menu select {
  width: 58px;
  min-height: 34px;
  padding: 0 7px;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.82);
  border: 1px solid var(--line);
  border-radius: 10px;
  font: 650 0.7rem/1 Inter, Avenir, "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.04em;
  cursor: pointer;
  outline: none;
}

.language-menu select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(56, 104, 79, 0.1);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-inline-start: auto;
  font-size: 0.88rem;
  font-weight: 500;
}

.main-nav a,
.footer-links a {
  color: var(--muted);
  transition: color 180ms ease;
}

.main-nav a:hover,
.footer-links a:hover {
  color: var(--ink);
}

.header-actions,
.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-trigger {
  min-height: 42px;
  padding: 4px 10px 4px 5px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.82);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: inherit;
  cursor: pointer;
}

.header-avatar,
.account-avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #f1e5cc;
  border-radius: 50%;
}

.header-avatar {
  width: 32px;
  height: 32px;
  font-size: 1.2rem;
}

.header-avatar img,
.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

[data-avatar="1"], [data-avatar="5"] { background: #dcebdc; }
[data-avatar="2"], [data-avatar="6"] { background: #f2ddd6; }
[data-avatar="3"], [data-avatar="7"] { background: #dce7f2; }

.login-button,
.logout-button {
  min-height: 42px;
  padding: 0 17px;
  border: 0;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.login-button {
  color: white;
  background: var(--green);
}

.logout-button {
  color: var(--green-dark);
  background: var(--green-pale);
}

.user-name {
  max-width: 130px;
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-link,
.admin-link {
  padding: 9px 12px;
  color: var(--green-dark);
  background: var(--green-pale);
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
}


.hero {
  width: min(900px, calc(100% - 40px));
  margin: 78px auto 118px;
  text-align: center;
}

.learning-access {
  width: min(760px, calc(100% - 40px));
  margin: 0 auto 110px;
  padding: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 18px 50px rgba(23, 34, 29, 0.08);
}

.learning-access[hidden] {
  display: none;
}

.learning-access h2 {
  margin-bottom: 12px;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
}

.learning-access p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.learning-access-actions {
  min-width: 190px;
  display: grid;
  gap: 10px;
}

.learning-access-actions button {
  width: 100%;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--orange);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin: 0 auto 24px;
  font-size: clamp(2.8rem, 7vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.hero-copy {
  max-width: 610px;
  margin: 0 auto 34px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.7;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 26px;
  color: white;
  background: var(--green);
  border-radius: 14px;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(56, 104, 79, 0.2);
  transition: transform 180ms ease, background 180ms ease;
}

.primary-button:hover {
  background: var(--green-dark);
  transform: translateY(-2px);
}

.word-card {
  max-width: 650px;
  margin: 76px auto 0;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  text-align: start;
  background: rgba(255, 253, 248, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.word-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.german-phrase {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.phrase-translation {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: end;
}

.hourly-lesson-card {
  max-width: 650px;
  margin: 14px auto 0;
  padding: 25px 28px;
  text-align: start;
  background: #213c30;
  color: white;
  border-radius: var(--radius);
  box-shadow: 0 16px 35px rgba(33, 60, 48, 0.18);
}

.hourly-lesson-card[hidden] {
  display: none;
}

.hourly-lesson-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hourly-lesson-card .word-label,
.hourly-lesson-card header small {
  color: rgba(255, 255, 255, 0.67);
}

.hourly-lesson-card h2 {
  margin: 11px 0 8px;
  font-size: 1.45rem;
  letter-spacing: -0.025em;
}

.hourly-lesson-card > p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.65;
}

.hourly-exercise {
  margin-top: 19px;
  padding: 17px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 14px;
}

.hourly-exercise strong,
.hourly-exercise code {
  display: block;
}

.hourly-exercise strong {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.hourly-exercise p {
  margin: 9px 0;
  font-size: 0.88rem;
}

.hourly-exercise code {
  color: #e9c976;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 650;
}

.persian-community {
  max-width: 650px;
  margin: 14px auto 0;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: start;
  color: white;
  background: #2587c8;
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(37, 135, 200, 0.18);
}

.persian-community[hidden] {
  display: none;
}

.community-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 12px;
}

.persian-community strong,
.persian-community small {
  display: block;
}

.persian-community small {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.76);
}

.learning-section {
  padding: 100px max(20px, calc((100% - 1120px) / 2)) 120px;
  background: var(--surface);
  border-radius: 48px 48px 0 0;
}

.learning-section[hidden] {
  display: none;
}

.section-heading {
  max-width: 620px;
  margin-bottom: 42px;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1.08;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.learning-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.learning-card {
  min-height: 138px;
  padding: 24px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  background: #f8f7f2;
  border: 1px solid #e5e3da;
  border-radius: var(--radius);
  transition: 180ms ease;
}

.learning-card:hover {
  background: white;
  border-color: #cad8ce;
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.card-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  color: var(--green);
  background: var(--green-pale);
  border-radius: 16px;
}

.card-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.learning-card strong,
.learning-card small {
  display: block;
}

.learning-card strong {
  margin-bottom: 7px;
  font-size: 1.08rem;
}

.learning-card small {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.arrow {
  color: var(--green);
  font-size: 1.35rem;
  transition: transform 180ms ease;
}

.learning-card:hover .arrow {
  transform: translateX(4px);
}

html[dir="rtl"] .arrow {
  transform: rotate(180deg);
}

html[dir="rtl"] .learning-card:hover .arrow {
  transform: rotate(180deg) translateX(4px);
}

.featured-card {
  grid-column: 1 / -1;
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: white;
}

.featured-card:hover {
  background: #203f31;
  border-color: #203f31;
}

.featured-card .card-icon {
  color: #fff5e8;
  background: rgba(255, 255, 255, 0.12);
}

.featured-card small,
.featured-card .arrow {
  color: rgba(255, 255, 255, 0.72);
}

footer {
  padding: 54px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 38px;
  color: var(--muted);
  background: var(--surface);
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}

.footer-links {
  display: flex;
  gap: 18px;
}

.content-page {
  min-height: calc(100vh - 170px);
  padding: 82px max(20px, calc((100% - 900px) / 2)) 120px;
}

.content-hero {
  max-width: 720px;
  margin-bottom: 64px;
}

.content-hero h1 {
  margin: 0 0 24px;
  font-size: clamp(2.7rem, 6vw, 4.8rem);
}

.content-hero > p:last-child {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.8;
}

.prose-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.info-card {
  padding: 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.info-card h2 {
  margin-bottom: 14px;
  font-size: 1.35rem;
  letter-spacing: -0.025em;
}

.info-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.75;
}

.contact-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.telegram-link {
  display: inline-flex;
  min-height: 48px;
  padding: 0 20px;
  align-items: center;
  flex: 0 0 auto;
  color: white;
  background: #2587c8;
  border-radius: 14px;
  font-weight: 600;
}

.auth-modal {
  position: fixed;
  z-index: 20;
  inset: 0;
  padding: 20px;
  display: grid;
  place-items: center;
  background: rgba(23, 34, 29, 0.55);
  backdrop-filter: blur(8px);
}

.auth-modal[hidden] {
  display: none;
}

.auth-dialog {
  position: relative;
  width: min(460px, 100%);
  padding: 38px;
  text-align: center;
  background: var(--surface);
  border-radius: 26px;
  box-shadow: 0 28px 70px rgba(23, 34, 29, 0.24);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.auth-dialog h2 {
  margin-bottom: 16px;
  font-size: 2rem;
}

.auth-dialog > .brand-mark {
  margin: 0 auto 20px;
}

.auth-dialog p {
  color: var(--muted);
  line-height: 1.65;
}

.auth-close {
  position: absolute;
  inset-block-start: 14px;
  inset-inline-end: 14px;
  width: 38px;
  height: 38px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 50%;
  font-size: 1.45rem;
  cursor: pointer;
}

.telegram-auth-button {
  width: 100%;
  min-height: 52px;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  background: #2587c8;
  border: 0;
  border-radius: 14px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-tabs {
  margin: 24px 0 18px;
  padding: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: #ecebe5;
  border-radius: 13px;
}

.auth-tab {
  min-height: 40px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-tab.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(23, 34, 29, 0.08);
}

.provider-list {
  display: grid;
  gap: 9px;
}

.provider-button,
.email-auth-button {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.telegram-provider {
  color: white;
  background: #2587c8;
  border-color: #2587c8;
}

.verification-step {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.verification-step[hidden] {
  display: none;
}

.telegram-open-link {
  min-height: 44px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #176da6;
  background: #e6f3fb;
  border-radius: 12px;
  font-size: 0.86rem;
  font-weight: 650;
}

.verification-step p {
  margin: 16px 0 10px;
  font-size: 0.86rem;
}

.verification-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
}

.verification-code-input {
  min-width: 0;
  min-height: 52px;
  padding: 0 14px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
  font: 700 1.25rem/1 Inter, Avenir, "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.18em;
  text-align: center;
  direction: ltr;
  outline: none;
}

.verification-code-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(56, 104, 79, 0.1);
}

.verification-button {
  min-height: 52px;
  padding: 0 17px;
  color: white;
  background: var(--green);
  border: 0;
  border-radius: 13px;
  font-family: inherit;
  font-weight: 650;
  cursor: pointer;
}

.verification-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.apple-provider {
  color: white;
  background: #161616;
  border-color: #161616;
}

.provider-letter {
  width: 20px;
  font-weight: 700;
}

.auth-divider {
  margin: 18px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.72rem;
}

.auth-divider::before,
.auth-divider::after {
  height: 1px;
  flex: 1;
  content: "";
  background: var(--line);
}

.email-auth-input,
.admin-search,
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
}

.email-auth-input {
  min-height: 50px;
  padding: 0 15px;
  margin-bottom: 9px;
}

.email-auth-input:focus,
.admin-search:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(56, 104, 79, 0.1);
}

.email-auth-button {
  color: white;
  background: var(--green);
  border-color: var(--green);
}

.dashboard-shell {
  width: min(1120px, calc(100% - 40px));
  min-height: calc(100vh - 84px);
  margin: 0 auto;
  padding: 70px 0 110px;
}

.dashboard-welcome {
  margin-bottom: 44px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
}

.dashboard-welcome h1 {
  max-width: none;
  margin: 0 0 13px;
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  line-height: 1;
}

.dashboard-welcome p:last-child {
  margin: 0;
  color: var(--muted);
}

.metric-grid {
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  min-height: 158px;
  padding: 24px;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric-card > span,
.metric-card small {
  color: var(--muted);
  font-size: 0.78rem;
}

.metric-card strong {
  margin: 13px 0 7px;
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.metric-card small {
  margin-top: auto;
  line-height: 1.4;
}

.accent-metric {
  color: white;
  background: var(--green-dark);
  border-color: var(--green-dark);
}

.accent-metric > span,
.accent-metric small {
  color: rgba(255, 255, 255, 0.66);
}

.dashboard-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.dashboard-panel {
  padding: 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel-heading {
  margin-bottom: 28px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.panel-heading .eyebrow {
  margin-bottom: 10px;
}

.panel-heading h2 {
  font-size: 1.7rem;
}

.profile-photo-row {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile-photo {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: white;
  background: var(--green);
  border-radius: 22px;
  font-size: 2rem;
  font-weight: 600;
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-summary {
  margin-bottom: 26px;
  display: flex;
  align-items: center;
  gap: 17px;
}

.profile-summary > div:last-child {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.profile-summary strong {
  overflow: hidden;
  font-size: 1.25rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-summary span,
.profile-details dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.profile-details {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.profile-details > div {
  min-width: 0;
  padding: 15px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.profile-details dt {
  margin-bottom: 7px;
}

.profile-details dd {
  margin: 0;
  line-height: 1.55;
}

.profile-description-row {
  grid-column: 1 / -1;
}

.profile-dialog {
  width: min(520px, calc(100% - 30px));
  max-height: calc(100vh - 40px);
  padding: 30px;
  color: var(--ink);
  background: var(--surface);
  border: 0;
  border-radius: 24px;
  box-shadow: 0 28px 70px rgba(23, 34, 29, 0.26);
}

.profile-dialog::backdrop {
  background: rgba(23, 34, 29, 0.55);
  backdrop-filter: blur(8px);
}

.account-dialog {
  width: min(620px, calc(100% - 30px));
  max-height: calc(100vh - 36px);
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 0;
  border-radius: 26px;
  box-shadow: 0 28px 70px rgba(23, 34, 29, 0.28);
}

.account-dialog::backdrop {
  background: rgba(23, 34, 29, 0.55);
  backdrop-filter: blur(8px);
}

.guest-level-dialog {
  width: min(500px, calc(100% - 30px));
  padding: 28px;
  color: var(--ink);
  background: var(--surface);
  border: 0;
  border-radius: 24px;
  box-shadow: 0 28px 70px rgba(23, 34, 29, 0.28);
}

.guest-level-dialog::backdrop {
  background: rgba(23, 34, 29, 0.55);
  backdrop-filter: blur(8px);
}

.guest-level-dialog > p {
  color: var(--muted);
  line-height: 1.65;
}

.guest-level-dialog .primary-button {
  width: 100%;
  border: 0;
  cursor: pointer;
}

.account-dialog-heading {
  padding: 25px 26px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.account-identity,
.account-photo-edit {
  display: flex;
  align-items: center;
  gap: 14px;
}

.account-avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  font-size: 1.75rem;
}

.account-avatar-large {
  width: 76px;
  height: 76px;
  font-size: 2.7rem;
}

.account-identity > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.account-identity strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-identity span:last-child,
.account-pane > p,
.account-member {
  color: var(--muted);
  font-size: 0.82rem;
}

.account-tabs {
  padding: 0 20px 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  border-bottom: 1px solid var(--line);
}

.account-tabs button {
  min-height: 40px;
  padding: 0 8px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 650;
  cursor: pointer;
}

.account-tabs button.active {
  color: var(--green-dark);
  background: var(--green-pale);
}

.account-tabs .account-logout {
  color: #8a4036;
}

.account-pane {
  padding: 26px;
}

.account-pane[hidden] {
  display: none;
}

.account-pane h2 {
  margin-bottom: 20px;
  font-size: 1.55rem;
}

.account-photo-edit {
  margin-bottom: 22px;
}

.account-pane .primary-button {
  border: 0;
  cursor: pointer;
}

.account-admin-link {
  margin-top: 20px;
  padding: 12px 15px;
  display: inline-flex;
  color: var(--green-dark);
  background: var(--green-pale);
  border-radius: 11px;
  font-size: 0.82rem;
  font-weight: 650;
}

.account-admin-link[hidden] {
  display: none;
}

.level-choice-grid {
  margin: 24px 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.level-choice-grid label {
  cursor: pointer;
}

.level-choice-grid input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.level-choice-grid span {
  min-height: 62px;
  display: grid;
  place-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
  font-size: 1.05rem;
  font-weight: 700;
}

.level-choice-grid input:checked + span {
  color: white;
  background: var(--green);
  border-color: var(--green);
}

.account-progress-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.account-progress-grid > div {
  padding: 18px;
  display: grid;
  gap: 9px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.account-progress-grid span {
  color: var(--muted);
  font-size: 0.75rem;
}

.account-progress-grid strong {
  font-size: 1.45rem;
}

.account-member {
  margin: 18px 0 0;
}

.account-status {
  min-height: 20px;
  margin: 0;
  padding: 0 26px 22px;
  color: var(--green-dark);
  font-size: 0.82rem;
}

.lesson-shell {
  width: min(900px, calc(100% - 40px));
  min-height: calc(100vh - 84px);
  margin: 0 auto;
  padding: 52px 0 100px;
}

.lesson-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.lesson-hero {
  padding: 62px 0 42px;
}

.lesson-hero h1 {
  max-width: 760px;
  margin: 0 0 20px;
  font-size: clamp(2.7rem, 7vw, 5rem);
}

.lesson-hero > p:last-child {
  max-width: 660px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.lesson-content {
  display: grid;
  gap: 16px;
}

.lesson-panel,
.lesson-passage,
.lesson-quiz {
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.lesson-panel h2 {
  margin-bottom: 13px;
  font-size: 1.35rem;
}

.lesson-panel p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.lesson-passage {
  color: var(--green-dark);
  background: var(--green-pale);
  border-color: rgba(56, 104, 79, 0.12);
  font-size: 1.1rem;
  line-height: 1.9;
}

.word-list {
  display: grid;
  gap: 10px;
}

.lesson-word {
  padding: 15px 16px;
  display: grid;
  grid-template-columns: 150px 1fr 1.4fr;
  align-items: center;
  gap: 16px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.lesson-word span,
.lesson-word small {
  color: var(--muted);
  line-height: 1.45;
}

.lesson-actions,
.writing-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.listening-panel #lesson-transcript {
  margin-top: 22px;
  padding-top: 20px;
  color: var(--ink);
  border-top: 1px solid var(--line);
}

.lesson-quiz {
  display: grid;
  gap: 22px;
}

.lesson-quiz fieldset {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
  border: 0;
}

.lesson-quiz legend {
  margin-bottom: 14px;
  font-size: 1.05rem;
  font-weight: 650;
}

.lesson-quiz label {
  padding: 13px 15px;
  display: flex;
  align-items: center;
  gap: 11px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

.lesson-quiz input {
  accent-color: var(--green);
}

.lesson-quiz .primary-button {
  justify-self: start;
  border: 0;
  cursor: pointer;
}

.writing-prompt {
  margin-bottom: 18px !important;
  color: var(--green-dark) !important;
  font-weight: 550;
}

.writing-panel textarea {
  width: 100%;
  min-height: 190px;
  padding: 16px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
  font: inherit;
  line-height: 1.7;
  resize: vertical;
  outline: none;
}

.writing-panel textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(56, 104, 79, 0.1);
}

.writing-footer {
  margin-top: 14px;
}

.writing-footer span {
  color: var(--muted);
  font-size: 0.8rem;
}

.writing-footer .primary-button {
  border: 0;
  cursor: pointer;
}

.lesson-status {
  min-height: 28px;
  margin: 20px 0 0;
  color: var(--green-dark);
  font-weight: 600;
  line-height: 1.6;
}

.level-library {
  margin-top: 18px;
  padding-top: 50px;
  border-top: 1px solid var(--line);
}

.level-library-heading {
  margin-bottom: 22px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.level-library-heading .eyebrow {
  margin-bottom: 8px;
}

.level-library-heading h2 {
  margin-bottom: 9px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.level-library-heading p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.level-library-heading > span {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--orange);
  border-radius: 16px;
  font-size: 1.2rem;
  font-weight: 700;
}

.level-module-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.level-module {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow: hidden;
}

.level-module summary {
  min-height: 76px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 34px 1fr 22px;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}

.level-module summary::-webkit-details-marker {
  display: none;
}

.level-module summary > span {
  color: var(--orange);
  font-size: 0.72rem;
  font-weight: 700;
}

.level-module summary > b {
  color: var(--muted);
  font-size: 1.15rem;
  font-weight: 400;
}

.level-module[open] summary > b {
  transform: rotate(45deg);
}

.level-module > div {
  padding: 0 16px 18px 60px;
}

html[dir="rtl"] .level-module > div {
  padding-right: 60px;
  padding-left: 16px;
}

.level-module p {
  margin-bottom: 10px;
  color: var(--green-dark);
  line-height: 1.65;
}

.level-module small {
  color: var(--muted);
  line-height: 1.55;
}

.level-module [data-complete-module] {
  margin-top: 14px;
  min-height: 36px;
  padding: 0 12px;
  color: var(--green-dark);
  background: var(--green-pale);
  border: 0;
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  cursor: pointer;
}

.level-module [data-complete-module]:disabled {
  color: white;
  background: var(--green);
}

.level-module.completed {
  border-color: rgba(56, 104, 79, 0.35);
}

.level-module form {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.level-module fieldset {
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 7px;
  border: 0;
}

.level-module legend {
  margin-bottom: 10px;
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.5;
}

.level-module form label {
  padding: 9px 10px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 0.78rem;
  line-height: 1.45;
  cursor: pointer;
}

.level-module form input {
  margin-top: 2px;
  accent-color: var(--green);
}

.level-module form button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--green-dark);
  background: var(--green-pale);
  border: 0;
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  cursor: pointer;
}

.level-module form button:disabled {
  opacity: 0.7;
}

.module-result {
  margin-top: 10px;
  display: block;
  color: var(--green-dark) !important;
}

html[dir="rtl"] .lesson-back {
  flex-direction: row-reverse;
}

.dialog-heading {
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.dialog-heading .eyebrow {
  margin-bottom: 8px;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 1.8rem;
}

.dialog-close {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  color: var(--muted);
  background: white;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 1.35rem;
  cursor: pointer;
}

.secondary-button {
  min-height: 43px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  color: var(--green-dark);
  background: var(--green-pale);
  border: 0;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.form-field {
  margin-bottom: 18px;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.form-field input,
.form-field select {
  min-height: 48px;
  padding: 0 14px;
}

.form-field textarea {
  min-height: 120px;
  padding: 13px 14px;
  resize: vertical;
}

.form-status {
  min-height: 22px;
  margin: 13px 0 0;
  color: var(--green);
  font-size: 0.82rem;
}

.skill-progress-list {
  display: grid;
  gap: 22px;
}

.skill-progress-row {
  display: grid;
  grid-template-columns: 120px 1fr 42px;
  align-items: center;
  gap: 14px;
}

.skill-progress-row strong,
.skill-progress-row span {
  display: block;
}

.skill-progress-row strong {
  font-size: 0.88rem;
}

.skill-progress-row div:first-child span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.7rem;
}

.skill-progress-row b {
  font-size: 0.78rem;
  text-align: end;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  background: #e8e9e3;
  border-radius: 999px;
}

.progress-track span {
  height: 100%;
  background: var(--green);
  border-radius: inherit;
}

.panel-note,
.empty-state {
  margin: 28px 0 0;
  padding: 18px;
  color: var(--muted);
  background: #f2f2ec;
  border-radius: 13px;
  font-size: 0.8rem;
  line-height: 1.6;
}

.recent-panel {
  margin-top: 18px;
}

.activity-row {
  padding: 16px 0;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 24px;
  border-top: 1px solid var(--line);
}

.page-loading {
  min-height: 60vh;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.admin-metrics .metric-card {
  min-height: 125px;
}

.admin-panel-heading {
  align-items: flex-end;
}

.admin-search {
  width: min(290px, 100%);
  min-height: 44px;
  padding: 0 14px;
}

.admin-user-list {
  display: grid;
}

.admin-user-row {
  padding: 18px 0;
  display: grid;
  grid-template-columns: minmax(170px, 1.4fr) 120px 80px minmax(220px, auto);
  align-items: center;
  gap: 18px;
  border-top: 1px solid var(--line);
}

.admin-user-identity strong,
.admin-user-identity span,
.admin-user-stat span,
.admin-user-stat b {
  display: block;
}

.admin-user-identity span,
.admin-user-stat span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
}

.admin-user-stat b {
  margin-top: 4px;
  font-size: 0.85rem;
}

.admin-user-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.admin-user-actions button {
  min-height: 36px;
  padding: 0 11px;
  color: var(--green-dark);
  background: var(--green-pale);
  border: 0;
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.admin-user-actions .danger-action {
  color: #813d32;
  background: #f5ded9;
}

.lesson-admin-panel { margin-top: 18px; }

.lesson-admin-filters,
.lesson-form-row,
.quiz-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.lesson-admin-filters select,
.lesson-create-form select,
.lesson-create-form input,
.lesson-create-form textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
}

.lesson-create-form textarea { min-height: 142px; resize: vertical; }

.lesson-admin-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(340px, 1.15fr);
  gap: 18px;
  align-items: start;
}

.lesson-create-form {
  padding: 20px;
  background: #f8f7f2;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.lesson-create-form .form-field { margin-bottom: 13px; }
.lesson-create-form .primary-button { width: 100%; border: 0; cursor: pointer; }

.lesson-admin-list {
  max-height: 780px;
  display: grid;
  gap: 11px;
  overflow-y: auto;
}

.admin-lesson-card {
  padding: 19px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 15px;
}

.admin-lesson-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--green-dark);
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-lesson-card h3 { margin: 10px 0 6px; }

.admin-lesson-card > p {
  max-height: 72px;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.admin-quiz-preview {
  margin: 15px 0;
  padding: 13px;
  background: var(--green-pale);
  border-radius: 11px;
  font-size: 0.78rem;
}

.admin-quiz-preview ol { margin: 8px 0 0; padding-inline-start: 22px; }
.admin-quiz-preview li.correct { color: var(--green-dark); font-weight: 750; }

.admin-lesson-card > button {
  padding: 8px 12px;
  color: #8a4036;
  background: #f8e8e4;
  border: 0;
  border-radius: 9px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.telegram-auth-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.auth-status {
  min-height: 24px;
  margin: 16px 0 0;
  font-size: 0.85rem;
}

footer p {
  margin: 0;
}

.footer-brand {
  color: var(--ink);
}

.footer-brand .brand-mark {
  width: 27px;
  height: 27px;
  border-radius: 8px 8px 8px 3px;
  font-size: 0.9rem;
}

:focus-visible {
  outline: 3px solid rgba(223, 126, 58, 0.55);
  outline-offset: 3px;
}

@media (max-width: 720px) {
  .site-header {
    min-height: 72px;
  }

  .brand > span:last-child {
    display: none;
  }

  .main-nav {
    display: none;
  }

  .site-header {
    gap: 10px;
  }

  .login-button,
  .logout-button {
    padding: 0 12px;
  }

  .dashboard-link,
  .admin-link {
    width: 38px;
    min-height: 38px;
    padding: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    font-size: 0;
    text-align: center;
  }

  .dashboard-link::before {
    content: "▦";
    font-size: 1rem;
  }

  .admin-link {
    display: none;
  }

  .hero {
    margin-top: 54px;
    margin-bottom: 82px;
  }

  .learning-access {
    margin-bottom: 72px;
    padding: 25px;
    align-items: stretch;
    flex-direction: column;
  }

  .learning-access-actions {
    min-width: 0;
  }

  h1 {
    font-size: clamp(2.7rem, 14vw, 4.2rem);
  }

  .word-card {
    margin-top: 56px;
    align-items: flex-start;
    flex-direction: column;
  }

  .hourly-lesson-card { padding: 22px; }

  .phrase-translation {
    text-align: start;
  }

  .learning-section {
    padding-top: 74px;
    padding-bottom: 82px;
    border-radius: 32px 32px 0 0;
  }

  .learning-grid {
    grid-template-columns: 1fr;
  }

  .featured-card {
    grid-column: auto;
  }

  .learning-card {
    min-height: 124px;
    padding: 20px;
    gap: 14px;
  }

  footer {
    flex-direction: column;
    gap: 14px;
  }

  .prose-grid {
    grid-template-columns: 1fr;
  }

  .contact-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth-dialog {
    padding: 34px 24px 26px;
  }

  .dashboard-shell {
    padding-top: 50px;
  }

  .dashboard-welcome {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-columns {
    grid-template-columns: 1fr;
  }

  .dashboard-panel {
    padding: 22px;
  }

  .profile-details {
    grid-template-columns: 1fr;
  }

  .profile-description-row {
    grid-column: auto;
  }

  .profile-dialog {
    padding: 24px 20px;
  }

  .account-dialog-heading,
  .account-pane {
    padding-inline: 20px;
  }

  .account-tabs {
    padding-inline: 14px;
    overflow-x: auto;
    grid-template-columns: repeat(4, minmax(100px, 1fr));
  }

  .lesson-shell {
    padding-top: 36px;
  }

  .lesson-hero {
    padding: 48px 0 30px;
  }

  .lesson-panel,
  .lesson-passage,
  .lesson-quiz {
    padding: 21px;
  }

  .lesson-word {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .level-module-grid {
    grid-template-columns: 1fr;
  }

  .level-library-heading {
    align-items: flex-start;
  }

  .lesson-actions,
  .writing-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .skill-progress-row {
    grid-template-columns: 100px 1fr 38px;
    gap: 10px;
  }

  .admin-panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-user-row {
    grid-template-columns: 1fr 1fr;
  }

  .admin-user-identity,
  .admin-user-actions {
    grid-column: 1 / -1;
  }

  .admin-user-actions {
    justify-content: flex-start;
  }

  .lesson-admin-layout { grid-template-columns: 1fr; }

  .lesson-admin-filters,
  .lesson-form-row,
  .quiz-choice-grid { grid-template-columns: 1fr; }

  .footer-brand > span:last-child {
    display: inline;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
