/* ---------- Design tokens (warm palette from first pic) ---------- */
:root{
  --bg: #F6F2EA;         /* warm cream */
  --ink: #0E0F12;        /* near-black */
  --muted: rgba(14,15,18,.68);
  --hairline: rgba(14,15,18,.10);

  --orange: #FF5A1F;     /* primary accent */
  --lemon: #FFE26B;      /* soft yellow */
  --mint: #ace38c;       /* soft green */
  --sky:  #BFD9FF;       /* soft blue */
  --pink: #FFB3D6;       /* soft pink */

  --glass: rgba(255,255,255,.55);
  --glass2: rgba(255,255,255,.38);

  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 16px;

  --shadow: 0 22px 70px rgba(0,0,0,.10);
  --shadow2: 0 10px 28px rgba(0,0,0,.10);

  --max: 1120px;
}

*{ box-sizing: border-box; }
html,body{ height: 100%; overflow-x: clip; }
body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Inter, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: var(--bg);
  color: var(--ink);
  overflow-x: clip;
}

::selection{
  background: #e74805;
  color: #ffffff;
}

::-moz-selection{
  background: #ff0000;
  color: #ffffff;
}

a{ color: inherit; text-decoration: none; }
button{ font: inherit; color: inherit; }
.wrap{ width: min(var(--max), calc(100% - 48px)); margin: 0 auto; }

.skip{
  position: absolute;
  left: 12px; top: 12px;
  background: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  transform: translateY(-140%);
  transition: transform .2s ease;
  z-index: 9999;
  border: 1px solid var(--hairline);
}
.skip:focus{ transform: translateY(0); }

/* ---------- Ambient background ---------- */
.ambient{ position: fixed; inset: 0; pointer-events: none; z-index: -1; }
.blob{
  position: absolute;
  filter: blur(40px);
  opacity: .55;
  transform: translate3d(0,0,0);
}
.blob--a{ width: 520px; height: 520px; left: -140px; top: -120px; background: radial-gradient(circle at 30% 30%, var(--sky), transparent 65%); }
.blob--b{ width: 560px; height: 560px; right: -180px; top: -140px; background: radial-gradient(circle at 30% 30%, var(--pink), transparent 62%); }
.blob--c{ width: 640px; height: 640px; left: 18%; bottom: -220px; background: radial-gradient(circle at 30% 30%, var(--mint), transparent 62%); }

.noise{
  position: absolute; inset: 0;
  background-image:
    radial-gradient(rgba(0,0,0,.08) 1px, transparent 1px);
  background-size: 3px 3px;
  opacity: .45;
  mix-blend-mode: multiply;
}

/* ---------- Topbar ---------- */
.topbar{
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: color-mix(in oklab, var(--bg), transparent 20%);
  border-bottom: 0.5px solid var(--hairline);
}
.topbar__inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 18px;
}

.brand{
  display: flex;
  align-items: center;  
  font-weight: 800;
  letter-spacing: 0.1em;
}
.brand__mark{
  width: 60px; height: 60px;
  display: grid; place-items: center;
  border-radius: 12px;
}
.brand__mark img{
  width: 35px;
  display: block;
}
.brand__name{ font-size: 14px; }

.nav{
  display: flex;
  gap: 18px;
  align-items: center;
}
.nav__link{
  font-size: 13px;
  color: var(--muted);
  padding: 10px 10px;
  border-radius: 12px;
  transition: background 0.2s ease, color 0.2s ease;
}
.nav__link:hover{ background: rgba(255,255,255,.6); color: var(--ink); }

.topbar__cta{
  display: flex;
  gap: 10px;
  align-items: center;
}

.burger{
  display: none;
  width: 44px; height: 44px;
  border-radius: 14px;
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,.65);
  box-shadow: var(--shadow2);
}
.burger span{
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  margin: 0 auto;
}
.burger span + span{ margin-top: 6px; }

.mobileNav{
  border-top: 1px solid var(--hairline);
  padding: 10px 24px 16px;
  display: grid;
  gap: 8px;
}
.mobileNav a{
  padding: 12px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.6);
  border: 1px solid var(--hairline);
}
.mobileNav[hidden]{ display: none; }
/* Hide mobile menu on desktop no matter what */
@media (min-width: 981px){
  .mobileNav{ display: none !important; }
}

/* ---------- Buttons ---------- */
.btn[hidden] { display: none !important; }
.btn{
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--hairline);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow .2s ease, background .2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active{ transform: translateY(1px) scale(.95); }

.btn--primary{
  background: var(--orange);
  color: #fff;
  border-color: color-mix(in oklab, var(--orange), #000 10%);
  box-shadow: 0 18px 45px rgba(255,90,31,.25);
}
.btn--primary:hover{ transform: translateY(-2px); }

.btn--soft{
  background: rgba(255,255,255,.70);
  box-shadow: var(--shadow2);
}
.btn--soft:hover{ transform: translateY(-1px); }

.btn--ghost{
  background: transparent;
  color: var(--muted);
}
.btn--ghost:hover{ background: rgba(255,255,255,.55); color: var(--ink); }

.btn__shine{
  position: absolute;
  inset: -2px;
  border-radius: 16px;
  opacity: 0;
  background: radial-gradient(120px 60px at var(--mx,30%) var(--my,20%), rgba(255,255,255,.55), transparent 60%);
  transition: opacity .2s ease;
  pointer-events: none;
}
.btn--primary:hover .btn__shine{ opacity: 1; }

.btn--magnetic{
  will-change: transform;
}
.btn--primary.btn--magnetic{
  box-shadow:
    0 0px 45px rgba(255,90,31,.45),
    0 0 26px rgba(255,90,31,.68);
}
.btn--primary.btn--magnetic:hover{
  box-shadow:
    0 0 10px rgba(255,90,31,.90),
    0 0 10px rgba(255,90,31,.92);
}

.w100{ width: 100%; }

/* ---------- Hero ---------- */
.hero{
  padding: 120px 0 80px;
}
.hero__grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 120px;
  align-items: start; 
}
.hero__copy{
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-self: center;
  width: min(100%, 820px);
  gap: 12px;
  margin-inline: auto;
}

.pill{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,.70);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  color: var(--muted);
  box-shadow: var(--shadow2);
  font-size: 13px;
}
.dot{
  width: 10px; height: 10px;
  border-radius: 999px;
  background: var(--orange);
  box-shadow: 0 0 0 6px rgba(255,90,31,.14);
}

