/*
 * WallStreet0Name 2026 local redesign layer
 * Loaded after the legacy stylesheet so the migration stays reversible while
 * every existing page keeps its current business behavior.
 */

:root {
  color-scheme: light;
  --ws-page: #f5f7fb;
  --ws-surface: #ffffff;
  --ws-surface-raised: #ffffff;
  --ws-surface-subtle: #f8fafc;
  --ws-surface-muted: #f1f5f9;
  --ws-border: #e2e8f0;
  --ws-border-strong: #cbd5e1;
  --ws-text: #0f172a;
  --ws-text-secondary: #475569;
  --ws-text-muted: #526176;
  --ws-brand: #4f46e5;
  --ws-brand-hover: #4338ca;
  --ws-brand-soft: #eef2ff;
  --ws-on-brand: #ffffff;
  --ws-positive: #047857;
  --ws-positive-soft: #ecfdf5;
  --ws-warning: #b45309;
  --ws-warning-soft: #fffbeb;
  --ws-danger: #b91c1c;
  --ws-danger-soft: #fef2f2;
  --ws-info: #2563eb;
  --ws-info-soft: #eff6ff;
  --ws-shadow-sm: 0 1px 2px rgb(15 23 42 / 0.04);
  --ws-shadow-md: 0 12px 34px rgb(15 23 42 / 0.08);
  --ws-shadow-overlay: 0 24px 72px rgb(15 23 42 / 0.18);
  --ws-radius-control: 9px;
  --ws-radius-card: 14px;
  --ws-radius-overlay: 18px;
  --ws-content: 1240px;
  --ws-reading: 760px;
  --ws-header: 64px;
  --ws-mobile-nav: 68px;
  --ws-gutter: clamp(16px, 3vw, 32px);

  /* Legacy aliases. */
  --bg: var(--ws-page);
  --bg-2: var(--ws-surface-subtle);
  --glass: var(--ws-surface);
  --glass-heavy: var(--ws-surface-raised);
  --glass-light: var(--ws-surface-subtle);
  --glass-border: var(--ws-border);
  --glass-blur: none;
  --border: var(--ws-border);
  --accent: var(--ws-brand);
  --accent-hover: var(--ws-brand-hover);
  --accent-light: var(--ws-brand-soft);
  --accent-gradient: linear-gradient(135deg, #4f46e5, #6366f1);
  --primary: var(--ws-brand);
  --text-1: var(--ws-text);
  --text-2: var(--ws-text-secondary);
  --text-3: var(--ws-text-muted);
  --radius: var(--ws-radius-card);
  --radius-sm: var(--ws-radius-control);
  --radius-xs: 7px;
  --header-h: var(--ws-header);
  --sidebar-w: 300px;
  --shadow: var(--ws-shadow-sm);
  --shadow-sm: var(--ws-shadow-sm);
  --shadow-hover: var(--ws-shadow-md);
  --transition: 180ms cubic-bezier(.2, .8, .2, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --ws-page: #090d16;
  --ws-surface: #111827;
  --ws-surface-raised: #172033;
  --ws-surface-subtle: #131c2b;
  --ws-surface-muted: #1e293b;
  --ws-border: #2a3850;
  --ws-border-strong: #41516a;
  --ws-text: #f8fafc;
  --ws-text-secondary: #cbd5e1;
  --ws-text-muted: #94a3b8;
  --ws-brand: #818cf8;
  --ws-brand-hover: #a5b4fc;
  --ws-brand-soft: rgb(99 102 241 / 0.16);
  --ws-on-brand: #0f172a;
  --ws-positive: #34d399;
  --ws-positive-soft: rgb(16 185 129 / 0.13);
  --ws-warning: #fbbf24;
  --ws-warning-soft: rgb(245 158 11 / 0.13);
  --ws-danger: #f87171;
  --ws-danger-soft: rgb(239 68 68 / 0.13);
  --ws-info: #60a5fa;
  --ws-info-soft: rgb(59 130 246 / 0.14);
  --ws-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.25);
  --ws-shadow-md: 0 14px 40px rgb(0 0 0 / 0.28);
  --ws-shadow-overlay: 0 28px 80px rgb(0 0 0 / 0.48);
}

html {
  min-width: 320px;
  scroll-padding-top: calc(var(--ws-header) + 24px);
  background: var(--ws-page);
}

body {
  min-width: 320px;
  background: var(--ws-page);
  color: var(--ws-text);
  font-family: Inter, "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  letter-spacing: -0.005em;
}

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

button,
a,
input,
textarea,
select,
[tabindex] {
  -webkit-tap-highlight-color: transparent;
}

:where(button, a, input, textarea, select, [tabindex]):focus-visible {
  outline: 3px solid var(--ws-brand);
  outline-offset: 2px;
}

::selection {
  color: var(--ws-text);
  background: color-mix(in srgb, var(--ws-brand) 23%, transparent);
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 16px;
  z-index: 10000;
  translate: 0 -160%;
  padding: 10px 14px;
  border-radius: var(--ws-radius-control);
  color: var(--ws-on-brand);
  background: var(--ws-brand);
  font-weight: 700;
  transition: translate var(--transition);
}

.skip-link:focus { translate: 0; }

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

.bg-deco {
  opacity: .28;
  overflow: clip;
}

.blob {
  animation: none !important;
  filter: blur(110px);
}

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* ---------- Global shell ---------- */

.header {
  position: fixed;
  inset: 0 0 auto;
  width: 100%;
  height: var(--ws-header);
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--ws-border) 82%, transparent);
  border-radius: 0;
  padding: 0 max(20px, calc((100vw - var(--ws-content)) / 2));
  gap: 24px;
  background: color-mix(in srgb, var(--ws-surface) 94%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 1px 0 rgb(15 23 42 / .03);
}

.header-left { min-width: 0; }

.logo {
  min-width: max-content;
  min-height: 44px;
  gap: 10px;
  border-radius: var(--ws-radius-control);
}

