/*
 * Word Market Mobile v1
 * Mobile-only presentation layer for the complete v2.4 learning engine.
 * The learning data, import pipeline, question engine, speech and progress
 * remain the same; this file only reshapes them for a touch-first phone UI.
 */

:root {
  color-scheme: dark light;
  --wm-mobile-header: 62px;
  --wm-mobile-nav: 72px;
  --wm-mobile-gutter: 14px;
  --wm-mobile-radius: 18px;
  --wm-mobile-radius-small: 13px;
  --wm-mobile-touch: 48px;
}

html.wm-mobile-root,
html.wm-mobile-root body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden !important;
  overscroll-behavior: none;
  background: var(--wm-window, #07100c);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body.wm-mobile-app.wm3-desktop-ready {
  min-width: 0 !important;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 50% -12%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 30%),
    var(--wm-window) !important;
  color: var(--wm-copy);
  overflow: hidden !important;
  touch-action: manipulation;
}

body.wm-mobile-app.wm3-desktop-ready #root {
  width: 100%;
  height: calc(100dvh - var(--wm-mobile-header)) !important;
  min-height: 0;
  margin-top: var(--wm-mobile-header) !important;
  overflow: hidden !important;
}

body.wm-mobile-app *,
body.wm-mobile-app *::before,
body.wm-mobile-app *::after {
  box-sizing: border-box;
}

body.wm-mobile-app button,
body.wm-mobile-app input,
body.wm-mobile-app select,
body.wm-mobile-app textarea {
  font-family: "IRANSansX Pro", "IRANSansX", Tahoma, Arial, sans-serif !important;
}

body.wm-mobile-app button,
body.wm-mobile-app [role="button"],
body.wm-mobile-app label,
body.wm-mobile-app select {
  touch-action: manipulation;
}

body.wm-mobile-app button:active,
body.wm-mobile-app [role="button"]:active {
  transform: scale(0.985);
}

body.wm-mobile-app button:focus-visible,
body.wm-mobile-app input:focus-visible,
body.wm-mobile-app select:focus-visible,
body.wm-mobile-app textarea:focus-visible {
  outline: 2px solid var(--accent) !important;
  outline-offset: 2px;
}

/* Native-feeling mobile app bar */
body.wm-mobile-app .wm3-titlebar {
  z-index: 14000;
  border: 0 !important;
  border-bottom: 1px solid var(--wm-line) !important;
  width: 100%;
  height: var(--wm-mobile-header) !important;
  color: var(--wm-copy);
  background: color-mix(in srgb, var(--wm-window) 91%, transparent) !important;
  display: block !important;
  box-shadow: 0 7px 24px rgba(0, 0, 0, 0.18) !important;
  backdrop-filter: blur(24px) saturate(1.2);
  position: fixed;
  inset: 0 0 auto;
  padding-top: env(safe-area-inset-top);
}

body.wm-mobile-app .wm3-window-row {
  border: 0 !important;
  width: 100%;
  height: calc(var(--wm-mobile-header) - env(safe-area-inset-top)) !important;
  direction: ltr !important;
  align-items: center;
  gap: 8px;
  padding: 8px 12px !important;
  display: flex;
}

body.wm-mobile-app .wm3-title-brand {
  height: 100%;
  direction: ltr;
  order: 3 !important;
  align-items: center;
  gap: 9px;
  padding: 0 !important;
  display: flex !important;
}

body.wm-mobile-app .wm3-title-logo {
  width: 36px !important;
  height: 36px !important;
  color: #102014 !important;
  background: linear-gradient(145deg, #c9ff82, var(--accent)) !important;
  border-radius: 10px !important;
  place-items: center;
  font-family: "Segoe UI", Arial, sans-serif !important;
  font-size: 21px !important;
  font-weight: 900 !important;
  display: grid;
  box-shadow: 0 7px 20px color-mix(in srgb, var(--accent) 16%, transparent);
}

body.wm-mobile-app .wm3-title-brand strong {
  color: var(--wm-copy);
  font-family: "Segoe UI", Arial, sans-serif !important;
  font-size: 14px !important;
  font-weight: 650;
  display: block !important;
}

body.wm-mobile-app .wm3-window-drag {
  min-width: 8px;
  height: 1px;
  order: 2 !important;
  flex: 1 1 auto;
}

body.wm-mobile-app .wm3-window-controls,
body.wm-mobile-app .wm3-ribbon-tabs {
  display: none !important;
}

body.wm-mobile-app .wm4-login-button {
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--wm-line));
  min-width: 66px;
  height: 38px !important;
  color: var(--wm-copy);
  background: color-mix(in srgb, var(--accent) 7%, var(--wm-panel-soft));
  border-radius: 11px !important;
  order: 1 !important;
  justify-content: center;
  gap: 6px;
  padding: 0 11px !important;
  display: inline-flex !important;
}

