:root {
  --bg: #f5f5f7;
  --panel: rgba(255, 255, 255, 0.86);
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(60, 60, 67, 0.16);
  --accent: #007aff;
  --accent-strong: #0062cc;
  --warm: #ff9f0a;
  --rose: #ff3b30;
  --blue: #0a84ff;
  --green-soft: rgba(0, 122, 255, 0.08);
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.08);
  --control: rgba(118, 118, 128, 0.12);
  --sidebar: rgba(246, 246, 248, 0.82);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overscroll-behavior: none;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #ffffff 0%, var(--bg) 42%, #eef1f6 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body.auth-locked {
  height: 100dvh;
  overflow: hidden;
}

body.auth-locked .app-shell {
  display: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  min-height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(circle at 50% 0%, rgba(0, 122, 255, 0.16), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #f5f5f7 100%);
}

.login-screen.hidden {
  display: none;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(24px) saturate(1.4);
}

.login-brand-logo {
  width: min(286px, 100%);
  height: auto;
  display: block;
}

.login-card h1 {
  margin: 0;
  font-size: 28px;
}

.login-tagline {
  margin: -8px 0 2px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.login-card label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.login-card input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  padding: 0 13px;
  outline: none;
}

.login-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.16);
}

.password-control {
  position: relative;
}

.password-control input {
  padding-right: 50px !important;
}

.password-visibility {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
}

.password-visibility:hover,
.password-visibility:focus-visible {
  color: var(--accent);
  background: rgba(0, 122, 255, 0.08);
  outline: none;
}

.login-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.login-hint:empty {
  display: none;
}

.login-hint.error {
  color: var(--rose);
}

.device-verification {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(0, 122, 255, 0.2);
  border-radius: 8px;
  background: rgba(0, 122, 255, 0.06);
}

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

.device-verification p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.device-verification strong {
  color: var(--ink);
}

.device-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.device-code-row input {
  min-width: 0;
}

.device-code-row .secondary-action {
  min-height: 46px;
  padding: 0 14px;
  white-space: nowrap;
}

.login-options {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: -8px;
}

.text-action {
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 650;
}

.text-action:hover,
.text-action:focus-visible {
  color: var(--accent-strong);
  text-decoration: underline;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  color: var(--ink);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid var(--line);
  backdrop-filter: blur(22px) saturate(1.5);
}

.brand {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: block;
  filter: drop-shadow(0 8px 14px rgba(23, 32, 51, 0.18));
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.brand-copy > span {
  display: block;
  margin-top: 1px;
  color: #3c8f70;
  font-size: 12px;
  font-weight: 700;
}

.brand p,
.eyebrow,
.ring-label span,
.stats-grid span {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-button,
.primary-action,
.secondary-action,
.icon-button,
.segment {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  font-weight: 650;
}

.nav-button span:first-child {
  width: 24px;
  text-align: center;
}

.nav-button.active,
.nav-button:hover {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.progress-panel {
  margin-top: auto;
  padding: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ring-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 14px;
}

.progress-ring {
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);
}

.ring-track,
.ring-value {
  fill: none;
  stroke-width: 11;
}

.ring-track {
  stroke: rgba(60, 60, 67, 0.14);
}

.ring-value {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 295;
  stroke-dashoffset: 295;
}

.ring-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.ring-label strong {
  font-size: 24px;
}

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

.stats-grid div {
  background: var(--control);
  border-radius: 8px;
  padding: 10px;
}

.stats-grid strong {
  display: block;
  font-size: 22px;
}

.content {
  padding: 26px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: flex-start;
  margin-bottom: 26px;
  padding: 12px 0 8px;
}

.topbar h2,
.word-focus h3,
.section-title-row h3 {
  margin: 0;
}

.topbar h2 {
  font-size: 34px;
  font-weight: 760;
  letter-spacing: 0;
}

.content .eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 700;
}

.topbar-actions,
.word-actions,
.section-title-row,
.segmented {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions {
  align-items: flex-end;
  gap: 16px;
  padding: 4px 0;
}

.topbar-actions .level-select {
  min-width: 220px;
}

.topbar-actions .level-select select,
#start-quiz {
  min-height: 52px;
}

#start-quiz {
  padding-right: 20px;
  padding-left: 20px;
}

.account-menu {
  position: relative;
  flex: 0 0 auto;
}

.account-avatar {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #172033;
  color: #ffffff;
  font-weight: 750;
  box-shadow: 0 8px 20px rgba(23, 32, 51, 0.2);
}

.account-avatar:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.24);
  outline-offset: 2px;
}

.account-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  width: 260px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(22px);
}

