/* ==========================================================================
   AKForexTrader Community — design system v2
   Neutral warm-black palette, calm spacing, compact type.
   Layout: [collapsible sidebar] [content] [fixed 20% ad rail]
   ========================================================================== */
:root {
  color-scheme: dark;
  --bg: #161615;
  --bg-2: #1a1a18;
  --surface: #1f1f1d;
  --surface-2: #252523;
  --surface-3: #2c2c29;
  --line: #2a2a27;
  --line-2: #3a3935;
  --text: #ece9e1;
  --text-2: #bab6ab;
  --muted: #8a867c;
  --accent: #d97757;
  --accent-strong: #c96442;
  --accent-ink: #ffffff;
  --accent-soft: rgba(217, 119, 87, .1);
  --accent-line: rgba(217, 119, 87, .32);
  --up: #6fae8c;
  --down: #c8706b;
  --radius: 12px;
  --radius-sm: 8px;
  --side: 244px;
  --side-collapsed: 68px;
  --rail: 20vw;
  --header: 56px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --hero-ink: var(--text);
  --hero-ink-2: var(--muted);
}

:root[data-theme=light] {
  color-scheme: light;
  --bg: #faf9f5;
  --bg-2: #f4f2ea;
  --surface: #ffffff;
  --surface-2: #f6f4ed;
  --surface-3: #ece9df;
  --line: #e7e4da;
  --line-2: #d6d2c5;
  --text: #1f1e1d;
  --text-2: #48453f;
  --muted: #85817a;
  --accent: #c96442;
  --accent-strong: #b5563a;
  --accent-ink: #ffffff;
  --accent-soft: rgba(201, 100, 66, .08);
  --accent-line: rgba(201, 100, 66, .3);
  --up: #3f8a66;
  --down: #b94b46;
}

* {
  box-sizing: border-box
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.65 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden
}

body {
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* Older IE/Edge */
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
  /* Chrome, Safari, Edge */
}

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

button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent
}

button,
a {
  touch-action: manipulation
}

a {
  color: inherit;
  text-decoration: none
}

button {
  cursor: pointer;
  color: inherit;
  border: 0;
  background: none
}

button:disabled {
  cursor: not-allowed;
  opacity: .5
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px
}

h1,
h2,
h3,
p {
  margin-top: 0
}

h1 {
  font-size: clamp(24px, 2.5vw, 31px);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -.025em;
  margin-bottom: 14px
}

h2 {
  font-size: 16px;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: -.01em
}

h3 {
  font-size: 13.5px;
  line-height: 1.45;
  font-weight: 600
}

p {
  color: var(--text-2)
}

small {
  font-size: 10px;
  color: var(--muted)
}

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

.ic {
  flex: none;
  display: block
}

.ext {
  display: inline-flex;
  vertical-align: -2px;
  margin-left: 3px;
  opacity: .65
}

.skip {
  position: fixed;
  top: -80px;
  left: 12px;
  z-index: 200;
  background: var(--text);
  color: var(--bg);
  padding: 9px 14px;
  border-radius: 8px;
  font-weight: 600
}

.skip:focus {
  top: 12px
}

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

.icon-button.desktop-only {
  display: inline-grid
}

.icon-button.mobile-only {
  display: none
}

select::picker-icon{
  display: none;
}

/* ---------- Sidebar ---------- */
#sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--side);
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: width .26s var(--ease), transform .3s var(--ease)
}

.side-top {
  height: var(--header);
  display: flex;
  align-items: center;
  padding: 0 16px;
  flex: none
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0
}

.brand-mark {
  flex: none;
  display: grid;
  border-radius: 8px
}

.brand-mark svg {
  width: 28px;
  height: 28px
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
  white-space: nowrap
}

.brand-text strong {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -.01em
}

.brand-text small {
  font-size: 10.5px
}

#navigation {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 10px;
  scrollbar-width: none;
  -ms-overflow-style: none
}

#navigation::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0
}


.nav-group {
  padding-bottom: 6px
}

.nav-group h2 {
  font-size: 10px;
  font-weight: 600;
  /* letter-spacing: .08em; */
  /* text-transform: uppercase; */
  color: var(--muted);
  margin: 12px 10px 4px;
  height: 14px;
  display: flex;
  align-items: center;
  white-space: nowrap
}

.nav-item,
.support-link,
.profile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px 10px;
  margin: 1px 0;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  transition: background .15s, color .15s;
  white-space: nowrap
}

.nav-item:hover,
.support-link:hover {
  background: var(--surface-2);
  color: var(--text)
}

.nav-item.active {
  background: var(--surface-3);
  color: var(--text)
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 18px;
  color: var(--muted);
  flex: none;
  transition: color .15s
}

.nav-item:hover .nav-icon,
.support-link:hover .nav-icon {
  color: var(--text)
}

.nav-item.active .nav-icon {
  color: var(--accent)
}

.nav-icon .ic {
  width: 17px;
  height: 17px
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity .2s
}

.nav-item .count {
  margin-left: auto;
  font-size: 9px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
  background: var(--surface-3);
  color: var(--text-2);
  border-radius: 999px;
  padding: 0 6px;
}

.nav-item.active .count {
  background: var(--bg);
}

.sidebar-bottom {
  flex: none;
  padding: 8px 10px 12px;
  border-top: 1px solid var(--line)
}

.support-link b,
.profile b {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3
}

.support-link small,
.profile small {
  display: block;
  font-size: 10.5px
}

.profile {
  cursor: default;
  padding: 8px 10px
}

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text);
  font-size: 10px;
  font-weight: 600;
  border: 1px solid var(--line-2)
}

.profile .avatar {
  margin: 0 -3px 0 -1px
}

/* collapsed (desktop) */
body.collapsed #sidebar {
  width: var(--side-collapsed)
}

body.collapsed .brand-text,
body.collapsed .nav-label,
body.collapsed .nav-item .count {
  opacity: 0;
  width: 0;
  pointer-events: none;
  position: absolute
}

body.collapsed .nav-group h2 {
  font-size: 0;
  margin: 8px 16px;
  height: 1px;
  background: var(--line)
}

body.collapsed .nav-group h2 span {
  display: none
}

body.collapsed .nav-group:first-child h2 {
  background: none;
  margin: 4px 0
}

body.collapsed .nav-item,
body.collapsed .support-link,
body.collapsed .profile {
  justify-content: center;
  padding: 9px 0
}

body.collapsed .side-top {
  padding: 0;
  justify-content: center
}