body.wm-mobile-app .wm4-login-button svg {
  width: 16px;
  height: 16px;
}

body.wm-mobile-app .wm4-login-button span {
  font-size: 12px !important;
  font-weight: 750;
  display: inline !important;
}

body.wm-mobile-app .wm-mobile-streak-button {
  border: 1px solid var(--wm-line);
  height: 38px;
  color: var(--wm-copy-soft);
  background: var(--wm-panel-soft);
  border-radius: 11px;
  order: 1;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
  display: inline-flex;
}

body.wm-mobile-app .wm-mobile-streak-button svg {
  width: 17px;
  height: 17px;
  color: var(--accent);
}

body.wm-mobile-app .wm-mobile-streak-button span {
  font-size: 10.5px;
  font-weight: 700;
}

/* App viewport and mobile bottom navigation */
body.wm-mobile-app .app-shell.wm3-desktop-shell {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  background: transparent !important;
  display: block !important;
  overflow: hidden !important;
}

body.wm-mobile-app .wm3-desktop-shell .ambient,
body.wm-mobile-app .wm3-desktop-shell .brand,
body.wm-mobile-app .wm3-desktop-shell .side-divider,
body.wm-mobile-app .wm3-desktop-shell .mini-profile,
body.wm-mobile-app .wm3-desktop-shell .sidebar-spacer,
body.wm-mobile-app .wm3-desktop-shell .install-card,
body.wm-mobile-app .wm3-desktop-shell .storage-note {
  display: none !important;
}

body.wm-mobile-app .wm3-desktop-shell .main-stage {
  width: 100%;
  height: 100% !important;
  min-height: 0 !important;
  background: transparent;
  overflow: hidden !important;
}

body.wm-mobile-app .wm3-desktop-shell .topbar {
  display: none !important;
}

body.wm-mobile-app .wm3-desktop-shell .page-content {
  width: 100%;
  height: 100% !important;
  min-height: 0;
  padding:
    15px
    var(--wm-mobile-gutter)
    calc(var(--wm-mobile-nav) + 24px + env(safe-area-inset-bottom)) !important;
  scroll-padding-bottom: calc(var(--wm-mobile-nav) + 30px);
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

body.wm-mobile-app .wm3-desktop-shell .page-content::-webkit-scrollbar {
  display: none;
}

body.wm-mobile-app .wm3-desktop-shell .sidebar {
  z-index: 13000 !important;
  border: 0 !important;
  border-top: 1px solid var(--wm-line) !important;
  width: 100% !important;
  height: calc(var(--wm-mobile-nav) + env(safe-area-inset-bottom)) !important;
  min-height: 0 !important;
  color: var(--wm-copy);
  background: color-mix(in srgb, var(--wm-window) 93%, transparent) !important;
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom)) !important;
  display: block !important;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(24px) saturate(1.18);
  position: fixed !important;
  inset: auto 0 0 !important;
}

body.wm-mobile-app .wm3-desktop-shell .side-nav {
  width: 100%;
  height: 100%;
  direction: rtl;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin: 0 !important;
  display: grid !important;
}

body.wm-mobile-app .wm3-desktop-shell .side-nav button {
  border: 0 !important;
  min-width: 0;
  width: 100% !important;
  min-height: 55px !important;
  height: 55px;
  color: var(--wm-copy-soft) !important;
  background: transparent !important;
  border-radius: 14px !important;
  flex-direction: column;
  align-items: center;
  justify-content: center !important;
  gap: 4px !important;
  padding: 3px 2px !important;
  font-size: 0 !important;
  display: flex !important;
  position: relative;
}

body.wm-mobile-app .wm3-desktop-shell .side-nav button::after {
  display: none !important;
}

body.wm-mobile-app .wm3-desktop-shell .side-nav button.active {
  color: #102014 !important;
  background: var(--accent) !important;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 17%, transparent);
}

body.wm-mobile-app .wm3-nav-icon,
body.wm-mobile-app .wm3-desktop-shell .side-nav button > span:first-child {
  width: 22px !important;
  height: 22px !important;
  color: inherit !important;
  background: transparent !important;
  place-items: center;
  display: grid !important;
}

body.wm-mobile-app .wm3-nav-icon svg {
  width: 20px !important;
  height: 20px !important;
}

body.wm-mobile-app .wm3-nav-label {
  color: inherit;
  font-size: 10.5px !important;
  font-weight: 700;
  line-height: 1;
  display: block !important;
}

