:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef4f8;
  color: #182028;
  --glass-bg: rgba(255, 255, 255, 0.48);
  --glass-bg-strong: rgba(255, 255, 255, 0.68);
  --glass-border: rgba(255, 255, 255, 0.72);
  --glass-shadow: 0 24px 70px rgba(55, 78, 106, 0.16);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.86);
  --ink: #182028;
  --muted: #6f7c8b;
  --blue: #4f7cff;
  --teal: #2faeaa;
  --rose: #d85f78;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 12%, rgba(122, 173, 255, 0.34), transparent 28%),
    radial-gradient(circle at 86% 16%, rgba(118, 226, 202, 0.28), transparent 26%),
    radial-gradient(circle at 62% 82%, rgba(255, 195, 213, 0.34), transparent 30%),
    linear-gradient(135deg, #f8fbff 0%, #eef4f8 42%, #f8f3f8 100%);
  background-attachment: fixed;
}

button,
select,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

button:active {
  transform: scale(0.985);
}

.line-app {
  min-height: 100vh;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.02)),
    transparent;
  isolation: isolate;
}

.line-app.dark-theme {
  --glass-bg: rgba(17, 24, 39, 0.42);
  --glass-bg-strong: rgba(24, 34, 52, 0.66);
  --glass-border: rgba(255, 255, 255, 0.16);
  --glass-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  --ink: #eef6ff;
  --muted: #9cadbf;
  --blue: #8da7ff;
  --teal: #6ee7da;
  --rose: #ff8fa3;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 12%, rgba(82, 118, 255, 0.28), transparent 28%),
    radial-gradient(circle at 86% 16%, rgba(42, 199, 178, 0.2), transparent 26%),
    radial-gradient(circle at 64% 82%, rgba(211, 93, 128, 0.2), transparent 30%),
    linear-gradient(135deg, #07111f 0%, #111827 46%, #15111f 100%);
}

.line-app::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.36), transparent 78%);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  min-height: 82px;
  padding: 0 8.2vw;
  border-bottom: 1px solid rgba(255, 255, 255, 0.68);
  background: rgba(255, 255, 255, 0.38);
  box-shadow: 0 12px 36px rgba(67, 86, 110, 0.08);
  backdrop-filter: blur(28px) saturate(170%);
}

.brand-button {
  justify-self: start;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 850;
  letter-spacing: 0;
}

.story-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: 0;
  text-align: center;
}

.story-title strong {
  color: var(--ink);
}

.back-button {
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--glass-bg-strong);
  color: #506071;
  font-size: 0.9rem;
  font-weight: 900;
  box-shadow: var(--glass-highlight), 0 10px 26px rgba(67, 86, 110, 0.1);
  backdrop-filter: blur(18px) saturate(170%);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.back-button:hover {
  border-color: rgba(79, 124, 255, 0.44);
  color: #315dce;
  transform: translateY(-1px);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.theme-toggle {
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 10px 13px;
  background: var(--glass-bg-strong);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 900;
  box-shadow: var(--glass-highlight), 0 12px 28px rgba(67, 86, 110, 0.1);
  backdrop-filter: blur(18px) saturate(170%);
}

.header-actions select {
  max-width: 190px;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 10px 12px;
  background: var(--glass-bg-strong);
  color: var(--ink);
  font-weight: 750;
  outline: none;
  box-shadow: var(--glass-highlight);
  backdrop-filter: blur(18px) saturate(170%);
}

.header-actions .voice-select {
  max-width: 128px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(79, 124, 255, 0.95), rgba(47, 174, 170, 0.95));
  color: white;
  font-size: 1.35rem;
  font-weight: 850;
  box-shadow: 0 14px 30px rgba(79, 124, 255, 0.22);
}

.counter {
  color: var(--muted);
  font-weight: 800;
}

.completed-strip {
  display: flex;
  gap: 10px;
  padding: 18px 8.2vw 0;
  overflow-x: auto;
}

.completed-strip button {
  flex: 0 0 auto;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--glass-bg);
  color: #506071;
  font-weight: 800;
  box-shadow: var(--glass-highlight);
  backdrop-filter: blur(18px) saturate(170%);
}