body.collapsed .profile .avatar {
  margin: 0
}

body.collapsed [data-tip]:hover::after {
  content: attr(data-tip);
  position: fixed;
  left: calc(var(--side-collapsed) - 2px);
  transform: translateY(-4px);
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--line-2);
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 60;
  pointer-events: none
}

/* ---------- Page frame ---------- */
.app {
  margin-left: var(--side);
  margin-right: var(--rail);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .26s var(--ease);
  min-width: 0
}

body.collapsed .app {
  margin-left: var(--side-collapsed)
}

.app>header {
  height: var(--header);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20
}

.breadcrumb,
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  min-width: 0
}

.breadcrumb #current {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.divider {
  color: var(--line-2)
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--text-2);
  transition: background .15s, color .15s;
  padding: 0
}

.icon-button:hover {
  background: var(--surface-2);
  color: var(--text)
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 32px;
  padding: 0 9px 0 11px;
  min-width: 190px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  transition: border-color .15s, color .15s
}

.search-trigger:hover {
  border-color: var(--line-2);
  color: var(--text)
}

.search-trigger span {
  flex: 1;
  text-align: left
}

kbd {
  font: 500 10px 'Inter', sans-serif;
  padding: 1px 5px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2)
}

.small-button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--text);
  padding: 8px 15px;
  font-size: 12px;
  font-weight: 500;
  transition: background .15s, border-color .15s, filter .15s;
  line-height: 1.2;
  white-space: nowrap
}

.small-button {
  padding: 0 12px;
  height: 32px;
  font-size: 12px
}

.button:hover,
.small-button:hover {
  background: var(--surface-2);
  border-color: var(--muted)
}

.button.primary {
  background: var(--accent-strong);
  color: var(--accent-ink);
  border-color: transparent
}

.button.primary:hover {
  background: var(--accent-strong);
  filter: brightness(1.1)
}

main {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 44px 40px 72px;
  flex: 1;
  outline: 0
}

.page {
  animation: arrive .35s var(--ease) both
}

main.noanim .page {
  animation: none
}

.eyebrow {
  font-size: 10.5px;
  font-weight: 600;
  /* letter-spacing: .09em; */
  /* text-transform: uppercase; */
  color: var(--accent);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--up);
  display: inline-block
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  margin-bottom: 28px
}

.hero-copy {
  padding: 44px 12px 40px 44px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start
}

.hero h1 {
  font-size: clamp(26px, 3vw, 36px);
  letter-spacing: -.03em;
  margin-bottom: 14px
}

.hero h1 span {
  color: var(--muted)
}

.hero p {
  font-size: 13.5px;
  max-width: 400px;
  line-height: 1.75;
  margin-bottom: 24px
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap
}

.chart {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 26px 28px 22px 8px
}

.chart svg {
  width: 100%;
  height: auto;
  overflow: visible
}

.chart-label {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .08em;
  color: var(--muted);
  padding: 0 4px 8px
}

.chart-note {
  align-self: center;
  margin-top: 8px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 10px;
  color: var(--muted)
}

.c-grid {
  fill: none;
  stroke: var(--text);
  opacity: .05
}

.c-level {
  stroke: var(--muted);
  opacity: .5
}

.c-zone {
  fill: var(--accent);
  opacity: .07
}

.c-up {
  stroke: var(--up)
}

.c-dn {
  stroke: var(--down)
}

.c-dnf {
  fill: var(--down)
}

.c-text {
  fill: var(--muted)
}

/* ---------- Cards & grids ---------- */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 12px
}

.quick-card {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 18px;
  border-radius: var(--radius);
  display: flex;
  gap: 13px;
  align-items: center;
  transition: border-color .15s, background .15s
}

.quick-card:hover {
  border-color: var(--line-2);
  background: var(--surface-2)
}

.tile-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--surface-3);
  color: var(--accent);
  flex: none
}

.tile-icon .ic {
  width: 18px;
  height: 18px
}

.quick-card h3 {
  font-size: 12px;
  margin: 0 0 2px
}

.quick-card p {
  font-size: 12px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5
}

.quick-card>.ext {
  margin-left: auto;
  color: var(--muted)
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 44px 0 16px;
  gap: 12px
}

.section-heading h2 {
  margin: 0;
  font-size: 16px
}

.text-link {
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center
}

.text-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px
}

.two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
}

.two-col .section-heading {
  margin-top: 32px
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 24px
}

.post-head {
  display: flex;
  gap: 11px;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px
}

.post-head small {
  display: block;
  font-weight: 400
}

.badge {
  display: inline-block;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 600;
  /* letter-spacing: .06em; */
  color: var(--muted);
  margin-left: 6px;
  vertical-align: 1px
}

.post h3 {
  font-size: 16px;
  margin-bottom: 8px;
  letter-spacing: -.015em
}

.post p {
  font-size: 12px;
  margin-bottom: 0px;
  /* margin-bottom: auto; */
}

.post-link {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--accent);
  display: block;
  font-size: 12px;
  font-weight: 500
}

.steps {
  counter-reset: steps;
  padding: 6px 22px
}

.step {
  display: flex;
  gap: 13px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line)
}

.step:last-child {
  border: 0
}

.step:before {
  counter-increment: steps;
  content: counter(steps);
  display: grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 8px;
  font-weight: 600
}

.step h3 {
  font-size: 12px;
  margin: 0 0 2px
}

.step p {
  font-size: 12px;
  margin: 0;
  color: var(--muted)
}

.note {
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  /* border-left: 2px solid var(--accent); */
  border-radius: 10px;
  color: var(--text-2);
  font-size: 12px;
  margin: 32px 0;
}

.page-intro {
  margin-bottom: 32px;
  max-width: 680px
}

.page-intro p {
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-2)
}

.page-intro h1 {
  font-size: clamp(24px, 2.6vw, 32px)
}

/* ---------- Articles ---------- */
.article-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px
}

.article-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color .15s, background .15s
}

.article-card:hover {
  border-color: var(--line-2);
  background: var(--surface-2)
}

.article-card .meta {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--accent)
}

.article-card h3 {
  font-size: 14px;
  line-height: 1.4;
  margin: 0
}

.article-card p {
  font-size: 12px;
  line-height: 1.6;
  margin: 0;
  color: var(--muted)
}

.crumbs {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 28px;
  flex-wrap: wrap
}

.crumbs a:hover {
  color: var(--text)
}