/* Typography and cards */
body.wm-mobile-app .wm3-desktop-shell .page-heading {
  align-items: flex-start !important;
  gap: 12px !important;
  margin-bottom: 15px;
}

body.wm-mobile-app .wm3-desktop-shell .page-heading h1 {
  margin: 0;
  font-size: 22px !important;
  line-height: 1.55;
}

body.wm-mobile-app .wm3-desktop-shell .page-heading p,
body.wm-mobile-app .wm3-desktop-shell .section-heading p,
body.wm-mobile-app .wm3-desktop-shell p {
  font-size: 12.5px !important;
  line-height: 1.9 !important;
}

body.wm-mobile-app .wm3-desktop-shell small,
body.wm-mobile-app .wm3-desktop-shell label,
body.wm-mobile-app .wm3-desktop-shell .stat-ring-wrap p,
body.wm-mobile-app .wm3-desktop-shell .micro-insight p {
  font-size: 11.5px !important;
  line-height: 1.75;
}

body.wm-mobile-app .wm3-desktop-shell .section-heading h2 {
  font-size: 17px !important;
  line-height: 1.55;
}

body.wm-mobile-app .wm3-desktop-shell .panel,
body.wm-mobile-app .wm3-desktop-shell .hero-card,
body.wm-mobile-app .wm3-desktop-shell .today-card,
body.wm-mobile-app .wm3-desktop-shell .settings-card,
body.wm-mobile-app .wm3-desktop-shell .library-pack,
body.wm-mobile-app .wm3-desktop-shell .mode-card,
body.wm-mobile-app .question-card,
body.wm-mobile-app .question-aside,
body.wm-mobile-app .feedback-box,
body.wm-mobile-app .results-view {
  border-color: var(--wm-line) !important;
  background: color-mix(in srgb, var(--wm-panel-solid) 90%, transparent) !important;
  border-radius: var(--wm-mobile-radius) !important;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.12) !important;
}

body.wm-mobile-app .primary-button,
body.wm-mobile-app .ghost-button,
body.wm-mobile-app .secondary-button {
  min-height: var(--wm-mobile-touch) !important;
  border-radius: 13px !important;
  justify-content: center;
  font-size: 13px !important;
  font-weight: 800;
}

/* Workspace / home */
body.wm-mobile-app .wm3-desktop-shell .hero-grid,
body.wm-mobile-app .wm3-desktop-shell .lower-grid,
body.wm-mobile-app .wm3-desktop-shell .progress-overview,
body.wm-mobile-app .wm3-desktop-shell .progress-grid,
body.wm-mobile-app .wm3-desktop-shell .settings-grid,
body.wm-mobile-app .wm3-desktop-shell .word-list,
body.wm-mobile-app .wm3-desktop-shell .pack-list-grid {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 12px !important;
}

body.wm-mobile-app .wm3-desktop-shell .hero-card {
  min-height: 0 !important;
  display: block !important;
}

body.wm-mobile-app .wm3-desktop-shell .hero-copy {
  padding: 15px !important;
}

body.wm-mobile-app .wm3-desktop-shell .hero-visual {
  display: none !important;
}

body.wm-mobile-app .wm-practice-picker {
  border-radius: 15px !important;
  padding: 14px !important;
}

body.wm-mobile-app .wm3-practice-heading {
  align-items: flex-start !important;
  gap: 10px;
}

body.wm-mobile-app .wm3-practice-heading h1,
body.wm-mobile-app .wm-practice-picker h1 {
  margin: 4px 0 0 !important;
  font-size: 20px !important;
  line-height: 1.55 !important;
}

body.wm-mobile-app .wm4-practice-controls {
  gap: 14px !important;
  margin-top: 14px !important;
}

body.wm-mobile-app .wm4-control-block > span,
body.wm-mobile-app .wm4-session-options label > span:first-child {
  margin-bottom: 7px !important;
  font-size: 11.5px !important;
}

body.wm-mobile-app .wm3-desktop-shell .wm-mode-chips {
  width: 100%;
  flex-wrap: nowrap !important;
  gap: 7px !important;
  margin: 0 !important;
  padding-bottom: 3px;
  display: flex !important;
  overflow-x: auto;
  scrollbar-width: none;
}

body.wm-mobile-app .wm3-desktop-shell .wm-mode-chips::-webkit-scrollbar,
body.wm-mobile-app .wm4-difficulty-chips::-webkit-scrollbar {
  display: none;
}

body.wm-mobile-app .wm3-desktop-shell .wm-mode-chip {
  min-width: max-content !important;
  min-height: 39px !important;
  border-radius: 11px !important;
  padding: 0 14px !important;
  font-size: 11.5px !important;
}