.logo-avatar {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

.logo-text {
  font-size: 16px;
  font-weight: 760;
  letter-spacing: -.02em;
}

.header-nav {
  margin-left: 32px;
  gap: 2px;
}

.header-nav-item {
  min-height: 44px;
  padding: 0 13px;
  gap: 7px;
  border: 0;
  border-radius: var(--ws-radius-control);
  color: var(--ws-text-secondary);
  background: transparent;
  font-size: 14px;
  font-weight: 620;
  transition: color var(--transition), background-color var(--transition);
}

.header-nav-item:hover,
.header-nav-item[aria-expanded="true"],
.header-nav-item.active,
.header-nav-item[aria-current="page"] {
  color: var(--ws-text);
  background: var(--ws-surface-muted);
  transform: none;
}

.header-nav-item.active,
.header-nav-item[aria-current="page"] { color: var(--ws-brand); }

.header-nav-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  font-size: 0;
}

.header-nav-icon svg,
.mobile-bottom-nav svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-nav-caret { font-size: 11px; }

.header-right { gap: 8px; }
.auth-buttons { gap: 6px; }

.header .btn,
.user-menu-trigger {
  min-height: 44px;
  border-radius: var(--ws-radius-control);
}

.btn-theme-toggle {
  min-width: 44px;
  padding-inline: 10px;
}

.user-menu-trigger {
  padding: 4px;
  border: 1px solid transparent;
  background: transparent;
}

.user-menu-trigger:hover { background: var(--ws-surface-muted); }

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ws-brand);
  color: var(--ws-on-brand);
  font-weight: 700;
}

.header-market-panel,
.user-dropdown {
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-card);
  background: var(--ws-surface-raised);
  box-shadow: var(--ws-shadow-overlay);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.user-dropdown:not(.active),
.header-market-panel:not(.active) {
  visibility: hidden;
}

.header-market-panel {
  width: min(420px, calc(100vw - 32px));
  padding: 8px;
}

.header-market-item,
.dropdown-item {
  min-height: 44px;
  border-radius: 8px;
  color: var(--ws-text-secondary);
}

.header-market-item:hover,
.dropdown-item:hover {
  color: var(--ws-text);
  background: var(--ws-surface-muted);
}

.page-container {
  width: 100%;
  max-width: none;
  flex: 1 0 auto;
  padding: calc(var(--ws-header) + 34px) var(--ws-gutter) 72px;
  margin: 0;
}

#mainContent {
  width: min(100%, var(--ws-content));
  min-height: 50vh;
  margin: 0 auto;
}

.site-footer {
  width: 100%;
  margin-top: auto;
  border-top: 1px solid var(--ws-border);
  background: var(--ws-surface);
}

.site-footer-inner {
  width: min(calc(100% - 2 * var(--ws-gutter)), var(--ws-content));
  min-height: 150px;
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px 48px;
}

.site-footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-footer-brand img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.site-footer-brand div { display: grid; gap: 2px; }
.site-footer-brand strong { font-size: 15px; }
.site-footer-brand span,
.site-footer-inner > p { color: var(--ws-text-muted); font-size: 13px; }
.site-footer-inner > p { grid-column: 1 / -1; }

.site-footer-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-footer-links button,
.site-footer-links a {
  min-height: 44px;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  color: var(--ws-text-secondary);
  background: transparent;
  font-size: 13px;
}

.site-footer-links :is(button, a):hover {
  color: var(--ws-text);
  background: var(--ws-surface-muted);
}

.mobile-bottom-nav { display: none; }

.mobile-explore-overlay {
  position: fixed;
  inset: 0;
  z-index: 360;
  align-items: flex-end;
  justify-content: center;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  background: rgb(2 6 23 / .58);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.mobile-explore-sheet {
  width: min(620px, 100%);
  max-height: min(720px, calc(100dvh - 36px));
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--ws-border);
  border-radius: 20px;
  color: var(--ws-text);
  background: var(--ws-surface-raised);
  box-shadow: var(--ws-shadow-overlay);
}

.mobile-explore-header {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.mobile-explore-header p {
  margin: 0 0 3px;
  color: var(--ws-brand);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.mobile-explore-header h2 { margin: 0; font-size: 22px; }
.mobile-explore-close {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 0;
  border-radius: 50%;
  color: var(--ws-text-muted);
  background: var(--ws-surface-muted);
  font-size: 25px;
  line-height: 1;
}

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

.mobile-explore-grid :is(a, button) {
  min-width: 0;
  min-height: 78px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--ws-border);
  border-radius: 12px;
  color: var(--ws-text);
  background: var(--ws-surface-subtle);
  text-align: left;
  text-decoration: none;
}

.mobile-explore-grid :is(a, button):hover { border-color: var(--ws-brand); background: var(--ws-brand-soft); }
.mobile-explore-grid strong { font-size: 14px; }
.mobile-explore-grid span { color: var(--ws-text-muted); font-size: 12px; line-height: 1.45; }

/* ---------- Shared components ---------- */

.btn,
.btn-send-code,
.sort-btn,
.tab,
.back-btn,
.page-btn,
.forum-sort-btn,
.forum-search-btn {
  min-height: 44px;
  border-radius: var(--ws-radius-control);
  font-weight: 650;
  transition: color var(--transition), border-color var(--transition), background-color var(--transition), box-shadow var(--transition), translate var(--transition);
}

.btn { padding: 10px 16px; }
.btn-sm { min-height: 44px; padding: 7px 12px; font-size: 13px; }
.btn-xs { min-height: 44px; padding: 5px 10px; font-size: 12px; }
.btn-lg { min-height: 48px; padding: 12px 18px; }

.btn-primary,
.btn-send-code {
  border: 1px solid var(--ws-brand);
  color: var(--ws-on-brand);
  background: var(--ws-brand);
  box-shadow: none;
}

.btn-primary:hover,
.btn-send-code:hover {
  border-color: var(--ws-brand-hover);
  background: var(--ws-brand-hover);
  transform: none;
}

.btn-ghost,
.btn-outline,
.back-btn {
  border: 1px solid var(--ws-border);
  color: var(--ws-text-secondary);
  background: var(--ws-surface);
  box-shadow: none;
}

.btn-ghost:hover,
.btn-outline:hover,
.back-btn:hover {
  border-color: var(--ws-border-strong);
  color: var(--ws-text);
  background: var(--ws-surface-muted);
  transform: none;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  margin: 0 0 24px;
  padding: 9px 13px;
  font-size: 13px;
}

.form-input,
.trades-input,
.post-title-input,
.post-content-input,
.forum-search-input,
.admin-plan-input,
.admin-plan-select,
.admin-cms-textarea,
input,
textarea,
select {
  border-color: var(--ws-border);
  border-radius: var(--ws-radius-control);
  color: var(--ws-text);
  background: var(--ws-surface);
  box-shadow: none;
}

.form-input,
.trades-input,
.post-title-input,
.forum-search-input,
.admin-plan-input,
.admin-plan-select {
  min-height: 44px;
}

:where(input, textarea, select):focus {
  border-color: var(--ws-brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ws-brand) 15%, transparent);
}

