@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 100 800;
  font-display: block;
  src: url('/assets/Sora-Variable-BedAVQot.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: block;
  src: url('/assets/Inter-Variable-DiVDrmQJ.woff2') format('woff2');
}

@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 200 1000;
  font-display: block;
  src: url('/assets/Cairo-Variable-uQPp9sL1.woff2') format('woff2');
}

/* A lesson edition or bilingual text island owns its language independently of UI. */
[lang|='en'] {
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-display: 'Sora', 'Inter', system-ui, sans-serif;
  --font-serif: 'Sora', 'Inter', system-ui, sans-serif;
  font-family: var(--font-sans);
}

[lang|='ar'] {
  --font-sans: 'Cairo', system-ui, sans-serif;
  --font-display: 'Cairo', system-ui, sans-serif;
  --font-serif: 'Cairo', system-ui, sans-serif;
  font-family: var(--font-sans);
}

:root {
  color-scheme: dark;
  --auth-bg: #0b0e14;
  --auth-paper: #121722;
  --auth-text: #f5f7fb;
  --auth-muted: #aab3c5;
  --auth-border: #2a3448;
  --auth-accent: #6ee7d8;
}

:root.light {
  color-scheme: light;
  --auth-bg: #f7f7f5;
  --auth-paper: #ffffff;
  --auth-text: #151922;
  --auth-muted: #596273;
  --auth-border: #d9dde5;
  --auth-accent: #087f73;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--auth-bg);
  color: var(--auth-text);
  font-family: var(--font-sans, Inter), 'Segoe UI', Tahoma, Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select {
  border-radius: 0.55rem;
}

:focus-visible {
  outline: 3px solid var(--auth-accent);
  outline-offset: 3px;
}

.auth-header {
  display: flex;
  min-height: 4.5rem;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  border-bottom: 1px solid var(--auth-border);
}

.auth-brand {
  color: inherit;
  font-size: 1.25rem;
  font-weight: 800;
  text-decoration: none;
}

.auth-actions {
  display: flex;
  gap: 0.75rem;
}

.auth-actions button {
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--auth-border);
  background: var(--auth-paper);
  color: inherit;
  cursor: pointer;
}

.auth-layout {
  display: grid;
  min-height: calc(100vh - 4.5rem);
  place-items: center;
  padding: 3rem 1.5rem;
}

.auth-card {
  width: min(100%, 34rem);
  padding: 2rem;
  border: 1px solid var(--auth-border);
  border-radius: 1rem;
  background: var(--auth-paper);
  box-shadow: 0 1.25rem 3rem rgb(0 0 0 / 18%);
}

.auth-muted {
  color: var(--auth-muted);
}

@media (min-width: 1100px) {
  .auth-card {
    padding: 2.5rem;
  }
}

.auth-card h1 {
  margin: 1.25rem 0 0.35rem;
  font-size: 2rem;
}

.login-back {
  color: var(--auth-muted);
  font-weight: 700;
  text-decoration: none;
}

.login-roles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 1.5rem 0;
  padding: 0.35rem;
  border: 1px solid var(--auth-border);
  border-radius: 0.8rem;
}

.login-roles legend {
  padding: 0 0.35rem;
  color: var(--auth-muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.login-roles label {
  position: relative;
  padding: 0.7rem;
  border-radius: 0.55rem;
  color: var(--auth-muted);
  cursor: pointer;
  font-weight: 700;
  text-align: center;
}

.login-roles input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.login-roles label:has(input:checked) {
  background: var(--auth-bg);
  color: var(--auth-text);
}

.login-roles label:has(input:focus-visible) {
  outline: 3px solid var(--auth-accent);
  outline-offset: 3px;
}

#login-form {
  display: grid;
  gap: 0.75rem;
}

#login-form > label,
.login-country span {
  font-size: 0.85rem;
  font-weight: 700;
}

#login-form input,
#login-form select {
  min-width: 0;
  min-height: 2.9rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--auth-border);
  background: var(--auth-bg);
  color: var(--auth-text);
}

.login-phone-row {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 0.65rem;
}

.login-country {
  display: grid;
  gap: 0.3rem;
}

.login-country[hidden] {
  display: none;
}

.login-phone-row > #login-email {
  grid-column: 1 / -1;
}

#login-submit {
  min-height: 3rem;
  margin-top: 0.35rem;
  border: 0;
  background: var(--auth-accent);
  color: #07110f;
  cursor: pointer;
  font-weight: 800;
}

#login-submit:disabled {
  cursor: wait;
  opacity: 0.7;
}

.login-status {
  min-height: 1.3rem;
  margin: 0;
  color: #fca5a5;
  font-size: 0.88rem;
}

:root.light .login-status {
  color: #a51d2d;
}

.login-register-line {
  margin: 1.25rem 0 0;
  color: var(--auth-muted);
  font-size: 0.9rem;
  text-align: center;
}

.login-register-line a {
  color: var(--auth-accent);
  font-weight: 700;
}

/* Keep Cairo's native fallback arrow positioned consistently across display scales. */
.login-register-line a:lang(ar) {
  text-rendering: geometricPrecision;
}
html.dark {
  color-scheme: dark;
  --bg-app: #0b0e14;
  --text-primary: #f5f5f5;
  --border-strong: rgba(255, 255, 255, 0.18);
}

html.light {
  color-scheme: light;
  --bg-app: #f7f7f5;
  --text-primary: #1a1a1a;
  --border-strong: #d2d2cc;
}

.hosted-progress {
  margin: 0.75rem 0;
  font-weight: 700;
}

.hosted-lessons {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hosted-lessons button {
  width: 100%;
}

.html-lesson-stage {
  box-sizing: border-box;
  width: calc(100vw - 16px);
  max-width: none;
  height: calc(100dvh - 16px);
  max-height: none;
  margin: auto;
  padding: 0;
  border: 1px solid var(--border-strong, #334);
  background: var(--bg-app, #0b0e14);
  color: var(--text-primary, #e8e6e3);
  overflow: hidden;
}

.html-lesson-stage[open] {
  display: flex;
  flex-direction: column;
}

.html-lesson-stage header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem;
  min-height: 3.5rem;
  flex-wrap: wrap;
}

.html-lesson-frame {
  display: block;
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  border: 0;
  background: #fff;
}