body.wm-mobile-app .wm4-difficulty-chips {
  width: 100% !important;
  max-width: 100%;
  border-radius: 12px !important;
  gap: 4px !important;
  padding: 4px !important;
  overflow-x: auto;
  scrollbar-width: none;
}

body.wm-mobile-app .wm4-difficulty-chips button {
  min-width: 78px !important;
  height: 38px !important;
  border-radius: 9px !important;
  font-size: 11px !important;
}

body.wm-mobile-app .wm4-session-options {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

body.wm-mobile-app .wm4-session-options > label:not(.wm4-coach-toggle) {
  min-width: 0;
  border-radius: 12px !important;
  padding: 9px 10px !important;
}

body.wm-mobile-app .wm4-session-options select {
  min-height: 32px !important;
  font-size: 12px !important;
}

body.wm-mobile-app .wm4-coach-toggle {
  min-height: 63px !important;
  border-radius: 12px !important;
  grid-column: 1 / -1;
}

body.wm-mobile-app .wm4-coach-toggle strong {
  font-size: 12px !important;
}

body.wm-mobile-app .wm4-coach-toggle small {
  font-size: 10.5px !important;
}

body.wm-mobile-app .wm3-desktop-shell .hero-actions {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px !important;
  margin-top: 14px !important;
  display: grid !important;
}

body.wm-mobile-app .wm3-desktop-shell .hero-actions button {
  min-height: 49px !important;
  border-radius: 13px !important;
  font-size: 13px !important;
}

body.wm-mobile-app .wm3-desktop-shell .today-card {
  padding: 16px !important;
  display: block !important;
}

body.wm-mobile-app .rings-row {
  width: 100%;
  justify-content: space-between;
  gap: 5px !important;
  margin-top: 15px !important;
}

body.wm-mobile-app .stat-ring {
  width: 76px !important;
  height: 76px !important;
}

body.wm-mobile-app .stat-ring::after {
  width: 64px !important;
  height: 64px !important;
}

body.wm-mobile-app .stat-ring strong {
  font-size: 16px !important;
}

body.wm-mobile-app .stat-ring-wrap > p {
  margin-top: 8px !important;
  font-size: 11.5px !important;
  font-weight: 650;
}

body.wm-mobile-app .micro-insight {
  border-radius: 13px !important;
  margin-top: 14px !important;
  padding: 12px !important;
}

body.wm-mobile-app .word-card,
body.wm-mobile-app .active-pack-card {
  border-radius: var(--wm-mobile-radius) !important;
  padding: 15px !important;
}

body.wm-mobile-app .wm3-active-source {
  min-height: 56px;
  border-radius: 12px !important;
  padding: 10px 12px !important;
}

body.wm-mobile-app .wm3-active-source strong {
  font-size: 13px !important;
}

/* Practice session */
body.wm-mobile-app .game-view {
  width: 100%;
  min-height: 100%;
  padding: 0 !important;
}

body.wm-mobile-app .game-topline {
  border: 1px solid var(--wm-line);
  width: 100%;
  min-height: 62px;
  background: var(--wm-panel-soft);
  border-radius: 15px;
  grid-template-columns: auto minmax(0, 1fr) auto !important;
  align-items: center;
  gap: 8px !important;
  margin-bottom: 12px;
  padding: 8px !important;
}

body.wm-mobile-app .game-topline > * {
  min-width: 0;
}

body.wm-mobile-app .game-mode-title,
body.wm-mobile-app .wm4-session-status {
  display: none !important;
}

body.wm-mobile-app .game-progress {
  grid-column: 2;
}

body.wm-mobile-app .game-close,
body.wm-mobile-app .game-topline > button {
  min-width: 42px !important;
  width: 42px !important;
  height: 42px !important;
  border-radius: 12px !important;
}

body.wm-mobile-app .question-stage {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 12px !important;
}

body.wm-mobile-app .question-card {
  min-width: 0;
  min-height: 0 !important;
  padding: 17px 15px !important;
  order: 1;
}

body.wm-mobile-app .question-aside {
  min-width: 0;
  padding: 14px !important;
  order: 2;
  display: block !important;
}

body.wm-mobile-app .question-aside .status-row,
body.wm-mobile-app .wm4-strategy-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

body.wm-mobile-app .question-aside h3,
body.wm-mobile-app .question-aside strong {
  font-size: 12.5px !important;
}

body.wm-mobile-app .question-aside p,
body.wm-mobile-app .question-aside span,
body.wm-mobile-app .question-aside small {
  font-size: 11px !important;
}

body.wm-mobile-app .question-number,
body.wm-mobile-app .question-meta {
  font-size: 11px !important;
}

body.wm-mobile-app .question-prompt {
  margin-block: 18px !important;
  font-size: clamp(22px, 7vw, 31px) !important;
  line-height: 1.65 !important;
  overflow-wrap: anywhere;
}

body.wm-mobile-app .question-prompt[dir="ltr"] {
  direction: ltr;
  text-align: center;
  font-family: "Segoe UI", Arial, sans-serif !important;
  line-height: 1.5 !important;
}

body.wm-mobile-app .question-word {
  font-size: clamp(34px, 12vw, 48px) !important;
}

body.wm-mobile-app .option-grid {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 9px !important;
}

body.wm-mobile-app .option-grid button {
  width: 100%;
  min-height: 53px !important;
  border-radius: 13px !important;
  align-items: center;
  padding: 10px 13px !important;
  font-size: 13px !important;
  line-height: 1.75 !important;
}

body.wm-mobile-app .answer-input,
body.wm-mobile-app .question-card input[type="text"],
body.wm-mobile-app .question-card textarea {
  width: 100%;
  min-height: 52px !important;
  border-radius: 13px !important;
  padding: 10px 13px !important;
  font-size: 16px !important;
}

body.wm-mobile-app .question-actions {
  flex-wrap: wrap;
  gap: 8px !important;
}

body.wm-mobile-app .question-actions button {
  min-height: 48px !important;
  border-radius: 13px !important;
  font-size: 13px !important;
}

body.wm-mobile-app .sentence-tokens,
body.wm-mobile-app .sentence-answer {
  gap: 8px !important;
  padding: 12px !important;
}

body.wm-mobile-app .sentence-tokens button,
body.wm-mobile-app .sentence-answer button {
  min-height: 43px !important;
  border-radius: 11px !important;
  padding: 7px 11px !important;
  font-size: 13px !important;
}

body.wm-mobile-app .spelling-mask {
  font-size: clamp(28px, 10vw, 42px) !important;
  letter-spacing: 0.09em !important;
}

body.wm-mobile-app .soft-hint {
  font-size: 11.5px !important;
  line-height: 1.8 !important;
}

body.wm-mobile-app .feedback-box {
  margin-top: 12px !important;
  padding: 14px !important;
}

body.wm-mobile-app .feedback-title {
  font-size: 15px !important;
}

body.wm-mobile-app .learning-note-grid {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 9px !important;
}

body.wm-mobile-app .learning-note-grid .wide {
  grid-column: auto !important;
}

body.wm-mobile-app .learning-note-grid > div {
  border-radius: 12px !important;
  padding: 12px !important;
}

body.wm-mobile-app .learning-note-grid p,
body.wm-mobile-app .learning-note-grid span {
  font-size: 12px !important;
  line-height: 1.9 !important;
}

body.wm-mobile-app .confidence-row {
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 9px !important;
}

body.wm-mobile-app .confidence-row > div {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  display: grid !important;
}

body.wm-mobile-app .confidence-row button {
  min-width: 0;
  min-height: 45px !important;
  border-radius: 11px !important;
  padding: 5px !important;
  font-size: 10.5px !important;
}

/* Results */
body.wm-mobile-app .results-view {
  padding: 16px !important;
}

body.wm-mobile-app .result-hero {
  padding: 20px 14px !important;
}

body.wm-mobile-app .result-hero h1,
body.wm-mobile-app .results-view h1 {
  font-size: 22px !important;
  line-height: 1.65 !important;
}

body.wm-mobile-app .result-score,
body.wm-mobile-app .score-ring {
  width: 112px !important;
  height: 112px !important;
  margin-inline: auto;
}

body.wm-mobile-app .result-score strong,
body.wm-mobile-app .score-ring strong {
  font-family: "IRANSansX Pro", Tahoma, Arial, sans-serif !important;
  font-size: 27px !important;
}

body.wm-mobile-app .result-stats,
body.wm-mobile-app .summary-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

body.wm-mobile-app .result-stats > div,
body.wm-mobile-app .summary-metrics > div {
  min-height: 94px !important;
  border: 1px solid var(--wm-line) !important;
  border-radius: 12px;
}

body.wm-mobile-app .result-stats strong,
body.wm-mobile-app .summary-metrics strong {
  font-size: 20px !important;
}

body.wm-mobile-app .review-list {
  max-height: none !important;
  overflow: visible !important;
}

body.wm-mobile-app .review-row {
  border-radius: 12px !important;
  grid-template-columns: 26px minmax(0, 1fr) auto !important;
  gap: 8px !important;
  padding: 10px !important;
}

body.wm-mobile-app .review-row > span:nth-child(3) {
  display: none !important;
}

body.wm-mobile-app .review-row strong {
  font-size: 12px !important;
}

body.wm-mobile-app .review-row small {
  font-size: 10.5px !important;
}

/* Sources and import */
body.wm-mobile-app .wm3-desktop-shell .library-pack,
body.wm-mobile-app .wm3-desktop-shell .add-pack-card,
body.wm-mobile-app .wm3-desktop-shell .update-guide,
body.wm-mobile-app .wm3-desktop-shell .wm-source-intro {
  min-height: 0 !important;
  border-radius: var(--wm-mobile-radius) !important;
  padding: 15px !important;
}

body.wm-mobile-app .library-pack-top {
  grid-template-columns: minmax(0, 1fr) auto !important;
}

body.wm-mobile-app .library-pack-top h2 {
  font-size: 15px !important;
}

body.wm-mobile-app .pack-description {
  min-height: 0 !important;
  font-size: 12px !important;
  line-height: 1.9 !important;
}

body.wm-mobile-app .pack-pages span {
  border-radius: 8px !important;
  padding: 5px 8px !important;
  font-size: 10px !important;
}

body.wm-mobile-app .pack-actions {
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 8px !important;
}

body.wm-mobile-app .pack-actions button {
  min-height: 44px !important;
  border-radius: 11px !important;
  font-size: 11.5px !important;
}

body.wm-mobile-app .add-pack-card {
  min-height: 180px !important;
}

body.wm-mobile-app .add-pack-card > span {
  width: 52px !important;
  height: 52px !important;
  border-radius: 15px !important;
}

body.wm-mobile-app .add-pack-card strong {
  font-size: 14px !important;
}

body.wm-mobile-app .add-pack-card p {
  max-width: 280px !important;
  font-size: 11.5px !important;
}

body.wm-mobile-app .update-guide {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 15px !important;
}

body.wm-mobile-app .update-guide ol {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 9px !important;
}

body.wm-mobile-app .update-guide li strong {
  font-size: 12px !important;
}

body.wm-mobile-app .update-guide li p {
  font-size: 10.5px !important;
}

body.wm-mobile-app .wm2-modal-backdrop {
  z-index: 22000 !important;
  place-items: end center !important;
  padding: 0 !important;
}

body.wm-mobile-app .wm2-modal,
body.wm-mobile-app .wm2-import-dialog,
body.wm-mobile-app .wm2-review-dialog,
body.wm-mobile-app .import-modal {
  width: min(100%, 100vw) !important;
  max-width: none !important;
  max-height: calc(100dvh - 18px) !important;
  border-radius: 22px 22px 0 0 !important;
  margin-top: auto;
  padding: 15px !important;
  overflow-y: auto !important;
}

body.wm-mobile-app .wm2-modal-header,
body.wm-mobile-app .wm2-modal-body,
body.wm-mobile-app .wm2-modal-footer {
  padding-inline: 14px !important;
}

body.wm-mobile-app .wm2-modal-title h2 {
  font-size: 16px !important;
}

body.wm-mobile-app .wm2-modal-title p {
  font-size: 10.5px !important;
}

body.wm-mobile-app .wm2-import-steps {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 4px !important;
  padding-inline: 10px !important;
}

body.wm-mobile-app .wm2-import-step {
  min-width: 0;
  font-size: 9.5px !important;
}

body.wm-mobile-app .wm2-import-grid,
body.wm-mobile-app .wm2-review-grid,
body.wm-mobile-app .wm3-voice-grid,
body.wm-mobile-app .wm3-extraction-summary {
  grid-template-columns: minmax(0, 1fr) !important;
}

body.wm-mobile-app .wm2-dropzone,
body.wm-mobile-app .wm2-drop-zone,
body.wm-mobile-app .upload-zone {
  min-height: 170px !important;
  border-radius: 16px !important;
  padding: 18px 14px !important;
}

body.wm-mobile-app .wm2-dropzone h3 {
  font-size: 14px !important;
}

body.wm-mobile-app .wm2-dropzone p {
  font-size: 11px !important;
}

body.wm-mobile-app .wm2-file-types {
  flex-wrap: wrap;
  justify-content: center;
}

body.wm-mobile-app .wm2-file-types span {
  border-radius: 8px !important;
  font-size: 9.5px !important;
}

body.wm-mobile-app .wm-mobile-source-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 10px;
  display: grid;
}