.account-summary {
  display: grid;
  gap: 2px;
  padding: 10px 11px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.account-summary span {
  color: var(--muted);
  font-size: 12px;
}

.account-summary small {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

#account-member-id {
  margin-top: 5px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0;
}

#account-vip-status.vip-active {
  color: #18864b;
}

[data-admin-only][hidden] {
  display: none !important;
}

.account-popover > button,
.account-popover > a {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.account-popover > a {
  text-decoration: none;
}

.account-popover > button:hover,
.account-popover > button:focus-visible,
.account-popover > a:hover,
.account-popover > a:focus-visible {
  background: var(--control);
  outline: none;
}

.account-popover .danger-menu-item {
  color: var(--rose);
}

.recovery-dialog[hidden],
.register-dialog[hidden],
.account-popover[hidden],
.settings-dialog[hidden],
.reset-user-form[hidden] {
  display: none;
}

.recovery-dialog {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
}

.dialog-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(8px);
}

.recovery-panel {
  position: relative;
  z-index: 1;
  width: min(390px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.auth-flow-panel {
  max-height: min(92dvh, 720px);
  overflow-y: auto;
  text-align: left;
}

.auth-flow-panel .recovery-icon,
.auth-flow-panel h2,
.auth-flow-intro {
  text-align: center;
}

.auth-flow-panel .auth-flow-intro {
  margin-bottom: 18px;
}

.settings-form label > .verification-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 122px;
  gap: 10px;
  margin: 0;
  color: inherit;
}

.verification-button {
  min-height: 46px;
  padding-inline: 12px;
  white-space: nowrap;
}

.verification-button:disabled {
  cursor: default;
  opacity: 0.62;
}

.captcha-row {
  display: grid;
  grid-template-columns: 112px minmax(72px, 1fr) 44px;
  align-items: center;
  gap: 8px;
}

.captcha-row img {
  width: 112px;
  height: 46px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f6f9;
  object-fit: contain;
  padding: 2px;
  filter: blur(0.4px);
}

.captcha-row img:not([src]) {
  visibility: hidden;
}

.captcha-row input {
  min-width: 0;
}

.captcha-refresh {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  color: var(--accent);
  background: var(--control);
  font-size: 20px;
}

.captcha-refresh:disabled {
  opacity: 0.55;
}

.recovery-panel h2 {
  margin: 14px 0 8px;
  font-size: 24px;
}

.recovery-panel p {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.65;
}

.recovery-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  border-radius: 50%;
  background: rgba(0, 122, 255, 0.1);
  color: var(--accent);
  font-size: 24px;
  font-weight: 750;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

body.recovery-open {
  overflow: hidden;
}

.settings-dialog {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  padding: 18px;
}

.settings-panel {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: min(86dvh, 760px);
  overflow-y: auto;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
}

.settings-panel-small {
  width: min(430px, 100%);
}

.settings-panel h2 {
  margin: 0 0 20px;
  font-size: 26px;
}

.settings-form {
  display: grid;
  gap: 14px;
}

.settings-form label > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.settings-form input,
.settings-form select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

.settings-form input:focus,
.settings-form select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.14);
}

.settings-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.password-rule {
  display: block;
  margin-top: -8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.settings-message.error {
  color: var(--rose);
}

.settings-message.success {
  color: #18864b;
}

.admin-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-right: 64px;
  margin-bottom: 20px;
}

.admin-heading h2 {
  margin: 3px 0 0;
}

.admin-heading > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.admin-panel .dialog-close {
  top: 18px;
  right: 18px;
}

.vip-admin-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.admin-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.admin-section-heading h3,
.admin-section-heading p {
  margin: 0;
}

.admin-section-heading h3 {
  margin-top: 3px;
  font-size: 18px;
}

.admin-section-heading p {
  color: var(--muted);
  font-size: 12px;
}

.vip-management-form {
  grid-template-columns: minmax(180px, 1fr) 130px auto auto;
  align-items: end;
}