.article {
  max-width: 700px;
  margin: 0
}

.article-head h1 {
  font-size: clamp(25px, 3vw, 34px);
  line-height: 1.2;
  letter-spacing: -.03em;
  max-width: 720px;
}

.lede {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-2);
  margin-bottom: 12px
}

.byline {
  font-size: 10px;
  color: var(--muted);
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px
}

.prose {
  font-size: 14px;
  /* line-height: 1.85; */
  color: var(--text-2);
  max-width: 700px
}

.prose h2 {
  font-size: 20px;
  color: var(--text);
  margin: 36px 0 12px;
  letter-spacing: -.015em;
}

.prose h3 {
  font-size: 14px;
  color: var(--text);
  margin: 24px 0 8px
}

.prose p {
  color: var(--text-2);
  margin: 0 0 16px;
  /* font-size: 14px; */
}

.prose strong {
  color: var(--text);
  font-weight: 600
}

.prose ul,
.prose ol {
  padding-left: 22px;
  margin: 0 0 18px
}

.prose li {
  margin: 6px 0;
  padding-left: 2px
}

.prose li::marker {
  color: var(--muted)
}

.prose a {
  color: var(--accent);
  /* text-decoration: underline; */
  text-underline-offset: 3px
}

.prose .updated {
  font-size: 12px;
  color: var(--muted)
}

.prose h2:first-child {
  margin-top: 0
}

.related {
  margin-top: 20px
}

.related .section-heading {
  margin-top: 36px
}

.pn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px
}

.pn {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .15s
}

.pn:hover {
  border-color: var(--line-2)
}

.pn small {
  font-size: 10px;
  /* text-transform: uppercase; */
  letter-spacing: .08em
}

.pn span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text)
}

.pn.next {
  text-align: right;
  grid-column: 2
}

.link-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0
}

.link-list a {
  display: flex;
  flex-direction: column;
  padding: 11px 0;
  border-bottom: 1px solid var(--line)
}

.link-list li:last-child a {
  border: 0
}

.link-list a:hover strong {
  color: var(--accent)
}

.link-list strong {
  font-size: 12px;
  font-weight: 600
}

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

.contact-cols .note {
  margin: 16px 0 0
}

/* ---------- Videos ---------- */
.video-grid,
.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px
}

.video-card {
  min-width: 0;
  display: flex;
  flex-direction: column
}

.video-art {
  position: relative;
  border-radius: 10px;
  background: var(--surface-3);
  aspect-ratio: 16/9;
  overflow: hidden;
  border: 1px solid var(--line)
}

.video-art>button:first-child {
  padding: 0;
  width: 100%;
  height: 100%;
  display: block
}

.video-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s var(--ease)
}

.video-art:hover img {
  transform: scale(1.03)
}

.video-art::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .3), transparent 40%, rgba(0, 0, 0, .4));
  pointer-events: none
}

.video-badges {
  position: absolute;
  top: 9px;
  left: 9px;
  right: 9px;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  z-index: 2
}

.pill,
.heart {
  background: rgba(18, 18, 17, .62);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 10px;
  font-weight: 500;
  border-radius: 99px;
  padding: 3px 10px;
  max-width: 75%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.heart {
  width: 28px;
  height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  flex: none
}

.heart[aria-pressed=true] {
  color: #ff4c38
}

.play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  background: rgba(107, 107, 107, 0.62);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  color: #ffffff;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  pointer-events: none;
  z-index: 2;
  transition: transform .2s var(--ease)
}

.play .ic {
  /* margin-left: 2px; */
  width: 24px;
  height: 24px
}

.video-art:hover .play {
  transform: translate(-50%, -50%) scale(1.08)
}

.duration {
  position: absolute;
  bottom: 8px;
  right: 9px;
  font-size: 10.5px;
  font-weight: 500;
  background: rgba(18, 18, 17, .7);
  color: #fff;
  padding: 1px 7px;
  border-radius: 5px;
  z-index: 2
}

.video-card h3 {
  font-size: 13.5px;
  margin: 12px 0 5px;
  line-height: 1.45
}

.video-card p {
  font-size: 12px;
  line-height: 1.65;
  margin: 0 0 12px;
  color: var(--muted);
  flex: 1
}

.video-bottom {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line)
}

.quiet-button {
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 0;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 6px
}

.quiet-button:hover {
  text-decoration: underline;
  text-underline-offset: 3px
}

.video-card h3 .quiet-button {
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45
}

.video-card h3 .quiet-button:hover {
  color: var(--accent);
  text-decoration: none
}

.filters {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 24px
}

.filter {
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 99px;
  color: var(--text-2);
  padding: 5px 13px;
  font-size: 12px;
  font-weight: 500;
  transition: all .15s
}

.filter:hover {
  border-color: var(--muted);
  color: var(--text)
}

.filter.selected {
  background: var(--text);
  color: var(--bg);
  border-color: transparent
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 18px
}

.toolbar p {
  margin: 0;
  font-size: 12px;
  color: var(--muted)
}

/* ---------- Forms ---------- */
.search-input,
input,
textarea,
select {
  background: var(--bg);
  border: 1px solid var(--accent-soft);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  width: 100%;
  font-size: 12px;
  transition: border-color .15s, box-shadow .15s
}

.search-input{
  border-radius: 999px;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted)
}

input:focus,
textarea:focus,
select:focus {
  outline: 0;
  border-color: var(--line-2);
  /* box-shadow: 0 0 0 3px var(--accent-soft) */
}

.search-input {
  margin-bottom: 16px
}

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 14px
}

label input,
label textarea,
label select {
  margin-top: 6px
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px
}

.form-grid .full {
  grid-column: 1/-1
}

textarea {
  resize: vertical;
  min-height: 120px
}

.split-form {
  display: flex;
  gap: 10px
}

.split-form input {
  flex: 1
}

.admin-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding: 13px 0;
  font-size: 12.5px
}

.admin-item button {
  border: 1px solid var(--line-2);
  color: var(--down);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 500
}

.admin-item button:hover {
  background: var(--surface-2)
}

.empty {
  text-align: center;
  padding: 52px 20px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius)
}

.empty h2 {
  font-size: 18px
}

.empty p {
  max-width: 480px;
  margin: 0 auto 18px
}

/* ---------- Accordions ---------- */
details {
  border-bottom: 1px solid var(--line);
  padding: 0
}

details:first-child {
  border-top: 1px solid var(--line)
}

summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 28px 16px 0;
  position: relative;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text)
}