body.wm-mobile-app .wm-mobile-source-actions button {
  border: 1px solid var(--wm-line);
  min-width: 0;
  min-height: 76px;
  color: var(--wm-copy);
  background: var(--wm-panel-soft);
  border-radius: 14px;
  align-items: center;
  grid-template-columns: 39px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 9px;
  padding: 10px;
  text-align: right;
  display: grid;
}

body.wm-mobile-app .wm-mobile-source-actions button > span {
  width: 39px;
  height: 39px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  border-radius: 11px;
  place-items: center;
  grid-row: 1 / 3;
  display: grid;
}

body.wm-mobile-app .wm-mobile-source-actions svg {
  width: 21px;
  height: 21px;
}

body.wm-mobile-app .wm-mobile-source-actions strong {
  align-self: end;
  font-size: 11.5px;
}

body.wm-mobile-app .wm-mobile-source-actions small {
  align-self: start;
  color: var(--wm-copy-soft);
  font-size: 9.5px !important;
}

body.wm-mobile-app .wm-mobile-camera-button {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--wm-line)) !important;
  background: color-mix(in srgb, var(--accent) 7%, var(--wm-panel-soft)) !important;
}

body.wm-mobile-app .wm2-toolbar {
  flex-wrap: wrap;
  gap: 8px !important;
}