.create-user-form {
  grid-template-columns: minmax(140px, 1fr) minmax(180px, 1fr) 140px auto;
  align-items: end;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.user-list {
  display: grid;
  margin-top: 6px;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.user-identity {
  min-width: 0;
}

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

.user-identity .user-member-id {
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.user-identity .user-vip-status {
  color: var(--muted);
  font-size: 12px;
}

.user-identity .user-vip-status.active {
  color: #18864b;
  font-weight: 700;
}

.user-identity strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-identity span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.role-badge {
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(0, 122, 255, 0.1);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.role-badge.inactive {
  background: var(--control);
  color: var(--muted);
}

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

.user-actions button {
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: var(--control);
  color: var(--ink);
}

.user-actions button[data-user-status="false"] {
  color: var(--rose);
}

.reset-user-form {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

body.settings-open {
  overflow: hidden;
}

.level-select {
  display: grid;
  gap: 4px;
  min-width: 160px;
}

.level-select span {
  color: var(--muted);
  font-size: 12px;
}

.level-select select,
.add-word-form select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  padding: 0 12px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  white-space: nowrap;
}

.primary-action {
  color: #ffffff;
  background: var(--accent);
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(0, 122, 255, 0.22);
}

.primary-action:hover {
  background: var(--accent-strong);
}

.secondary-action {
  color: var(--ink);
  background: var(--control);
  font-weight: 650;
}

.secondary-action:hover,
.icon-button:hover,
.segment:hover {
  transform: translateY(-1px);
}

.icon-button {
  width: 42px;
  min-width: 42px;
  color: var(--accent);
  background: var(--control);
  font-weight: 800;
}

.accent-actions {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
  align-items: center;
}

.accent-button {
  font-size: 14px;
  letter-spacing: 0;
}

.tab-view {
  display: none;
}

.search-panel {
  margin-bottom: 18px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.35);
}

.search-box {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.search-box label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.search-box input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.16);
}

.search-result {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.search-result-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.search-result-head strong {
  display: block;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1;
}

.search-result-head span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 18px;
}

#search-result-meaning {
  margin: 12px 0;
  font-size: 18px;
  line-height: 1.5;
}

.search-meta {
  margin: 0 0 12px;
}

.search-phonics {
  display: grid;
  grid-template-columns: 0.85fr 1fr 1.5fr;
  gap: 10px;
}

.search-phonics > div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 12px;
}

.search-phonics p,
.search-phonics ol {
  margin: 0;
  line-height: 1.55;
}

.search-phonics ol {
  padding-left: 18px;
}

.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
}

.learn-grid,
.practice-layout,
.library-layout,
.directory-layout,
.review-layout {
  display: grid;
  gap: 18px;
}

.learn-grid {
  grid-template-columns: minmax(320px, 1.15fr) minmax(260px, 0.85fr);
}

.word-focus,
.daily-plan,
.quiz-card,
.dictation-card,
.speaking-card,
.review-panel,
.add-word-form,
.word-list-panel,
.directory-search-panel,
.grade-directory-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.35);
}

.word-focus {
  grid-row: span 2;
  padding: 26px;
}

.word-focus,
.search-panel,
.phonics-panel,
.daily-plan,
.quiz-card,
.dictation-card,
.speaking-card,
.add-word-form,
.word-list-panel,
.directory-search-panel,
.grade-directory-panel {
  background-clip: padding-box;
}

.word-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.word-focus h3 {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: baseline;
  font-size: clamp(36px, 6vw, 72px);
  line-height: 1.14;
  max-width: 100%;
  padding: 0.04em 0 0.16em;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
  font-weight: 780;
}

.word-letter {
  flex: 0 0 auto;
  appearance: none;
  min-width: .72em;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 2px 0.12em;
  background: transparent;
  color: var(--ink);
  font: inherit;
  line-height: 1.08;
  text-align: center;
}

.word-space {
  flex: 0 0 .32em;
}

.word-letter:hover,
.word-letter.active {
  border-color: rgba(0, 122, 255, 0.28);
  background: rgba(0, 122, 255, 0.08);
  color: var(--accent);
}

.word-letter:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.18);
  outline-offset: 2px;
}

#word-phonetic {
  color: var(--muted);
  margin: 10px 0 0;
  font-size: 18px;
}

.letter-sound-hint {
  min-height: 24px;
  margin: 8px 0 0;
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
}

.meaning {
  font-size: 22px;
  margin: 24px 0;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -6px 0 18px;
}

.meta-row span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(0, 122, 255, 0.1);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.example-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  background: var(--green-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.example-box span {
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
}

.example-box p,
.quiz-question,
#speaking-target {
  margin: 8px 0 0;
  font-size: 19px;
  line-height: 1.55;
}

.example-phonetics {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.sentence-word-ipa {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.word-ipa-chip {
  display: inline-grid;
  gap: 3px;
  min-width: 78px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.word-ipa-chip strong {
  color: var(--ink);
  font-size: 14px;
}

.word-ipa-chip span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.sentence-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.sentence-panel .section-title-row {
  margin-bottom: 10px;
}

.translation-line {
  margin: 0 0 14px;
  padding: 12px;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--accent);
  line-height: 1.5;
  font-weight: 700;
}

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

.grammar-grid > div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.9);
}

.grammar-grid p {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
}