.hero__title{
  margin: 20px 0 12px;
  font-size: clamp(44px, 6vw, 78px);
  line-height: 1;
  letter-spacing: -0.04em;
}
.accent{
  background: linear-gradient(90deg, var(--orange), color-mix(in oklab, var(--orange), var(--pink) 15%));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.accent--language{
  background-image: linear-gradient(90deg, color-mix(in oklab, var(--orange), #e30000 52%), var(--orange));
}
.accent--level{
  background-image: linear-gradient(90deg, color-mix(in oklab, var(--sky), #0055ff 65%), color-mix(in oklab, var(--mint), #00b71e 70%));
}
.hero__title--demo{
  text-align: center;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.15;
  margin: 0 0 28px;
}

.hero__sub{
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
  max-width: 70ch;
  margin-inline: auto;
}

.hero__actions{
  margin-top: 24px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hero__meta{
  margin-top: 24px;
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}
.hero__note{
  width: 100%;
  margin-top: 12px;
}
.stat{
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,.55);
  box-shadow: var(--shadow2);
  min-width: 150px;
}
.stat__num{ font-weight: 800; letter-spacing: -0.02em; }
.stat__label{ color: var(--muted); font-size: 13px; margin-top: 2px; }
.stat--full{
  width: 100%;
  padding: 16px 18px;
  text-align: center;
  overflow: hidden;
}
.stat__headline{
  margin: 0 0 14px;
  font-size: clamp(22px, 2vw, 38px);
  line-height: 1.12;
  letter-spacing: -0.02em;
}
.heroNoteMarquee{
  margin-top: 12px;
  display: flex;
  gap: 12px;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.heroNoteMarquee__track{
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
  animation: heroNoteSlide 22s linear infinite;
}
.heroNoteLogo{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(14,15,18,.10);
  background: rgba(255,255,255,.70);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.heroNoteLogo img{
  width: 16px;
  height: 16px;
  border-radius: 3px;
}
@keyframes heroNoteSlide{
  from { transform: translateX(0); }
  to { transform: translateX(calc(-100% - 12px)); }
}
.logoMarquee{
  display: flex;
  gap: 12px;
  overflow: hidden;
  min-width: 0;
  mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
}
.logoMarquee__track{
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
  animation: logoMarqueeMove 24s linear infinite;
}
.logoPill{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,.72);
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}
.logoPill img{
  width: 18px;
  height: 18px;
  border-radius: 4px;
}
@keyframes logoMarqueeMove{
  from { transform: translateX(0); }
  to { transform: translateX(calc(-100% - 12px)); }
}

.hero__visual{
  position: relative;
  min-height: 520px;
}

.glassCard{
  background: var(--glass);
  border: 1px solid rgba(255,255,255,.55);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 10px 18px;
}

/* Make the device a fixed-height layout */
.device{
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;              /* prevents spilling outside the device */
}

/* Screen takes remaining height and scrolls internally */

.device__screen.news--verge{
  padding: 12px;     /* was 16px in your base styles */
  gap: 10px;
}

.device__top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.55);
  border: 1px solid var(--hairline);
}
.device__pill{
  font-size: 12px;
  color: rgba(14,15,18,.35);
}
.device__label{
  font-size: 12px;
  color: var(--muted);
}
.device__cta{
  font-size: 12px;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.65);
  border: 1px solid var(--hairline);
}

.device__screen{
  flex: 1;
  min-height: 0;                 /* CRITICAL: enables overflow scrolling in flex children */
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.chatRow{ display: flex; }
.chatRow--right{ justify-content: flex-end; }

/* ============ Verge-style news UI (inside the device) ============ */
.device__screen.news--verge{
  gap: 12px;
}

/* Top bar inside the device */
.newsTop{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(14,15,18,.10);
}

.newsTop__logo{
  font-weight: 1000;
  letter-spacing: -0.04em;
  font-size: 14px;
}
.newsTop__sub{
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
.newsTop__pill{
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: .08em;
  background: #fff;
  border: 1px solid rgba(14,15,18,.14);
}

/* Tag pills (high contrast like The Verge) */
.tag{
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  border: 1px solid rgba(14,15,18,.12);
  background: #fff;
}
.tag--politics{
  background: color-mix(in oklab, var(--orange), #fff 84%);
  border-color: color-mix(in oklab, var(--orange), #000 10%);
}
.tag--italian{
  background: color-mix(in oklab, var(--lemon), #fff 35%);
  border-color: rgba(14,15,18,.14);
}

/* Lead story */
.lead{
  padding: 14px;
  border-radius: 22px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(14,15,18,.10);
}

.lead__headline{
  margin: 10px 0 6px;
  font-size: 22px;           /* bigger, verge-y */
  line-height: 1.08;
  letter-spacing: -0.04em;
  font-weight: 1000;
}

.highlight-static{
  
  background: color-mix(in oklab, var(--lemon), #fff 34%);
  padding: 2px 6px;
  border-radius: 2px 2px 2px 2px;
}

.lead__dek{
  margin: 0;
  color: rgba(14,15,18,.72);
  font-size: 13px;
  line-height: 1.55;
}

.lead__byline{
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}
.dotSep{ margin: 0 6px; opacity: .7; }

/* Big, bold media block */
.lead__media{
  position: relative;
  margin-top: 12px;
  height: 280px;
  border-radius: 18px;
  border: 1px solid rgba(14,15,18,.12);
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.9), transparent 45%),
    linear-gradient(135deg, rgba(191,217,255,.65), rgba(255,179,214,.55));
  overflow: hidden;
}
.lead__mediaBadge{
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.9);
  border: 1px solid rgba(14,15,18,.12);
  font-weight: 1000;
  font-size: 11px;
  letter-spacing: .1em;
}

/* Inline translated article text block */
.callout{
  padding: 14px;
  border-radius: 22px;
  border: 1px solid rgba(14,15,18,.12);
  background: rgba(255,255,255,.84);
  box-shadow: 0 14px 30px rgba(0,0,0,.08);
  margin-top: 5px;
}

.callout__controls{
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.switch{
  display: inline-flex;
  flex: 0 1 auto;
  min-width: 0;
  width: fit-content;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(14,15,18,.3);
  background: rgba(255,255,255,.9);
}

.switch--levels{
  display: inline-flex;
  flex: 0 1 auto;
  min-width: 0;
  width: fit-content;
  flex-wrap: wrap;
}

.switch__btn{
  border: 0;
  background: transparent;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .01em;
  color: rgba(14,15,18,.66);
  cursor: pointer;
  transition: color .2s ease, background .2s ease;
}

.switch--levels .switch__btn{
  flex: 0 0 auto;
}

.switch__btn.is-active{
  color: rgba(14,15,18,.94);
  background: var(--lemon);
  box-shadow: 3px 4px 5px rgba(72, 60, 15, 0.25);
}

.callout__text{
  margin: 0;
  font-size: 14px;
  line-height: 1.68;
  letter-spacing: 0;
  color: rgba(14,15,18,.86);
  padding-bottom: 10px;
}

/* Hide rewritten text until REWRITE is clicked */
[data-callout-text]{
  display: none;
}

/* REWRITE button */
.callout__rewrite-btn{
  border: 0;
  outline: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(14,15,18,.3);
  background: var(--lemon);
  box-shadow: 3px 4px 5px rgba(72,60,15,.25);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(14,15,18,.9);
  flex: 0 0 auto;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.callout__rewrite-btn:hover{ transform: translateY(-1px); box-shadow: 3px 6px 8px rgba(72,60,15,.28); }
.callout__rewrite-btn:active{ transform: translateY(1px) scale(.96); box-shadow: 1px 2px 4px rgba(72,60,15,.2); }
.callout__rewrite-btn[data-revealed]{ opacity: .45; pointer-events: none; }

/* Swap animation for lang/level changes after reveal */
@keyframes callout-swap{
  0%  { opacity: 0; transform: translateY(5px); }
  100%{ opacity: 1; transform: translateY(0); }
}
.callout__text--swap{
  animation: callout-swap .25s cubic-bezier(.22,1,.36,1) forwards;
}

/* Typewriter cursor */
[data-callout-text].is-typing::after{
  content: '|';
  display: inline;
  margin-left: 1px;
  animation: callout-cursor .7s step-end infinite;
  color: rgba(14,15,18,.45);
}
@keyframes callout-cursor{
  0%, 100%{ opacity: 1; }
  50%     { opacity: 0; }
}

.rewritten__head, .original__head{
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(14,15,18,.55);
  text-align: left;
  margin: 0 0 6px;
}

.callout__top{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.callout__stamp{
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: .14em;
  color: rgba(14,15,18,.55);
}

.callout__quote{
  font-weight: 1000;
  font-size: 15px;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.callout__sub{
  margin-top: 8px;
  font-size: 12px;
  color: rgba(14,15,18,.65);
}

/* Bottom rail cards (verge grid vibe) */
/* Horizontal rail: less height, more “feed” vibe */
/* Horizontal rail tiles (single row) */
.rail{
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(160px, 1fr);
  gap: 12px;

  overflow-x: auto;
  overflow-y: hidden;
  padding-top: 16px;
  padding-bottom: 6px;

  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.railCard{
  scroll-snap-align: start;
}

.railCard__tag{
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(14,15,18,.55);
}

.railCard__title{
  margin-top: 8px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
  font-size: 12.5px;
}

.bubble{
  max-width: 78%;
  padding: 11px 12px;
  border-radius: 18px;
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,.70);
  box-shadow: 0 10px 22px rgba(0,0,0,.06);
  font-size: 13px;
  line-height: 1.35;
}
.bubble--ai{ border-top-left-radius: 8px; }
.bubble--me{
  background: color-mix(in oklab, var(--orange), #fff 72%);
  border-color: color-mix(in oklab, var(--orange), #000 8%);
  border-top-right-radius: 8px;
}

.tileRow{
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 10px;
}
.miniTile{
  border-radius: 18px;
  background: rgba(255,255,255,.62);
  border: 1px solid var(--hairline);
  padding: 12px;
}
.miniTile__k{ color: var(--muted); font-size: 12px; }
.miniTile__v{ font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; }

.progress{
  margin-top: auto;
  border-radius: 18px;
  background: rgba(255,255,255,.62);
  border: 1px solid var(--hairline);
  padding: 12px;
}
.progress__label{ font-size: 12px; color: var(--muted); }
.progress__bar{
  height: 10px;
  border-radius: 999px;
  background: rgba(14,15,18,.08);
  overflow: hidden;
  margin: 10px 0 8px;
}
.progress__bar span{
  display: block;
  height: 100%;
  width: var(--w,60%);
  background: linear-gradient(90deg, var(--orange), color-mix(in oklab, var(--orange), var(--pink) 35%));
  border-radius: 999px;
}
.progress__hint{ font-size: 12px; color: var(--muted); }

.floating{
  position: absolute;
  padding: 14px 14px;
}
.floating--review{
  right: 0;
  top: 0;
  left: auto;
  bottom: auto;
  width: min(340px, 100%);
  opacity: 0.8;
  animation: floatY 6.5s ease-in-out infinite;
}
.floating--badge{
  right: 0px;
  top: 140px;
  padding: 12px 12px;
  opacity: 1;
}
.stars{ letter-spacing: 2px; font-size: 12px; }
.floating__title{ font-weight: 800; margin-top: 6px; }
.floating__text{ margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.floating__who{ margin-top: 10px; color: var(--muted); font-size: 12px; }

.badge{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.65);
  border: 1px solid var(--hairline);
}
.badge__dot{
  width: 10px; height: 10px;
  border-radius: 999px;
  background: var(--mint);
  box-shadow: 0 0 0 6px rgba(191,232,167,.25);
    animation: badgePulse 1.8s ease-out infinite;
}
@keyframes badgePulse{
  0%{
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(191, 232, 167, 0.81);
  }
  65%{
    transform: scale(1.08);
    box-shadow: 0 0 0 10px rgba(191,232,167,0);
  }
  100%{
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(191,232,167,0);
  }
}

.hero__scroller{
  padding: 18px 0 0;
}
/* Create breathing room so floaters don't cover content */
.hero__visual{
  padding-left: 18px;
  padding-right: 18px;
}
.marquee{
  display: flex;
  gap: 28px;
  white-space: nowrap;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  color: rgba(14,15,18,.40);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.marquee span{
  animation: slide 18s linear infinite;
}
@keyframes slide{
  0%{ transform: translateX(0); }
  100%{ transform: translateX(-380px); }
}

/* ---------- Sections ---------- */
.section{ padding: 70px 0; }
.section--soft{
  background: rgba(255,255,255,.35);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}

.page--landing main > section:not(#download){
  opacity: 0.5;
  filter: saturate(0.6);
  transition: opacity 5s ease-out, filter 5s ease-out;
}
.page--landing main > section:not(#download).is-centered{
  opacity: 1;
  filter: saturate(1);
  transition: opacity .25s ease-in, filter .25s ease-in;
}

.section__head{
  position: relative;
  overflow: clip;
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  max-width: 70ch;
}

.wrap--features{
  position: relative;
  padding-top: 8px;
}

@keyframes floatY{
  0%, 100%{ transform: translateY(0); }
  50%{ transform: translateY(-12px); }
}
.h2{
  margin: 0;
  font-size: clamp(28px, 3.2vw, 40px);
  letter-spacing: -0.03em;
}
.muted{ color: var(--muted); }

.grid3{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.card{
  border-radius: var(--r-lg);
  background: rgba(255,255,255,.60);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow2);
  padding: 18px;
}
.card__icon{ font-size: 20px; }
.card h3{ margin: 12px 0 6px; letter-spacing: -0.02em; }
.card p{ margin: 0; color: var(--muted); line-height: 1.6; }

.split{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: center;
}
.list{ list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 10px; }
.check{
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 999px;
  background: rgba(255,255,255,.65);
  border: 1px solid var(--hairline);
  margin-right: 10px;
}

.stack{ display: grid; gap: 12px; }
.stackCard{ padding: 18px; }
.stackCard__head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.stackCard__title{ font-weight: 800; letter-spacing: -0.02em; }
.levelMeter{
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.levelMeter__label{
  font-size: 12px;
  font-weight: 800;
  color: color-mix(in oklab, var(--ink), #fff 20%);
}
.levelMeter__bar{
  width: 136px;
  height: 14px;
  border-radius: 999px;
  background: rgba(14,15,18,.08);
  overflow: hidden;
}
.levelMeter__bar span{
  display: block;
  height: 100%;
  width: var(--w,50%);
  background: linear-gradient(90deg, var(--mint), color-mix(in oklab, var(--mint), var(--lemon) 25%));
  border-radius: 999px;
}

.barItem{ display: grid; gap: 8px; margin: 10px 0; }
.barItem__label{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}
.barItem__value{
  font-weight: 700;
  color: color-mix(in oklab, var(--ink), #fff 30%);
  white-space: nowrap;
}
.barItem__bar{
  height: 10px;
  border-radius: 999px;
  background: rgba(14,15,18,.08);
  overflow: hidden;
}
.barItem__bar span{
  display: block;
  height: 100%;
  width: var(--w,50%);
  background: linear-gradient(90deg, var(--orange), color-mix(in oklab, var(--orange), var(--lemon) 35%));
  border-radius: 999px;
}

.quote{
  margin: 0;
  padding: 18px;
  border-radius: var(--r-lg);
  background: rgba(255,255,255,.60);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow2);
}
.quote blockquote{
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.01em;
}
.quote figcaption{
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- CTA ---------- */
.cta{
  padding: 62px 0;
}
.cta__inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border-radius: var(--r-xl);
  border: 1px solid var(--hairline);
  background: linear-gradient(180deg, rgba(255,255,255,.65), rgba(255,255,255,.45));
  box-shadow: var(--shadow);
}
.cta__actions{ display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Footer ---------- */
.footer{
  padding: 28px 0 40px;
  border-top: 1px solid var(--hairline);
}
.footer__inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.footer__links{ display: flex; gap: 14px; }
.footer__links a{ color: var(--muted); }
.footer__links a:hover{ color: var(--ink); }

/* ---------- WoFi variant ---------- */
.hero--wofi{ padding-top: 46px; }
.hero__grid--wofi{ grid-template-columns: 1fr 1fr; }
.hero__title--wofi{
  font-size: clamp(42px, 5.2vw, 74px);
  letter-spacing: -0.05em;
}

.langRow{
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.langChip{
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,.65);
  cursor: pointer;
  box-shadow: var(--shadow2);
  transition: transform .18s ease;
}
.langChip:hover{ transform: translateY(-1px); }

.collage{
  position: relative;
  min-height: 520px;
}
.faceCard{
  position: absolute;
  left: 10px;
  top: 18px;
  width: 62%;
  padding: 18px;
}
.faceCard__avatar{
  width: 100%;
  height: 240px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.9), transparent 45%),
    linear-gradient(135deg, color-mix(in oklab, var(--lemon), #fff 10%), color-mix(in oklab, var(--pink), #fff 20%));
  border: 1px solid rgba(14,15,18,.08);
}
.faceCard__note{ margin-top: 10px; }

.bubbleTag{
  position: absolute;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,.75);
  box-shadow: var(--shadow2);
  font-weight: 700;
  font-size: 13px;
}
.bubbleTag--hello{ left: 18px; top: -14px; color: #fff; background: var(--orange); border-color: color-mix(in oklab, var(--orange), #000 10%); }
.bubbleTag--bonjour{ right: 18px; top: 60px; background: color-mix(in oklab, var(--pink), #fff 35%); }

.phoneMock{
  position: absolute;
  right: 0;
  top: 60px;
  width: 46%;
  padding: 14px;
}
.phoneMock__top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px;
  border-radius: 18px;
  background: rgba(255,255,255,.60);
  border: 1px solid var(--hairline);
}
.pillMini{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.65);
  border: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--muted);
}
.phoneMock__body{
  margin-top: 12px;
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 22px;
  background: rgba(255,255,255,.48);
  border: 1px solid rgba(14,15,18,.08);
}
.task{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.65);
  border: 1px solid var(--hairline);
}
.task__k{ color: var(--muted); font-size: 12px; }
.task__v{ font-weight: 800; letter-spacing: -0.02em; }

.sticker{
  position: absolute;
  left: 34%;
  bottom: 22px;
  padding: 12px;
}

.duo{
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.panel{
  border-radius: var(--r-xl);
  padding: 20px;
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow2);
}
.panel h3{ margin: 0 0 8px; letter-spacing: -0.02em; }
.panel p{ margin: 0 0 14px; color: var(--muted); line-height: 1.6; }
.panel--yellow{ background: color-mix(in oklab, var(--lemon), #fff 18%); }
.panel--green{ background: color-mix(in oklab, var(--mint), #fff 18%); }

.chatPreview{
  display: grid;
  gap: 10px;
  margin-top: 10px;
}
.chip{
  display: inline-flex;
  width: fit-content;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.65);
  border: 1px solid rgba(14,15,18,.10);
  font-size: 12px;
  color: var(--muted);
}
.confettiCard{
  border-radius: 22px;
  border: 1px solid rgba(14,15,18,.10);
  background: rgba(255,255,255,.55);
  padding: 14px;
}
.confettiCard__title{ font-weight: 900; letter-spacing: -0.02em; margin-bottom: 6px; }

.courseCard{ padding: 16px; }
.courseCard__top{ display: flex; justify-content: space-between; }
.courseCard__item{
  margin-top: 12px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.60);
  border: 1px solid var(--hairline);
}
.courseCard__k{ font-weight: 800; letter-spacing: -0.02em; }
.courseCard__bar{
  margin-top: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(14,15,18,.08);
  overflow: hidden;
}
.courseCard__bar span{
  display: block;
  height: 100%;
  width: var(--w,60%);
  background: linear-gradient(90deg, var(--orange), color-mix(in oklab, var(--orange), var(--lemon) 35%));
  border-radius: 999px;
}

/* ---------- Command palette ---------- */
.cmdk{
  position: fixed;
  inset: 0;
  z-index: 1000;
}
.cmdk__backdrop{
  position: absolute; inset: 0;
  background: rgba(0,0,0,.20);
  backdrop-filter: blur(6px);
}
.cmdk__panel{
  position: absolute;
  left: 50%; top: 18%;
  transform: translateX(-50%);
  width: min(680px, calc(100% - 26px));
  border-radius: 22px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.cmdk__top{
  display: flex;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--hairline);
}
.cmdk__input{
  width: 100%;
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,.75);
  outline: none;
}
.cmdk__close{
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,.70);
  cursor: pointer;
}
.cmdk__list{
  padding: 10px;
  display: grid;
  gap: 8px;
  max-height: 340px;
  overflow: auto;
}
.cmdk__item{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,.65);
  cursor: pointer;
}
.cmdk__item strong{ letter-spacing: -0.02em; }
.cmdk__item span{ color: var(--muted); font-size: 12px; }
.cmdk__item[aria-selected="true"]{
  outline: 2px solid color-mix(in oklab, var(--orange), #fff 20%);
  background: color-mix(in oklab, var(--orange), #fff 84%);
}
.cmdk__hint{ padding: 10px 12px; border-top: 1px solid var(--hairline); }

/* ---------- Toasts ---------- */
.toasts{
  position: fixed;
  right: 14px;
  bottom: 14px;
  display: grid;
  gap: 10px;
  z-index: 1200;
}
.toast{
  width: min(360px, calc(100vw - 28px));
  padding: 12px 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(255,255,255,.70);
  box-shadow: var(--shadow2);
  backdrop-filter: blur(14px);
}
.toast__title{ font-weight: 900; letter-spacing: -0.02em; }
.toast__msg{ margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.45; }

/* ---------- Reveal animation ---------- */
[data-reveal]{
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .6s ease, transform .6s ease;
}
.revealed{ opacity: 1; transform: translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 980px){
  .nav{ display: none; }
  .topbar__cta{ display: none; }
  .burger{ display: inline-grid; place-items: center; }
  .topbar__inner{ padding: 10px 0; }
  .brand__mark{ width: 44px; height: 44px; }

  /* disable section dim/saturate effect on mobile — filter creates stacking context
     that breaks IntersectionObserver, causing [data-reveal] elements to stay at opacity:0 */
  .page--landing main > section:not(#download){ opacity: 1; filter: none; transition: none; }
  .page--landing main > section:not(#download).is-centered{ opacity: 1; filter: none; transition: none; }

  .hero{ padding: 72px 0 40px; }
  /* ensure the section itself never creates horizontal scroll */
  .hero__grid{ grid-template-columns: 1fr; gap: 36px; text-align: center; min-width: 0; overflow: hidden; }
  /* constrain hero__copy so it cannot escape the grid track */
  .hero__copy{ justify-self: stretch; width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
  /* safety net: above-the-fold copy must never depend on JS */
  .hero__copy [data-reveal]{ opacity: 1; transform: none; transition: none; }
  /* constrain marquees so they cannot bleed outside their containers */
  .heroNoteMarquee{ overflow: hidden; max-width: 100%; }
  .hero__scroller{ overflow: hidden; max-width: 100%; }
  .hero__title{ font-size: clamp(36px, 8vw, 52px); }
  .hero__sub{ font-size: 15px; max-width: 32ch; margin: 0 auto; }
  .hero__actions{ flex-direction: column; gap: 10px; align-items: stretch; }
  .hero__actions .btn{ width: 100%; justify-content: center; padding: 14px 20px; font-size: 15px; }
  .hero__meta{ justify-content: center; flex-wrap: wrap; gap: 12px; }
  .hero__note{ text-align: left; }
  .hero__visual{ min-height: 0; overflow: visible; max-width: 100%; min-width: 0; }
  .glassCard.device{ background: none; border: none; box-shadow: none; backdrop-filter: none; padding: 0; height: auto; overflow: visible; }
  .device__top{ display: none; }
  .device__screen{ overflow: visible; min-height: 0; flex: none; }
  .device__screen.news--verge{ display: block; padding: 0; }
  .lead{ display: block; }
  .lead__headline, .lead__byline, .tag{ display: none; }
  .lead__media{ margin: 0 0 8px; border-radius: 14px; overflow: hidden; height: auto; aspect-ratio: 16/6; }
  .lead__media img{ width: 100%; height: 40%; object-fit: cover; display: block; }
  .rail{ display: none; }
  .callout{ margin-top: 0; }
  .callout__controls{ flex-direction: column; gap: 6px; align-items: stretch; }
  .switch{ width: 100%; justify-content: space-between; box-sizing: border-box; }
  .switch__btn{ flex: 1 1 0; text-align: center; }
  .switch--levels{ flex: 1 1 auto; width: 100%; flex-wrap: nowrap; overflow: visible; }
  .callout__rewrite-btn{ width: 100%; box-sizing: border-box; padding: 13px 18px; }
  .floating--badge{ top: 650px; }

  .wrap--features{ padding-top: 0; }
  .wrap--features .floating--review{
    position: static;
    margin-bottom: 20px;
    width: 100%;
  }
  .grid3{ grid-template-columns: 1fr; }
  .card{ padding: 20px; }

  .split{ grid-template-columns: 1fr; gap: 32px; }
  .split__visual{ order: 2; }
  .levelMeter__bar{ width: 100%; max-width: 180px; }

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

  .cta__inner{ flex-direction: column; align-items: stretch; gap: 20px; }
  .cta__actions{ display: flex; flex-direction: column; gap: 10px; }
  .cta__actions .btn{ width: 100%; justify-content: center; }

  .phoneMock{ width: 60%; }
  .faceCard{ width: 75%; }
  .hero__grid--wofi{ grid-template-columns: 1fr; }
  .logoMarquee__track{ animation-duration: 18s; }
  .logoPill{ font-size: 12px; padding: 6px 10px; }
  [data-action="openCommand"]{ display: none; }
}

/* ---------- Mid-range: single-column but not yet mobile (981px–1200px) ---------- */
@media (min-width: 981px) and (max-width: 1200px){
  .hero__title{ font-size: clamp(44px, 5vw, 62px); overflow-wrap: break-word; }
}

@media (prefers-reduced-motion: reduce){
  *{ scroll-behavior: auto !important; }
  [data-reveal]{ transition: none; }
  .page--landing main > section:not(#download){ transition: none; }
  .marquee span{ animation: none; }
  .heroNoteMarquee__track{ animation: none; }
  .logoMarquee__track{ animation: none; }
  [data-callout-text].is-typing::after{ animation: none; }
  .callout__text--swap{ animation: none; }
}

/* ---------- Auth page ---------- */
.authMain{
  min-height: calc(100dvh - 90px);
  display: grid;
  place-items: center;
  padding: 48px 24px;
}

.authSection{
  width: min(560px, 100%);
}

.authMain > section:not(#download){
  opacity: 1;
  filter: none;
}

.authCard{
  padding: 28px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow2);
}

.authTitle{
  margin: 16px 0 6px;
}

.authLead{
  margin: 0 0 20px;
}

.authSwitch{
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.authSwitch .btn{
  flex: 1;
}

.authSwitch .btn.is-active{
  background: var(--ink);
  color: #fff;
}

.authForm{
  display: grid;
  gap: 10px;
}

.authForm [hidden]{
  display: none !important;
}

.authForm #loginIdentifierWrap{
  display: grid;
  gap: 10px;
}

.authFieldsGroup{
  display: grid;
  gap: 10px;
}

.authLabel{
  font-size: 14px;
  font-weight: 600;
}

.authInput{
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

.authInput:focus{
  outline: 2px solid color-mix(in oklab, var(--orange), white 60%);
  outline-offset: 1px;
}

.authMessage{
  min-height: 22px;
  margin: 14px 0 0;
}

.authMessage--error{
  color: #a40d00;
}

.authMessage--success{
  color: #0f6f1f;
}

/* ---------- Dashboard ---------- */
.page--dashboard{
  background: #cbcbd8;
  overflow: hidden;
}

.dashModern{
  width: min(1320px, calc(100% - 44px));
  margin: 12px auto;
  height: calc(100dvh - 24px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
}

.dashNavBar{
  padding: 14px 18px;
  border-radius: 24px;
  border: 1px solid rgba(18, 19, 26, 0.08);
  background: rgba(255, 255, 255, 0.84);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
}

.dashLogo{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.dashLogo img{
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.dashNavTabs{
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(240, 242, 246, 0.9);
}

.dashNavTabs a{
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 16px;
  color: #232634;
}

.dashNavTabs a.is-active{
  background: #0f1117;
  color: #fff;
}

.dashNavRight{
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.dashIcon{
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(247, 247, 250, 0.95);
  border: 1px solid rgba(19, 21, 28, 0.12);
}

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

.dashUser img{
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(19, 21, 28, 0.1);
}

.dashLogout{
  padding: 8px 10px;
}

.dashGrid{
  display: grid;
  grid-template-columns: 1fr 1.05fr 1fr;
  grid-template-rows: minmax(0, 54%) minmax(0, 46%);
  gap: 18px;
  min-height: 0;
}

.dashTile{
  border-radius: 26px;
  border: 1px solid rgba(19, 21, 28, 0.08);
  background: rgba(255, 255, 255, 0.86);
  padding: 20px;
  box-shadow: 0 10px 28px rgba(26, 28, 38, 0.08);
  overflow: hidden;
}

.dashTile__head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}

.dashTile h2{
  margin: 0;
  font-size: clamp(25px, 1vw, 30px);
  letter-spacing: -0.02em;
}

.dashTile h3{
  margin: 0;
  font-size: 23px;
  letter-spacing: -0.02em;
}

.dashTile--activity{
  grid-column: 1;
  grid-row: 1 / 3;
  display: grid;
  gap: 16px;
  overflow: auto;
}

.dashSelect{
  border: 1px solid rgba(22, 24, 32, 0.18);
  border-radius: 999px;
  padding: 8px 30px 8px 12px;
  font-weight: 700;
  font-size: 14px;
  background-color: rgba(255, 255, 255, 0.9);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #24263a 50%), linear-gradient(135deg, #24263a 50%, transparent 50%);
  background-position: calc(100% - 14px) 13px, calc(100% - 9px) 13px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.dashRangeToggle{
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(22, 24, 32, 0.07);
  border: 1px solid rgba(22, 24, 32, 0.10);
}
.dashRangeBtn{
  padding: 5px 14px;
  border-radius: 999px;
  border: none;
  background: transparent;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.dashRangeBtn.is-active{
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0,0,0,.10);
}

.dashActivityBody{
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.dashBarsWrap{ position: relative; padding-right: 42px; }

.dashBars{
  position: relative;
  height: 270px;
  display: grid;
  align-items: end;
  gap: 3px;
  border-radius: 14px;
  padding: 14px 0 0;
  background: var(--bg);
}

.dashBars__bands{
  position: absolute;
  inset: 0;
  display: grid;
  pointer-events: none;
  z-index: 0;
  border-radius: 10px;
  overflow: hidden;
  gap: 0;
  container-type: size;
}

.dashBars__band{
  position: relative;
  height: 100%;
  align-self: stretch;
}
.dashBars__band.is-even{ background: rgba(57, 181, 74, 0.06); }
.dashBars__band.is-odd{ background: rgba(57, 181, 74, 0.16); }

.dashBars__bandLabel{
  /* Vertical text stamp. sideways-lr reads bottom-to-top; box height fills the
     tile, width = font-size. The stamp is centered on the tile then shifted
     left by --centerShift so it sits centered on the conceptual full-week
     span. Partial tiles (which keep their right edge but lose days off the
     left) thus push the stamp toward — and past — the chart edges, where the
     bands container's overflow:hidden clips it symmetrically on both sides.
     Same font-size on every tile within a mode (--tileWidth = 1/7 week,
     7/30 month). */
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  transform: translateX(calc(-50% + var(--centerShift, 0px)));
  writing-mode: sideways-lr;
  font-size: calc(var(--tileWidth, 7 / 30) * 80cqw);
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.42);
  text-transform: uppercase;
  white-space: nowrap;
  user-select: none;
  text-align: end;
  padding-top: 4px;
}

.dashBars > span{
  position: relative;
  z-index: 1;
  height: var(--h, 0%);
  min-height: 3px;
  border-radius: 6px 6px 0 0;
  background: rgba(57, 181, 74, 0.55);
}

.dashBars > span.is-empty{ background: rgba(120, 124, 132, 0.45); }
.dashBars > span.is-today{ background: var(--orange); }

.dashBarsScale{
  position: absolute;
  top: 0;
  right: 0;
  height: 270px;
  width: 38px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
}

.dashBarsScale span{ font-size: 15px; color: rgba(20, 20, 25, 0.62); font-weight: 800; }

.dashBars__labels{
  margin-top: 10px;
  padding: 0 10px 0 10px;
  margin-right: 42px;
  display: grid;
  gap: 3px;
  font-size: 16px;
  color: rgba(25, 27, 35, 0.66);
  text-align: center;
}

.dashBars__labels span{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashBars__labels span.is-today{ font-weight: 800; color: var(--ink); }

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

.dashMiniStat{
  border-radius: 14px;
  padding: 12px;
  border: 1px solid rgba(22, 24, 32, 0.1);
  background: rgba(255, 255, 255, 0.76);
}

.dashMiniStat h3{ margin: 0 0 6px; font-size: 14px; text-transform: uppercase; }
.dashMiniStat p{ margin: 0; display: grid; gap: 2px; }
.dashMiniStat strong{ font-size: 25px; line-height: 1; color: var(--orange);}
.dashMiniStat span{ color: rgba(25, 27, 35, 0.7); font-size: 15px; }

.dashSubTile{
  border-radius: 16px;
  background: rgba(248, 249, 252, 0.95);
  border: 1px solid rgba(22, 24, 32, 0.08);
  padding: 14px;
}

.dashSiteList{ list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 9px; }
.dashSiteList li{ display: flex; justify-content: space-between; align-items: center; color: #202332; font-size: 22px; }
.dashSiteList strong{ font-size: 20px; }

.dashTile--progress{
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  min-height: 0;
  overflow: visible;      /* never clip; rows grow to fit and the card scrolls */
}
.dashTile--progress h2{
  font-size: clamp(24px, 2.2vw, 30px);
}

/* Level + altitude share one compact header (altitude IS the level). */
.dashProgressTop{ display: flex; align-items: center; gap: 14px; }
.dashProgressTop strong{ font-size: clamp(30px, 3.4vw, 44px); line-height: 1; letter-spacing: -0.02em; }
.dashProgressTop__meta{ display: grid; gap: 2px; min-width: 0; }
.dashProgressTop__meta > span{ font-size: 17px; color: rgba(22, 25, 35, 0.72); line-height: 1.2; }
.dashProgressTop__alt{ font-size: 14px !important; color: rgba(22, 25, 35, 0.55) !important; }
.dashProgressTop__alt b{ color: var(--ink); font-weight: 700; }

.dashXpRow{ display: flex; justify-content: space-between; align-items: center; font-size: 16px; color: #202332; }
.dashXpRow strong{ font-size: 19px; }

.dashGoal__bar{
  height: 10px;
  border-radius: 999px;
  background: rgba(137, 120, 255, 0.2);
  overflow: hidden;
}

.dashGoal__bar span{
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #6f39ff 0%, #a070ff 100%);
}

.dashSubTile--goals h3{ margin-bottom: 10px; }

/* Today's goals lives as a totem at the bottom of the big Activity tile. */
.dashGoalsTotem{
  margin-top: auto;
  background: rgba(111, 57, 255, 0.06);
  border: 1px solid rgba(111, 57, 255, 0.14);
  border-radius: 16px;
  padding: 14px 16px;
}

.dashChecklist{ list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.dashChecklist li{ display: flex; align-items: center; gap: 8px; font-size: 15px; }
.dashChecklist span{
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(111, 57, 255, 0.16);
  color: #2f2363;
  font-size: 12px;
  font-weight: 800;
}
.dashChecklist span.done{ background: rgba(77, 196, 124, 0.24); color: #13743a; }

.dashTile--word{ grid-column: 3; display: grid; align-content: space-between; gap: 12px; padding: 16px; }
.dashTile--word h2{ font-size: clamp(28px, 2.8vw, 36px); }
.dashWordKicker{ margin: 0; font-size: 14px; text-transform: uppercase; letter-spacing: 0.07em; color: rgba(22, 25, 35, 0.62); }
.dashWordPron{ margin: 6px 0 0; color: rgba(22, 25, 35, 0.62); font-weight: 700; }
.dashWordDef{ margin: 8px 0 0; font-size: 16px; line-height: 1.35; }
.wordPos{ font-style: italic; color: rgba(22, 25, 35, 0.55); margin-right: 2px; }

.dashTile--schedule{
  grid-column: 2 / 4;
  display: grid;
  gap: 14px;
  padding: 16px;
}

.dashArticleGrid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  min-height: 0;
}

.dashArticle{
  border-radius: 18px;
  border: 1px solid rgba(21, 24, 32, 0.08);
  background: rgba(255, 255, 255, 0.9);
  padding: 14px;
}

.dashArticle--link{
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}
.dashArticle--link h3{ font-size: 16px; }
.dashArticle--link:hover{
  background: color-mix(in srgb, var(--mint) 22%, transparent);
  border-color: color-mix(in srgb, var(--mint) 60%, transparent);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(21, 24, 32, 0.08);
}
.dashArticle--link:active{
  transform: translateY(0);
  background: color-mix(in srgb, var(--mint) 32%, transparent);
}

.dashSource{ display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: rgba(26, 29, 39, 0.72); }
.dashSource__logo{
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
}

.dashArticle h3{ margin: 8px 0 6px; font-size: 20px; line-height: 1.3; }
.dashArticle p{ margin: 0; color: rgba(24, 27, 36, 0.72); font-size: 14px; line-height: 1.4; }

.dashArticle--telex .dashSource__logo{ background: #44a870; }
.dashArticle--24 .dashSource__logo{ background: #3976ff; }
.dashArticle--partizan .dashSource__logo{ background: #ff6a38; }

#dashboardMessage{ margin: 2px 6px 0; }

@media (max-width: 1280px){
  .dashGrid{
    grid-template-columns: 1fr 1fr;
  }
  .dashTile--activity{ grid-column: 1 / 3; }
  .dashTile--progress{ grid-column: 1; }
  .dashTile--word{ grid-column: 2; }
  .dashTile--schedule{ grid-column: 1 / 3; }
}

@media (max-width: 960px){
  .page--dashboard{ overflow: auto; }
  .dashModern{ width: calc(100% - 18px); margin-top: 10px; height: auto; }
  .dashNavBar{ grid-template-columns: 1fr; gap: 10px; }
  .dashNavTabs{ justify-self: stretch; overflow-x: auto; }
  .dashNavRight{ justify-self: end; }
  .dashGrid{ grid-template-columns: 1fr; grid-template-rows: none; }
  .dashTile--activity,
  .dashTile--progress,
  .dashTile--word,
  .dashTile--schedule{ grid-column: 1; }
  .dashActivityStats,
  .dashArticleGrid{ grid-template-columns: 1fr; }
}

/* ---------- Workbook ---------- */
.workbookSurface{
  border-radius: 26px;
  border: 1px solid rgba(19, 21, 28, 0.08);
  background: rgba(255, 255, 255, 0.86);
  padding: 20px;
  box-shadow: 0 10px 28px rgba(26, 28, 38, 0.08);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
  overflow: hidden;
}

.workbookSurface__head h1{
  margin: 0;
  font-size: clamp(30px, 3.2vw, 42px);
  letter-spacing: -0.02em;
}

.workbookSurface__head p{
  margin: 6px 0 0;
  font-size: 15px;
}

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

.wbLangStrip{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.wbLangBtn{
  width: 60px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid rgba(22, 24, 32, 0.18);
  background: rgba(255, 255, 255, 0.9);
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.wbLangBtn.is-active{
  border: 2px solid #000;
  transform: scale(1.08);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.wbLangBtn--more{
  font-size: 16px;
  font-weight: 800;
  color: #232734;
  cursor: default;
}

.workbookTableWrap{
  position: relative;
  min-height: 0;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgba(22, 24, 32, 0.1);
  background: rgba(250, 251, 255, 0.82);
}

.workbookTable{
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.workbookTable thead th{
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(23, 26, 35, 0.72);
  background: rgba(244, 246, 252, 0.96);
  border-bottom: 1px solid rgba(22, 24, 32, 0.12);
  padding: 12px 14px;
}

.workbookTable thead th:last-child{
  width: 56px;
  text-align: center;
}

.workbookRow td{
  padding: 12px 14px;
  border-bottom: 1px solid rgba(22, 24, 32, 0.08);
  vertical-align: top;
  font-size: 14px;
  color: #202332;
}

.workbookRow td:nth-child(1){ width: 26%; }
.workbookRow td:nth-child(2){ width: 34%; }
.workbookRow td:nth-child(3){ width: 30%; }

.workbookRow strong{
  font-size: 16px;
  letter-spacing: -0.01em;
}

.wbSyn{
  display: inline-flex;
  margin: 0 6px 6px 0;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(111, 57, 255, 0.12);
  color: #33206b;
  font-size: 12px;
  font-weight: 700;
}

.wbActionCell{
  text-align: center;
}

.wbExpandBtn{
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(21, 24, 32, 0.16);
  background: rgba(255, 255, 255, 0.92);
  color: #272b3b;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: transform .2s ease, background .2s ease;
}

.wbExpandBtn:hover{
  background: rgba(230, 235, 255, 0.95);
}

.wbExpandBtn.is-open{
  transform: rotate(90deg);
}

.workbookDetailRow td{
  padding: 0;
  border-bottom: 1px solid rgba(22, 24, 32, 0.08);
  background: rgba(243, 246, 255, 0.75);
}

.wbSentWrap{
  padding: 12px 14px 12px 18px;
}

.wbSentWrap p{
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(28, 31, 41, 0.65);
}

.wbContextLine{
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(22, 24, 32, 0.12);
  font-size: 13px;
  line-height: 1.45;
  color: #1f2330;
}

.wbMeaningEdit{
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 12px;
}
.wbMeaningInput{
  flex: 1 1 240px;
  min-width: 180px;
  resize: vertical;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(22, 24, 32, 0.18);
  background: rgba(255, 255, 255, 0.85);
  font: inherit;
  font-size: 13px;
}
.wbMeaningInput:focus{ outline: none; border-color: rgba(255,90,31,.5); }
.wbMeaningSave{ flex: 0 0 auto; }
.wbMeaningStatus{ flex: 0 0 auto; align-self: center; font-size: 13px; }

.wbSentWrap ul{
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.wbSentWrap li{
  font-size: 14px;
  line-height: 1.5;
  color: #1f2330;
}

.wbSentWrap mark{
  border-radius: 6px;
  padding: 1px 4px;
  background: rgba(255, 154, 53, 0.34);
  color: #4d2a0a;
}

.workbookEmptyRow td{
  padding: 18px 14px;
  font-size: 14px;
  color: rgba(26, 29, 40, 0.68);
}

@media (max-width: 960px){
  .workbookSurface{
    padding: 14px;
  }
  .workbookSurface__head{
    flex-direction: column;
    align-items: stretch;
  }
  .wbLangStrip{
    justify-content: flex-start;
  }
  .workbookTable thead th,
  .workbookRow td{
    padding: 10px;
  }
}

/* ---------- Topics ---------- */
.page--topics{
  overflow: hidden;
  --topics-primary-fixed-h: auto;
  --topics-tile-fixed-h: auto;
}

.page--topics .dashModern{
  height: calc(100dvh - 24px);
}

.page--topics .topicsSurface{
  min-height: 0;
  height: 100%;
  grid-template-rows: auto 1fr;
}

#topicsGridsWrap{
  display: grid;
  gap: 14px;
  align-content: start;
  overflow-y: auto;
}

#topicViewBody{
  overflow-y: auto;
}

/* Animated view switching for topics */
#topicsGridsWrap.is-entering,
#topicViewBody.is-entering {
  animation: topicsEnter 0.38s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes topicsEnter {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.page--topics.topics-expanded{
  overflow: auto;
}

.page--topics.topics-expanded .dashModern{
  height: auto;
  min-height: calc(100dvh - 24px);
}

.page--topics.topics-expanded .topicsSurface{
  height: auto;
}

.topicsSurface{
  border-radius: 26px;
  border: 1px solid rgba(19, 21, 28, 0.08);
  background: rgba(255, 255, 255, 0.86);
  padding: 20px;
  box-shadow: 0 10px 28px rgba(26, 28, 38, 0.08);
  display: grid;
  gap: 14px;
}

.topicsSurface__headRow{
  display: flex;
  align-items: center;
  gap: 10px;
}

.topicsSurface__head h1{
  margin: 0;
  font-size: clamp(30px, 3.2vw, 42px);
  letter-spacing: -0.02em;
}

.topicsSurface__head p{
  margin: 6px 0 0;
  font-size: 15px;
}

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

.topicTile{
  border-radius: 18px;
  border: 1px solid rgba(22, 24, 32, 0.1);
  background: rgba(247, 249, 255, 0.9);
  padding: 12px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  align-content: stretch;
  align-items: stretch;
  min-height: 0;
  height: var(--topics-tile-fixed-h);
}

.topicTile h3{
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.topicArt{
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(20, 23, 33, 0.08);
}

/* Sport: football pitch + ball */
.topicArt--sport{
  background:
    radial-gradient(circle at 78% 28%, #fff 0 11px, #151720 12px 14px, transparent 15px),
    linear-gradient(90deg, transparent 49%, rgba(255,255,255,.74) 50%, transparent 51%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.18) 0 42px, rgba(255,255,255,.08) 42px 84px),
    linear-gradient(145deg, #74c66f, #53a85a);
}

/* History: cartoony pyramids */
.topicArt--history{
  background: linear-gradient(180deg, #7fd0ff 0 52%, #f7d18a 52% 100%);
}
.topicArt--history::before,
.topicArt--history::after{
  content: "";
  position: absolute;
  bottom: 14px;
  width: 0;
  height: 0;
  border-left: 34px solid transparent;
  border-right: 34px solid transparent;
  border-bottom: 56px solid #d7a65e;
}
.topicArt--history::before{ left: 18px; }
.topicArt--history::after{ left: 70px; border-bottom-color: #c69552; }

.topicArt--travel{
  background:
    radial-gradient(circle at 18% 22%, #ffe07b 0 14px, transparent 15px),
    linear-gradient(160deg, transparent 44%, #ffffff 45% 49%, transparent 50%),
    linear-gradient(180deg, #9cd8ff 0 64%, #77c58f 64% 100%);
}

.topicArt--technology{
  background:
    linear-gradient(90deg, transparent 30%, #7e87ff 30% 70%, transparent 70%),
    linear-gradient(0deg, transparent 34%, #7e87ff 34% 66%, transparent 66%),
    radial-gradient(circle at 50% 50%, #d8ddff 0 26px, #8d98ff 27px 30px, transparent 31px),
    linear-gradient(145deg, #d7d9ff, #9aa1ff);
}

.topicArt--food{
  background:
    radial-gradient(circle at 50% 58%, #fff6e3 0 38px, #ffb16b 39px 42px, transparent 43px),
    linear-gradient(90deg, transparent 22%, #ff7c56 22% 24%, transparent 24% 76%, #ff7c56 76% 78%, transparent 78%),
    linear-gradient(145deg, #ffe9ca, #ffc98d);
}

.topicArt--business{
  background:
    linear-gradient(0deg, transparent 66%, #2f4f45 66% 70%, transparent 70%),
    linear-gradient(90deg, transparent 18%, #2f4f45 18% 82%, transparent 82%),
    linear-gradient(180deg, transparent 40%, #86d8b0 40% 100%),
    linear-gradient(145deg, #c2f3d3, #7fd7a1);
}

.topicArt--science{
  background:
    radial-gradient(circle at 34% 72%, #ffffff 0 9px, transparent 10px),
    radial-gradient(circle at 66% 66%, #ffffff 0 7px, transparent 8px),
    linear-gradient(180deg, transparent 42%, #ff86bd 42% 100%),
    linear-gradient(145deg, #ffd1e5, #ff9cc8);
}

.topicArt--arts{
  background:
    radial-gradient(circle at 28% 44%, #ff6f61 0 9px, transparent 10px),
    radial-gradient(circle at 45% 33%, #5ca8ff 0 8px, transparent 9px),
    radial-gradient(circle at 62% 45%, #79c85c 0 8px, transparent 9px),
    radial-gradient(circle at 50% 58%, #ffffff 0 22px, #ffcc7f 23px 28px, transparent 29px),
    linear-gradient(145deg, #ffe9a7, #ffc86a);
}

.topicArt--health{
  background:
    linear-gradient(90deg, transparent 42%, #ffffff 42% 58%, transparent 58%),
    linear-gradient(0deg, transparent 36%, #ffffff 36% 64%, transparent 64%),
    linear-gradient(145deg, #c8f0ff, #8bdaf8);
}

.topicArt--nature{
  background:
    linear-gradient(145deg, transparent 52%, #68b15d 53% 100%),
    linear-gradient(215deg, transparent 52%, #4f9f57 53% 100%),
    linear-gradient(180deg, #b4ecff 0 56%, #8edc8e 56% 100%);
}

.topicArt--politics{
  background:
    linear-gradient(90deg, transparent 49%, #334f8d 49% 51%, transparent 51%),
    linear-gradient(180deg, transparent 38%, #ffffff 38% 40%, #ff6d63 40% 56%, #ffffff 56% 58%, #3d78ff 58% 74%, transparent 74%),
    linear-gradient(145deg, #ffd4d4, #ff8f8f);
}

.topicArt--music{
  background:
    radial-gradient(circle at 62% 68%, #31264f 0 10px, transparent 11px),
    linear-gradient(90deg, transparent 58%, #31264f 58% 63%, transparent 63%),
    linear-gradient(145deg, #e0d2ff, #a98bff);
}

.topicArt--film{
  background:
    repeating-linear-gradient(90deg, #ffffff 0 10px, #29354f 10px 20px),
    linear-gradient(180deg, transparent 26%, #b2bfcd 26% 100%),
    linear-gradient(145deg, #d8e1ef, #a7b6cd);
}

.topicArt--economy{
  background:
    linear-gradient(0deg, transparent 72%, #2b4f3f 72% 100%),
    linear-gradient(90deg, transparent 22%, #4fa86a 22% 30%, transparent 30% 42%, #4fa86a 42% 52%, transparent 52% 64%, #4fa86a 64% 76%, transparent 76%),
    linear-gradient(145deg, #f7d7a8, #efaf66);
}

.topicArt--culture{
  background:
    linear-gradient(0deg, transparent 56%, #f6f1df 56% 60%, transparent 60%),
    linear-gradient(90deg, transparent 28%, #f6f1df 28% 34%, transparent 34% 66%, #f6f1df 66% 72%, transparent 72%),
    linear-gradient(145deg, #cde7ff, #8bc0ff);
}

.topicArt--education{
  background:
    linear-gradient(90deg, transparent 50%, #6d4ca5 50% 52%, transparent 52%),
    linear-gradient(180deg, transparent 38%, #f5ddff 38% 100%),
    linear-gradient(145deg, #f3defd, #d6a8f5);
}

.topicsMoreWrap{
  display: flex;
  justify-content: center;
  margin: 4px 0;
}

.topicsMoreBtn{
  border: 1px solid rgba(24, 26, 34, 0.14);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.03em;
  background: rgba(255, 255, 255, 0.92);
  color: #232736;
  cursor: pointer;
}

.topicsGrid--extra{
  margin-top: 4px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-10px);
  pointer-events: none;
  transition:
    max-height .45s ease,
    opacity .25s ease,
    transform .35s ease;
}

#topicsGridPrimary{
  min-height: 0;
  height: var(--topics-primary-fixed-h);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  align-content: stretch;
}

.topicsGrid--extra .topicTile{
  height: var(--topics-tile-fixed-h);
}

.page--topics.topics-expanded .topicsGrid--extra,
.app-page--topics.topics-expanded .topicsGrid--extra{
  max-height: 1200px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.page--topics .topicsGrid--extra[hidden],
.app-page--topics .topicsGrid--extra[hidden]{
  display: none !important;
}
#topicsGridsWrap[hidden]   { display: none !important; }
#topicViewBody[hidden]     { display: none !important; }
#topicsSurfaceBack[hidden] { display: none !important; }

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

@media (max-width: 760px){
  .page--topics{
    overflow: auto;
    --topics-primary-fixed-h: auto;
    --topics-tile-fixed-h: auto;
  }
  .page--topics .dashModern{
    height: auto;
  }
  .page--topics .topicsSurface{
    height: auto;
    grid-template-rows: auto auto auto auto;
  }
  .topicsGrid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ======================================================
   App Layout — post-login shell (dashboard, workbook, topics)
   ====================================================== */

.app-page {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

/* Two-blob background: orange top-left, sky bottom-right */
.app-page .blob--c { display: none; }
.app-page .blob--a {
  width: 600px; height: 600px;
  left: -140px; top: -160px;
  background: radial-gradient(circle at 30% 30%, var(--orange), transparent 60%);
  opacity: 0.11;
  filter: blur(80px);
}
.app-page .blob--b {
  width: 520px; height: 520px;
  right: -140px; top: auto; bottom: -140px;
  background: radial-gradient(circle at 70% 70%, var(--sky), transparent 62%);
  opacity: 0.13;
  filter: blur(80px);
}

/* Header */
.app-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  z-index: 50;
}

.app-logo {
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  font-style: italic;
  color: var(--ink);
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-avatar {
  height: 34px;
  width: auto;
  object-fit: contain;
}

/* Segmented nav */
.app-seg-nav {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding: 0 28px 18px;
  z-index: 40;
}

.app-seg-pill {
  display: flex;
  gap: 4px;
  padding: 6px;
  border-radius: 28px;
  width: 100%;
  max-width: 600px;
}

.app-seg-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.83rem;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s, transform .1s;
}

.app-seg-btn:hover { background: rgba(255, 255, 255, .40); }

.app-seg-btn.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow2);
  transform: scale(1.03);
}

/* Main content */
.app-main {
  flex: 1;
  overflow: hidden;
  padding: 0 28px;
  z-index: 30;
  min-height: 0;
}

.app-card {
  height: 100%;
  border-radius: 32px;
  overflow-y: auto;
  padding: 32px 40px;
  box-shadow: var(--shadow);
  max-width: 1500px;
  margin: 0 auto;
  background: rgba(255, 255, 255, .40);
  border: 1px solid rgba(255, 255, 255, .55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, .10) transparent;
}

.app-card::-webkit-scrollbar { width: 4px; }
.app-card::-webkit-scrollbar-thumb { background: rgba(0,0,0,.12); border-radius: 99px; }

/* Footer */
.app-footer {
  flex-shrink: 0;
  text-align: center;
  padding: 12px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.5;
  z-index: 50;
}

/* Dashboard: dashGrid fills the card; the card scrolls if content exceeds the
   viewport so nothing clips behind a tile (e.g. the content-heavy progress tile). */
.app-page--dashboard .app-card { display: flex; flex-direction: column; overflow-y: auto; }
.app-page--dashboard .dashGrid { flex: 1; min-height: 0; }
/* Percentage rows act as a floor, not a hard cap — rows grow to fit content. */
.app-page--dashboard .dashGrid { grid-template-rows: minmax(54%, auto) minmax(46%, auto); }
.app-page--dashboard #dashboardMessage { flex-shrink: 0; margin-top: 8px; }

/* Workbook: surface fills the card */
.app-page--workbook .app-card { display: flex; flex-direction: column; overflow: hidden; }
.app-page--workbook .workbookSurface { flex: 1; min-height: 0; }
.app-page--workbook #workbookMessage { flex-shrink: 0; margin-top: 8px; }

/* Topics: card overflow toggle */
.app-page--topics .app-card { overflow: hidden; }
.app-page--topics .topicsSurface { height: 100%; min-height: 0; }

/* Discover (articles) list view: the card scrolls so the feed can grow via
   infinite scroll. The reader view (topics-in-view) keeps the default rules. */
.app-page--articles:not(.topics-in-view) .app-card { overflow-y: auto; }
.app-page--articles:not(.topics-in-view) .topicsSurface { height: auto; }
.app-page--topics.topics-expanded .app-card { overflow-y: auto; }
.app-page--topics.topics-expanded .topicsSurface { height: auto; }
.app-page--topics.topics-in-view .app-card     { overflow-y: auto; }
.app-page--topics.topics-in-view .topicsSurface { height: auto; }

/* Workbook loading dots */
.wbLoader {
  position: absolute;
  left: 0; right: 0;
  top: calc(50% + 20px); /* offset down past the thead (~40px) */
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}
.wbLoader[hidden] { display: none; }
.wbLoader__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--orange);
  animation: wbDotBounce 1.1s ease-in-out infinite both;
}
.wbLoader__dot:nth-child(1) { animation-delay: 0s; }
.wbLoader__dot:nth-child(2) { animation-delay: 0.18s; }
.wbLoader__dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes wbDotBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40%            { transform: translateY(-10px); opacity: 1; }
}

/* Streak badge — animated CSS flame */
@keyframes scaleUpDown {
  0%, 100% { transform: scaleY(1) scaleX(1); }
  50%, 90%  { transform: scaleY(1.1); }
  75%        { transform: scaleY(0.95); }
  80%        { transform: scaleX(0.95); }
}
@keyframes shake {
  0%, 100% { transform: skewX(0) scale(1); }
  50%       { transform: skewX(5deg) scale(0.9); }
}
@keyframes particleUp {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0; top: -100%; transform: scale(0.5); }
}
@keyframes glow {
  0%, 100% { background-color: #ef5a00; }
  50%       { background-color: #ff7800; }
}

.fire {
  position: absolute;
  width: 100px;
  height: 100px;
  background-color: transparent;
}
.fire-center {
  position: absolute;
  height: 100%;
  width: 100%;
  animation: scaleUpDown 3s ease-out infinite both;
}
.fire-center .main-fire {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(farthest-corner at 10px 0, #d43300 0%, #ef5a00 95%);
  transform: scaleX(0.8) rotate(45deg);
  border-radius: 0 40% 60% 40%;
  filter: drop-shadow(0 0 10px #d43322);
}
.fire-center .particle-fire {
  position: absolute;
  top: 60%;
  left: 45%;
  width: 10px;
  height: 10px;
  background-color: #ef5a00;
  border-radius: 50%;
  filter: drop-shadow(0 0 10px #d43322);
  animation: particleUp 2s ease-out infinite both;
}
.fire-right {
  position: absolute;
  height: 100%;
  width: 100%;
  animation: shake 2s ease-out infinite both;
}
.fire-right .main-fire {
  position: absolute;
  top: 15%;
  right: -25%;
  width: 80%;
  height: 80%;
  background-color: #ef5a00;
  transform: scaleX(0.8) rotate(45deg);
  border-radius: 0 40% 60% 40%;
  filter: drop-shadow(0 0 10px #d43322);
}
.fire-right .particle-fire {
  position: absolute;
  top: 45%;
  left: 50%;
  width: 15px;
  height: 15px;
  background-color: #ef5a00;
  transform: scaleX(0.8) rotate(45deg);
  border-radius: 50%;
  filter: drop-shadow(0 0 10px #d43322);
  animation: particleUp 2s ease-out infinite both;
}
.fire-left {
  position: absolute;
  height: 100%;
  width: 100%;
  animation: shake 3s ease-out infinite both;
}
.fire-left .main-fire {
  position: absolute;
  top: 15%;
  left: -20%;
  width: 80%;
  height: 80%;
  background-color: #ef5a00;
  transform: scaleX(0.8) rotate(45deg);
  border-radius: 0 40% 60% 40%;
  filter: drop-shadow(0 0 10px #d43322);
}
.fire-left .particle-fire {
  position: absolute;
  top: 10%;
  left: 20%;
  width: 10%;
  height: 10%;
  background-color: #ef5a00;
  border-radius: 50%;
  filter: drop-shadow(0 0 10px #d43322);
  animation: particleUp 3s ease-out infinite both;
}
.fire-bottom .main-fire {
  position: absolute;
  top: 30%;
  left: 20%;
  width: 75%;
  height: 75%;
  background-color: #ff7800;
  transform: scaleX(0.8) rotate(45deg);
  border-radius: 0 40% 100% 40%;
  filter: blur(10px);
  animation: glow 2s ease-out infinite both;
}

/* Badge wrapper — scales the 100px flame down to fit the header */
.streakBadge {
  position: relative;
  width: 40px;
  height: 48px;
  flex-shrink: 0;
  cursor: default;
  user-select: none;
}
.streakBadge .fire {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -52%) scale(0.42);
  transform-origin: center center;
  pointer-events: none;
}
.streakBadge__count {
  position: absolute;
  z-index: 10;
  bottom: 10px;
  left: 0; right: 0;
  text-align: center;
  font-size: 1rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.65);
  letter-spacing: -0.02em;
  pointer-events: none;
}

@media (max-width: 768px) {
  .app-header { padding: 12px 16px; }
  .app-seg-nav { padding: 0 12px 12px; }
  .app-main { padding: 0 12px; }
  .app-card { padding: 18px 16px; border-radius: 20px; }
  .app-seg-btn { font-size: 0.75rem; padding: 10px 8px; }
  .app-page--topics .app-card,
  .app-page--topics.topics-expanded .app-card { overflow-y: auto; }
  .app-page--topics .topicsSurface { height: auto; }
  .app-page--dashboard .dashGrid { flex: none; }
}

/* ═══════════════════════════════════════════════════════════════
   GAMIFICATION — shared setup controls
═══════════════════════════════════════════════════════════════ */

.fcSetupControls {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 16px;
  align-items: center;
  max-width: 380px;
  margin: 20px 0;
}
.fcSetupControls label { font-size: 0.9rem; font-weight: 600; }
.fcEmpty { margin-top: 14px; }

.fcResultsInner {
  text-align: center;
  padding: 40px 20px;
}
.fcResultsInner h2 { margin: 8px 0 4px; }
.fcResultsEmoji { font-size: 3rem; line-height: 1; }
.fcResultsStat { font-size: 1.1rem; margin: 6px 0; }
.fcResultsXp   { margin: 8px 0 24px; }
.fcResultsBtns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════════
   FLASHCARDS
═══════════════════════════════════════════════════════════════ */

.fcArena,
.fcResults { padding: 4px 0; }

.fcControls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.fcControls__label {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Progress bar */
.fcProgress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  font-size: 0.85rem;
  font-weight: 600;
}
.fcProgressBar {
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: var(--hairline);
  overflow: hidden;
}
.fcProgressBar > div {
  height: 100%;
  background: var(--orange);
  border-radius: 99px;
  transition: width 0.4s ease;
}
.fcXpBadge {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--orange);
  transition: transform 0.15s ease;
}
.fcXpBadge.is-lit { transform: scale(1.15); }

/* Discard pile */
.fcPile {
  position: relative;
  height: 16px;
  margin-bottom: 8px;
}

/* Card wrap + flip container */
.fcCardWrap {
  perspective: 1000px;
  width: min(400px, 100%);
  margin: 0 auto;
}
.fcCard {
  width: 100%;
  cursor: pointer;
  outline: none;
}
.fcCard__inner {
  position: relative;
  width: 100%;
  min-height: 220px;
  border-radius: var(--r-lg);
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow);
}
.fcCard__inner.is-flipped { transform: rotateY(180deg); }

.fcCard__front,
.fcCard__back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 28px;
  text-align: center;
}
.fcCard__front {
  background: var(--glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--hairline);
}
.fcCard__back {
  background: var(--lemon);
  transform: rotateY(180deg);
  border: 1px solid rgba(0,0,0,.06);
}

.fcCard__lang {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 8px;
}
.fcCard__word {
  font-size: 2rem;
  font-weight: 900;
  margin: 0 0 8px;
  word-break: break-word;
}
.fcCard__hint { font-size: 0.78rem; margin: 0; }

.fcCard__synonyms {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 8px;
  letter-spacing: .02em;
}
.fcCard__definition {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 10px;
  word-break: break-word;
}
.fcCard__context {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
  font-style: italic;
  border-left: 3px solid rgba(0,0,0,.12);
  padding-left: 10px;
  text-align: left;
}

/* Answer buttons */
.fcActions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 20px;
}
.fcBtn--no {
  background: rgba(220,53,69,.12);
  color: #c0392b;
  border: 1.5px solid rgba(220,53,69,.3);
  padding: 12px 28px;
  border-radius: var(--r-md);
  font-weight: 700;
  transition: background 0.15s, transform 0.1s;
}
.fcBtn--no:hover  { background: rgba(220,53,69,.22); transform: scale(1.04); }
.fcBtn--yes {
  background: rgba(39,174,96,.14);
  color: #1a8c4e;
  border: 1.5px solid rgba(39,174,96,.3);
  padding: 12px 28px;
  border-radius: var(--r-md);
  font-weight: 700;
  transition: background 0.15s, transform 0.1s;
}
.fcBtn--yes:hover  { background: rgba(39,174,96,.26); transform: scale(1.04); }

/* Throw-to-pile animation */
@keyframes fcThrowCorrect {
  0%   { transform: rotate(0deg) translateY(0) scale(1); opacity: 1; }
  60%  { transform: rotate(-8deg) translateY(-30px) scale(0.9); opacity: 0.8; }
  100% { transform: rotate(-15deg) translateY(80px) scale(0.5); opacity: 0; }
}
@keyframes fcThrowWrong {
  0%   { transform: rotate(0deg) translateY(0) scale(1); opacity: 1; }
  60%  { transform: rotate(8deg) translateY(-20px) scale(0.92); opacity: 0.8; }
  100% { transform: rotate(20deg) translateY(80px) scale(0.5); opacity: 0; }
}
.fc-thrown {
  position: absolute;
  top: 0; left: 0;
  pointer-events: none;
}
.fc-thrown--correct { animation: fcThrowCorrect 0.5s ease forwards; }
.fc-thrown--wrong   { animation: fcThrowWrong   0.5s ease forwards; }


/* ═══════════════════════════════════════════════════════════════
   SYNONYM MATCH GAME
═══════════════════════════════════════════════════════════════ */

.matchArena,
.matchResults { padding: 4px 0; }

/* Controls bar (language + More cards) */
.matchControls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.matchControls__left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.matchControls__label {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

.matchHud {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
  padding: 14px 20px;
  background: var(--glass);
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
}
.matchStat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.matchStatLabel { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.matchStatVal { font-size: 1.3rem; font-weight: 900; }

/* Table surface — cards scattered as absolute elements */
.matchGrid {
  position: relative;
  height: 520px;
  min-height: 400px;
}

.matchTile {
  position: absolute;
  width: 148px;
  padding: 12px 10px;
  border-radius: var(--r-md);
  border: 2px solid var(--hairline);
  background: var(--glass);
  backdrop-filter: blur(8px);
  box-shadow: 2px 4px 14px rgba(0,0,0,0.13);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  word-break: break-word;
  user-select: none;
  transform: rotate(var(--tile-rot, 0deg));
  transition: box-shadow 0.15s, opacity 0.35s, transform 0.15s;
  opacity: 0;
  z-index: 1;
}
.matchTile--in { opacity: 1; }
.matchTile:hover:not(:disabled) {
  box-shadow: 0 6px 22px rgba(0,0,0,0.2);
  transform: rotate(var(--tile-rot, 0deg)) translateY(-3px);
  z-index: 10;
}
.matchTile.is-selected {
  border-color: var(--orange);
  background: rgba(255,90,31,.12);
  transform: rotate(var(--tile-rot, 0deg)) scale(1.06);
  z-index: 10;
  box-shadow: 0 8px 24px rgba(255,90,31,0.25);
}
.matchTile.is-matched {
  border-color: #27ae60;
  background: rgba(39,174,96,.12);
  color: #1a8c4e;
  pointer-events: none;
  opacity: 0;
}

/* Snap animation */
@keyframes matchSnap {
  0%   { transform: rotate(var(--tile-rot,0deg)) scale(1.04); }
  50%  { transform: rotate(var(--tile-rot,0deg)) scale(1.14); }
  100% { transform: rotate(var(--tile-rot,0deg)) scale(1); }
}
.matchTile.snap { animation: matchSnap 0.5s cubic-bezier(.36,.07,.19,.97); }

/* Shake animation (wrong pair) */
@keyframes matchShake {
  0%,100% { transform: rotate(var(--tile-rot,0deg)) translateX(0); }
  20%     { transform: rotate(var(--tile-rot,0deg)) translateX(-7px); }
  40%     { transform: rotate(var(--tile-rot,0deg)) translateX(7px); }
  60%     { transform: rotate(var(--tile-rot,0deg)) translateX(-5px); }
  80%     { transform: rotate(var(--tile-rot,0deg)) translateX(4px); }
}
.matchTile.shake {
  animation: matchShake 0.5s ease;
  border-color: #c0392b;
  background: rgba(220,53,69,.1);
}


/* ═══════════════════════════════════════════════════════════════
   ARTICLE CHALLENGES
═══════════════════════════════════════════════════════════════ */

.chHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}
.chLoading { padding: 20px 0; }

.chArticleList {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chArticleItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  background: var(--glass);
  flex-wrap: wrap;
}
.chArticleInfo { flex: 1; min-width: 0; }
.chArticleTitle { display: block; font-size: 0.95rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chArticleMeta { font-size: 0.78rem; }
.chArticleActions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chDeleteBtn { padding: 8px 10px; opacity: 0.5; }
.chDeleteBtn:hover { opacity: 1; color: #c0392b; }

.chQuizHeader {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.chQuizTitle { margin: 0; font-size: 1.1rem; }
.chBackBtn { flex-shrink: 0; }

.chQuestions { display: flex; flex-direction: column; gap: 20px; }
.chQuestion { padding: 16px; border-radius: var(--r-md); background: var(--glass); border: 1px solid var(--hairline); }
.chQuestionText { margin: 0 0 12px; font-size: 0.95rem; font-weight: 600; }
.chOptions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.chOption {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s;
  font-size: 0.9rem;
}
.chOption:hover { background: rgba(255,90,31,.08); }
.chOption input[type="radio"] { margin-top: 2px; accent-color: var(--orange); }

.chQuizFooter { margin-top: 24px; text-align: right; }

.chAnswerReview { margin: 16px 0; text-align: left; display: flex; flex-direction: column; gap: 10px; }
.chReviewItem {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
}
.chReviewItem.is-correct { background: rgba(39,174,96,.12); border-left: 3px solid #27ae60; }
.chReviewItem.is-wrong   { background: rgba(220,53,69,.10); border-left: 3px solid #c0392b; }
.chReviewQ { margin: 0 0 4px; font-weight: 600; }
.chReviewA { margin: 0; color: var(--muted); }

/* ── Language flag badge ─────────────────────────────────────────────────── */
.chLangFlag { font-size: 1rem; vertical-align: middle; margin-right: 2px; }

/* ── Article text in quiz ────────────────────────────────────────────────── */
.chArticleCollapse {
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--glass);
  margin-bottom: 20px;
  overflow: hidden;
}
.chArticleCollapseToggle {
  padding: 10px 16px;
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
}
.chArticleText {
  padding: 12px 16px 16px;
  font-size: 0.88rem;
  line-height: 1.65;
  white-space: pre-wrap;
  color: var(--muted);
  border-top: 1px solid var(--hairline);
}

/* ── Topic badge + select ────────────────────────────────────────────────── */
.chTopicWrap { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.chTopicBadge {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(255,90,31,.13);
  color: var(--orange);
  cursor: pointer;
  border: none;
  letter-spacing: 0.02em;
  transition: background 0.15s;
}
.chTopicBadge:hover { background: rgba(255,90,31,.22); }
.chTopicBadge--none {
  background: var(--glass);
  color: var(--muted);
  border: 1px dashed var(--hairline);
}
.chTopicSelect {
  font-size: 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--hairline);
  background: var(--glass);
  padding: 2px 6px;
  color: inherit;
}

/* ── Topics page — My own tile ───────────────────────────────────────────── */
.topicsGrid--own { margin-bottom: 14px; }
.topicTile--own .topicArt--own {
  background: linear-gradient(135deg, #ff5a1f 0%, #f7b731 100%);
}
.topicTile--own .topicArt--own::after {
  content: "✦";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: rgba(255,255,255,.8);
}
.topicTile--own .topicArt { position: relative; }
.topicTile.is-active {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}
.topicTile.is-empty {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* ── Topic detail panel ──────────────────────────────────────────────────── */
.topicPanel {
  margin-top: 24px;
  border-radius: var(--r-md);
  background: var(--glass);
  border: 1px solid var(--hairline);
  padding: 20px;
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.topicPanelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.topicPanelTitle { margin: 0; font-size: 1.05rem; }
.topicPanelClose { padding: 4px 10px; opacity: 0.5; }
.topicPanelClose:hover { opacity: 1; }
.topicPanelSub { margin: 0 0 16px; font-size: 0.83rem; }

/* ── Topic article list (in panel) ───────────────────────────────────────── */
.topicArticleList {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.topicArticleItem {
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,.04);
}
.topicArticleItem--own { background: rgba(255,90,31,.04); }
.topicArticleMeta { font-size: 0.78rem; display: block; margin-top: 2px; }
.topicArticlePreview {
  font-size: 0.81rem;
  margin: 6px 0 0;
  line-height: 1.5;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Small button modifier ───────────────────────────────────────────────── */
.btn--sm {
  font-size: 0.8rem;
  padding: 5px 14px;
  border-radius: 8px;
}

/* ── Topic screen base (list / quiz / results) ───────────────────────────── */
.topicScreen {
  animation: fadeIn 0.18s ease;
}
/* ── Topic view (full-page replacement when tile is clicked) ─────────────── */
.topicViewHeader {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.topicViewBack {
  padding: 6px 14px;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.topicViewTitle { margin: 0; font-size: 1.15rem; }
.topicViewSub { margin: 0 0 18px; font-size: 0.83rem; }
.topicViewBody { min-height: 80px; }

/* ── Topic bubbles ───────────────────────────────────────────────────────── */
.chTopicWrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  position: relative;
}
.topicBubble {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--hairline);
  background: var(--glass);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.topicBubble:hover {
  background: rgba(255,90,31,.1);
  color: var(--orange);
  border-color: var(--orange);
}
.topicBubble--active {
  background: rgba(255,90,31,.13);
  color: var(--orange);
  border-color: rgba(255,90,31,.35);
}
.topicBubble--active:hover {
  background: rgba(220,53,69,.12);
  color: #c0392b;
  border-color: #c0392b;
}
.topicBubble__x {
  font-size: 0.9em;
  line-height: 1;
  opacity: 0.7;
}
.topicBubble--add {
  font-size: 1rem;
  font-weight: 700;
  padding: 2px 9px;
  line-height: 1;
  background: rgba(255,90,31,.07);
  color: var(--orange);
  border-color: rgba(255,90,31,.3);
  border-style: dashed;
}
.topicBubble--add:hover {
  background: rgba(255,90,31,.18);
}
.topicBubble--sm {
  font-size: 0.7rem;
  padding: 2px 8px;
  font-weight: 500;
  cursor: default;
  pointer-events: none;
}
.topicBubbleRow {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

/* ── Topic article list (expandable items) ───────────────────────────────── */
/* Articles page: header add button */
.topicsSurface__headRow { display: flex; align-items: center; gap: 12px; }
.articlesAddBtn { margin-left: auto; flex: 0 0 auto; white-space: nowrap; }

/* Articles page: grouped filter rows */
.taFilters--articles {
  gap: 12px;
  margin-bottom: 18px;
}
.taFilterGroup {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.taFilterGroup__label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.taFilters__row--wrap { flex-wrap: wrap; }

/* URL input inside the add-article (step 1) modal */
.taModal__url {
  padding: 10px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: rgba(255,255,255,.6);
  color: inherit;
  font: inherit;
}
.taModal__url:focus { outline: none; border-color: rgba(255,90,31,.45); }

/* Add-article modal */
.taModal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 12, 18, .45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.taModal__card {
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  overflow-y: auto;
  border-radius: 20px;
  padding: 22px 24px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(255, 255, 255, .6);
  box-shadow: var(--shadow);
}
.taModal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.taModal__head h2 { margin: 0; font-size: 20px; }
.taModal__close {
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 4px;
}
.taModal__form { display: flex; flex-direction: column; gap: 16px; }
.taModal__field { display: flex; flex-direction: column; gap: 8px; }
.taModal__label { font-weight: 700; font-size: 14px; }
.taModal__title {
  padding: 10px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: rgba(255,255,255,.6);
  color: inherit;
  font: inherit;
}
.taModal__title:focus { outline: none; border-color: rgba(255,90,31,.45); }
.taModal__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.taModal__status { margin: 0; font-size: 14px; }
.taModal__status.is-error { color: #ff6b6b; }
.taModal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.taList {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.taItem {
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: rgba(255,255,255,.04);
  overflow: hidden;
  transition: border-color 0.15s;
}
.taItem--own { background: rgba(255,90,31,.03); }
.taItem.is-open { border-color: rgba(255,90,31,.3); }

.taItem__header {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s;
}
.taItem__header:hover { background: rgba(255,255,255,.04); }

.taItem__titleRow {
  display: flex;
  align-items: center;
  gap: 8px;
}
.taItem__flag { font-size: 1.05rem; flex-shrink: 0; }
.taItem__title {
  flex: 1;
  font-size: 0.93rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.taItem__chevron {
  font-size: 1.1rem;
  color: var(--muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.taItem.is-open .taItem__chevron { transform: rotate(90deg); }
.taItem__meta { font-size: 0.77rem; padding-left: 2px; }
.taItem__savedBy {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: rgba(32, 35, 50, 0.7);
  background: rgba(32, 35, 50, 0.07);
  border-radius: 20px;
  padding: 2px 10px;
  margin-top: 4px;
}

.taItem__preview {
  padding: 0 16px 14px;
  border-top: 1px solid var(--hairline);
  animation: fadeIn 0.15s ease;
}
.taItem__previewText {
  font-size: 0.84rem;
  line-height: 1.6;
  margin: 12px 0 10px;
  white-space: pre-wrap;
}
.taItem__actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* ── Topic picker popup ──────────────────────────────────────────────────── */
.topicPicker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--hairline);
  animation: fadeIn 0.12s ease;
}

/* ═══════════════════════════════════════════════════════════════
   PHONE BREAKPOINT (max-width: 480px)
═══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

  /* ── Global / Landing ──────────────────────────────────────── */
  .wrap { width: calc(100% - 28px); }

  .blob--a { width: 200px; height: 200px; }
  .blob--b { width: 220px; height: 220px; }
  .blob--c { width: 260px; height: 260px; }

  .hero { padding: 56px 0 28px; }
  .hero__grid { gap: 24px; }
  .hero__title { font-size: clamp(30px, 8vw, 40px); }
  .hero__sub { font-size: 14px; }

  .hero__actions { gap: 8px; }
  .hero__actions .btn { padding: 13px 18px; font-size: 14px; }

  .stat { min-width: 0; padding: 8px 10px; }
  .stat__label { font-size: 11px; }

  .card { padding: 16px; }

  .footer__inner { flex-direction: column; gap: 12px; text-align: center; }
  .footer__links { justify-content: center; }

  /* ── App shell (post-login pages) ──────────────────────────── */
  .app-header { padding: 10px 12px; }
  .app-seg-nav { padding: 0 8px 10px; }
  .app-seg-pill {
    flex-wrap: wrap;
    gap: 2px;
    padding: 4px;
    max-width: 100%;
  }
  .app-seg-btn {
    flex: 1 1 auto;
    font-size: 0.78rem;
    padding: 10px 8px;
    min-width: 0;
    text-align: center;
  }
  .app-main { padding: 0 8px; }
  .app-card { padding: 14px 12px; border-radius: 16px; }
  .app-footer { padding: 8px; font-size: 0.55rem; }

  /* ── Dashboard ─────────────────────────────────────────────── */
  .dashNavBar { padding: 10px 12px; gap: 8px; }
  .dashNavTabs { gap: 4px; padding: 4px; }
  .dashNavTabs a { font-size: 13px; padding: 8px 10px; }
  .dashLogo { font-size: 28px; gap: 6px; }
  .dashLogo img { width: 24px; height: 24px; }
  .dashGrid { gap: 12px; }
  .dashTile { border-radius: 18px; padding: 14px; }
  .dashBars { height: 180px; }
  .dashBarsScale { height: 180px; }
  .dashBars__labels { font-size: 14px; }
  .dashMonthView { min-height: 220px; }
  .dashMonthGrid { min-height: 180px; gap: 5px; padding: 8px; }
  .dashMiniStat h3 { font-size: 12px; }
  .dashMiniStat strong { font-size: 20px; }
  .dashSiteList li { font-size: 16px; }
  .dashSiteList strong { font-size: 16px; }

  /* ── Workbook ──────────────────────────────────────────────── */
  .workbookSurface { padding: 10px; }
  .workbookSurface__head h1 { font-size: 24px; }
  .workbookTable { min-width: 520px; }
  .wbLangBtn { width: 48px; height: 34px; font-size: 16px; }

  /* ── Topics ────────────────────────────────────────────────── */
  .topicsGrid { grid-template-columns: 1fr; }
  .topicsSurface { padding: 14px; }
  .topicsSurface__head h1 { font-size: 24px; }

  /* ── Flashcards ────────────────────────────────────────────── */
  .fcCard__front, .fcCard__back { padding: 24px 18px; }
  .fcCard__word { font-size: 1.6rem; }
  .fcActions { gap: 10px; }
  .fcBtn--no, .fcBtn--yes { padding: 12px 20px; }

  /* ── Match game ────────────────────────────────────────────── */
  .matchGrid { height: 380px; min-height: 300px; }
  .matchTile { width: 120px; font-size: 0.8rem; padding: 10px 8px; }
  .matchHud { gap: 14px; padding: 10px 14px; flex-wrap: wrap; }
  .matchStatVal { font-size: 1.1rem; }
  .matchControls { flex-wrap: wrap; }

  /* ── Challenges ────────────────────────────────────────────── */
  .chArticleItem { padding: 10px 12px; gap: 8px; }
  .chQuizHeader { gap: 10px; }
  .chQuestion { padding: 12px; }

  /* ── Article reader ─────────────────────────────────────────── */
  .articleSelectorBtn { font-size: .76rem; padding: 5px 10px; }
}

/* ── Filter bar ──────────────────────────────────────────────────────────── */
.taFilters { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.taFilters[hidden] { display: none !important; }
.taFilters--global { margin-bottom: 16px; }
.taFilters__row { display: flex; flex-wrap: wrap; gap: 6px; }
.taFilters__row[hidden] { display: none !important; }
.taFilter__chip {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,.55);
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}
.taFilter__chip:hover { background: rgba(255,90,31,.08); color: var(--orange); border-color: rgba(255,90,31,.3); }
.taFilter__chip.is-active { background: rgba(255,90,31,.12); color: var(--orange); border-color: rgba(255,90,31,.4); }

/* ── Article reader view ─────────────────────────────────────────────────── */
#articleReaderView[hidden] { display: none !important; }
#articleReaderView.is-entering { animation: topicsEnter .38s cubic-bezier(.22,1,.36,1) forwards; }

.articleReader { padding: 4px 0 24px; max-width: 72ch; }
.articleReader p { margin: 0 0 1em; font-size: .93rem; line-height: 1.7; color: var(--ink); }
.articleReader p[data-idx] { border-radius: 6px; padding: 2px 6px; margin-left: -6px; transition: background .15s; cursor: default; }
.articleReader p[data-idx]:hover { background: color-mix(in oklab, var(--mint), #fff 78%); }
.articleReader__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
  margin-top: 8px;
}

/* ── Challenge question preview (shown in reader for non-original combos) ─── */
.articleQuestionPreview { margin-bottom: 1.2em; }
.articleQuestionPreview p { margin: 0 0 .3em; }
.articleQuestionPreview ul { margin: 0; padding-left: 1.4em; }
.articleQuestionPreview li { font-size: .88rem; line-height: 1.6; color: var(--muted); }

/* ── Language / level selector (button rows) ─────────────────────────────── */
.articleLangSelector {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}
.articleLangSelector__row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.articleLangSelector__generate {
  display: flex;
  align-items: center;
  padding-top: 2px;
}
.articleSelectorBtn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--hairline);
  background: rgba(255,255,255,.55);
  font-size: .83rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s, opacity .15s;
  white-space: nowrap;
}
.articleSelectorBtn:hover {
  border-color: rgba(255,90,31,.4);
  background: rgba(255,90,31,.07);
}
.articleSelectorBtn.is-active {
  border-color: var(--orange);
  background: transparent;
  color: var(--orange);
}
.articleSelectorBtn.is-greyed {
  opacity: .5;
  border-style: dashed;
}
.articleSelectorBtn.is-greyed.is-active {
  opacity: 1;
  border-style: solid;
}
.articleSelectorBtn.is-generating {
  opacity: .6;
  pointer-events: none;
}
.articleSelectorBtn__flag { font-size: 1.05em; line-height: 1; }

/* ── Word-click tokens ───────────────────────────────────────────────────── */
.peek-para {
  margin: -0.5em 0 1em;
  padding: 0.55em 0.75em;
  border-radius: 8px;
  background: color-mix(in oklab, var(--mint), #fff 52%);
  border-left: 3px solid var(--mint);
  font-size: .93rem;
  line-height: 1.7;
  color: var(--ink);
  user-select: none;
  animation: peekIn .12s ease;
}
@keyframes peekIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

.w-token {
  cursor: pointer;
  border-radius: 3px;
  transition: background .12s, outline .12s;
}
.w-token:hover {
  background: rgba(255, 90, 31, .13);
  outline: 1px solid rgba(255, 90, 31, .28);
}

/* ── Word lookup bubble ──────────────────────────────────────────────────── */
.wordBubble {
  position: absolute;
  z-index: 900;
  width: 280px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  box-shadow: var(--shadow2), 0 4px 16px rgba(0, 0, 0, .10);
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.wordBubble[hidden] { display: none !important; }

.wordBubble__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.wordBubble__word {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
}
.wordBubble__lang {
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(14, 15, 18, .07);
  border-radius: 5px;
  padding: 1px 5px;
  text-transform: uppercase;
}

.wordBubble__body {
  font-size: .84rem;
  line-height: 1.55;
  color: var(--ink);
  max-height: 168px;
  overflow-y: auto;
}
.wordBubble__body p { margin: 0 0 .3em; }
.wordBubble__loading { color: var(--muted); font-style: italic; }
.wordBubble__err { color: #c0392b; }

.wordBubble__sense + .wordBubble__sense {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--hairline);
}
.wordBubble__pos {
  display: inline-block;
  font-size: .72rem;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 2px;
}
.wordBubble__ex {
  color: var(--muted);
  font-size: .79rem;
  font-style: italic;
  margin-top: 2px;
}

.wordBubble__meaning {
  margin: 0 0 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wordBubble__meaningLabel {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.wordBubble__meaningInput {
  width: 100%;
  resize: vertical;
  padding: 6px 8px;
  border: 1px solid rgba(0,0,0,0.16);
  border-radius: 8px;
  font: inherit;
  font-size: .82rem;
}
.wordBubble__meaningInput:focus { outline: none; border-color: rgba(255,90,31,.5); }

.wordBubble__footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.wordBubble__editBtn {
  padding: 7px 10px;
  font-size: .82rem;
}
.wordBubble__saveBtn {
  flex: 1;
  padding: 7px 12px;
  font-size: .82rem;
}
.wordBubble__closeBtn {
  padding: 6px 10px;
  font-size: .82rem;
  line-height: 1;
}

@media (max-width: 480px) {
  .wordBubble { width: calc(100vw - 24px); }
}

/* ── Tester feedback widget ─────────────────────────────────────────────── */
#tester-feedback{
  position: fixed;
  top: 96px;
  left: 0;
  z-index: 9999;
  display: flex;
  align-items: stretch;
  pointer-events: none;
  font-family: inherit;
}
#tester-feedback .tfw-tab,
#tester-feedback .tfw-card{ pointer-events: auto; }

#tester-feedback .tfw-card{
  width: 320px;
  max-width: calc(100vw - 48px);
  padding: 14px 16px 12px;
  background: var(--glass, rgba(255,255,255,.85));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--hairline, rgba(14,15,18,.10));
  border-left: none;
  border-radius: 0 var(--r-md, 16px) var(--r-md, 16px) 0;
  box-shadow: var(--shadow, 0 22px 70px rgba(0,0,0,.10));
  transform: translateX(-110%);
  transition: transform 250ms ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  order: 2;
}
#tester-feedback.tfw-expanded .tfw-card{ transform: translateX(0); }

#tester-feedback .tfw-tab{
  order: 1;
  width: 28px;
  min-height: 96px;
  padding: 0;
  margin: 0;
  background: var(--orange, #FF5A1F);
  color: #fff;
  border: 1px solid var(--hairline, rgba(14,15,18,.10));
  border-left: none;
  border-radius: 0 var(--r-md, 16px) var(--r-md, 16px) 0;
  cursor: pointer;
  box-shadow: var(--shadow, 0 22px 70px rgba(0,0,0,.10));
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  transition: background-color 150ms ease;
}
#tester-feedback .tfw-tab:hover{ background: #e64f17; }
#tester-feedback .tfw-tab__label{
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

#tester-feedback .tfw-label{
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted, rgba(14,15,18,.68));
}

#tester-feedback .tfw-text{
  width: 100%;
  min-height: 110px;
  resize: vertical;
  padding: 10px 12px;
  font: inherit;
  font-size: .9rem;
  color: var(--ink, #0E0F12);
  background: rgba(255,255,255,.7);
  border: 1px solid var(--hairline, rgba(14,15,18,.10));
  border-radius: 10px;
  box-sizing: border-box;
}
#tester-feedback .tfw-text:focus{
  outline: none;
  border-color: var(--orange, #FF5A1F);
  box-shadow: 0 0 0 3px rgba(255,90,31,.18);
}

#tester-feedback .tfw-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
#tester-feedback .tfw-status{
  font-size: .82rem;
  color: var(--muted, rgba(14,15,18,.68));
  min-height: 1em;
}
#tester-feedback .tfw-status--ok{ color: #1f7a3a; }
#tester-feedback .tfw-status--err{ color: #b3261e; }

#tester-feedback .tfw-send{
  appearance: none;
  border: none;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--ink, #0E0F12);
  color: #fff;
  font: inherit;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
}
#tester-feedback .tfw-send:hover{ transform: translateY(-1px); }
#tester-feedback .tfw-send:disabled{ opacity: .55; cursor: default; transform: none; }

@media (max-width: 480px){
  #tester-feedback{ top: 72px; }
  #tester-feedback .tfw-card{ width: calc(100vw - 48px); }
}

/* ── Discover feed ─────────────────────────────────────────────────────────── */
.taFilters--discover{
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}
.discoverFilterBar{
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

/* Feed column (card grid + infinite-scroll sentinel/status) */
.discoverFeed{ min-width: 0; }
.discoverFeed__status{
  text-align: center;
  padding: 16px 0 4px;
  font-size: 0.85rem;
}
.discoverFeed__status::after{
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  vertical-align: -2px;
  border: 2px solid var(--hairline);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: discoverSpin 0.7s linear infinite;
}
@keyframes discoverSpin{ to { transform: rotate(360deg); } }
.discoverFeed__sentinel{ height: 1px; }

/* Two-column layout: feed + leaderboard sidebar */
.discoverLayout{
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  align-items: start;
}
.discoverLayout--reading{ display: none; }

/* Card grid */
.discoverGrid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

/* Article card */
.discoverCard{
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md, 16px);
  background: var(--glass, rgba(255,255,255,.55));
  box-shadow: var(--shadow2, 0 10px 28px rgba(0,0,0,.10));
  overflow: hidden;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.discoverCard:hover{
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(0,0,0,.14);
}
.discoverCard:focus-visible{
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}
.discoverCard__art{
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-bottom: 1px solid var(--hairline);
}
.discoverCard__art--plain{
  background: linear-gradient(135deg, var(--sky, #BFD9FF), var(--mint, #ace38c));
}
.discoverCard__flag{
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 18px;
  line-height: 1;
  background: rgba(255,255,255,.85);
  border-radius: 999px;
  padding: 3px 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.discoverCard__body{
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px 14px;
}
.discoverCard__title{
  font-size: 0.98rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.discoverCard__topics{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.discoverCard__meta{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  font-size: 0.78rem;
  color: var(--muted);
}
.discoverCard__by::before{ content: "by "; opacity: .7; }
.discoverCard__views{ margin-left: auto; }

/* Leaderboard sidebar */
.leaderboard{
  position: sticky;
  top: 8px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg, 22px);
  background: var(--glass, rgba(255,255,255,.55));
  box-shadow: var(--shadow2, 0 10px 28px rgba(0,0,0,.10));
  padding: 16px 16px 18px;
}
.leaderboard__title{
  margin: 0 0 12px;
  font-size: 1rem;
  letter-spacing: -0.01em;
}
.leaderboard__list{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  counter-reset: lb;
}
.leaderboard__row{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.45);
  border: 1px solid var(--hairline);
}
.leaderboard__rank{
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  background: rgba(14,15,18,.06);
  color: var(--ink);
}
.leaderboard__row:first-child .leaderboard__rank{
  background: var(--orange);
  color: #fff;
}
.leaderboard__row:nth-child(2) .leaderboard__rank{ background: var(--lemon); }
.leaderboard__row:nth-child(3) .leaderboard__rank{ background: var(--sky); }
.leaderboard__name{
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.leaderboard__xp{
  flex: none;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--orange);
}
.leaderboard__empty{ padding: 8px 2px; font-size: 0.85rem; }

@media (max-width: 960px){
  .discoverLayout{ grid-template-columns: 1fr; }
  .leaderboard{ position: static; order: -1; }
}

/* ── Guided learning: "Do this next" pop-up + Altitude ────────────────── */

/* Reopen-button bar above the grid. */
.dashNextBar{ display: flex; justify-content: flex-end; margin-bottom: 14px; }
.dashNextBar__btn{ white-space: nowrap; }

/* Two-option chooser inside the shared .taModal. */
.dashNextModal__card{ max-width: 560px; }
.dashNextModal__sub{ margin: -6px 0 16px; font-size: .9rem; }
.dashNextModal__opts{ display: grid; gap: 12px; }

.dashNextOpt{
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--hairline);
  background: rgba(248, 249, 252, 0.95);
  color: var(--ink);
  text-decoration: none;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.dashNextOpt:hover{
  transform: translateY(-2px);
  border-color: color-mix(in oklab, var(--orange), #000 8%);
  box-shadow: 0 10px 24px rgba(255, 90, 31, 0.14);
}
.dashNextOpt__icon{ font-size: 26px; line-height: 1; flex: none; }
.dashNextOpt__body{ display: grid; gap: 3px; min-width: 0; }
.dashNextOpt__body strong{ font-size: 1.02rem; }
.dashNextOpt__desc{ font-size: .82rem; color: rgba(22, 25, 35, 0.62); line-height: 1.3; }
.dashNextOpt__xp{
  flex: none;
  align-self: flex-start;
  font-size: .82rem;
  font-weight: 800;
  color: color-mix(in oklab, var(--orange), #000 14%);
  background: color-mix(in oklab, var(--orange), #fff 82%);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

.dashAltitude__hint{ margin: -2px 0 2px; font-size: .78rem; line-height: 1.3; }

@media (max-width: 480px){
  .dashNextBar{ justify-content: stretch; }
  .dashNextBar__btn{ width: 100%; }
  .dashNextOpt{ flex-wrap: wrap; }
  .dashNextOpt__xp{ align-self: center; }
}

/* ── Grammar mode: sentence-structure popup ─────────────────────────────────── */
#articleGrammarToggle.is-active {
  background: var(--accent, #2f6fed);
  color: #fff;
  border-color: transparent;
}
/* In grammar mode, sentences are the click target. */
.articleReader.grammar-mode .gr-sentence {
  cursor: pointer;
  border-radius: 4px;
  transition: background .12s ease;
}
.articleReader.grammar-mode .gr-sentence:hover {
  background: rgba(47, 111, 237, .10);
}
/* Word-tap lookup is suppressed while in grammar mode. */
.articleReader.grammar-mode .w-token { cursor: inherit; }

.grammarBubble {
  position: absolute;
  z-index: 950;
  width: 440px;
  max-width: calc(100vw - 24px);
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  box-shadow: var(--shadow2), 0 4px 16px rgba(0, 0, 0, .12);
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.grammarBubble[hidden] { display: none !important; }
.grammarBubble__close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted, #888);
  padding: 4px;
}
.grammarBubble__sentence {
  font-size: 1.05rem;
  line-height: 1.7;
  padding-right: 18px;
}
.grammarBubble__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: .78rem;
}
.gr-legend { display: inline-flex; align-items: center; gap: 5px; }
.gr-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.grammarBubble__explain {
  font-size: .9rem;
  line-height: 1.5;
  color: var(--ink, #333);
  border-top: 1px solid var(--hairline);
  padding-top: 10px;
}

/* ── "A human has approved this" badge (per-variant, in the reader) ─────────── */
.humanApprovedBadge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(22, 101, 52, .10);
  border: 1px solid rgba(22, 101, 52, .25);
  color: #166534;
  font-size: .8rem;
  font-weight: 600;
  line-height: 1;
}
.humanApprovedBadge[hidden] { display: none !important; }
.humanApprovedBadge__check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #166534;
  color: #fff;
  font-size: .7rem;
}

/* ── Flow matrix editor ─────────────────────────────────────────────────────
   Drag-and-drop grid for placing flow items. Rows are spine steps, columns are
   depth; column 0 is the spine itself. Layout is an explicit CSS grid whose
   cells map 1:1 to the stored (row, col) coordinates. */

.btn-sm--primary {
  background: #166534;
  border-color: #166534;
  color: #fff;
}
.btn-sm--primary:disabled { opacity: .45; cursor: default; }

.flow-hint {
  margin: 0 0 .75rem;
  font-size: .78rem;
  color: #555;
  line-height: 1.5;
}
.flow-legend {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .72rem;
  color: #666;
}
.flow-swatch {
  width: .7rem;
  height: .7rem;
  border-radius: 3px;
  display: inline-block;
}
.flow-swatch--spine { background: #e8e2d4; border: 1px solid #1c1b19; }
.flow-swatch--depth { background: #fff; border: 1px dashed #b3aca0; }

.flow-dirty {
  font-size: .72rem;
  color: #8a6516;
  background: #fdf6e3;
  border: 1px solid #e6d5a8;
  border-radius: 999px;
  padding: .1rem .5rem;
}

/* Horizontal scroll lives here so wide matrices stay reachable without the
   page itself scrolling sideways. */
.flow-gridwrap {
  overflow-x: auto;
  padding: .5rem;
  background: rgba(0, 0, 0, .02);
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 8px;
}
.flow-grid {
  display: grid;
  gap: 10px;
  align-items: stretch;
  min-width: max-content;
}

.flow-cell {
  min-width: 168px;
  min-height: 62px;
  border-radius: 8px;
  position: relative;
}

/* The add-a-quiz affordance inside an empty cell. Hidden until hover so the
   grid doesn't read as a wall of buttons. */
.flow-cell__addquiz {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  color: rgba(0, 0, 0, .38);
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s;
}
.flow-cell--empty:hover .flow-cell__addquiz { opacity: 1; }
.flow-cell__addquiz:hover { color: #166534; background: rgba(22, 101, 52, .06); }
/* During a drag the cell is a drop target, so the button must not eat the drop. */
.flow-grid.is-dragging .flow-cell__addquiz { pointer-events: none; opacity: 0; }

/* Empty cells are drop targets; they stay faint until a drag is in progress. */
.flow-cell--empty {
  border: 1px dashed rgba(0, 0, 0, .13);
  background: transparent;
  transition: background .12s, border-color .12s;
}
.flow-grid.is-dragging .flow-cell--empty {
  border-color: rgba(22, 101, 52, .45);
  background: rgba(22, 101, 52, .04);
}
.flow-cell--empty.is-over {
  border-color: #166534;
  border-style: solid;
  background: rgba(22, 101, 52, .12);
}

.flow-box {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .5rem .6rem;
  border-radius: 8px;
  background: #fff;
  border: 1px dashed #b3aca0;
  cursor: grab;
  font-size: .8rem;
  line-height: 1.3;
}
.flow-box:active { cursor: grabbing; }
.flow-box.is-dragged { opacity: .4; }

/* The spine is the reading path, so it gets the solid, heavier treatment. */
.flow-box--spine {
  background: #e8e2d4;
  border: 1px solid #1c1b19;
  border-left: 3px solid #1c1b19;
  font-weight: 600;
}

/* Quizzes are checkpoints, not reading steps — light red so they're findable
   at a glance in a grid of otherwise identical boxes. Overrides --spine, so it
   must come after it. */
.flow-box--quiz,
.flow-box--spine.flow-box--quiz {
  background: #fdeaea;
  border: 1px solid #c05252;
  border-left: 3px solid #c05252;
}
.flow-box--quiz .flow-box__step { background: #c05252; color: #fff; }

.flow-box__head {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .68rem;
  color: #6b675f;
  font-weight: 400;
}
.flow-box__step {
  font-variant-numeric: tabular-nums;
  background: #1c1b19;
  color: #fff;
  border-radius: 3px;
  padding: 0 .3rem;
  font-weight: 600;
}
.flow-box__rm {
  margin-left: auto;
  border: 0;
  background: none;
  cursor: pointer;
  color: #991b1b;
  font-size: .8rem;
  line-height: 1;
  padding: 0 .1rem;
}
.flow-box__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