body.wm-mobile-app .wm2-toolbar button,
body.wm-mobile-app .wm2-inline-button {
  min-height: 43px !important;
  border-radius: 11px !important;
  font-size: 11.5px !important;
}

body.wm-mobile-app .wm2-candidate-row {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 9px !important;
}

body.wm-mobile-app .wm2-form-grid,
body.wm-mobile-app .wm2-candidate-fields {
  grid-template-columns: minmax(0, 1fr) !important;
}

body.wm-mobile-app .wm2-form-field.wide,
body.wm-mobile-app .wm2-candidate-fields .wide {
  grid-column: auto !important;
}

body.wm-mobile-app .wm2-form-field input,
body.wm-mobile-app .wm2-form-field select,
body.wm-mobile-app .wm2-candidate-fields input,
body.wm-mobile-app .wm2-candidate-fields textarea {
  min-height: 45px !important;
  border-radius: 11px !important;
  font-size: 12px !important;
}

body.wm-mobile-app .wm2-modal-actions {
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px !important;
  display: grid !important;
}

body.wm-mobile-app .wm2-modal-actions button {
  width: 100%;
  min-height: 46px !important;
  border-radius: 11px !important;
  font-size: 12px !important;
}

/* Progress and settings */
body.wm-mobile-app .settings-card,
body.wm-mobile-app .skill-card,
body.wm-mobile-app .mastery-card,
body.wm-mobile-app .level-card {
  padding: 16px !important;
}