.word-actions {
  margin: 0 0 22px;
  flex-wrap: wrap;
}

.daily-plan,
.phonics-panel,
.quiz-card,
.dictation-card,
.speaking-card,
.review-panel,
.word-list-panel {
  padding: 20px;
}

.phonics-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.35);
}

.phonics-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 14px;
}

.phonics-grid > div {
  min-width: 0;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.wide-cell {
  grid-column: 1 / -1;
}

.mini-label {
  display: block;
  color: var(--accent);
  font-weight: 800;
  font-size: 12px;
  margin-bottom: 8px;
}

#syllables,
#grapheme-map {
  margin: 0;
  line-height: 1.5;
}

.phoneme-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.phoneme-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--accent);
  font-weight: 800;
}

#blend-steps {
  margin: 0;
  padding-left: 20px;
  line-height: 1.6;
}

.section-title-row {
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title-row span {
  color: var(--muted);
  font-size: 13px;
}

.timeline {
  display: grid;
  gap: 8px;
}

.timeline-item {
  appearance: none;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.timeline-item:hover {
  border-color: rgba(0, 122, 255, 0.35);
  background: #ffffff;
  transform: translateY(-1px);
}

.timeline-item:active {
  transform: translateY(0);
}

.timeline-item:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.18);
  outline-offset: 2px;
}

.timeline-item:first-child {
  border-top: 1px solid var(--line);
}

.timeline-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--control);
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
}

.timeline-item.done .timeline-dot {
  background: var(--accent);
  color: white;
}

.timeline-item strong {
  display: block;
  font-size: 16px;
  letter-spacing: 0;
}

.timeline-item p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.practice-layout {
  grid-template-columns: minmax(320px, 1.2fr) minmax(280px, 0.8fr);
}

.review-layout {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
}

.review-intro,
.review-empty {
  margin: -4px 0 16px;
  color: var(--muted);
  line-height: 1.55;
}

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

.review-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.review-item.due {
  border-color: rgba(0, 122, 255, 0.34);
  background: rgba(0, 122, 255, 0.07);
}

.review-item strong {
  display: block;
  font-size: 20px;
}

.review-item p,
.review-item span {
  display: block;
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.review-stat-grid {
  display: grid;
  gap: 10px;
}

.review-stat-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 14px;
}

.review-stat-grid strong {
  display: block;
  font-size: 28px;
}

.review-stat-grid span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.quiz-card {
  grid-row: span 2;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.option-button {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  text-align: left;
  padding: 12px;
}

.option-button.correct {
  border-color: var(--accent);
  background: rgba(0, 122, 255, 0.1);
}

.option-button.wrong {
  border-color: var(--rose);
  background: rgba(255, 59, 48, 0.1);
}

.feedback {
  min-height: 26px;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.dictation-card input,
.add-word-form input,
.add-word-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  padding: 12px;
  color: var(--ink);
  outline: none;
}

.dictation-card input:focus,
.add-word-form input:focus,
.add-word-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.16);
}

.compact {
  margin-top: 12px;
}

.wide {
  width: 100%;
}

.library-layout {
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
}

.directory-layout {
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
}

.add-word-form {
  padding: 20px;
  display: grid;
  gap: 14px;
  align-self: start;
}

.add-word-form label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.segmented {
  gap: 4px;
  background: var(--control);
  padding: 4px;
  border-radius: 8px;
}

.segment {
  min-height: 30px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
}

.segment.active {
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.word-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 175px);
  overflow: auto;
  padding-right: 4px;
}

.word-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.word-item strong {
  display: block;
  font-size: 18px;
}

.word-item p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.word-item-actions {
  display: flex;
  gap: 6px;
}

.directory-search-panel,
.grade-directory-panel {
  padding: 20px;
}

.directory-search-panel {
  align-self: start;
  display: grid;
  gap: 14px;
}

.vocab-status {
  margin: -4px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 159, 10, 0.28);
  border-radius: 8px;
  background: rgba(255, 159, 10, 0.1);
  color: #8a4b00;
  font-size: 13px;
  line-height: 1.45;
}

.directory-search span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.directory-search input {
  width: 100%;
}

.directory-results {
  display: grid;
  gap: 10px;
}

.directory-empty {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.directory-result {
  appearance: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  text-align: left;
}

.directory-result:hover,
.directory-word:hover {
  border-color: rgba(0, 122, 255, 0.35);
  background: #ffffff;
}

.directory-result strong,
.directory-word strong {
  display: block;
  letter-spacing: 0;
}

.directory-result em {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-style: normal;
}

.directory-result b {
  color: var(--accent);
  font-size: 13px;
}

.grade-directory {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 175px);
  overflow: auto;
  padding-right: 4px;
}