.form-label { color: var(--ws-text-secondary); font-size: 13px; font-weight: 650; }
.form-hint,
.settings-hint { color: var(--ws-text-muted); font-size: 13px; }

.modal-overlay,
.warning-overlay,
.post-image-lightbox {
  background: rgb(2 6 23 / .54);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.modal,
.warning-modal,
.admin-order-modal-content {
  width: min(480px, calc(100vw - 32px));
  max-height: min(760px, calc(100dvh - 32px));
  overflow: auto;
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-overlay);
  color: var(--ws-text);
  background: var(--ws-surface-raised);
  box-shadow: var(--ws-shadow-overlay);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.modal-close,
.admin-order-modal-close,
.post-image-lightbox-close {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
}

.post-image-lightbox-dialog {
  position: relative;
  max-width: min(1100px, 100%);
  max-height: calc(100dvh - 64px);
  display: grid;
  place-items: center;
}

.post-image-lightbox-dialog .post-image-lightbox-close {
  top: -18px;
  right: -18px;
}

.create-post-form .ql-toolbar.ql-snow :is(button, .ql-picker-label) {
  min-width: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
}

.create-post-form .ql-toolbar.ql-snow .ql-picker-options .ql-picker-item {
  min-height: 44px;
  display: flex;
  align-items: center;
}

.loading-spinner,
.billing-loading,
.article-loading {
  color: var(--ws-text-muted);
}

.loading-spinner::before,
.billing-loading::before,
.article-loading::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 9px;
  vertical-align: -3px;
  border: 2px solid var(--ws-border-strong);
  border-top-color: var(--ws-brand);
  border-radius: 50%;
  animation: ws-spin .75s linear infinite;
}

@keyframes ws-spin { to { rotate: 1turn; } }

.empty-state,
.community-empty,
.forum-empty {
  border: 1px dashed var(--ws-border-strong);
  border-radius: var(--ws-radius-card);
  color: var(--ws-text-secondary);
  background: var(--ws-surface-subtle);
}

.page-title,
.membership-title,
.tools-title,
.trades-title,
.quotes-title,
.community-title,
.settings-section-title,
.admin-title {
  color: var(--ws-text);
  font-weight: 760;
  letter-spacing: -.035em;
}

.page-subtitle,
.membership-subtitle,
.tools-subtitle,
.trades-subtitle,
.quotes-subtitle,
.community-subtitle,
.settings-section-desc {
  color: var(--ws-text-secondary);
  line-height: 1.7;
}

/* ---------- Home and catalog ---------- */

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-w);
  align-items: start;
  gap: 32px;
}

.home-main { min-width: 0; }
.home-sidebar { width: auto; min-width: 0; }