body.wm-mobile-app .settings-title h2 {
  font-size: 15px !important;
}

body.wm-mobile-app .settings-title p {
  font-size: 11px !important;
}

body.wm-mobile-app .settings-title > span {
  width: 44px !important;
  height: 44px !important;
  border-radius: 13px !important;
}

body.wm-mobile-app .segmented-control {
  border-radius: 13px !important;
  padding: 4px !important;
}

body.wm-mobile-app .segmented-control button {
  min-height: 43px !important;
  border-radius: 10px !important;
  font-size: 12px !important;
}

body.wm-mobile-app .toggle-row {
  min-height: 65px !important;
}

body.wm-mobile-app .toggle-row strong {
  font-size: 12px !important;
}

body.wm-mobile-app .toggle-row small {
  font-size: 10.5px !important;
}

body.wm-mobile-app .settings-action {
  min-height: 50px !important;
  border-radius: 12px !important;
  font-size: 12px !important;
}

body.wm-mobile-app .field-label select,
body.wm-mobile-app .wm2-settings-select {
  min-height: 46px !important;
  border-radius: 11px !important;
  font-size: 12px !important;
}

body.wm-mobile-app .level-card {
  align-items: center !important;
  gap: 16px !important;
}

body.wm-mobile-app .big-level {
  flex-basis: 82px !important;
  width: 82px !important;
  height: 82px !important;
  font-size: 31px !important;
}

body.wm-mobile-app .skill-bar-row span,
body.wm-mobile-app .pack-progress-line span {
  font-size: 12px !important;
}

body.wm-mobile-app .mastery-stage {
  grid-template-columns: 38px minmax(0, 1fr) auto !important;
  min-height: 60px;
}

body.wm-mobile-app .mastery-stage > span {
  width: 36px !important;
  height: 36px !important;
  border-radius: 11px !important;
}

body.wm-mobile-app .mastery-stage strong {
  font-size: 12px !important;
}

body.wm-mobile-app .mastery-stage small {
  font-size: 10px !important;
}

/* Streak calendar and dialogs */
body.wm-mobile-app .wm3-streak-backdrop,
body.wm-mobile-app .wm3-confirm-backdrop {
  place-items: end center !important;
  padding: 0 !important;
}

body.wm-mobile-app .wm3-streak-modal {
  width: 100% !important;
  max-height: calc(100dvh - 10px);
  border-radius: 24px 24px 0 0 !important;
  padding: 17px 14px calc(17px + env(safe-area-inset-bottom)) !important;
  overflow-y: auto;
}