.grade-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.grade-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  cursor: pointer;
  list-style: none;
}

.grade-group summary::-webkit-details-marker {
  display: none;
}

.grade-group summary span {
  font-weight: 800;
}

.grade-group summary strong {
  color: var(--muted);
  font-size: 13px;
}

.directory-word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  padding: 0 12px 12px;
}

.directory-word {
  appearance: none;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.directory-word span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.directory-word.matched {
  border-color: rgba(0, 122, 255, 0.5);
  background: rgba(0, 122, 255, 0.08);
}

body[data-active-tab="quest"] .level-select,
body[data-active-tab="membership"] .level-select {
  display: none;
}

.quest-shell {
  display: grid;
  gap: 18px;
}

.quest-course-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-left: 5px solid #34c759;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.quest-course-copy h3 {
  margin: 4px 0 8px;
  font-size: 26px;
}

.quest-course-copy > p:last-child {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.quest-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 8px;
}

.quest-stats div {
  min-width: 92px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f5f7;
}

.quest-stats span,
.quest-stats strong {
  display: block;
}

.quest-stats span {
  color: var(--muted);
  font-size: 12px;
}

.quest-stats strong {
  margin-top: 3px;
  font-size: 18px;
}

.course-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control);
}

.course-tab {
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.course-tab:hover,
.course-tab.active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.course-tab.active {
  color: var(--accent);
}

.quest-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1.08fr) minmax(350px, 0.92fr);
  gap: 18px;
  align-items: start;
}

.quest-path-panel,
.quest-stage {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.35);
}

.quest-path-panel {
  padding: 22px;
}

.quest-path-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.quest-path-heading strong {
  display: block;
  font-size: 21px;
}

.quest-path-heading > span {
  color: var(--accent);
  font-weight: 800;
}

.quest-course-progress,
.quest-chapter-progress,
.quest-stage-progress {
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(60, 60, 67, 0.12);
}

.quest-course-progress {
  height: 10px;
  margin: 12px 0 24px;
}

.quest-course-progress span,
.quest-chapter-progress span,
.quest-stage-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #34c759;
  transition: width 0.25s ease;
}

.quest-path {
  position: relative;
  display: grid;
  gap: 14px;
}

.quest-path::before {
  content: "";
  position: absolute;
  top: 34px;
  bottom: 34px;
  left: 26px;
  width: 2px;
  background: rgba(60, 60, 67, 0.14);
}

.quest-chapter {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.quest-chapter-marker {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 4px solid #ffffff;
  border-radius: 50%;
  background: #e5e5ea;
  color: var(--muted);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.12);
  font-weight: 850;
}

.quest-chapter.open .quest-chapter-marker {
  background: var(--accent);
  color: #ffffff;
}

.quest-chapter.ready .quest-chapter-marker {
  background: var(--warm);
  color: #1d1d1f;
}

.quest-chapter.complete .quest-chapter-marker {
  background: #34c759;
  color: #ffffff;
}

.quest-chapter.premium .quest-chapter-marker {
  background: #1d1d1f;
  color: #ffffff;
}

.quest-chapter.locked {
  opacity: 0.62;
}

.quest-chapter-body {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.quest-chapter.ready .quest-chapter-body {
  border-color: rgba(255, 159, 10, 0.45);
  background: rgba(255, 159, 10, 0.07);
}

.quest-chapter.complete .quest-chapter-body {
  border-color: rgba(52, 199, 89, 0.4);
  background: rgba(52, 199, 89, 0.07);
}

.quest-chapter.premium .quest-chapter-body {
  border-color: rgba(255, 159, 10, 0.45);
  background: rgba(255, 159, 10, 0.06);
}

.quest-chapter-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.quest-chapter-title span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.quest-chapter-title h4 {
  margin: 4px 0 0;
  font-size: 18px;
}

.quest-chapter-title > strong {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 12px;
}

.quest-chapter > .quest-chapter-body > p {
  margin: 9px 0 12px;
  color: var(--muted);
  line-height: 1.45;
}

.quest-chapter-progress {
  height: 7px;
}

.quest-chapter-action {
  width: 100%;
  margin-top: 12px;
}

.quest-chapter-action:disabled {
  cursor: not-allowed;
  transform: none;
}

.quest-stage {
  position: sticky;
  top: 20px;
  min-height: 520px;
  padding: 24px;
}

.quest-stage-empty {
  margin: 0;
  color: var(--muted);
}

.quest-overview,
.quest-result {
  display: grid;
  justify-items: center;
  gap: 14px;
  min-height: 470px;
  align-content: center;
  text-align: center;
}

.quest-crest {
  width: 160px;
  height: 132px;
  color: var(--accent);
}

.quest-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
}