.catalog-heading {
  margin: 0 0 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.catalog-heading h1 {
  color: var(--ws-text);
  font-size: clamp(25px, 3vw, 32px);
  line-height: 1.2;
  font-weight: 760;
  letter-spacing: -.035em;
}

.catalog-heading p {
  max-width: 48ch;
  color: var(--ws-text-muted);
  font-size: 14px;
  text-align: right;
}

.home-quotes {
  min-height: 248px;
  margin-bottom: 28px;
  padding: clamp(28px, 4vw, 52px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid #273454;
  border-radius: 20px;
  color: #e2e8f0;
  background: linear-gradient(140deg, #101827 0%, #172554 100%);
  box-shadow: none;
  overflow: hidden;
}

.home-quotes::before {
  inset: 20px auto auto 26px;
  color: rgb(255 255 255 / .08);
}

.quote-hero {
  max-width: 720px;
  margin: 0;
  color: #f8fafc;
  font-size: clamp(23px, 3vw, 36px);
  line-height: 1.42;
  font-weight: 720;
  letter-spacing: -.035em;
}

.quote-divider { width: 48px; margin: 22px 0 14px; }
.quote-detail { color: #cbd5e1; font-size: 13px; }
.quote-author { margin-top: 16px; color: #a5b4fc; }

.tabs {
  max-width: 100%;
  margin: 0 0 14px;
  padding: 4px;
  display: flex;
  gap: 3px;
  overflow-x: auto;
  border: 1px solid var(--ws-border);
  border-radius: 12px;
  background: var(--ws-surface);
  scrollbar-width: none;
}

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

.tab {
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 0;
  color: var(--ws-text-secondary);
  background: transparent;
  box-shadow: none;
  white-space: nowrap;
}

.tab:hover { color: var(--ws-text); background: var(--ws-surface-muted); }
.tab.active { color: var(--ws-page); background: var(--ws-text); box-shadow: none; }

.sort-bar {
  justify-content: flex-end;
  margin: 0 0 18px;
  gap: 4px;
}

.sort-btn {
  min-height: 44px;
  padding: 7px 12px;
  border: 1px solid transparent;
  color: var(--ws-text-muted);
  background: transparent;
  font-size: 13px;
}

.sort-btn:hover,
.sort-btn.active {
  border-color: var(--ws-border);
  color: var(--ws-text);
  background: var(--ws-surface);
}

[data-theme="dark"] .sort-btn.active {
  color: var(--ws-on-brand);
  border-color: var(--ws-brand);
  background: var(--ws-brand);
}

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

.episode-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-card);
  color: var(--ws-text);
  background: var(--ws-surface);
  box-shadow: var(--ws-shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition), translate var(--transition);
}

.episode-card:hover {
  translate: 0 -2px;
  border-color: var(--ws-border-strong);
  box-shadow: var(--ws-shadow-md);
}

.card-thumbnail { aspect-ratio: 16 / 9; min-height: 0; }
.card-thumbnail-bg { height: 100%; border-radius: 0; }

.card-body {
  min-height: 104px;
  padding: 14px 15px 16px;
  color: var(--ws-text);
  background: var(--ws-surface);
}

.card-title {
  min-height: 44px;
  color: var(--ws-text);
  font-size: 15px;
  line-height: 1.45;
  font-weight: 680;
  -webkit-line-clamp: 2;
}

.card-desc {
  margin-top: 7px;
  color: var(--ws-text-muted);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.card-duration,
.card-ep-badge,
.card-paid-badge,
.card-type-badge,
.card-complete-badge {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: none;
}

.card-paid-badge { color: #312e81; background: #e0e7ff; }
.card-type-badge { color: #075985; background: #e0f2fe; }
.card-progress { height: 3px; background: var(--ws-surface-muted); }

.sidebar-card {
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-card);
  color: var(--ws-text);
  background: var(--ws-surface);
  box-shadow: var(--ws-shadow-sm);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.sidebar-card h3 {
  margin-bottom: 14px;
  color: var(--ws-text);
  font-size: 14px;
  font-weight: 720;
}

.stats-grid { gap: 8px; }
.stat-box { padding: 12px 8px; border-radius: 9px; background: var(--ws-surface-subtle); }
.stat-number { color: var(--ws-text); font-size: 20px; }
.stat-label { color: var(--ws-text-muted); }

.sidebar-quote-item,
.history-item,
.update-item {
  border-color: var(--ws-border);
}

.sidebar-quote-open {
  width: 100%;
  min-height: 44px;
  border: 0;
  background: transparent;
}

.history-item,
.update-item {
  width: 100%;
  color: inherit;
  background: transparent;
  text-align: left;
}

.history-info,
.history-title,
.history-progress-bar,
.update-info,
.update-date { display: block; }

.sidebar-quote-num,
.update-icon {
  color: var(--ws-brand);
  background: var(--ws-brand-soft);
}

/* ---------- Course detail and reading ---------- */

.video-view,
.article-view {
  width: min(100%, 1120px);
  margin-inline: auto;
}

.video-container,
.article-container {
  overflow: hidden;
  border: 1px solid var(--ws-border);
  border-radius: 16px;
  background: #020617;
  box-shadow: var(--ws-shadow-md);
}

.video-container { aspect-ratio: 16 / 9; }

.video-info {
  margin-top: 20px;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-card);
  background: var(--ws-surface);
  box-shadow: var(--ws-shadow-sm);
}

.video-title {
  color: var(--ws-text);
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.3;
  font-weight: 760;
  letter-spacing: -.035em;
}

.video-description {
  margin-top: 8px;
  color: var(--ws-text-muted);
  font-size: 14px;
}

.video-actions {
  margin-top: 22px;
  gap: 8px;
}

.paid-hint { width: 100%; color: var(--ws-text-muted); }
.paid-hint-link,
.settings-link {
  appearance: none;
  min-height: 44px;
  align-items: center;
  border: 0;
  background: transparent;
  padding: 0 2px;
  font: inherit;
  cursor: pointer;
}

.paid-hint-link {
  display: inline-flex;
  color: var(--ws-brand);
  font-weight: 650;
}

.video-paywall-overlay {
  background: linear-gradient(145deg, #111827, #1e1b4b) !important;
}

.video-lock-icon { font-size: 38px; }
.video-lock-title { color: white; }
.video-lock-text { color: #cbd5e1; }

.article-container {
  min-height: 620px;
  background: var(--ws-surface);
  box-shadow: var(--ws-shadow-sm);
}

.article-frame { width: 100%; background: var(--ws-surface); }

.article-study-order,
.article-video-section {
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-card);
  color: var(--ws-text-secondary);
  background: var(--ws-surface-subtle);
}

.article-study-order-icon { color: var(--ws-brand); background: var(--ws-brand-soft); }

.warning-modal { padding: 28px; text-align: left; }
.warning-modal { position: relative; }
.warning-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--ws-text-muted);
  background: var(--ws-surface-muted);
  font-size: 24px;
  line-height: 1;
}
.warning-close:hover { color: var(--ws-text); background: var(--ws-brand-soft); }
.warning-icon { font-size: 28px; }
.warning-title { color: var(--ws-text); font-size: 20px; }
.warning-text { color: var(--ws-text-secondary); font-size: 14px; line-height: 1.75; }

/* ---------- Quiz, knowledge and mind map ---------- */

.quiz-section,
.knowledge-section,
.mindmap-section {
  width: min(100%, 960px);
  margin-inline: auto;
}

.quiz-page-title,
.knowledge-section > h1,
.mindmap-section > h1 {
  margin: 0 0 18px;
  color: var(--ws-text);
  font-size: clamp(25px, 3vw, 32px);
  line-height: 1.25;
  font-weight: 760;
  letter-spacing: -.035em;
}

.quiz-card,
.knowledge-card,
.mindmap-item,
.mindmap-structure-wrapper {
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-card);
  color: var(--ws-text);
  background: var(--ws-surface);
  box-shadow: var(--ws-shadow-sm);
}

.quiz-card { padding: clamp(20px, 4vw, 36px); }
.quiz-header { border-color: var(--ws-border); }
.quiz-header h1,
.quiz-header h2 { color: var(--ws-text); font-size: clamp(20px, 3vw, 27px); }
.quiz-question { color: var(--ws-text); font-size: clamp(18px, 2.4vw, 23px); line-height: 1.55; }

.quiz-progress-bar { height: 7px; background: var(--ws-surface-muted); }
.quiz-progress-fill { background: var(--ws-brand); }

.quiz-options { gap: 10px; }
.quiz-option {
  width: 100%;
  min-height: 52px;
  padding: 13px 14px;
  border: 1px solid var(--ws-border);
  border-radius: 10px;
  color: var(--ws-text-secondary);
  background: var(--ws-surface);
  text-align: left;
}

.quiz-option:hover { border-color: var(--ws-brand); background: var(--ws-brand-soft); }
.quiz-option.selected { border-color: var(--ws-brand); color: var(--ws-text); background: var(--ws-brand-soft); }
.quiz-option.correct { border-color: var(--ws-positive); background: var(--ws-positive-soft); }
.quiz-option.wrong { border-color: var(--ws-danger); background: var(--ws-danger-soft); }

.quiz-feedback,
.quiz-insight {
  border: 1px solid var(--ws-border);
  border-radius: 10px;
  background: var(--ws-surface-subtle);
}

.knowledge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.knowledge-card { padding: 20px; }
.knowledge-card:hover { translate: 0 -2px; box-shadow: var(--ws-shadow-md); }
.knowledge-card h3 { color: var(--ws-text); }

.mindmap-list { gap: 18px; }
.mindmap-item { padding: 18px; }
.mindmap-image-wrapper,
.mindmap-pdf-wrapper { border-radius: 10px; background: var(--ws-surface-subtle); }
.mindmap-structure-toolbar { border-color: var(--ws-border); background: var(--ws-surface-subtle); }
.mindmap-tool { min-width: 44px; min-height: 44px; border-radius: 8px; }

/* ---------- Membership ---------- */

.membership-page { width: min(100%, 1120px); margin-inline: auto; }
.membership-header { max-width: 720px; margin: 0 auto 32px; text-align: center; }
.membership-title { font-size: clamp(30px, 5vw, 46px); line-height: 1.15; }
.membership-subtitle { margin-top: 12px; font-size: 16px; }

.membership-pause-banner,
.membership-credit-summary {
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-card);
  background: var(--ws-surface);
  box-shadow: var(--ws-shadow-sm);
}

.membership-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}

.mem-card {
  border: 1px solid var(--ws-border);
  border-radius: 16px;
  background: var(--ws-surface);
  box-shadow: var(--ws-shadow-sm);
  overflow: hidden;
}

.mem-card:hover { translate: 0 -2px; box-shadow: var(--ws-shadow-md); }
.mem-card-featured { border: 2px solid var(--ws-brand); transform: none; }
.mem-card-header { min-height: 132px; padding: 24px; background: var(--ws-surface-subtle); }
.mem-plus { color: var(--ws-text); background: var(--ws-brand-soft); }
.mem-pro { color: #f8fafc; background: #111827; }
.mem-icon { font-size: 30px; }
.mem-plan-name { font-size: 21px; font-weight: 760; }
.mem-plan-desc { color: var(--ws-text-muted); }
.mem-price-section { border-color: var(--ws-border); }
.price-tab { min-height: 44px; }
.mem-price-display { color: var(--ws-text); }
.mem-price-save { color: var(--ws-positive); }
.mem-features { color: var(--ws-text-secondary); }
.mem-check { color: var(--ws-positive); background: var(--ws-positive-soft); }
.mem-x { color: var(--ws-text-muted); background: var(--ws-surface-muted); }
.membership-faq { max-width: 760px; margin-inline: auto; }

/* ---------- Profile and account ---------- */

.settings-page { width: min(100%, 1080px); margin-inline: auto; }
.settings-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); align-items: start; gap: 28px; }