summary::-webkit-details-marker {
  display: none
}

summary:after {
  content: '';
  position: absolute;
  right: 4px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  transition: transform .2s var(--ease)
}

details[open] summary:after {
  transform: translateY(-30%) rotate(-135deg)
}

details p {
  font-size: 12px;
  line-height: 1.85;
  padding: 0 28px 14px 0;
  white-space: pre-line;
  margin: 0
}

.policy-list {
  max-width: 1500px
}

/* ---------- Plans ---------- */
.plan {
  display: flex;
  flex-direction: column;
  padding: 26px;
  position: relative
}

.plan>small {
  font-weight: 600;
  letter-spacing: .09em
}

.plan.featured {
  border-color: var(--accent-line)
}

.plan.featured::before {
  content: 'Most popular';
  position: absolute;
  top: -10px;
  right: 18px;
  background: var(--accent-strong);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 99px
}

.plan h2 {
  font-size: 32px;
  margin: 12px 0;
  letter-spacing: -.03em
}

.plan h2 small {
  font-size: 12px;
  font-weight: 500
}

.plan p {
  font-size: 12.5px
}

.plan ul {
  list-style: none;
  padding: 0;
  margin: 8px 0 26px;
  flex: 1
}

.plan li {
  font-size: 12px;
  color: var(--text-2);
  padding: 6px 0 6px 22px;
  position: relative
}

.plan li:before {
  content: '';
  position: absolute;
  left: 2px;
  top: 11px;
  width: 10px;
  height: 4px;
  border-left: 1.5px solid var(--up);
  border-bottom: 1.5px solid var(--up);
  transform: rotate(-45deg)
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px
}

.resource-grid h3 {
  margin-top: 14px
}

.resource-grid p {
  font-size: 12.5px
}

.support-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px
}

.support-grid a {
  transition: border-color .15s
}

.support-grid a:hover {
  border-color: var(--line-2)
}

.support-grid h3 {
  margin-bottom: 6px
}

.support-grid p {
  font-size: 12px;
  margin: 0
}

.chat-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px
}

.message {
  margin-bottom: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line)
}

.message strong {
  font-size: 12px
}

.message p {
  white-space: pre-wrap;
  margin: 6px 0 0;
  font-size: 13px
}

.message small {
  margin-left: 8px
}

.progress {
  height: 3px;
  border-radius: 5px;
  background: var(--surface-3);
  overflow: hidden;
  margin-top: 12px
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  transform-origin: left
}

/* ---------- E-book ---------- */
.book-reader {
  width: 100%;
  /* max-width: 900px; */
  margin: 0 auto
}

.book-page {
  margin: 0 0 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff
}

.book-page figcaption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11.5px
}

.book-page img {
  display: block;
  width: 100%;
  height: auto
}

.book-membership {
  text-align: center;
  padding: 40px 24px;
  margin: 32px 0
}

.book-membership .eyebrow,
.book-membership .hero-actions {
  justify-content: center
}

.book-membership p {
  max-width: 560px;
  margin: 0 auto 22px
}

.book-membership .text-link {
  margin-top: 18px
}

.announcement-video .video-card {
  animation: arrive .35s var(--ease) both
}

.announcement-video h3 .quiet-button {
  font-size: 14px
}

/* ---------- Dialog / search ---------- */
dialog {
  color: var(--text);
  border: 1px solid var(--line-2);
  background: var(--surface);
  border-radius: 16px;
  padding: 20px;
  width: min(760px, calc(100% - 28px));
  max-height: 88vh;
  margin: auto
}

 dialog::-webkit-scrollbar {
   display: none
 }

dialog::backdrop {
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(6px)
}

dialog[open] {
  animation: arrive .25s var(--ease) both
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 16px
}

.dialog-head strong {
  font-size: 14px;
  font-weight: 600
}

.dialog-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px
}

iframe {
  width: 100%;
  aspect-ratio: 16/9;
  border: 0;
  border-radius: 10px;
  background: #000
}

.search-result {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 8px;
  margin: 4px 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2)
}

.search-result .sr-ic {
  color: var(--muted);
  display: grid
}

.search-result .ext {
  margin-left: auto
}

.search-result:hover,
.search-result:focus-visible {
  background: var(--surface-2);
  color: var(--text)
}

#toast {
  position: fixed;
  bottom: 24px;
  left: calc(var(--side) + (100vw - var(--side) - var(--rail))/2);
  transform: translateX(-50%) translateY(30px);
  background: var(--text);
  color: var(--bg);
  padding: 9px 18px;
  border-radius: 16px;
  z-index: 100;
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: .25s var(--ease);
  max-width: calc(100vw - 32px);
    box-shadow: 0 32px 56px -6px rgba(27, 35, 64, 0.1);
}

body.collapsed #toast {
  left: calc(var(--side-collapsed) + (100vw - var(--side-collapsed) - var(--rail))/2)
}

#toast.show {
  transform: translateX(-50%);
  opacity: 1
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 40px 40px 24px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px
}

.foot-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  max-width: 1040px;
  margin: 0 auto 32px
}

.foot-about strong {
  display: block;
  color: var(--text);
  font-size: 12px;
  margin-bottom: 8px
}

.foot-about p {
  font-size: 12px;
  line-height: 1.7;
  margin: 0;
  max-width: 340px;
  color: var(--muted)
}

.site-footer nav {
  display: flex;
  flex-direction: column;
  gap: 7px
}

.site-footer h2 {
  font-size: 10px;
  font-weight: 600;
  /* letter-spacing: .09em; */
  text-transform: uppercase;
  color: var(--text-2);
  margin: 0 0 6px
}

.site-footer a:hover {
  color: var(--text)
}

.foot-base {
  display: flex;
  gap: 8px 24px;
  flex-wrap: wrap;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  max-width: 1040px;
  margin: 0 auto;
  font-size: 10px
}

.full-width {
  grid-column: 1/-1
}

/* ---------- Advertising: fixed right rail (20% of viewport) ---------- */
#ad-rail {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--rail);
  background: var(--bg-2);
  /* border-left: 1px solid var(--line); */
  z-index: 30;
  display: flex;
  overflow: hidden
}

.ad-rail-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 12px;
  gap: 8px
}

.ad-label {
  font-size: 9px;
  font-weight: 500;
  /* letter-spacing: .12em; */
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  flex: none
}

.ad-slot {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  border-radius: 10px
}

