/* DailyEnglishMaster · Light Pastel Stationery Theme (Modeled after DailyChineseMaster) */
:root {
  --g1: #FFF4D6;
  --g2: #FFE2A8;
  --g3: #FFD1B8;
  --acc: #F6C445;
  --acc-dark: #7a5000;
  --acc-soft: #fff8e1;

  --ink: #2b2118;
  --ink2: #4a3f33;
  --soft: #655a4d;
  --line: #d8cfc2;

  --sf: #ffffff;
  --sf2: #fffdf8;
  --sf3: #f6efe2;
  --card: rgba(255, 255, 255, 0.88);
  --note: #fff8e1;

  --k-ok: #047857;
  --k-warn: #9A4A00;
  --k-bad: #B42318;
  --k-info: #1D4ED8;
  --k-hv: #7E22CE;

  --font-ui: 'Be Vietnam Pro', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-en: 'Newsreader', 'Lora', Georgia, serif;
  --shadow: 0 6px 22px rgba(60, 40, 10, 0.08);
  --border-ink: 2px solid rgba(43, 33, 24, 0.88);
  --reader-size: 1.24rem;
}

/* 5 Switchable Pastel Themes */
body[data-theme="honey"] {
  --g1: #FFF4D6; --g2: #FFE2A8; --g3: #FFD1B8;
  --acc: #F6C445; --acc-dark: #7a5000; --acc-soft: #fff8e1;
}
body[data-theme="peach"] {
  --g1: #FFE3EC; --g2: #FFD0DD; --g3: #FFE9D6;
  --acc: #F5A9BD; --acc-dark: #A8274F; --acc-soft: #fff0f5;
}
body[data-theme="matcha"] {
  --g1: #E6F4D7; --g2: #D3EBC0; --g3: #F5F2C8;
  --acc: #A5D77F; --acc-dark: #2c5e0f; --acc-soft: #f2fae9;
}
body[data-theme="sky"] {
  --g1: #DDEFFF; --g2: #CFE0FF; --g3: #E6F6F3;
  --acc: #8EC5F5; --acc-dark: #1B5A9E; --acc-soft: #eef7ff;
}
body[data-theme="lavender"] {
  --g1: #EBE3FF; --g2: #F7D9F0; --g3: #DDE9FF;
  --acc: #BCA5F2; --acc-dark: #5835b0; --acc-soft: #f5f1ff;
}

/* Toggleable English Display Fonts */
body.font-en-sans {
  --font-en: 'Plus Jakarta Sans', 'Be Vietnam Pro', system-ui, sans-serif;
}
body.font-en-editorial {
  --font-en: 'Lora', 'Georgia', serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  font-family: var(--font-ui);
  color: var(--ink);
  background: linear-gradient(135deg, var(--g1) 0%, var(--g2) 52%, var(--g3) 100%) fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

/* Layout Shell */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 256px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.56);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: var(--border-ink);
  padding: 1rem 0.85rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--sf);
  border: var(--border-ink);
  border-radius: 18px;
  padding: 0.65rem 0.75rem;
  box-shadow: var(--shadow);
}

.brand-avatar {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  border: 2px solid var(--ink);
  background: var(--acc);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.96rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.brand-title {
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.brand-author-pill {
  display: inline-block;
  margin-top: 3px;
  padding: 0.1rem 0.48rem;
  border-radius: 999px;
  background: var(--acc-soft);
  border: 1.2px solid var(--ink);
  color: var(--acc-dark);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.brand-sub {
  font-size: 0.68rem;
  color: var(--soft);
  font-weight: 600;
  margin-top: 3px;
}

/* YouTube Studio Layout (modeled after DailyLearningEnglish) */
.yt-studio-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1.18fr) minmax(300px, 1fr);
  gap: 1rem;
  align-items: start;
}
.yt-studio-grid > * {
  min-width: 0;
}

.yt-player-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  border: 2px solid var(--ink);
  background: #14110f;
  overflow: hidden;
}

.yt-player-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.yt-sub-stream {
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
  max-height: 410px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.yt-sub-row {
  background: var(--sf);
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  transition: background 0.12s, transform 0.1s;
}
.yt-sub-row:hover { background: var(--acc-soft); }
.yt-sub-row.active {
  background: var(--note);
  border-width: 2.2px;
  box-shadow: 0 3px 10px rgba(43, 33, 24, 0.1);
}

.yt-time-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: var(--sf3);
  border: 1px solid var(--ink);
  margin-right: 0.4rem;
}

.collo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.72rem;
}

.collo-card {
  background: var(--sf);
  border: 1.8px solid var(--ink);
  border-radius: 18px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  transition: transform 0.12s, background 0.12s;
}
.collo-card:hover { transform: translateY(-2px); background: var(--sf2); }

/* A4 Session Summary Sheet Modal (modeled after DailyChineseMaster) */
.a4-modal-sheet {
  width: 100%;
  max-width: 920px;
  background: var(--sf2);
  border: 2.5px solid var(--ink);
  border-radius: 26px;
  padding: 1.25rem 1.4rem;
  box-shadow: 0 20px 54px rgba(43, 33, 24, 0.28);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: 92vh;
  overflow-y: auto;
}