.settings-nav {
  position: sticky;
  top: calc(var(--ws-header) + 24px);
  padding: 10px;
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-card);
  background: var(--ws-surface);
  box-shadow: var(--ws-shadow-sm);
}

.settings-nav-title,
.settings-nav-section { color: var(--ws-text-muted); font-size: 12px; font-weight: 720; letter-spacing: .04em; text-transform: uppercase; }
.settings-nav-title { padding: 10px 12px 8px; }
.settings-nav-divider { background: var(--ws-border); }

.settings-nav-item {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  border: 0;
  border-radius: 9px;
  color: var(--ws-text-secondary);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.settings-nav-item:hover { color: var(--ws-text); background: var(--ws-surface-muted); }
.settings-nav-item.active { color: var(--ws-brand); background: var(--ws-brand-soft); font-weight: 700; }
.settings-nav-icon { display: none; }

.settings-content { min-width: 0; }
.settings-section-title { font-size: 28px; }
.settings-section-desc { margin-top: 4px; }

.settings-card {
  padding: 22px;
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-card);
  color: var(--ws-text);
  background: var(--ws-surface);
  box-shadow: var(--ws-shadow-sm);
}

.settings-card + .settings-card { margin-top: 14px; }
.settings-card-title { color: var(--ws-text); font-size: 16px; }
.profile-info-item { min-height: 48px; border-color: var(--ws-border); }
.profile-info-label { color: var(--ws-text-muted); }
.profile-info-value { color: var(--ws-text); }

.sub-plan-row,
.billing-item,
.forum-notification-item,
.subscription-credit-center {
  border-color: var(--ws-border);
  border-radius: 10px;
  background: var(--ws-surface-subtle);
}

.sub-plan-row { min-height: 72px; }
.sub-plan-active { border-color: var(--ws-brand); background: var(--ws-brand-soft); }
.settings-link {
  display: inline-flex;
  color: var(--ws-brand);
  font-weight: 650;
}

.stream-file-label:is(button) {
  appearance: none;
  width: 100%;
  font: inherit;
  text-align: left;
}

/* ---------- Community ---------- */

.community-page,
.forum-page,
.post-page { width: min(100%, 1040px); margin-inline: auto; }

.community-header,
.forum-header {
  margin-bottom: 24px;
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid var(--ws-border);
  border-radius: 16px;
  color: var(--ws-text);
  background: var(--ws-surface);
  box-shadow: var(--ws-shadow-sm);
}

.community-title { font-size: clamp(28px, 4vw, 40px); }
.forum-header-kicker { color: var(--ws-brand); font-weight: 700; }
.forum-header-meta { gap: 10px; }
.forum-header-stat { min-width: 112px; border-color: var(--ws-border); background: var(--ws-surface-subtle); }
.forum-header-stat-num { color: var(--ws-text); }
.forum-header-stat-label { color: var(--ws-text-muted); }

.forum-toolbar,
.community-create,
.forum-create-box {
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-card);
  background: var(--ws-surface);
  box-shadow: var(--ws-shadow-sm);
}

.forum-toolbar { padding: 14px; }
.forum-tag-chip,
.forum-tag-filter,
.forum-sort-btn {
  min-height: 44px;
  padding-inline: 12px;
  display: inline-flex;
  align-items: center;
  border-color: var(--ws-border);
  color: var(--ws-text-secondary);
  background: var(--ws-surface);
}
.forum-tag-chip.active,
.forum-tag-filter.active,
.forum-sort-btn.active { border-color: var(--ws-brand); color: var(--ws-brand); background: var(--ws-brand-soft); }
.forum-tag-chip.static { cursor: default; pointer-events: none; }

.state-page-title {
  margin: 0 0 16px;
  color: var(--ws-text);
  font-size: clamp(26px, 5vw, 36px);
  line-height: 1.2;
}