.quest-overview h3,
.quest-result h3 {
  margin: 0;
  font-size: 25px;
}

.quest-overview > p,
.quest-result > p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.quest-overview-meta,
.quest-reward-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}

.quest-overview-meta span,
.quest-reward-row span {
  padding: 7px 9px;
  border-radius: 8px;
  background: var(--control);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.quest-overview .wide,
.quest-result .wide {
  max-width: 360px;
}

.quest-stage-note {
  font-size: 12px;
}

.quest-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.quest-stage-head span {
  color: var(--muted);
  font-size: 12px;
}

.quest-stage-head h3 {
  margin: 4px 0 0;
  font-size: 22px;
}

.quest-stage-head > strong {
  color: var(--accent);
}

.quest-stage-progress {
  height: 9px;
  margin: 12px 0 22px;
}

.quest-word-card,
.quest-exam-question {
  margin: 0 -24px;
  padding: 22px 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f9f9fb;
}

.quest-word-title,
.quest-question-label {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.quest-word-title h4 {
  max-width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 44px;
  line-height: 1.18;
}

.quest-word-title p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.quest-word-meaning {
  display: block;
  margin-top: 18px;
  font-size: 21px;
}

.quest-example {
  margin-top: 18px;
  padding-left: 14px;
  border-left: 3px solid var(--accent);
}

.quest-example p,
.quest-example span {
  display: block;
  margin: 0;
  line-height: 1.5;
}

.quest-example span {
  margin-top: 5px;
  color: var(--muted);
}

.quest-stage-actions {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 10px;
  margin-top: 20px;
}

.quest-question-label > span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.quest-exam-question h4 {
  margin: 18px 0;
  font-size: 22px;
  line-height: 1.45;
}

.quest-options {
  display: grid;
  gap: 9px;
}

.quest-option {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 11px 13px;
  text-align: left;
  line-height: 1.4;
}

.quest-option:hover:not(:disabled) {
  border-color: rgba(0, 122, 255, 0.45);
  background: rgba(0, 122, 255, 0.06);
}

.quest-option.correct {
  border-color: #34c759;
  background: rgba(52, 199, 89, 0.12);
}

.quest-option.wrong {
  border-color: var(--rose);
  background: rgba(255, 59, 48, 0.1);
}

.quest-answer-feedback {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin: 20px -24px -24px;
  padding: 18px 24px;
  border-top: 1px solid var(--line);
  animation: quest-feedback-in 0.18s ease-out;
}

.quest-answer-feedback.correct {
  background: rgba(52, 199, 89, 0.12);
  color: #176a2d;
}

.quest-answer-feedback.wrong {
  background: rgba(255, 59, 48, 0.1);
  color: #9f251f;
}

.quest-answer-feedback strong,
.quest-answer-feedback p {
  display: block;
  margin: 0;
}

.quest-answer-feedback strong {
  font-size: 17px;
}

.quest-answer-feedback p {
  margin-top: 5px;
  line-height: 1.45;
}

.quest-exit-exam {
  width: 100%;
  margin-top: 18px;
}

.quest-result-mark {
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  border: 7px solid rgba(52, 199, 89, 0.2);
  border-radius: 50%;
  background: #34c759;
  color: #ffffff;
  font-size: 30px;
  font-weight: 850;
  box-shadow: 0 14px 30px rgba(52, 199, 89, 0.24);
}

.quest-result.retry .quest-result-mark {
  border-color: rgba(255, 159, 10, 0.22);
  background: var(--warm);
  color: #1d1d1f;
  box-shadow: 0 14px 30px rgba(255, 159, 10, 0.2);
}

.quest-toast {
  position: fixed;
  z-index: 30;
  top: 20px;
  right: 22px;
  max-width: min(360px, calc(100vw - 44px));
  padding: 12px 15px;
  border: 1px solid rgba(52, 199, 89, 0.32);
  border-radius: 8px;
  background: #ffffff;
  color: #176a2d;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.16);
  font-weight: 750;
  animation: quest-feedback-in 0.18s ease-out;
}

.quest-toast.error {
  border-color: rgba(255, 59, 48, 0.3);
  color: #9f251f;
}

.quest-toast.notice {
  border-color: rgba(255, 159, 10, 0.35);
  color: #8a4b00;
}

@keyframes quest-feedback-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nav-button.premium-active {
  color: #8a4b00;
}

.directory-word.premium-locked,
.directory-result.premium-locked {
  border-color: rgba(255, 159, 10, 0.34);
  background: rgba(255, 159, 10, 0.07);
}

.directory-word.premium-locked span,
.directory-result.premium-locked em,
.directory-result.premium-locked b {
  color: #8a4b00;
}

.accent-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.membership-shell {
  display: grid;
  gap: 18px;
}

.membership-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 320px);
  gap: 24px;
  align-items: center;
  padding: 24px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--warm);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.membership-summary h3 {
  margin: 5px 0 9px;
  font-size: 28px;
}