.ad-slot ins.adsbygoogle {
  display: block;
  width: 100%;
  height: 100%
}

.ad-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-2);
  border-radius: 10px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .06em;
  pointer-events: none
}

.ad-slot ins[data-ad-status=filled]~.ad-placeholder,
.ad-slot ins:not(:empty)~.ad-placeholder {
  display: none
}

.ad-band {
  display: none
}

body[data-ads=off] {
  --rail: 0px
}

body[data-ads=off] #ad-rail,
body[data-ads=off] .ad-band {
  display: none !important
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(6px)
  }

  to {
    opacity: 1;
    transform: none
  }
}

/* ---------- Responsive ---------- */
@media(min-width:1700px) {
  main {
    max-width: 1120px;
    padding: 52px 48px 80px
  }
}

@media(max-width:1360px) {
  .two-col {
    grid-template-columns: 1fr
  }

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

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

  .hero-copy {
    padding: 36px 8px 32px 34px
  }

  .search-trigger {
    min-width: 0
  }

  .search-trigger kbd {
    display: none
  }
}

@media(max-width:1180px) {
  main {
    padding: 34px 26px 56px
  }

  .app>header {
    padding: 0 20px
  }

  .site-footer {
    padding: 36px 26px 22px
  }

  .quick-grid {
    grid-template-columns: 1fr
  }

  .hero {
    grid-template-columns: 1fr
  }

  .hero-copy {
    padding: 32px 28px 6px
  }

  .chart {
    padding: 6px 24px 26px
  }

  .foot-grid {
    grid-template-columns: 1fr 1fr
  }

  .foot-about {
    grid-column: 1/-1
  }
}

@media(max-width:1023px) {
  :root {
    --rail: 0px
  }

  .icon-button.desktop-only {
    display: none
  }

  .icon-button.mobile-only {
    display: inline-grid
  }

  #sidebar {
    width: min(280px, 86vw);
    transform: translateX(-100%)
  }

  body.menu-open #sidebar {
    transform: none;
    box-shadow: 0 0 80px rgba(0, 0, 0, .6)
  }

  body.collapsed #sidebar {
    width: min(280px, 86vw)
  }

  body.collapsed .brand-text,
  body.collapsed .nav-label,
  body.collapsed .nav-item .count {
    opacity: 1;
    width: auto;
    position: static;
    pointer-events: auto
  }

  body.collapsed .nav-group h2 {
    font-size: 10px;
    margin: 12px 10px 4px;
    height: 14px;
    background: none
  }

  body.collapsed .nav-group h2 span {
    display: inline
  }

  body.collapsed .nav-item,
  body.collapsed .support-link,
  body.collapsed .profile {
    justify-content: flex-start;
    padding: 7px 10px
  }

  body.collapsed .side-top {
    padding: 0 16px;
    justify-content: flex-start
  }

  body.collapsed [data-tip]:hover::after {
    display: none
  }

  #overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(3px);
    z-index: 35
  }

  #overlay[hidden] {
    display: none
  }

  .app,
  body.collapsed .app {
    margin: 0
  }

  #ad-rail {
    display: none
  }

  .ad-band {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 26px 32px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-2)
  }

  .ad-slot-band {
    min-height: 100px;
    flex: none
  }

  .ad-band .ad-slot {
    border: 1px dashed var(--line-2)
  }

  #toast,
  body.collapsed #toast {
    left: 50%
  }

  .search-trigger {
    min-width: 0;
    width: 32px;
    padding: 0;
    justify-content: center
  }

  .search-trigger span {
    display: none
  }
}

@media(max-width:700px) {
  :root {
    --header: 52px
  }

  main {
    padding: 26px 16px 44px
  }

  .app>header {
    padding: 0 12px
  }

  .site-footer {
    padding: 32px 16px 20px
  }

  .ad-band {
    margin: 0 16px 28px
  }

  .video-grid,
  .article-grid,
  .resource-grid,
  .support-grid,
  .form-grid {
    grid-template-columns: 1fr
  }

  .hero {
    border-radius: 14px
  }

  .hero-copy {
    padding: 26px 20px 4px
  }

  .hero h1 {
    font-size: 27px
  }

  .hero-actions {
    width: 100%
  }

  .hero-actions .button {
    flex: 1
  }

  .chart {
    padding: 6px 16px 22px
  }

  .chart svg {
    max-height: 180px
  }

  .panel {
    padding: 20px
  }

  .page-intro h1 {
    font-size: 25px
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px
  }

  .split-form {
    flex-direction: column
  }

  .form-grid .full {
    grid-column: auto
  }

  .small-button.yt span {
    display: none
  }

  .small-button.yt {
    width: 32px;
    padding: 0
  }

  .breadcrumb .crumb-root {
    display: none
  }

  .book-page {
    border-radius: 8px;
    margin-bottom: 18px
  }

  .book-membership {
    padding: 30px 18px
  }

  .book-membership .hero-actions {
    flex-direction: column
  }

  .plan h2 {
    font-size: 30px
  }

  dialog {
    padding: 16px;
    border-radius: 14px
  }

  .dialog-links .button {
    flex: 1
  }

  .filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-inline: -16px;
    padding: 0 16px 4px;
    scrollbar-width: none
  }

  .filters::-webkit-scrollbar {
    display: none
  }

  .filter {
    white-space: nowrap;
    flex: none
  }

  .section-heading {
    margin-top: 36px
  }

  .prose {
    font-size: 14px
  }

  .article-head h1 {
    font-size: 25px
  }

  .pn-row {
    grid-template-columns: 1fr
  }

  .pn-row .pn.next,
  .pn-row .pn:only-child.next {
    grid-column: auto;
    text-align: left
  }

  .foot-grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px
  }
}

@media(prefers-reduced-motion:reduce) {

  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important
  }
}

.course-notes {
  margin-top: 44px
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  line-height: 1
}

.pn-row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.pn {
  flex-direction: row;
  align-items: center;
  padding: 9px 16px;
  border-radius: 999px
}

.pn span {
  display: none
}

.pn small {
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text)
}

.article{
  max-width: 1400px;
}

/* Highlights carousel (home page) */
.hl {
  margin: 0 0 8px
}

.hl-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  position: relative;
  scrollbar-width: none;
  -ms-overflow-style: none
}

.hl-track::-webkit-scrollbar {
  display: none
}

.hl-card {
  flex: 0 0 84%;
  scroll-snap-align: start;
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  align-items: center;
  gap: 28px;
  min-height: 300px;
  padding: 28px 32px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface)
}