.completed-strip button.active {
  border-color: rgba(47, 174, 170, 0.42);
  color: #1c817d;
}

.library-page {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 34px;
  width: min(1320px, calc(100% - 44px));
  margin: 0 auto;
  padding: 36px 0 70px;
}

.featured-column {
  display: grid;
  align-content: start;
  gap: 22px;
}

.creator-hero {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 32px;
  padding: 30px;
  background:
    radial-gradient(circle at 16% 14%, rgba(255, 255, 255, 0.78), transparent 28%),
    radial-gradient(circle at 88% 20%, rgba(111, 231, 218, 0.34), transparent 26%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.34));
  box-shadow: var(--glass-highlight), var(--glass-shadow);
  backdrop-filter: blur(28px) saturate(180%);
}

.creator-hero::after {
  position: absolute;
  right: -34px;
  bottom: -44px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(79, 124, 255, 0.36), rgba(216, 95, 120, 0.28));
  content: "";
  filter: blur(2px);
}

.creator-hero span,
.creator-hero h1,
.creator-hero p {
  position: relative;
  z-index: 1;
}

.creator-hero span {
  display: block;
  margin-bottom: 42px;
  color: var(--blue);
  font-size: 0.86rem;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.creator-hero h1 {
  max-width: 280px;
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 2.55rem;
  line-height: 0.98;
  letter-spacing: 0;
}

.creator-hero p {
  max-width: 260px;
  margin: 0;
  color: #647184;
  font-weight: 760;
  line-height: 1.55;
}

.feature-card {
  min-height: 300px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 28px;
  padding: 28px;
  color: white;
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.32);
  backdrop-filter: blur(24px) saturate(160%);
  transition:
    transform 200ms ease,
    box-shadow 200ms ease;
}

.feature-card.primary {
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.42), transparent 26%),
    linear-gradient(180deg, rgba(29, 40, 60, 0.08), rgba(29, 40, 60, 0.58)),
    linear-gradient(135deg, rgba(79, 124, 255, 0.78), rgba(47, 174, 170, 0.72));
}

.feature-card.dark {
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 255, 255, 0.22), transparent 24%),
    linear-gradient(180deg, rgba(28, 34, 48, 0.12), rgba(28, 34, 48, 0.68)),
    linear-gradient(135deg, rgba(42, 51, 72, 0.86), rgba(121, 139, 164, 0.72));
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 30px 86px rgba(55, 78, 106, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.feature-card span {
  display: block;
  margin-bottom: 128px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.feature-card h2 {
  margin: 0 0 10px;
  font-size: 1.75rem;
  letter-spacing: 0;
}

.feature-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 1rem;
  line-height: 1.65;
}

.stories-column {
  min-width: 0;
  padding-top: 8px;
}

.library-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.58);
}

.library-heading p {
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 800;
}

.library-heading h1 {
  margin: 0;
  color: var(--ink);
  font-size: 1.55rem;
  letter-spacing: 0;
}

.library-heading button {
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 10px 15px;
  background: var(--glass-bg-strong);
  color: #506071;
  font-weight: 900;
  box-shadow: var(--glass-highlight), 0 14px 34px rgba(67, 86, 110, 0.1);
  backdrop-filter: blur(18px) saturate(170%);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.library-heading button:active,
.difficulty-tabs button:active,
.library-card:active,
.listen-button:active {
  transform: scale(0.985);
}

.difficulty-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.difficulty-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 8px 13px;
  background: var(--glass-bg);
  color: #506071;
  font-weight: 900;
  box-shadow: var(--glass-highlight), 0 12px 28px rgba(67, 86, 110, 0.08);
  backdrop-filter: blur(18px) saturate(170%);
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.difficulty-tabs button.active {
  border-color: rgba(79, 124, 255, 0.4);
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
}

.level-dot,
.difficulty-label i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.level-dot.beginner,
.difficulty-label.beginner i {
  background: #4c9a7c;
}

.level-dot.intermediate,
.difficulty-label.intermediate i {
  background: #376df0;
}

.level-dot.hard,
.difficulty-label.hard i {
  background: #be6470;
}

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

.library-card {
  display: grid;
  align-content: space-between;
  min-height: 176px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 26px;
  padding: 18px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.32)),
    rgba(255, 255, 255, 0.36);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--glass-highlight), 0 18px 50px rgba(67, 86, 110, 0.1);
  backdrop-filter: blur(24px) saturate(170%);
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.library-card::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.68), transparent 42%);
  opacity: 0.58;
}