.membership-summary > div:first-child > p:last-child {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.membership-state {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f5f7;
}

.membership-state > span,
.membership-state > strong,
.membership-state > p {
  display: block;
}

.membership-state > span {
  color: var(--muted);
  font-size: 12px;
}

.membership-state > strong {
  margin-top: 4px;
  font-size: 22px;
}

.membership-state > p {
  margin: 5px 0 13px;
  color: var(--muted);
  line-height: 1.4;
}

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

.membership-plan {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.membership-plan.featured {
  border-color: rgba(255, 159, 10, 0.52);
  box-shadow: 0 20px 48px rgba(255, 159, 10, 0.12);
}

.plan-label {
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
}

.membership-plan.featured .plan-label,
.paywall-panel .plan-label {
  color: #a75a00;
}

.membership-plan h4 {
  margin: 7px 0 0;
  font-size: 21px;
}

.plan-price {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin: 18px 0;
}

.plan-price strong {
  font-size: 38px;
  line-height: 1;
}

.plan-price span {
  color: var(--muted);
}

.membership-plan ul {
  margin: 0 0 20px;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.75;
}

.membership-plan button:disabled {
  cursor: default;
  opacity: 0.72;
}

.premium-catalog {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.82);
}

.premium-catalog div {
  min-width: 0;
  padding: 16px;
}

.premium-catalog div + div {
  border-left: 1px solid var(--line);
}

.premium-catalog span,
.premium-catalog strong {
  display: block;
}

.premium-catalog span {
  color: #a75a00;
  font-size: 11px;
  font-weight: 850;
}

.premium-catalog strong {
  margin-top: 5px;
}

.payment-message {
  margin: 0;
  padding: 13px 15px;
  border: 1px solid rgba(52, 199, 89, 0.34);
  border-radius: 8px;
  background: rgba(52, 199, 89, 0.09);
  color: #176a2d;
  line-height: 1.5;
  font-weight: 700;
}

.payment-message.notice {
  border-color: rgba(255, 159, 10, 0.38);
  background: rgba(255, 159, 10, 0.08);
  color: #8a4b00;
}

.paywall-dialog[hidden] {
  display: none;
}

.paywall-dialog {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.paywall-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(7px);
}

.paywall-panel {
  position: relative;
  z-index: 1;
  width: min(470px, 100%);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

.paywall-close {
  position: absolute;
  top: 14px;
  right: 14px;
  color: var(--muted);
}

.paywall-panel h2 {
  margin: 10px 48px 8px 0;
  font-size: 26px;
}

.paywall-panel > p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.55;
}

.paywall-price-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.paywall-price-row div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f5f7;
}

.paywall-price-row strong,
.paywall-price-row span {
  display: block;
}

.paywall-price-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.paywall-panel > .wide + .wide {
  margin-top: 9px;
}

body.paywall-open {
  overflow: hidden;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .progress-panel {
    display: none;
  }

  .nav-tabs {
    grid-template-columns: repeat(7, 1fr);
  }

  .nav-button {
    justify-content: center;
  }

  .learn-grid,
  .practice-layout,
  .library-layout,
  .directory-layout,
  .review-layout {
    grid-template-columns: 1fr;
  }

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

  .quest-stage {
    position: static;
    min-height: 0;
  }

  .membership-plan-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
    min-height: 100dvh;
  }

  .sidebar {
    position: fixed;
    inset: auto 0 0;
    z-index: 18;
    display: block;
    padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border: 0;
    border-top: 1px solid var(--line);
    background: rgba(250, 250, 252, 0.94);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(22px) saturate(1.6);
  }

  .sidebar .brand,
  .sidebar .progress-panel {
    display: none;
  }

  .nav-tabs {
    grid-template-columns: repeat(7, minmax(52px, 1fr));
    gap: 2px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  body[data-role="user"] .nav-tabs {
    grid-template-columns: repeat(6, minmax(52px, 1fr));
  }

  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-button {
    min-width: 52px;
    min-height: 54px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 5px 2px;
    font-size: 11px;
    line-height: 1.1;
  }

  .nav-button span:first-child {
    width: auto;
    font-size: 17px;
  }

  .nav-button.active,
  .nav-button:hover {
    background: rgba(0, 122, 255, 0.1);
    color: var(--accent);
    box-shadow: none;
  }

  .content {
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
  }

  .topbar {
    position: relative;
    top: auto;
    z-index: auto;
    margin: 0 0 16px;
    padding: 0 0 4px;
    border-bottom: 0;
    background: transparent;
    backdrop-filter: none;
  }

  .topbar h2 {
    font-size: 28px;
  }

  .account-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    bottom: auto;
    left: auto;
    width: min(260px, calc(100vw - 36px));
  }

  .settings-dialog {
    place-items: end center;
    padding: 0;
  }

  .settings-panel {
    width: 100%;
    max-height: 92dvh;
    padding: 24px 18px calc(20px + env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
  }

  .create-user-form {
    grid-template-columns: 1fr;
  }

  .vip-management-form {
    grid-template-columns: 1fr 1fr;
  }

  .vip-management-form .primary-action,
  .vip-management-form .secondary-action {
    width: 100%;
  }

  .admin-heading {
    padding-right: 44px;
  }

  .admin-section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .create-user-form .primary-action {
    width: 100%;
  }

  .user-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .user-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .user-actions button {
    flex: 1;
  }
}