.post-state-message { padding: 40px 24px; }
.post-state-message p { margin: 0; color: var(--ws-text-muted); }

.post-card,
.forum-thread-card,
.forum-floor-card,
.post-detail-card {
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-card);
  color: var(--ws-text);
  background: var(--ws-surface);
  box-shadow: var(--ws-shadow-sm);
}

.post-card:hover,
.forum-thread-card:hover { translate: 0 -1px; border-color: var(--ws-border-strong); box-shadow: var(--ws-shadow-md); }
.forum-thread-open {
  min-width: 0;
  display: block;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
}
.forum-thread-open:focus-visible { outline: 3px solid var(--ws-brand); outline-offset: 4px; }
.post-card-title,
.forum-thread-title,
.post-detail-title { color: var(--ws-text); }
.post-card-preview,
.forum-thread-preview,
.post-detail-content { color: var(--ws-text-secondary); }
.post-card-time,
.forum-thread-meta,
.forum-floor-meta { color: var(--ws-text-muted); }

.board-tab,
.forum-action-btn,
.forum-floor-action,
.forum-delete-btn,
.post-delete-btn,
.post-delete-detail-btn,
.reply-delete-btn,
.pwd-tab {
  min-height: 44px;
}

.post-delete-btn,
.reply-delete-btn {
  min-width: 44px;
}

.post-detail-card { overflow: hidden; }
.post-detail-header { border-color: var(--ws-border); }
.post-detail-body-wrap { padding: clamp(20px, 4vw, 38px); }
.post-detail-content-rich { max-width: 76ch; font-size: 16px; line-height: 1.8; }
.post-replies-section { margin-top: 20px; }
.post-paywall-overlay { background: linear-gradient(to bottom, transparent, var(--ws-surface) 42%); }
.post-paywall-box { border: 1px solid var(--ws-border); background: var(--ws-surface-raised); box-shadow: var(--ws-shadow-md); }

/* ---------- Admin ---------- */

.admin-dashboard { width: min(100%, 1280px); margin-inline: auto; }
.admin-title { font-size: clamp(28px, 4vw, 38px); }

.admin-board-tabs,
.admin-user-subtabs {
  padding: 4px;
  display: flex;
  gap: 3px;
  overflow-x: auto;
  border: 1px solid var(--ws-border);
  border-radius: 12px;
  background: var(--ws-surface);
  scrollbar-width: none;
}

.admin-board-tab,
.admin-user-subtabs button {
  min-height: 44px;
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  color: var(--ws-text-secondary);
  background: transparent;
  white-space: nowrap;
}

.admin-board-tab:hover,
.admin-board-tab.active,
.admin-user-subtabs button:hover,
.admin-user-subtabs button.active {
  color: var(--ws-text);
  background: var(--ws-surface-muted);
  box-shadow: none;
}

.admin-board-tab.active,
.admin-user-subtabs button.active { color: var(--ws-brand); background: var(--ws-brand-soft); }

.admin-section,
.admin-user-panel,
.admin-resource-panel,
.admin-stream-box,
.admin-resource-summary,
.admin-referral-content,
.admin-audit-container {
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-card);
  color: var(--ws-text);
  background: var(--ws-surface);
  box-shadow: var(--ws-shadow-sm);
}

.admin-section { padding: 22px; }
.admin-section-header { padding-bottom: 14px; border-color: var(--ws-border); }
.admin-section-header h2,
.admin-section-header h3 { color: var(--ws-text); }

.admin-stats-grid,
.admin-presence-grid,
.admin-referral-stats { gap: 12px; }
.admin-stat-icon { display: none; }

.admin-stat-card,
.admin-presence-card {
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--ws-border);
  border-radius: 12px;
  color: var(--ws-text);
  background: var(--ws-surface-subtle);
  box-shadow: none;
}

.admin-stat-card:hover { transform: none; }
.admin-stat-clickable:hover { border-color: var(--ws-brand); background: var(--ws-brand-soft); }
.admin-stat-value,
.admin-presence-value { color: var(--ws-text); font-variant-numeric: tabular-nums; }
.admin-stat-label,
.admin-presence-label,
.admin-presence-sub { color: var(--ws-text-muted); }

.admin-table-wrapper {
  overflow: auto;
  border: 1px solid var(--ws-border);
  border-radius: 10px;
  background: var(--ws-surface);
}

.admin-table { min-width: 760px; border-collapse: separate; border-spacing: 0; }
.admin-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 12px 14px;
  border-color: var(--ws-border);
  color: var(--ws-text-muted);
  background: var(--ws-surface-subtle);
  font-size: 12px;
  letter-spacing: .03em;
  text-align: left;
}

.admin-table td { padding: 13px 14px; border-color: var(--ws-border); color: var(--ws-text-secondary); }
.admin-table tr:hover td { background: var(--ws-surface-subtle); }
.admin-uid { color: var(--ws-brand); }

.admin-resource-step {
  border: 1px solid var(--ws-border);
  border-radius: 12px;
  background: var(--ws-surface-subtle);
}
.admin-resource-step-index { color: var(--ws-on-brand); background: var(--ws-brand); }
.admin-resource-choice { min-height: 44px; border-color: var(--ws-border); background: var(--ws-surface); }
.admin-resource-choice:hover { border-color: var(--ws-brand); background: var(--ws-brand-soft); }

/* ---------- Tools, trades, quotes and legal ---------- */

.tools-page,
.trades-page,
.quotes-page,
.tos-page { width: min(100%, 1040px); margin-inline: auto; }

.tools-header,
.trades-header,
.quotes-header { max-width: 720px; margin: 0 auto 34px; text-align: center; }
.tools-title,
.trades-title,
.quotes-title { font-size: clamp(30px, 5vw, 44px); }

.tools-category { margin-top: 36px; }
.tools-cat-title,
.trades-section-title { color: var(--ws-text); font-size: 20px; letter-spacing: -.02em; }
.tools-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

.tool-card,
.trades-stat-card,
.trades-admin-form,
.trades-section,
.quote-card,
.tos-card {
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-card);
  color: var(--ws-text);
  background: var(--ws-surface);
  box-shadow: var(--ws-shadow-sm);
}