.hl-copy h3 {
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.25;
  letter-spacing: -.02em;
  margin: 0 0 10px
}

.hl-copy p {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 0 16px
}

.hl-link {
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0
}

.hl-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px
}

.hl-art {
  position: relative;
  display: block;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16/9;
  border: 1px solid var(--line);
  background: var(--surface-3)
}

.hl-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s var(--ease)
}

.hl-art:hover img {
  transform: scale(1.03)
}

.hl-ctrl {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 18px
}

.hl-dots {
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 11px 14px;
  border-radius: 99px;
  background: var(--surface-2)
}

.hl-dot {
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: var(--line-2);
  padding: 0;
  transition: width .3s var(--ease), background .3s
}

.hl-dot.on {
  width: 26px;
  background: var(--text)
}

.hl-pause {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text)
}

.hl-pause:hover {
  background: var(--surface-3)
}

@media(max-width:700px) {
  .hl-card {
    flex-basis: 90%;
    grid-template-columns: 1fr;
    padding: 20px;
    min-height: 0;
    gap: 18px
  }

  .hl-art {
    order: -1
  }
}

a.button[target=_blank] .ext {
  display: none
}

.button .ext {
  display: none
}

/* Video card: done button beside category, meta line */
.video-badges {
  align-items: flex-start
}

.badge-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0
}

.badge-left .pill {
  max-width: none;
  min-width: 0
}

.heart.done-btn {
  color: rgba(255, 255, 255, .75);
}

.heart.done-btn svg {
  scale: 1.3;
}

.heart.done-btn[aria-pressed=true] {
  color: #00ff7b;
  /* border-color: rgba(1, 255, 124, 1); */
  background: rgba(0, 0, 0, 0.50)
}

.video-card h3 {
  margin: 12px 0 0px
}

.video-card .video-meta {
  font-size: 12px;
  line-height: 1.4;
  margin: 0 0 6px;
  color: var(--muted);
  flex: 0 0 auto
}

/* Align header and footer with the page column */
@media(min-width:1181px) {
  .app>header {
    padding-inline: max(40px, calc((100% - 1040px)/2 + 40px))
  }

  .site-footer {
    max-width: 1040px;
    width: 100%;
    margin: 8px auto 0;
    padding-inline: 40px
  }

  .foot-grid,
  .foot-base {
    max-width: none
  }
}

@media(min-width:1700px) {
  .app>header {
    padding-inline: max(48px, calc((100% - 1120px)/2 + 48px))
  }

  .site-footer {
    max-width: 1120px;
    padding-inline: 48px
  }
}

[hidden] {
  display: none !important
}

.chat {
  /* max-width: 680px; */
  border: 1px solid var(--line, rgba(128, 128, 128, .25));
  border-radius: 20px;
  background: var(--panel, transparent);
  overflow: hidden
}

.chat-list {
  height: min(48vh, 520px);
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: none
}

.chat-list::-webkit-scrollbar {
  display: none
}

.bubble-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 82%
}

.bubble-wrap small {
  font-size: 11px;
  opacity: .6;
  margin: 0 10px 0px;
}

.bubble {
  padding: 9px 14px;
  border-radius: 18px 18px 18px 6px;
  background: rgba(128, 128, 128, .18);
  line-height: 1.45;
  word-break: break-word;
  font-size: 14px;
  margin-bottom: 4px;
}

.bubble-wrap.me {
  align-self: flex-end;
  align-items: flex-end
}

.bubble-wrap.me .bubble {
  background: #d97757;
  color: #fff;
  border-radius: 18px 18px 6px 18px
}

.chat-del {
  background: none;
  border: 0;
  color: #d9534f;
  font-size: 11px;
  cursor: pointer;
  padding: 2px 10px
}

.chat-form {
  border-top: 1px solid var(--line, rgba(128, 128, 128, .25));
  padding: 10px;
  display: grid;
  gap: 8px
}

.chat-form input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line, rgba(128, 128, 128, .3));
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px
}

.chat-row {
  display: flex;
  gap: 8px
}

.chat-send {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: #d97757;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.video-art img{
  scale: 1.01;
}

.hl-art img{
  scale: 1.02;
}

/* ---- Chat: borderless page, floating composer ---- */
.chat {
  max-width: none;
  border: 0;
  border-radius: 0;
  background: none;
  overflow: visible;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 200px)
}

.chat-list {
  height: auto;
  overflow: visible;
  padding: 0 0 24px;
  flex: 1
}

.chat-form {
  position: sticky;
  bottom: 16px;
  z-index: 5;
  margin-top: auto;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 32px 56px -6px rgba(27, 35, 64, 0.1);
  padding: 6px 6px 6px 8px;
  display: flex;
  align-items: center;
  gap: 6px
}

.chat-form input {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  outline: 0
}

.chat-form>input[name=name] {
  flex: none;
  width: 150px;
  border-right: 1px solid var(--line);
  border-radius: 0
}

.chat-row {
  flex: 1;
  min-width: 0
}

.chat-send {
  width: 64px;
  height: 40px;
  border-radius: 999px;
}

@media(max-width:700px) {
  .chat-form {
    flex-wrap: wrap;
    border-radius: 22px;
    padding: 6px
  }

  .chat-form>input[name=name] {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    padding: 8px 12px
  }

  .chat-row {
    flex: 1 1 100%
  }
}

.calc-out small{
  margin-right: 4px;
}

.qa-reply{
  gap: 12px;
}

.qa-thread{
  display: flex;
    flex-direction: column;
    gap: 8px;
}


.qa-reply input{
  margin-top: 16px;
  margin-bottom: 8px;
  border-radius: 999px;
}

.chat-del{
  display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: 999px;
    border: 1px solid var(--line-2);
    background: transparent;
    color: #d9534f;
    padding: 8px 15px;
    font-size: 12px;
    font-weight: 500;
    transition: background .15s, border-color .15s, filter .15s;
    line-height: 1.2;
    white-space: nowrap
}

.repdel{
  display: flex;
  gap: 6px;
}

.nav-item .count.new {
  background: var(--accent-soft);
  color: var(--accent)
}

.nav-item.active .count.new {
  background: var(--accent-soft)
}

.admnaaabtns{
  display: flex;
  gap: 8px;
}

/* ---- Calculator: tabs and fields ---- */
.seg {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  margin-bottom: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none
}

.seg::-webkit-scrollbar {
  display: none
}