.library-card > * {
  position: relative;
}

.library-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 28px 76px rgba(67, 86, 110, 0.18), var(--glass-highlight);
}

.library-card.beginner:hover {
  border-color: rgba(76, 154, 124, 0.34);
}

.library-card.intermediate:hover {
  border-color: rgba(55, 109, 240, 0.28);
}

.library-card.hard:hover {
  border-color: rgba(190, 100, 112, 0.34);
}

.card-topline,
.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.card-topline {
  margin-bottom: 16px;
  color: #8a96a4;
  font-size: 0.92rem;
  font-weight: 850;
}

.card-check {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.56);
  color: #728092;
  box-shadow: var(--glass-highlight);
}

.card-check.done {
  background: rgba(217, 246, 234, 0.72);
  color: #23705a;
}

.library-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.15rem;
}

.library-card small {
  display: block;
  margin-bottom: 36px;
  color: #84909f;
  font-weight: 850;
}

.card-bottom {
  color: #7b8898;
  font-weight: 850;
}

.difficulty-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.difficulty-label.beginner {
  color: #4c9a7c;
}

.difficulty-label.intermediate {
  color: #376df0;
}

.difficulty-label.hard {
  color: #be6470;
}

.dark-theme .app-header {
  border-bottom-color: rgba(255, 255, 255, 0.12);
  background: rgba(10, 16, 28, 0.48);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.dark-theme .library-card {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05)),
    rgba(15, 23, 42, 0.34);
  color: var(--ink);
}

.dark-theme .library-card:hover {
  background: rgba(25, 36, 58, 0.68);
}

.dark-theme .feature-card.primary {
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.22), transparent 26%),
    linear-gradient(180deg, rgba(8, 16, 32, 0.08), rgba(8, 16, 32, 0.66)),
    linear-gradient(135deg, rgba(87, 118, 255, 0.58), rgba(40, 194, 174, 0.46));
}

.dark-theme .feature-card.dark {
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 255, 255, 0.12), transparent 24%),
    linear-gradient(180deg, rgba(8, 12, 24, 0.06), rgba(8, 12, 24, 0.72)),
    linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(53, 65, 94, 0.7));
}

.dark-theme .creator-hero {
  background:
    radial-gradient(circle at 16% 14%, rgba(255, 255, 255, 0.16), transparent 28%),
    radial-gradient(circle at 88% 20%, rgba(111, 231, 218, 0.16), transparent 26%),
    linear-gradient(145deg, rgba(30, 41, 59, 0.72), rgba(15, 23, 42, 0.44));
}

.dark-theme .creator-hero p {
  color: var(--muted);
}

.dark-theme .library-heading {
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.dark-theme .library-heading h1,
.dark-theme .story-title strong,
.dark-theme .brand-button,
.dark-theme .typing-stats span:first-child,
.dark-theme .letter.correct,
.dark-theme .completion-card h2 {
  color: var(--ink);
}

.dark-theme .library-heading p,
.dark-theme .story-title,
.dark-theme .counter,
.dark-theme .card-topline,
.dark-theme .library-card small,
.dark-theme .card-bottom,
.dark-theme .arabic-translation,
.dark-theme .live-note,
.dark-theme .line-count {
  color: var(--muted);
}

.dark-theme .word-translation-chip,
.dark-theme .typing-stats,
.dark-theme .listen-button,
.dark-theme .voice-badge,
.dark-theme .completion-card {
  background: var(--glass-bg-strong);
}

.dark-theme .header-actions select,
.dark-theme .library-heading button,
.dark-theme .difficulty-tabs button,
.dark-theme .completed-strip button,
.dark-theme .back-button {
  background: var(--glass-bg-strong);
  color: var(--ink);
}

.dark-theme .difficulty-tabs button.active {
  background: rgba(72, 88, 126, 0.72);
}

.dark-theme .letter.pending,
.dark-theme .typing-line {
  color: rgba(217, 226, 238, 0.26);
}

.dark-theme .progress-line {
  background: rgba(255, 255, 255, 0.14);
}

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 82px);
  padding: 28px 8.2vw 150px;
}