.a4-paper {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 14px;
  padding: 1.4rem 1.6rem;
  color: #1f2937;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.a4-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2.5px solid #991b1b;
  padding-bottom: 0.65rem;
  margin-bottom: 0.9rem;
  gap: 0.75rem;
}

.a4-stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.a4-stat-box {
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
}

.a4-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  margin-bottom: 1rem;
}
.a4-table th {
  background: #fef3c7;
  color: #78350f;
  text-align: left;
  padding: 0.5rem 0.6rem;
  border: 1px solid #d6d3d1;
  font-weight: 800;
}
.a4-table td {
  padding: 0.48rem 0.6rem;
  border: 1px solid #e5e7eb;
  vertical-align: top;
}

.a4-usage-card {
  border: 1.5px solid #e5e7eb;
  border-left: 4px solid #047857;
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.7rem;
  background: #f9fafb;
  page-break-inside: avoid;
}

@media (max-width: 920px) {
  .yt-studio-grid, .collo-grid { grid-template-columns: 1fr; }
  .a4-stat-row { grid-template-columns: repeat(2, 1fr); }
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--soft);
  padding: 0.35rem 0.45rem 0.1rem;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.58rem;
  min-height: 44px;
  padding: 0.48rem 0.65rem;
  border-radius: 14px;
  border: 1.5px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 0.84rem;
  font-weight: 700;
  transition: background 0.14s, transform 0.12s, border-color 0.14s;
  width: 100%;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.72);
  transform: translateX(2px);
}

.nav-item.active {
  background: var(--sf);
  border-color: var(--ink);
  box-shadow: 0 3px 10px rgba(43, 33, 24, 0.09);
}

.nav-item .sh {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1.5px solid var(--ink);
  background: var(--sf2);
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 800;
  flex-shrink: 0;
}

.nav-item.active .sh {
  background: var(--acc);
}

.nav-item .nav-label {
  flex: 1;
  line-height: 1.24;
}

.nav-badge {
  font-size: 0.71rem;
  font-weight: 800;
  padding: 0.12rem 0.48rem;
  border-radius: 999px;
  background: var(--sf3);
  border: 1px solid var(--ink);
  min-width: 24px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 0.65rem;
  border-top: 1.5px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.swatch-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--soft);
}

.swatch-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  cursor: pointer;
  transition: transform 0.14s, box-shadow 0.14s;
}