@media (max-width: 640px) {
  .login-screen {
    place-items: start center;
    padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
  }

  .login-card {
    width: 100%;
    margin: auto 0;
    gap: 12px;
    padding: 22px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.12);
  }

  .login-brand-logo {
    width: min(240px, 82%);
  }

  .login-card h1 {
    font-size: 26px;
  }

  .login-card input {
    min-height: 50px;
    font-size: 16px;
  }

  .recovery-dialog {
    place-items: end center;
    padding: 10px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .recovery-panel {
    width: 100%;
    max-height: calc(100dvh - 20px - env(safe-area-inset-bottom));
    padding: 22px 18px;
  }

  .auth-flow-panel h2 {
    font-size: 22px;
  }

  .settings-form label > .verification-row {
    grid-template-columns: minmax(0, 1fr) 116px;
  }

  .captcha-row {
    grid-template-columns: 104px minmax(68px, 1fr) 44px;
  }

  .captcha-row img {
    width: 104px;
  }

  .content {
    padding: 18px;
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
  }

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

  .topbar-actions,
  .word-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .primary-action,
  .secondary-action {
    flex: 1;
    min-width: 0;
  }

  .level-select {
    flex: 1 1 100%;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
  }

  .vip-management-form {
    grid-template-columns: 1fr;
  }

  .topbar-actions .level-select {
    grid-column: 1 / -1;
  }

  #start-quiz {
    width: 100%;
  }

  .account-menu {
    align-self: end;
  }

  .word-actions .primary-action,
  .word-actions .secondary-action,
  .review-actions .primary-action,
  .review-actions .secondary-action {
    flex: 1 1 100%;
    white-space: normal;
  }

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

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

  .search-box,
  .search-phonics {
    grid-template-columns: 1fr;
  }

  .search-box .primary-action {
    width: 100%;
  }

  .section-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .phoneme-chip {
    min-height: 28px;
    padding: 0 8px;
  }

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

  .nav-tabs {
    grid-template-columns: repeat(7, minmax(52px, 1fr));
  }

  .quest-course-bar {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .quest-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .quest-stats div {
    min-width: 0;
    padding: 9px;
  }

  .quest-stats strong {
    font-size: 16px;
  }

  .course-tab {
    min-height: 52px;
    padding: 5px;
    white-space: normal;
  }

  .quest-path-panel,
  .quest-stage {
    padding: 18px;
  }

  .quest-word-card,
  .quest-exam-question {
    margin-right: -18px;
    margin-left: -18px;
    padding-right: 18px;
    padding-left: 18px;
  }

  .quest-word-title h4 {
    font-size: 36px;
  }

  .quest-answer-feedback {
    grid-template-columns: 1fr;
    margin-right: -18px;
    margin-bottom: -18px;
    margin-left: -18px;
    padding-right: 18px;
    padding-left: 18px;
  }

  .quest-stage-actions {
    grid-template-columns: 1fr;
  }

  .quest-chapter-title {
    display: grid;
  }

  .quest-chapter-title > strong {
    justify-self: start;
  }

  .membership-summary {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .premium-catalog {
    grid-template-columns: 1fr;
  }

  .premium-catalog div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .paywall-panel {
    padding: 22px;
  }

  .paywall-price-row {
    grid-template-columns: 1fr;
  }

  .word-focus {
    padding: 20px;
  }
}