.progress-line {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.36);
  box-shadow: inset 0 1px 2px rgba(67, 86, 110, 0.08);
  backdrop-filter: blur(10px);
}

.progress-line span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(79, 124, 255, 0.9), rgba(47, 174, 170, 0.86), rgba(216, 95, 120, 0.72));
  transition: width 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.line-stage {
  display: grid;
  justify-items: center;
  width: min(1040px, 100%);
  margin: auto;
  padding: 80px 0 30px;
}

.line-enter {
  animation: lineIn 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.word-focus {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 18px;
  margin-bottom: 52px;
  color: #677485;
  font-size: 1.55rem;
  font-weight: 800;
}

.word-focus .active-word {
  color: var(--blue);
}

.sentence-panel {
  display: grid;
  justify-items: center;
  width: 100%;
}

.listen-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 46px;
}

.listen-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--glass-bg-strong);
  color: #455466;
  font-size: 0.96rem;
  font-weight: 900;
  box-shadow: var(--glass-highlight), 0 14px 34px rgba(67, 86, 110, 0.1);
  backdrop-filter: blur(20px) saturate(175%);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.listen-button:hover,
.listen-button.is-speaking {
  transform: translateY(-1px);
  border-color: rgba(79, 124, 255, 0.44);
  box-shadow: 0 18px 42px rgba(79, 124, 255, 0.16), var(--glass-highlight);
}

.listen-button span {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: white;
  font-size: 0.78rem;
  line-height: 1;
}

.line-count {
  color: var(--muted);
  font-weight: 850;
}

.voice-badge {
  max-width: 220px;
  overflow: hidden;
  padding: 8px 11px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  color: #647184;
  font-size: 0.86rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.44);
  box-shadow: var(--glass-highlight);
  backdrop-filter: blur(18px) saturate(170%);
}

.word-translation-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: min(620px, 100%);
  margin: 0 0 8px;
  padding: 11px 16px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.42)),
    rgba(255, 255, 255, 0.42);
  color: var(--blue);
  font-weight: 900;
  box-shadow: var(--glass-highlight), 0 18px 46px rgba(67, 86, 110, 0.12);
  backdrop-filter: blur(22px) saturate(175%);
}

.word-translation-chip strong {
  overflow: hidden;
  color: #4d5b6b;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.typing-line {
  width: min(920px, 100%);
  color: rgba(91, 100, 112, 0.34);
  cursor: text;
  font-size: 4.8rem;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.18;
  text-align: left;
  word-break: break-word;
}

.letter {
  transition:
    color 120ms ease,
    background 120ms ease,
    text-decoration-color 120ms ease;
}

.letter.correct {
  color: var(--ink);
}

.letter.pending {
  color: rgba(91, 100, 112, 0.34);
}

.letter.wrong,
.letter.extra {
  color: var(--rose);
  text-decoration: underline;
  text-decoration-color: #c8c3df;
  text-decoration-thickness: 4px;
  text-underline-offset: 12px;
}

.arabic-translation {
  width: min(920px, 100%);
  margin: 48px 0 0;
  color: #687586;
  font-size: 2.05rem;
  font-weight: 650;
  line-height: 1.6;
  text-align: left;
}

.live-note {
  min-height: 28px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 800;
}

.live-note.has-error {
  color: var(--rose);
}

.typing-dock {
  position: fixed;
  right: 50%;
  bottom: 18px;
  z-index: 4;
  width: auto;
  transform: translateX(50%);
}

.mobile-keyboard-input {
  position: fixed;
  left: 50%;
  bottom: 8px;
  width: 1px;
  height: 1px;
  border: 0;
  padding: 0;
  opacity: 0.01;
  pointer-events: none;
}