.swatch:hover { transform: scale(1.1); }
.swatch.active { box-shadow: 0 0 0 2.5px #fff, 0 0 0 4.5px var(--ink); }
.sw-honey { background: linear-gradient(135deg, #FFF4D6, #F6C445); }
.sw-peach { background: linear-gradient(135deg, #FFE3EC, #F5A9BD); }
.sw-matcha { background: linear-gradient(135deg, #E6F4D7, #A5D77F); }
.sw-sky { background: linear-gradient(135deg, #DDEFFF, #8EC5F5); }
.sw-lavender { background: linear-gradient(135deg, #EBE3FF, #BCA5F2); }

.sidebar-mini-row {
  display: flex;
  gap: 0.38rem;
}

.btn-mini {
  flex: 1;
  min-height: 36px;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: var(--sf);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}
.btn-mini:hover { background: var(--acc-soft); }

/* Mobile Chrome (<920px) */
.mobile-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: var(--border-ink);
  padding: 0.55rem 0.85rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 0.92rem;
}

.mobile-tabs {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: var(--border-ink);
  padding: 0.35rem 0.35rem calc(0.4rem + env(safe-area-inset-bottom, 0px));
  grid-template-columns: repeat(6, 1fr);
  gap: 0.2rem;
}

.m-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  min-height: 46px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  background: transparent;
  font-size: 0.67rem;
  font-weight: 700;
  cursor: pointer;
}

.m-tab.active {
  background: var(--acc);
  border-color: var(--ink);
}

.more-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(43, 33, 24, 0.38);
  backdrop-filter: blur(3px);
  align-items: flex-end;
}
.more-drawer-backdrop.open { display: flex; }

.more-drawer {
  width: 100%;
  background: var(--sf2);
  border-top: 2.5px solid var(--ink);
  border-radius: 24px 24px 0 0;
  padding: 1.1rem 1.1rem calc(1.4rem + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 82vh;
  overflow-y: auto;
}

/* Main Content */
.main-wrap {
  flex: 1;
  min-width: 0;
  padding: 1.4rem 1.65rem 3.5rem;
}

.content-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}

.page-title {
  font-size: 1.42rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.page-subtitle {
  font-size: 0.88rem;
  color: var(--soft);
  font-weight: 500;
  margin-top: 0.2rem;
}

/* Cards */
.card {
  background: var(--card);
  border: var(--border-ink);
  border-radius: 24px;
  padding: 1.3rem 1.4rem;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 1.04rem;
  font-weight: 800;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Pills & Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  min-height: 42px;
  padding: 0.52rem 1.08rem;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--acc);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, background 0.14s;
  text-decoration: none;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(43, 33, 24, 0.14);
}
.btn:disabled { opacity: 0.52; cursor: not-allowed; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-ghost { background: var(--sf); }
.btn-ghost:hover:not(:disabled) { background: var(--acc-soft); }
.btn-soft { background: var(--sf3); }
.btn-ok { background: #ccf2de; color: #065f46; border-color: #047857; }
.btn-sm { min-height: 35px; padding: 0.34rem 0.82rem; font-size: 0.8rem; }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.chip {
  min-height: 36px;
  padding: 0.38rem 0.85rem;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: var(--sf);
  font-size: 0.81rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  transition: background 0.13s, transform 0.1s;
}
.chip:hover { background: var(--acc-soft); }
.chip.active { background: var(--ink); color: #fff; }
.chip.active-amber { background: var(--acc); color: var(--ink); }

.search-pill {
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--sf);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 0.25rem 0.9rem;
  min-height: 44px;
}

.search-pill input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  font-weight: 600;
}

.select-pill {
  min-height: 44px;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--sf);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

/* Stat Tiles */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.72rem;
}

.stat-tile {
  background: var(--sf);
  border: 1.8px solid var(--ink);
  border-radius: 18px;
  padding: 0.85rem 0.7rem;
  text-align: center;
  cursor: pointer;
  transition: transform 0.14s, background 0.14s;
}
.stat-tile:hover { transform: translateY(-2px); background: var(--acc-soft); }
.stat-num { font-size: 1.52rem; font-weight: 800; line-height: 1.15; }
.stat-lbl { font-size: 0.77rem; font-weight: 700; color: var(--soft); margin-top: 0.24rem; }

/* Multi-select Level Grid */
.hlv-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.72rem;
}

.hlv-card {
  background: var(--sf);
  border: 2px solid var(--ink);
  border-radius: 18px;
  padding: 0.85rem 0.95rem;
  cursor: pointer;
  transition: transform 0.13s, background 0.14s;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.hlv-card:hover { transform: translateY(-2px); }
.hlv-card.active {
  background: var(--acc);
  box-shadow: 0 4px 14px rgba(43, 33, 24, 0.12);
}

.hlv-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.hlv-title { font-weight: 800; font-size: 0.94rem; }
.hlv-pill {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: var(--sf);
}
.hlv-card.active .hlv-pill {
  background: var(--ink);
  color: #fff;
}

.hlv-sub { font-size: 0.77rem; color: var(--ink2); font-weight: 600; line-height: 1.35; }
.hlv-frac { font-size: 0.76rem; font-weight: 700; color: var(--ink); margin-top: 0.18rem; }

.prog-track {
  height: 7px;
  background: rgba(43, 33, 24, 0.12);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(43, 33, 24, 0.35);
}
.prog-fill {
  height: 100%;
  background: var(--k-ok);
  border-radius: 999px;
  transition: width 0.25s;
}

/* Roadmap Timeline */
.roadmap-timeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.rm-stage {
  background: var(--sf);
  border: 2px solid var(--ink);
  border-radius: 18px;
  padding: 0.9rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.rm-stage.current {
  background: var(--note);
  border-width: 2.5px;
  box-shadow: 0 4px 14px rgba(246, 196, 69, 0.25);
}
.rm-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  background: var(--acc);
  border: 1.5px solid var(--ink);
}
.rm-goal { font-size: 0.88rem; font-weight: 800; }
.rm-list {
  padding-left: 1rem;
  font-size: 0.78rem;
  color: var(--ink2);
  display: flex;
  flex-direction: column;
  gap: 0.26rem;
  line-height: 1.42;
}

/* Flashcard Module */
.fc-wrap {
  max-width: 740px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.fc-card {
  background: var(--sf);
  border: 2.5px solid var(--ink);
  border-radius: 28px;
  padding: 1.4rem 1.65rem;
  min-height: 360px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
}

.fc-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.fc-center {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin: auto 0;
}

.fc-word {
  font-family: var(--font-en);
  font-size: clamp(2.1rem, 5vw, 3.35rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.15;
}

.fc-ipa {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--k-ok);
}

.fc-anchor-pill {
  background: #f3e8ff;
  color: #6b21a8;
  border: 1.5px solid #c084fc;
  padding: 0.24rem 0.95rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

.fc-context {
  font-size: 0.9rem;
  color: var(--soft);
  max-width: 560px;
  line-height: 1.5;
}

.fc-meaning-big {
  font-size: 1.24rem;
  font-weight: 800;
  color: var(--ink);
  text-align: center;
}

.fc-def-en {
  font-size: 0.92rem;
  color: var(--ink2);
  text-align: center;
  max-width: 580px;
  margin: 0 auto;
  line-height: 1.5;
}

.fc-layer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.fc-subbox {
  background: var(--sf3);
  border: 1.5px solid var(--ink);
  border-radius: 18px;
  padding: 0.8rem 0.95rem;
}

.fc-subbox-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--soft);
  margin-bottom: 0.45rem;
}

.fc-rel-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--sf);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  margin: 0.16rem;
}
.fc-rel-chip:hover { background: var(--acc); }

.fc-ex-box {
  background: var(--sf3);
  border: 1.5px solid var(--ink);
  border-radius: 18px;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.srs-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.58rem;
}

.srs-btn {
  min-height: 54px;
  border-radius: 18px;
  border: 2px solid var(--ink);
  padding: 0.45rem 0.5rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.88rem;
  transition: transform 0.12s;
}
.srs-btn:hover { transform: translateY(-2px); }
.srs-btn small { font-size: 0.72rem; font-weight: 600; opacity: 0.85; margin-top: 2px; }
.srs-again { background: #ffdcd6; color: #7f1d1d; }
.srs-hard { background: #fff0c7; color: #78350f; }
.srs-good { background: #d8edb0; color: #14532d; }
.srs-easy { background: #ccf2de; color: #064e3b; }

/* Vocabulary Bank Grid & List */
.word-tile-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.68rem;
}

.w-tile {
  background: var(--sf);
  border: 1.8px solid var(--ink);
  border-radius: 18px;
  padding: 0.75rem 0.68rem 0.68rem;
  min-height: 126px;
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.22rem;
  transition: transform 0.12s, box-shadow 0.12s;
}
.w-tile:hover { transform: translateY(-2px); box-shadow: 0 5px 14px rgba(43,33,24,0.1); }
.w-tile.mastered { background: #effaf3; border-color: #2e8b57; }
.w-tile.learning { background: #fffbeb; border-color: #d97706; }
.w-tile.in-album { box-shadow: 0 0 0 2.5px var(--acc), 0 0 0 4.5px var(--ink); }

.w-tile-lv {
  position: absolute;
  top: 7px;
  left: 8px;
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--soft);
}
.w-tile-st {
  position: absolute;
  top: 7px;
  right: 8px;
  font-size: 0.72rem;
  font-weight: 800;
}

.w-tile-word {
  font-family: var(--font-en);
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--ink);
  margin-top: 0.55rem;
  word-break: break-word;
}
.w-tile-ipa {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--k-ok);
}
.w-tile-src {
  font-size: 0.66rem;
  font-weight: 800;
  color: #6b21a8;
  background: #f3e8ff;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
}
.w-tile-vi {
  font-size: 0.74rem;
  color: var(--ink2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.32;
}

.word-list-rows {
  display: flex;
  flex-direction: column;
  gap: 0.58rem;
}

.w-row {
  background: var(--sf);
  border: 1.8px solid var(--ink);
  border-radius: 18px;
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  cursor: pointer;
  transition: background 0.12s;
}
.w-row:hover { background: var(--sf2); }
.w-row.mastered { background: #effaf3; border-color: #2e8b57; }
.w-row.learning { background: #fffbeb; border-color: #d97706; }

.w-row-head {
  min-width: 150px;
  font-family: var(--font-en);
  font-size: 1.15rem;
  font-weight: 800;
}
.w-row-body { flex: 1; min-width: 0; }
.w-row-actions { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.14rem 0.56rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  border: 1.2px solid rgba(43, 33, 24, 0.25);
}
.tag.lv { background: #fef3c7; color: #78350f; }
.tag.lv-c1 { background: #ede9fe; color: #5b21b6; }
.tag.pos { background: #dcfce7; color: #166534; }
.tag.rad { background: #e0f2fe; color: #075985; }
.tag.hv { background: #f3e8ff; color: #6b21a8; }

/* Mindmap & Progression Bar */
.mm-progression-bar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.42rem;
}
.mm-tier-pill {
  min-width: 0;
  border: 2px solid var(--ink);
  border-radius: 16px;
  padding: 0.58rem 0.4rem;
  text-align: center;
  cursor: pointer;
  background: var(--sf);
  transition: transform 0.14s;
}
@media (max-width: 1120px) {
  .mm-progression-bar {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
}
.mm-tier-pill:hover { transform: translateY(-2px); }
.mm-tier-1 { background: #fef9c3; }
.mm-tier-2 { background: #fde68a; }
.mm-tier-3 { background: #fed7aa; }
.mm-tier-4 { background: #fecaca; }
.mm-tier-5 { background: #e9d5ff; }
.mm-tier-6 { background: #bfdbfe; }
.mm-tier-7 { background: #a7f3d0; }

.mm-canvas-box {
  position: relative;
  background: var(--sf2);
  border: 2px solid var(--ink);
  border-radius: 22px;
  padding: 1.2rem;
  overflow-x: auto;
}
.mm-tree {
  display: grid;
  grid-template-columns: 205px 1fr;
  gap: 1.2rem;
  align-items: start;
}
.mm-root-node {
  background: var(--acc);
  border: 2.5px solid var(--ink);
  border-radius: 20px;
  padding: 1.1rem 0.9rem;
  text-align: center;
  position: sticky;
  top: 1rem;
}
.mm-branches {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  border-left: 3px solid var(--ink);
  padding-left: 1.1rem;
}
.mm-branch-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.mm-branch-row::before {
  content: '';
  position: absolute;
  left: -1.1rem;
  top: 16px;
  width: 1rem;
  height: 3px;
  background: var(--ink);
}
.mm-branch-badge {
  min-width: 96px;
  padding: 0.35rem 0.55rem;
  border-radius: 12px;
  border: 1.8px solid var(--ink);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
  flex-shrink: 0;
}
.mm-node-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.48rem;
}
.mm-word-chip {
  background: var(--sf);
  border: 1.6px solid var(--ink);
  border-radius: 14px;
  padding: 0.42rem 0.72rem;
  cursor: pointer;
  transition: transform 0.12s, background 0.12s;
  text-align: left;
}
.mm-word-chip:hover { transform: translateY(-2px); background: var(--acc-soft); }

/* Games */
.match-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.match-col { display: flex; flex-direction: column; gap: 0.5rem; }
.match-tile {
  background: var(--sf);
  border: 2px solid var(--ink);
  border-radius: 16px;
  padding: 0.72rem 0.9rem;
  min-height: 54px;
  cursor: pointer;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  text-align: left;
  transition: transform 0.12s, background 0.12s;
}
.match-tile:hover:not(.matched) { background: var(--acc-soft); transform: translateY(-1px); }
.match-tile.selected { background: var(--acc); }
.match-tile.matched { background: #ccf2de; border-color: #047857; opacity: 0.55; cursor: default; }
.match-tile.wrong { background: #ffdcd6; border-color: #b91c1c; animation: shakeTile 0.3s; }
@keyframes shakeTile {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.chain-track {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  padding: 0.9rem;
  background: var(--sf3);
  border: 1.5px solid var(--ink);
  border-radius: 18px;
  margin: 0.75rem 0;
}
.chain-node {
  background: var(--sf);
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  padding: 0.42rem 0.75rem;
  text-align: center;
  cursor: pointer;
  font-weight: 700;
}
.chain-node.current { background: var(--acc); border-width: 2px; }

.quiz-opts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.quiz-opt {
  background: var(--sf);
  border: 2px solid var(--ink);
  border-radius: 18px;
  padding: 0.85rem 1rem;
  text-align: left;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.1s, background 0.12s;
}
.quiz-opt:hover:not(:disabled) { background: var(--acc-soft); transform: translateY(-1px); }
.quiz-opt.correct { background: #ccf2de; border-color: #047857; }
.quiz-opt.wrong { background: #ffdcd6; border-color: #b91c1c; }

/* Reading Library & Interactive Reader */
.reading-list-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.78rem;
}
.r-card {
  background: var(--sf);
  border: 2px solid var(--ink);
  border-radius: 20px;
  padding: 1rem 1.1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: transform 0.13s, background 0.13s;
}
.r-card:hover { transform: translateY(-2px); background: var(--acc-soft); }
.r-card.read { background: #effaf3; border-color: #2e8b57; }

.reader-note-box {
  background: var(--note);
  border: 1.5px solid var(--ink);
  border-left: 5px solid var(--ink);
  border-radius: 16px;
  padding: 0.95rem 1.1rem;
  font-size: 0.94rem;
  line-height: 1.65;
  color: var(--ink2);
}

.reader-text {
  font-family: var(--font-en);
  font-size: var(--reader-size);
  line-height: 1.88;
  color: var(--ink);
}
.reader-text.ruby-on { line-height: 2.65; }

.reader-para {
  margin-bottom: 1.05rem;
}
.reader-para.evidence-hit {
  background: #fef08a;
  border-radius: 12px;
  padding: 0.45rem 0.65rem;
  box-shadow: 0 0 0 2px var(--ink);
  transition: background 0.3s;
}

.r-seg {
  cursor: pointer;
  border-radius: 5px;
  padding: 0 2px;
  transition: background 0.12s;
}
.r-seg:hover, .r-seg:active { background: var(--acc); }
.r-seg.cefr-hl {
  color: #b91c1c;
  border-bottom: 1.5px solid rgba(185, 28, 28, 0.35);
  font-weight: 600;
}
.r-seg.known-hl {
  color: inherit;
  border-bottom: 1.5px dotted rgba(4, 120, 87, 0.35);
}

.reader-ruby {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin: 0 2px;
  vertical-align: bottom;
}
.reader-ruby .ipa-top {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  color: #065f46;
  line-height: 1.1;
}

.reading-q-box {
  background: var(--sf);
  border: 2px solid var(--ink);
  border-radius: 20px;
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.explain-box {
  background: #effaf3;
  border: 1.6px solid #047857;
  border-radius: 16px;
  padding: 0.75rem 0.95rem;
  font-size: 0.86rem;
  color: #064e3b;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

/* Speaking & Listening Lab */
.dict-diff {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.75rem;
  background: var(--sf2);
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  font-size: 0.92rem;
  font-weight: 700;
}
.dw-ok { background: #ccf2de; color: #065f46; padding: 0.14rem 0.45rem; border-radius: 8px; }
.dw-bad { background: #ffdcd6; color: #991b1b; padding: 0.14rem 0.45rem; border-radius: 8px; text-decoration: underline wavy; }
.dw-miss { background: #fff0c7; color: #92400e; padding: 0.14rem 0.45rem; border-radius: 8px; border: 1px dashed #d97706; }

.mic-pulse {
  animation: micPulse 1.2s infinite;
  background: #ffdcd6 !important;
  border-color: #b91c1c !important;
  color: #991b1b !important;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(185, 28, 28, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(185, 28, 28, 0); }
}

.wave-bars {
  display: none;
  align-items: center;
  gap: 3px;
  height: 22px;
}
.wave-bars.active {
  display: inline-flex;
}
.wave-bars span {
  display: inline-block;
  width: 4px;
  height: 8px;
  border-radius: 99px;
  background: var(--ink);
  transition: height 0.08s;
}
.wave-bars.active span {
  animation: waveAnim 0.6s ease-in-out infinite alternate;
}
.wave-bars.active span:nth-child(2) { animation-delay: 0.15s; }
.wave-bars.active span:nth-child(3) { animation-delay: 0.3s; }
.wave-bars.active span:nth-child(4) { animation-delay: 0.45s; }
@keyframes waveAnim {
  from { height: 5px; }
  to { height: 22px; }
}

/* Writing & Essay Analyzer */
.essay-box {
  width: 100%;
  min-height: 200px;
  padding: 0.95rem 1.05rem;
  border-radius: 18px;
  border: 2px solid var(--ink);
  background: var(--sf);
  font-size: 0.96rem;
  line-height: 1.68;
  resize: vertical;
  outline: none;
}
.essay-box:focus { box-shadow: 0 0 0 3px var(--acc); }

.model-essay-card {
  background: #effaf3;
  border: 2px solid #047857;
  border-radius: 20px;
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Album & Roots */
.write-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1rem;
  align-items: start;
}

.roots-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.65rem;
}
.root-card {
  background: var(--sf);
  border: 1.8px solid var(--ink);
  border-radius: 18px;
  padding: 0.78rem 0.72rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: transform 0.12s, background 0.12s;
}
.root-card:hover { transform: translateY(-2px); background: var(--acc-soft); }

/* Modals */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 240;
  background: rgba(43, 33, 24, 0.46);
  backdrop-filter: blur(4px);
  padding: 1rem;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}
.modal-backdrop.open { display: flex; }

.modal-sheet {
  width: 100%;
  max-width: 650px;
  background: var(--sf2);
  border: 2.5px solid var(--ink);
  border-radius: 28px;
  padding: 1.35rem 1.5rem;
  box-shadow: 0 18px 46px rgba(43, 33, 24, 0.24);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  max-height: 90vh;
  overflow-y: auto;
}

.toast {
  position: fixed;
  bottom: 76px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 0.58rem 1.15rem;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 250;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Fullscreen reader mode */
body.reader-fs .sidebar,
body.reader-fs .mobile-bar,
body.reader-fs .mobile-tabs { display: none !important; }
body.reader-fs .content-inner { max-width: 920px; }

/* Responsive */
@media (max-width: 1080px) {
  .word-tile-grid, .roots-grid { grid-template-columns: repeat(4, 1fr); }
  .roadmap-timeline { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 920px) {
  .sidebar { display: none; }
  .mobile-bar { display: flex; }
  .mobile-tabs { display: grid; }
  .main-wrap { padding: 1rem 0.85rem 5.4rem; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .hlv-grid { grid-template-columns: repeat(2, 1fr); }
  .word-tile-grid { grid-template-columns: repeat(2, 1fr); }
  .roots-grid { grid-template-columns: repeat(2, 1fr); }
  .reading-list-grid, .fc-layer-grid, .match-board, .quiz-opts, .write-layout {
    grid-template-columns: 1fr;
  }
  .mm-tree { grid-template-columns: 1fr; }
  .mm-root-node { position: static; }
  .srs-grid { grid-template-columns: repeat(2, 1fr); }
  .w-row { flex-wrap: wrap; }
}

@media print {
  .sidebar, .mobile-bar, .mobile-tabs, .no-print { display: none !important; }
  body { background: #fff !important; }
  .card { box-shadow: none !important; border: 1px solid #333 !important; }
  body.printing-a4-modal .app-shell,
  body.printing-a4-modal .toast { display: none !important; }
  body.printing-a4-modal #word-modal-backdrop {
    position: static !important;
    display: block !important;
    background: #fff !important;
    padding: 0 !important;
  }
  body.printing-a4-modal .a4-modal-sheet {
    max-height: none !important;
    overflow: visible !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  body.printing-a4-modal .a4-paper {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
}

/* Fullscreen Candy Crush mode (100% edge-to-edge canvas, zero web sidebar bleed) */
body.candy-fs .sidebar,
body.candy-fs .mobile-bar,
body.candy-fs .mobile-tabs { display: none !important; }
body.candy-fs .main-wrap { padding: 0 !important; }
body.candy-fs .content-inner { max-width: none !important; margin: 0 !important; }

/* ==================== PASTEL CANDY CRUSH VOCABULARY GAME ==================== */
.cc-wrap {
  --cc-scale: 1.15;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.cc-wrap.cc-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  width: 100vw;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--g1) 0%, var(--g2) 52%, var(--g3) 100%);
  padding: 0.75rem 1.15rem 1rem;
  overflow-y: auto;
}
.cc-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: var(--sf);
  border: 1.6px solid var(--line);
  border-radius: 16px;
  padding: 0.45rem 0.75rem;
}
.cc-pill {
  padding: 0.36rem 0.78rem;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--sf2);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.14s;
}
.cc-pill.active {
  background: #eab308;
  border-color: #ca8a04;
  color: #1c1917;
}
.cc-font-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--sf2);
}
.cc-font-btn {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1.4px solid var(--ink);
  background: var(--sf);
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cc-font-btn:hover { background: var(--acc); }
.cc-stat-btn {
  padding: 0.36rem 0.82rem;
  border-radius: 999px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}
.cc-stat-score {
  padding: 0.36rem 0.82rem;
  border-radius: 999px;
  border: 1.5px solid #fde047;
  background: #fef9c3;
  color: #854d0e;
  font-size: 0.82rem;
  font-weight: 900;
}
.cc-stat-moves {
  padding: 0.36rem 0.82rem;
  border-radius: 999px;
  border: 1.5px solid #fecdd3;
  background: #ffe4e6;
  color: #9f1239;
  font-size: 0.82rem;
  font-weight: 900;
}
.cc-level-bar {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: center;
}
.cc-lv-chip {
  padding: 0.32rem 0.75rem;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--sf);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.12s;
}
.cc-lv-chip.active {
  background: #eab308;
  border-color: #b45309;
  color: #1c1917;
}
.cc-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 315px;
  gap: 0.75rem;
  align-items: start;
}
.cc-board-card {
  background: var(--sf);
  border: 1.8px solid var(--line);
  border-radius: 20px;
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.58rem;
}
.cc-board-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.cc-grid-scroll {
  width: 100%;
  overflow-x: auto;
}
.cc-grid-scroll.is-200 {
  max-height: calc(100vh - 205px);
  overflow-y: auto;
  padding-right: 4px;
}
.cc-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 5px;
}
.cc-tile {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: calc(64px * var(--cc-scale));
  padding: 5px 4px;
  border-radius: 12px;
  border: 1.8px solid transparent;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  text-align: center;
  overflow: hidden;
}
.cc-size-200 .cc-tile {
  min-height: calc(56px * var(--cc-scale));
  padding: 4px 3px;
}
.cc-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.cc-tile.selected {
  transform: scale(1.05);
  outline: 3px solid #1c1917;
  box-shadow: 0 6px 14px rgba(0,0,0,0.16);
  z-index: 2;
}
.cc-tile.hinted {
  animation: ccPulse 0.9s infinite alternate;
  outline: 2.5px dashed #b45309;
}
@keyframes ccPulse {
  from { transform: scale(1); }
  to { transform: scale(1.05); }
}
.cc-tile-w {
  font-family: var(--font-en), sans-serif;
  font-size: calc(0.95rem * var(--cc-scale));
  font-weight: 900;
  line-height: 1.12;
  white-space: nowrap;
  word-break: normal;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cc-tile.cc-tile-lg .cc-tile-w {
  font-size: calc(0.84rem * var(--cc-scale));
}
.cc-tile.cc-tile-xl .cc-tile-w {
  font-size: calc(0.73rem * var(--cc-scale));
}
.cc-tile-vi {
  font-size: calc(0.68rem * var(--cc-scale));
  font-weight: 800;
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.92;
}
.cc-tile-ipa {
  font-size: calc(0.58rem * var(--cc-scale));
  opacity: 0.72;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 6 Pastel Candy Palettes matched directly to user reference image */
.cc-color-0 { background: #bae6fd; border-color: #7dd3fc; color: #0c4a6e; }
.cc-color-1 { background: #fed7aa; border-color: #fdba74; color: #7c2d12; }
.cc-color-2 { background: #a7f3d0; border-color: #6ee7b7; color: #064e3b; }
.cc-color-3 { background: #fef08a; border-color: #fde047; color: #713f12; }
.cc-color-4 { background: #fecdd3; border-color: #fda4af; color: #881337; }
.cc-color-5 { background: #ddd6fe; border-color: #c4b5fd; color: #4c1d95; }

.cc-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.cc-side-card {
  background: var(--sf);
  border: 1.8px solid var(--line);
  border-radius: 18px;
  padding: 0.85rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
}
.cc-insp-word {
  font-family: var(--font-en);
  font-size: calc(1.55rem * min(1.3, var(--cc-scale)));
  font-weight: 900;
  color: #b91c1c;
  line-height: 1.15;
}
.cc-insp-ipa {
  font-size: calc(0.8rem * min(1.2, var(--cc-scale)));
  color: var(--soft);
  margin-top: 2px;
}
.cc-insp-vi {
  background: var(--sf2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.48rem 0.68rem;
  font-size: calc(0.86rem * min(1.22, var(--cc-scale)));
  font-weight: 800;
  color: var(--ink);
}
.cc-insp-ex {
  background: var(--sf3);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.68rem;
  max-height: 155px;
  overflow-y: auto;
}
.cc-ex-en {
  font-family: var(--font-en);
  font-size: calc(0.84rem * min(1.22, var(--cc-scale)));
  font-weight: 700;
  line-height: 1.42;
}
.cc-ex-vi {
  font-size: calc(0.79rem * min(1.2, var(--cc-scale)));
  color: #0f766e;
  font-weight: 700;
  margin-top: 0.25rem;
  line-height: 1.38;
}
.cc-save-btn {
  width: 100%;
  border-radius: 11px;
  border: 1.6px solid #ca8a04;
  background: #facc15;
  color: #1c1917;
  font-weight: 900;
  font-size: calc(0.84rem * min(1.15, var(--cc-scale)));
  padding: 0.52rem 0.7rem;
  cursor: pointer;
}
.cc-save-btn.saved {
  background: #dcfce7;
  border-color: #15803d;
  color: #166534;
}
.cc-goal-bar {
  height: 6px;
  border-radius: 99px;
  background: var(--sf2);
  overflow: hidden;
  margin-top: 2px;
}
.cc-goal-bar > div {
  height: 100%;
  border-radius: 99px;
  transition: width 0.25s;
}
.cc-stage-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
  max-height: 210px;
  overflow-y: auto;
}
.cc-mini-chip {
  background: var(--sf2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.28rem 0.5rem;
  font-size: calc(0.74rem * min(1.18, var(--cc-scale)));
  cursor: pointer;
  color: var(--ink);
  text-align: left;
}
.cc-mini-vi {
  color: var(--soft);
  font-weight: 600;
}
.cc-mini-chip.active, .cc-mini-chip:hover {
  background: #fef08a;
  border-color: #ca8a04;
}
@media (max-width: 1120px) {
  .cc-main-grid { grid-template-columns: 1fr; }
}

/* ==================== TRUYEN CHEM 3-MODE BILINGUAL READER ==================== */
.tc-story-wrap {
  font-family: 'Be Vietnam Pro', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}
.tc-story-wrap.tc-font-serif {
  font-family: 'Lora', 'Be Vietnam Pro', Georgia, serif;
}
.tc-prose-vi,
.tc-vi-box {
  font-family: 'Be Vietnam Pro', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  letter-spacing: 0.005em;
  word-spacing: 0.02em;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.tc-story-wrap.tc-font-serif .tc-prose-vi,
.tc-story-wrap.tc-font-serif .tc-vi-box {
  font-family: 'Lora', 'Be Vietnam Pro', Georgia, serif;
}
.tc-chem-pill {
  display: inline;
  padding: 2px 7px;
  margin: 0 3px 0 1px;
  border-radius: 7px;
  border: 1.3px solid #38bdf8;
  background: #e0f2fe;
  color: #0c4a6e;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95em;
  line-height: 1.5;
  cursor: pointer;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: background 0.12s, border-color 0.12s;
}
.tc-chem-pill.is-c {
  border-color: #a78bfa;
  background: #ede9fe;
  color: #4c1d95;
}
.tc-chem-pill:hover {
  background: #fef08a;
  border-color: #ca8a04;
  color: #1c1917;
}
.tc-ipa {
  font-family: 'Plus Jakarta Sans', 'Be Vietnam Pro', system-ui, sans-serif;
  font-size: 0.8em;
  opacity: 0.8;
  font-weight: 500;
  margin-left: 4px;
}
.tc-hint {
  font-family: 'Be Vietnam Pro', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 0.88em;
  color: #0f766e;
  font-weight: 600;
  margin-right: 4px;
}
.tc-recall-pill {
  display: inline;
  padding: 2px 7px;
  margin: 0 2px;
  border-radius: 7px;
  border: 1.4px dashed #d97706;
  background: #fef3c7;
  color: #92400e;
  font-family: 'Be Vietnam Pro', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 0.9em;
  font-weight: 700;
  line-height: 1.5;
  cursor: pointer;
}
.tc-recall-pill.revealed {
  border-style: solid;
  border-color: #15803d;
  background: #dcfce7;
  color: #166534;
}

/* ==================== AI ENGLISH TUTOR & PRONUNCIATION COACH ==================== */
.ai-chat-stream {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 440px;
  overflow-y: auto;
  padding: 0.65rem 0.75rem;
  background: var(--sf2);
  border: 1.6px solid var(--line);
  border-radius: 18px;
}
.ai-msg {
  max-width: 88%;
  padding: 0.72rem 0.92rem;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.55;
  box-shadow: 0 2px 6px rgba(43, 33, 24, 0.05);
}
.ai-msg.is-bot {
  align-self: flex-start;
  background: var(--sf3);
  border: 1.5px solid var(--line);
  border-bottom-left-radius: 5px;
}
.ai-msg.is-user {
  align-self: flex-end;
  background: #fef08a;
  border: 1.6px solid #ca8a04;
  color: #1c1917;
  font-weight: 700;
  border-bottom-right-radius: 5px;
}
.ai-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.05rem;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: #facc15;
  color: #1c1917;
  font-weight: 900;
  font-size: 0.86rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(43, 33, 24, 0.22);
  transition: transform 0.14s, background 0.14s;
}
.ai-fab:hover {
  transform: translateY(-2px) scale(1.03);
  background: var(--acc);
}
body.candy-fs .ai-fab { display: none !important; }
@media (max-width: 920px) {
  .ai-fab { bottom: 72px; right: 14px; font-size: 0.78rem; padding: 0.5rem 0.85rem; }
  .ai-msg { max-width: 96%; }
}

/* ==================== LEXIBOT WORD CHOICE DIFF TAGS ==================== */
.lx-del {
  background: #fee2e2;
  color: #b91c1c;
  text-decoration: line-through;
  padding: 1px 4px;
  border-radius: 5px;
  margin-right: 2px;
}
.lx-ins {
  background: #dcfce7;
  color: #15803d;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 6px;
  margin: 0 3px 0 1px;
  border: 1px solid #86efac;
}