.seg-btn {
  flex: none;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  transition: background .15s, color .15s
}

.seg-btn:hover {
  color: var(--text)
}

.seg-btn.on {
  background: var(--surface-3);
  color: var(--text);
  /* box-shadow: 0 1px 2px rgba(0, 0, 0, .2) */
}

.seg-sm {
  margin: 6px 0 0
}

.cpane {
  display: contents
}

.cfield {
  display: block;
  margin-bottom: 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2)
}

.cin {
  position: relative;
  display: block;
  margin-top: 6px
}

.cin input,
.cin select {
  margin-top: 0
}

.cin input {
  padding-right: 58px;
  -moz-appearance: textfield;
  appearance: textfield
}

.cin input::-webkit-outer-spin-button,
.cin input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0
}

.cin em {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-style: normal;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  pointer-events: none
}

.seg-sm {
  display: flex;
  width: max-content
}

@media(max-width:700px) {
  .seg {
    /* display: flex; */
    gap: 2px;
    /* max-width: 200px; */
  }

  .seg-btn {
    padding: 7px 12px;
    font-size: 10px;
  }
}

.calc-out {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px
}

.calc-box {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px
}

.calc-box strong {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.02em
}

.calc-warn {
  grid-column: 1/-1;
  margin: 0
}

@media(max-width:700px) {
  .calc-out {
    grid-template-columns: repeat(2, minmax(0, 1fr))
  }
}

.calc .seg-sm .seg-btn{
  padding: 4px 16px;
}

/* ---- E-book library, book page and reader ---- */
.book-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px
}

.book-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  max-width: 120px;
}

.cover {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-3);
  box-shadow: 0 32px 56px -6px rgba(27, 35, 64, 0.1);
  transition: transform .25s var(--ease), box-shadow .25s;
  width: 120px;
  height: auto;
}

.cover img {
  display: block;
  width: 100%;
  height: auto;
}

a.book-card:hover .cover {
  transform: scale(1.01);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .3)
}

.book-card .cat,
.tag {
  font-size: 10px;
  font-weight: 600;
  /* letter-spacing: .04em; */
  /* text-transform: uppercase; */
  color: var(--accent);
}

.book-card .cat{
  line-height: .5;
}

.book-card h3 {
  font-size: 12px;
  margin: 3px 0 2px
}

.book-card .by,
.book-info .by {
  font-size: 10px;
  color: var(--muted);
  margin: 0
}

.lib-bar {
  margin-bottom: 14px
}

.lib-bar .search-input {
  margin-bottom: 0
}

.book-hero {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 40px;
  align-items: center;
  margin-bottom: 40px
}

.book-info h1 {
  margin: 8px 0 6px;
  font-weight: 800;
}

.book-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  margin: 24px 0;
  /* max-width: 320px; */
}

.book-stats div {
  padding: 12px 10px;
  text-align: center;
  border-left: 1px solid var(--line)
}

.book-stats div:first-child {
  border-left: 0
}

.book-stats small {
  display: block;
  margin-bottom: 2px
}

.book-stats strong {
  font-size: 14px;
  font-weight: 600
}

.book-about {
  max-width: 720px
}

.book-about h2 {
  margin: 28px 0 10px
}

.book-about h2:first-child {
  margin-top: 0
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc
}

.toc-list li {
  counter-increment: toc;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  color: var(--text-2)
}

.toc-list li:before {
  content: counter(toc);
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600
}

.reader {
  margin-top: 48px;
  scroll-margin-top: 80px
}

.reader-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px
}

.reader-bar h2 {
  margin: 0
}

.reader-bar .seg {
  margin: 0
}

.sheet {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  margin: 0 0 20px;
  overflow: hidden
}

.sheet-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 22px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted)
}

.sheet-body {
  padding: 38px 44px 42px;
  max-width: 800px;
  margin: 0 auto;
  font-size: calc(var(--rd, 15)*1px);
  line-height: 1.8;
  color: var(--text-2)
}

.sheet-body h2 {
  font-size: 1.5em;
  line-height: 1.3;
  color: var(--text);
  letter-spacing: -.02em;
  margin: 0 0 16px
}

.sheet-body p {
  font-size: 1em;
  margin: 0 0 14px
}

.sheet-body strong {
  color: var(--text)
}

.sheet-center {
  text-align: center
}

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

.term-grid div {
  display: flex;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line)
}

.term-grid b {
  flex: 0 0 64px;
  color: var(--text)
}

.fig {
  margin: 22px 0 0
}

.fig img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line)
}

.fig figcaption {
  font-size: .8em;
  line-height: 1.5;
  color: var(--muted);
  margin-top: 8px
}

.fig-pair {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px
}

.sheet-locked .sheet-body {
  min-height: 340px;
  -webkit-mask-image: linear-gradient(#000, rgba(0, 0, 0, .5) 45%, transparent 88%);
  mask-image: linear-gradient(#000, rgba(0, 0, 0, .5) 45%, transparent 88%)
}

.skel i {
  display: block;
  height: 10px;
  border-radius: 99px;
  background: var(--line-2);
  margin: 0 0 18px
}

.lock-cta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 110px 24px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  background: linear-gradient(transparent, var(--surface) 62%)
}

.lock-cta p {
  margin: 0;
  font-size: 12px;
  color: var(--muted)
}

@media(max-width:1180px) {
  .book-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr))
  }
}

@media(max-width:700px) {
  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px
  }

  .book-hero {
    /* display: flex; */
    /* flex-direction: column; */
    grid-template-columns: 1fr;
    gap: 24px;
    /* justify-content: center; */
    /* align-items: center; */
    /* text-align: center; */
    width: 100%;
  }

  .book-hero .cover {
    max-width: 220px
  }

  .book-stats {
    /* display: flex; */
    max-width: 1000px;
  }

  .book-stats div:nth-child(3) {
    border-left: 0
  }

  .book-stats div:nth-child(n+3) {
    border-top: 1px solid var(--line)
  }

  .sheet-body {
    padding: 26px 20px 30px
  }

  .sheet-meta {
    padding: 10px 16px
  }

  .term-grid,
  .fig-pair {
    grid-template-columns: 1fr
  }

  .book-info{
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: auto;
  }
}

/* ---- E-book v2: continuous reading, progressive blur, authors ---- */
.reader-body {
  max-width: 760px;
  font-size: calc(var(--rd, 15)*1px);
  line-height: 1.85;
  color: var(--text-2)
}