body.wm-mobile-app .wm4-streak-hero {
  border-radius: 17px !important;
  padding: 15px !important;
}

body.wm-mobile-app .wm3-streak-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 7px !important;
}

body.wm-mobile-app .wm3-streak-stats article {
  border-radius: 12px !important;
  padding: 9px 4px !important;
}

body.wm-mobile-app .wm3-streak-stats strong {
  font-size: 19px !important;
}

body.wm-mobile-app .wm3-streak-stats span {
  font-size: 9.5px !important;
}

body.wm-mobile-app .wm3-calendar-grid {
  border-radius: 14px !important;
  gap: 2px !important;
  padding: 6px !important;
}

body.wm-mobile-app .wm3-calendar-grid > div {
  height: 40px !important;
}

body.wm-mobile-app .wm3-calendar-grid > div span {
  width: 32px !important;
  height: 32px !important;
  font-size: 11px !important;
}

body.wm-mobile-app .wm3-confirm-dialog {
  width: calc(100% - 24px) !important;
  border-radius: 18px !important;
  margin: auto auto calc(12px + env(safe-area-inset-bottom));
  padding: 16px !important;
}

body.wm-mobile-app .wm3-confirm-dialog footer {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  display: grid !important;
}

body.wm-mobile-app .wm3-confirm-dialog button {
  min-height: 46px !important;
  border-radius: 11px !important;
}

body.wm-mobile-app .toast {
  max-width: calc(100% - 28px) !important;
  width: max-content;
  border-radius: 13px !important;
  bottom: calc(var(--wm-mobile-nav) + 15px + env(safe-area-inset-bottom)) !important;
  padding: 11px 14px !important;
  font-size: 11.5px !important;
}

/* Theme integrity */
body.wm-mobile-app[data-wm-theme="light"] {
  background:
    radial-gradient(circle at 50% -12%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 32%),
    var(--wm-window) !important;
}

body.wm-mobile-app[data-wm-theme="light"] .wm3-titlebar,
body.wm-mobile-app[data-wm-theme="light"] .wm3-desktop-shell .sidebar {
  background: color-mix(in srgb, var(--wm-window) 92%, transparent) !important;
}

body.wm-mobile-app[data-wm-theme="light"] .wm3-desktop-shell .panel,
body.wm-mobile-app[data-wm-theme="light"] .wm3-desktop-shell .hero-card,
body.wm-mobile-app[data-wm-theme="light"] .wm3-desktop-shell .today-card,
body.wm-mobile-app[data-wm-theme="light"] .wm3-desktop-shell .settings-card,
body.wm-mobile-app[data-wm-theme="light"] .wm3-desktop-shell .library-pack,
body.wm-mobile-app[data-wm-theme="light"] .wm3-desktop-shell .mode-card,
body.wm-mobile-app[data-wm-theme="light"] .question-card,
body.wm-mobile-app[data-wm-theme="light"] .question-aside,
body.wm-mobile-app[data-wm-theme="light"] .feedback-box,
body.wm-mobile-app[data-wm-theme="light"] .results-view {
  background: rgba(255, 255, 255, 0.93) !important;
}

/* Very small phones */
@media (max-width: 370px) {
  :root {
    --wm-mobile-gutter: 10px;
  }

  body.wm-mobile-app .wm3-title-brand strong {
    display: none !important;
  }

  body.wm-mobile-app .wm-mobile-streak-button span {
    display: none;
  }

  body.wm-mobile-app .wm-mobile-streak-button {
    width: 38px;
    padding: 0;
  }

  body.wm-mobile-app .wm4-session-options {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.wm-mobile-app .wm4-coach-toggle {
    grid-column: auto;
  }

  body.wm-mobile-app .rings-row {
    transform: scale(0.94);
    transform-origin: center;
  }

  body.wm-mobile-app .confidence-row > div {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.wm-mobile-app .wm-mobile-source-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Landscape phones keep controls reachable without looking like desktop. */
@media (orientation: landscape) and (max-height: 520px) {
  :root {
    --wm-mobile-header: 54px;
    --wm-mobile-nav: 60px;
  }

  body.wm-mobile-app .wm3-title-logo {
    width: 32px !important;
    height: 32px !important;
  }

  body.wm-mobile-app .wm3-desktop-shell .sidebar {
    padding-top: 4px !important;
  }

  body.wm-mobile-app .wm3-desktop-shell .side-nav button {
    height: 48px;
    min-height: 48px !important;
  }

  body.wm-mobile-app .question-aside {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.wm-mobile-app *,
  body.wm-mobile-app *::before,
  body.wm-mobile-app *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