.tool-card { min-height: 220px; padding: 20px; }
.tool-card:hover { translate: 0 -2px; border-color: var(--ws-border-strong); box-shadow: var(--ws-shadow-md); }
.tool-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; background: var(--ws-brand-soft); }
.tool-name { color: var(--ws-text); }
.tool-desc,
.tool-note { color: var(--ws-text-secondary); }
.tool-tag { border: 1px solid transparent; }
.tool-tag-warning { color: #713f12; border-color: #fde68a; background: #fef3c7; }
.tool-tag-success { color: #065f46; border-color: #a7f3d0; background: #d1fae5; }
.tool-tag-info { color: #1e3a8a; border-color: #bfdbfe; background: #dbeafe; }
[data-theme="dark"] .tool-tag-warning { color: #fde68a; border-color: rgb(245 158 11 / .38); background: rgb(245 158 11 / .14); }
[data-theme="dark"] .tool-tag-success { color: #a7f3d0; border-color: rgb(16 185 129 / .38); background: rgb(16 185 129 / .14); }
[data-theme="dark"] .tool-tag-info { color: #bfdbfe; border-color: rgb(59 130 246 / .4); background: rgb(59 130 246 / .14); }
.tool-link { color: var(--ws-brand); }
.tools-disclaimer { border: 1px solid var(--ws-border); border-radius: 10px; color: var(--ws-text-muted); background: var(--ws-surface-subtle); }

.trades-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.trades-stat-card { padding: 18px; }
.trades-stat-num { font-variant-numeric: tabular-nums; }
.trades-stat-label { color: var(--ws-text-muted); }
.trades-subtitle,
.trade-date,
.trade-prices,
.trade-notes { color: var(--ws-text-muted); }
.trades-stat-card.win .trades-stat-num,
.trade-direction.long,
.trade-profit.win,
.trade-result.win { color: var(--ws-positive); }
.trades-stat-card.loss .trades-stat-num,
.trade-direction.short,
.trade-profit.loss,
.trade-result.loss { color: var(--ws-danger); }
.trades-stat-card.rate .trades-stat-num { color: var(--ws-info); }
.trade-direction.long { background: var(--ws-positive-soft); }
.trade-direction.short { background: var(--ws-danger-soft); }
.trade-row { border-left-color: var(--ws-positive); border-top-color: var(--ws-border); }
.trade-row.loss { border-left-color: var(--ws-danger); }
.trade-notes { border-top-color: var(--ws-border); }
.billing-paid { color: var(--ws-positive); background: var(--ws-positive-soft); }
.billing-pending { color: var(--ws-warning); background: var(--ws-warning-soft); }
.billing-expired { color: var(--ws-text-muted); background: var(--ws-surface-muted); }
.complete-badge { color: var(--ws-positive); background: var(--ws-positive-soft); }
.trades-section { padding: 24px; }
.trades-timeline::before { background: var(--ws-border); }

.quotes-list { gap: 12px; }
.quote-card { padding: 22px; }

.tos-card { padding: clamp(22px, 5vw, 48px); }
.tos-content { max-width: 76ch; margin-inline: auto; }
.tos-content h2 { color: var(--ws-text); }
.tos-content p,
.tos-content li { color: var(--ws-text-secondary); }

/* ---------- Dark-specific corrections ---------- */

[data-theme="dark"] .card-body,
[data-theme="dark"] .sidebar-card,
[data-theme="dark"] .settings-card,
[data-theme="dark"] .post-card,
[data-theme="dark"] .forum-thread-card,
[data-theme="dark"] .mem-card,
[data-theme="dark"] .tool-card,
[data-theme="dark"] .admin-section,
[data-theme="dark"] .quiz-card,
[data-theme="dark"] .knowledge-card,
[data-theme="dark"] .mindmap-item {
  background: var(--ws-surface);
}

[data-theme="dark"] .card-thumbnail-bg { filter: brightness(.82) saturate(.9); }
[data-theme="dark"] .tab.active { color: #0f172a; background: #e2e8f0; }
[data-theme="dark"] .home-quotes { border-color: #354269; background: linear-gradient(140deg, #0f172a, #1e1b4b); }
[data-theme="dark"] .card-paid-badge { color: #c7d2fe; background: rgb(79 70 229 / .72); }
[data-theme="dark"] .card-type-badge { color: #bae6fd; background: rgb(3 105 161 / .72); }

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  :root { --ws-content: 1080px; --sidebar-w: 280px; }
  .header { padding-inline: 20px; }
  .episode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  :root { --ws-header: 56px; --ws-gutter: 18px; }

  .header {
    height: var(--ws-header);
    padding: 0 16px;
    border-bottom-color: var(--ws-border);
  }

  .logo-text,
  .header-nav,
  .theme-toggle-label,
  .user-name,
  .auth-buttons #registerBtn { display: none !important; }

  .logo-avatar { width: 32px; height: 32px; }
  .logo { min-width: 44px; padding-inline: 6px; }
  .header-left { flex: 0 0 auto; }
  .header-right { margin-left: auto; }
  .header .btn,
  .user-menu-trigger { min-height: 44px; }

  .page-container {
    padding: calc(var(--ws-header) + 22px) var(--ws-gutter) calc(var(--ws-mobile-nav) + 34px);
  }

  .site-footer { display: none; }

  .mobile-bottom-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 120;
    height: calc(var(--ws-mobile-nav) + env(safe-area-inset-bottom));
    padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    border-top: 1px solid var(--ws-border);
    background: color-mix(in srgb, var(--ws-surface) 96%, transparent);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    box-shadow: 0 -8px 24px rgb(15 23 42 / .06);
  }

  .mobile-bottom-nav :is(button, a) {
    min-width: 0;
    min-height: 52px;
    padding: 5px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    border-radius: 9px;
    color: var(--ws-text-muted);
    background: transparent;
    font-size: 11px;
  }

  .mobile-bottom-nav svg { width: 21px; height: 21px; }
  .mobile-bottom-nav :is(button, a):hover,
  .mobile-bottom-nav :is(button, a).active { color: var(--ws-brand); background: var(--ws-brand-soft); }

  .home-layout { display: block; }
  .home-sidebar { display: none; }
  .home-mobile-below-courses { display: grid; gap: 14px; margin-top: 28px; }
  .home-mobile-below-courses .sidebar-card { margin: 0; }
  .home-quotes { display: none; }

  .catalog-heading {
    margin-bottom: 14px;
    display: block;
  }
  .catalog-heading h1 { font-size: 25px; }
  .catalog-heading p { margin-top: 5px; text-align: left; }

  .tabs { position: sticky; top: calc(var(--ws-header) + 8px); z-index: 20; margin-inline: -2px; }
  .episode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card-body { min-height: 98px; padding: 12px; }
  .card-title { font-size: 14px; }

  .membership-cards { grid-template-columns: 1fr; max-width: 620px; margin-inline: auto; }
  .mem-card-featured { order: -1; }

  .settings-layout { grid-template-columns: 1fr; gap: 16px; }
  .settings-nav {
    position: static;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 5px;
    scrollbar-width: none;
  }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav-title,
  .settings-nav-section,
  .settings-nav-divider { display: none; }
  .settings-nav-item { flex: 0 0 auto; min-height: 44px; white-space: nowrap; }
  .settings-nav-item { width: auto; }

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

  .admin-stats-grid,
  .admin-presence-grid,
  .admin-referral-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-section { padding: 16px; }

  .community-header,
  .forum-header { padding: 22px; }
  .forum-header-meta { width: 100%; }
}

@media (max-width: 560px) {
  :root { --ws-gutter: 14px; }

  body { font-size: 14px; }
  .page-container { padding-top: calc(var(--ws-header) + 16px); }

  .header { padding-inline: 12px; }
  .btn-theme-toggle {
    display: inline-flex !important;
    width: 44px;
    padding-inline: 0;
    justify-content: center;
  }
  .auth-buttons #loginBtn { min-width: 64px; }

  .header-market-panel {
    position: fixed !important;
    inset: calc(var(--ws-header) + 8px) 12px auto !important;
    width: auto !important;
    max-height: calc(100dvh - var(--ws-header) - 24px);
    overflow: auto;
  }

  .episode-grid { grid-template-columns: 1fr; gap: 14px; }
  .episode-card {
    display: grid;
    grid-template-columns: 42% minmax(0, 1fr);
    min-height: 124px;
  }
  .episode-card .card-thumbnail { height: 100%; aspect-ratio: auto; }
  .episode-card .card-body { min-height: 0; display: flex; flex-direction: column; justify-content: center; }
  .episode-card .card-title { min-height: 0; font-size: 14px; }
  .episode-card .card-desc { margin-top: 8px; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .episode-card .card-progress { position: absolute; inset: auto 0 0; width: 100%; }
  .episode-card { position: relative; }

  .tabs { margin-bottom: 10px; }
  .tab { padding-inline: 12px; }
  .sort-bar { margin-bottom: 12px; }
  .sort-btn { min-height: 44px; }
  .btn-sm,
  .btn-xs { min-height: 44px; }

  .video-container { margin-inline: calc(-1 * var(--ws-gutter)); border-inline: 0; border-radius: 0; }
  .video-info { margin-top: 14px; padding: 18px; }
  .video-title { font-size: 23px; }
  .video-actions { display: grid; grid-template-columns: 1fr; }
  .video-actions .btn { width: 100%; }

  .article-container { margin-inline: calc(-1 * var(--ws-gutter)); border-inline: 0; border-radius: 0; }

  .quiz-card,
  .knowledge-card,
  .mindmap-item { padding: 16px; }
  .quiz-option { min-height: 56px; }

  .membership-header { text-align: left; }
  .membership-title { font-size: 32px; }
  .membership-cards { gap: 14px; }

  .settings-nav { margin-inline: -4px; }
  .settings-nav-icon { display: none; }
  .settings-section-title { font-size: 25px; }
  .settings-card { padding: 17px; }
  .form-row { align-items: stretch; }

  .community-header,
  .forum-header { padding: 18px; }
  .forum-header-meta { display: grid; grid-template-columns: 1fr 1fr; }
  .forum-header-stat { min-width: 0; }
  .forum-toolbar-row { flex-direction: column; align-items: stretch; }
  .forum-search-form { width: 100%; }
  .post-detail-body-wrap { padding: 18px; }
  .forum-floor-card { grid-template-columns: 1fr; }
  .forum-floor-aside { display: none; }

  .tools-header,
  .trades-header,
  .quotes-header { text-align: left; }
  .tools-grid { grid-template-columns: 1fr; }
  .tool-card { min-height: 0; }
  .trades-stats { grid-template-columns: 1fr; }
  .trades-form-grid { grid-template-columns: 1fr; }

  .admin-stats-grid,
  .admin-presence-grid,
  .admin-referral-stats { grid-template-columns: 1fr; }
  .admin-stat-card,
  .admin-presence-card { min-height: 96px; }
  .admin-table-wrapper::after {
    content: "可左右滑动查看完整表格";
    position: sticky;
    left: 12px;
    display: inline-block;
    padding: 7px 10px;
    color: var(--ws-text-muted);
    font-size: 11px;
    pointer-events: none;
  }

  .site-footer-inner { display: block; }
  .mobile-explore-overlay { padding-inline: 10px; }
  .mobile-explore-sheet { padding: 16px; border-radius: 18px; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .modal-overlay { align-items: flex-start; overflow-y: auto; padding: 12px; }
  .modal {
    width: min(560px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    margin: 0 auto;
    padding: 20px 28px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .modal-header h2 { margin-bottom: 14px; }
  .modal .form-group { margin-bottom: 10px; }
  .mobile-explore-overlay { align-items: flex-start; padding: 10px; }
  .mobile-explore-sheet { max-height: calc(100dvh - 20px); }
}

@media (max-width: 900px) and (max-height: 520px) and (orientation: landscape) {
  :root { --ws-mobile-nav: 48px; }
  .mobile-bottom-nav {
    height: calc(var(--ws-mobile-nav) + env(safe-area-inset-bottom));
    padding: 2px 8px calc(2px + env(safe-area-inset-bottom));
  }
  .mobile-bottom-nav :is(button, a) {
    min-height: 44px;
    flex-direction: row;
    gap: 5px;
    padding: 2px 4px;
  }
  .mobile-bottom-nav svg { width: 18px; height: 18px; }
  .page-container { padding-bottom: calc(var(--ws-mobile-nav) + 20px); }
}

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

@media print {
  .header,
  .mobile-bottom-nav,
  .mobile-explore-overlay,
  .site-footer,
  .bg-deco,
  .back-btn { display: none !important; }
  .page-container { padding: 0; }
  body { background: white; color: black; }
}