@media (pointer: coarse), (max-width: 700px) {
  .typing-dock {
    width: min(520px, calc(100% - 28px));
  }

  .mobile-keyboard-input {
    position: static;
    width: 100%;
    height: 44px;
    margin-bottom: 10px;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    padding: 0 16px;
    opacity: 1;
    pointer-events: auto;
    background: var(--glass-bg-strong);
    color: var(--ink);
    font-size: 1rem;
    font-weight: 800;
    outline: none;
    box-shadow: var(--glass-highlight), 0 12px 30px rgba(67, 86, 110, 0.12);
    backdrop-filter: blur(22px) saturate(175%);
  }

  .mobile-keyboard-input::placeholder {
    color: var(--muted);
  }
}

.typing-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.54);
  color: #708092;
  font-size: 0.84rem;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: var(--glass-highlight), 0 16px 38px rgba(67, 86, 110, 0.12);
  backdrop-filter: blur(26px) saturate(180%);
}

.typing-stats span:first-child {
  color: var(--ink);
}

.auto-next {
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(128, 143, 162, 0.42);
  color: white;
  font-size: 0.82rem;
  font-weight: 950;
}

.auto-next.ready {
  background: linear-gradient(135deg, var(--blue), var(--teal));
}

.completion-card {
  display: grid;
  justify-items: center;
  gap: 16px;
  max-width: 680px;
  margin: auto;
  padding: 46px;
  border: 1px solid var(--glass-border);
  border-radius: 34px;
  background: var(--glass-bg-strong);
  text-align: center;
  box-shadow: var(--glass-highlight), var(--glass-shadow);
  backdrop-filter: blur(26px) saturate(180%);
}

.completion-badge {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: white;
  font-size: 1.45rem;
  font-weight: 950;
}

.completion-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: 2.8rem;
  letter-spacing: 0;
}

.completion-card p {
  margin: 0;
  color: #657286;
  line-height: 1.65;
}

.completion-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

.completion-actions button {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: white;
  font-weight: 950;
}

.completion-actions .secondary {
  background: linear-gradient(135deg, #263244, #526176);
}

@keyframes lineIn {
  from {
    opacity: 0;
    filter: blur(10px);
    transform: translateY(18px) scale(0.992);
  }

  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .app-header {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 18px 22px;
  }

  .brand-button,
  .header-actions {
    justify-self: center;
  }

  .library-page {
    grid-template-columns: 1fr;
    width: min(720px, calc(100% - 28px));
    padding-top: 24px;
  }

  .featured-column {
    grid-template-columns: 1fr 1fr;
  }

  .feature-card {
    min-height: 220px;
  }

  .creator-hero {
    min-height: 220px;
  }

  .feature-card span {
    margin-bottom: 62px;
  }

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

  .stage {
    padding: 22px 24px 170px;
  }

  .line-stage {
    padding-top: 48px;
  }

  .typing-line {
    font-size: 3.25rem;
  }

  .arabic-translation {
    font-size: 1.6rem;
  }
}

@media (max-width: 560px) {
  .header-actions {
    flex-wrap: wrap;
  }

  .header-actions select {
    max-width: 100%;
  }

  .library-page {
    width: min(100% - 22px, 420px);
  }

  .featured-column,
  .story-grid {
    grid-template-columns: 1fr;
  }

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

  .library-heading button {
    width: 100%;
  }

  .word-focus {
    gap: 10px;
    margin-bottom: 34px;
    font-size: 1.25rem;
  }

  .listen-row {
    flex-direction: column;
  }

  .voice-badge {
    max-width: min(280px, 100%);
  }

  .word-translation-chip {
    align-items: center;
    border-radius: 18px;
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }

  .typing-line {
    font-size: 2.35rem;
  }

  .arabic-translation {
    margin-top: 34px;
    font-size: 1.32rem;
  }

  .typing-stats {
    flex-wrap: wrap;
    gap: 8px;
    border-radius: 18px;
    white-space: normal;
  }

  .completion-card {
    padding: 32px 22px;
  }

  .completion-card h2 {
    font-size: 2rem;
  }
}