.reader-body h2 {
  font-size: 1.45em;
  line-height: 1.3;
  color: var(--text);
  letter-spacing: -.02em;
  margin: 44px 0 14px
}

.reader-body h2:first-child {
  margin-top: 0
}

.reader-body p {
  font-size: 1em;
  margin: 0 0 16px
}

.reader-body strong {
  color: var(--text)
}

.reader-body .fig {
  margin: 24px 0 0
}

.teaser {
  position: relative;
  margin-top: 40px
}

.teaser-text {
  height: 260px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none
}

.teaser::after {
  content: '';
  position: absolute;
  left: -8px;
  right: -8px;
  top: 0;
  bottom: 0;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent 30%, var(--bg) 94%)
}

.pblur {
  position: absolute;
  left: -8px;
  right: -8px;
  top: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 1
}

.pblur i {
  position: absolute;
  inset: 0
}

.pblur i:nth-child(1) {
  -webkit-backdrop-filter: blur(.6px);
  backdrop-filter: blur(.6px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 6%, #000 20%);
  mask-image: linear-gradient(to bottom, transparent 6%, #000 20%)
}

.pblur i:nth-child(2) {
  -webkit-backdrop-filter: blur(1px);
  backdrop-filter: blur(1px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 18%, #000 32%);
  mask-image: linear-gradient(to bottom, transparent 18%, #000 32%)
}

.pblur i:nth-child(3) {
  -webkit-backdrop-filter: blur(1.6px);
  backdrop-filter: blur(1.6px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 30%, #000 44%);
  mask-image: linear-gradient(to bottom, transparent 30%, #000 44%)
}

.pblur i:nth-child(4) {
  -webkit-backdrop-filter: blur(2.6px);
  backdrop-filter: blur(2.6px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 42%, #000 56%);
  mask-image: linear-gradient(to bottom, transparent 42%, #000 56%)
}

.pblur i:nth-child(5) {
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 54%, #000 68%);
  mask-image: linear-gradient(to bottom, transparent 54%, #000 68%)
}

.pblur i:nth-child(6) {
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 66%, #000 80%);
  mask-image: linear-gradient(to bottom, transparent 66%, #000 80%)
}

.teaser-cta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap
}

.teaser-solo {
  position: static;
  margin-top: 32px
}

.authors-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.author-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 72px;
  text-align: center;
  padding: 0;
}

.author-chip b {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.avatar-lg {
  display: grid;
  place-items: center;
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .02em;
  overflow: hidden;
  transition: border-color .15s, transform .2s var(--ease);
  margin-bottom: 4px;
}

.avatar-lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block
}

button.author-chip:hover .avatar-lg,
.author-chip.selected .avatar-lg {
  /* border-color: var(--accent); */
  transform: scale(1.02);
}

.author-card {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px 14px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color .15s
}

.author-card:hover {
  border-color: var(--line-2)
}

.author-card .avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 16px
}

.author-card b {
  display: block;
  font-size: 13.5px;
  color: var(--text)
}

.book-stats {
  margin-bottom: 24px
}

@media(max-width:700px) {
  .author-chip {
    width: 84px
  }

  .teaser-text {
    height: 240px
  }

    .book-stats {
      /* display: flex; */
      /* grid-template-columns: repeat(1fr); */
      /* width: 100%; */
      margin: 16px 0;
    }

    .book-hero{
      display: block;
    }

}

#bookcoverinside{
  width: 100%;
}

/* E-book page — mobile header */
@media(max-width:700px) {
  .book-hero {
    /* --hero-bg: color-mix(in srgb, var(--accent) 42%, #efcf93); */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: 100%;
    margin: 0 0 32px;
    /* padding: 30px 18px 18px; */
    padding-top: 30px;
    border-radius: 24px;
    background: var(--hero-bg);
    color: var(--hero-ink);
    text-align: center
  }

  .book-hero #bookcoverinside {
    width: min(50%, 180px);
    max-width: none;
    margin: 0 0 22px;
    border: 0;
    border-radius: 12px;
    box-shadow: 0 32px 76px -6px rgba(27, 35, 64, .1);
  }

  .book-hero .book-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%
  }

  .book-hero .tag {
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(36, 31, 25, .1);
    color: var(--hero-ink);
    margin-bottom: 2px;
    font-weight: 300;
  }

  .book-hero .book-info h1 {
    margin: 8px 0 4px;
    font-size: 21px;
    line-height: 1.25;
    color: var(--hero-ink)
  }

  .book-hero .book-info .by {
    font-size: 11px;
    color: var(--muted)
  }

  .book-hero .book-stats {
    width: 100%;
    margin: 24px 0 20px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 0;
    border-radius: 0
  }

  .book-hero .book-stats div,
  .book-hero .book-stats div:nth-child(3),
  .book-hero .book-stats div:nth-child(n+3) {
    padding: 2px 6px;
    border-top: 0;
    border-left: 1px solid rgba(36, 31, 25, .18)
  }

  .book-hero .book-stats div:first-child {
    border-left: 0
  }

  .book-hero .book-stats small {
    font-size: 10px;
    color: var(--hero-ink-2);
    margin-bottom: 3px
  }

  .book-hero .book-stats strong {
    font-size: 14px;
    color: var(--hero-ink)
  }

  .book-hero .hero-actions {
    display: flex;
    flex-direction: column;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%
  }

  .tpbtn{
    display: flex;
    flex-direction: row;
    gap: 10px;
  }

  /* .hero-actions{
    grid-template-columns: 2fr 1fr !important;
  } */

  .book-hero .hero-actions .button,
  .book-hero .hero-actions .button.primary {
    width: 100%;
    padding: 14px 10px;
    border: 0;
    border-radius: 999px;
    background: #d97757;
    color: #f4efe6;
    font-size: 12px;
    font-weight: 600
  }

    .book-hero .hero-actions .button{
      background: none;
      border: 1px solid var(--line);
      color: var(--text);
    }

  .book-hero .hero-actions .button:hover,
  .book-hero .hero-actions .button.primary:hover {
    /* background: #2b2721; */
    filter: none
  }

  .book-hero .book-stats{
    background-color: var(--surface);
    padding: 20px 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  #bookcoverinside{
    box-shadow: 0 32px 56px -6px rgba(27, 35, 64, 0.1);
  }

}

.reader-bar .seg-btn{
  padding: 4px 8px;
}

.tpbtn {
  display: flex;
  flex-direction: row;
  gap: 10px;
}