:root {
  color-scheme: light;
  --bg: #F8F9FA;
  --bg-aux: #FFFFFF;
  --card: #FFFFFF;
  --accent: #F5D704;
  --accent-hover: #E2C603;
  --accent-opacity: rgba(245, 215, 4, 0.15);
  
  --ink: #1A1A1A;
  --muted: #707070;
  --line: rgba(0, 0, 0, 0.04);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 12px 36px rgba(0, 0, 0, 0.08);
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  
  /* Study Feedback Colors */
  --green: #22C55E;
  --green-light: rgba(34, 197, 94, 0.08);
  --red: #EF4444;
  --red-light: rgba(239, 68, 68, 0.08);
  --amber: #F59E0B;
  
  /* Radius standards */
  --radius-card: 20px;
  --radius-btn: 999px;
  --radius-small: 12px;
}

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

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

button, input {
  font: inherit;
  outline: none;
}

button {
  cursor: pointer;
  border: none;
  background: transparent;
  transition: transform 0.1s ease, background-color 0.15s ease, opacity 0.15s ease;
}

/* Micro-interaction: scale down on click */
button:active, .answer:active, .sp-item:active, .chapter:active {
  transform: scale(0.96);
}

/* Top Header */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.brand h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand p {
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
}

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

.header-btn, .lang-toggle {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: var(--radius-btn);
  font-weight: 700;
  white-space: nowrap;
}

.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
}

.header-btn:hover {
  background: var(--accent-opacity);
}

.header-icon-svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  display: block;
}

.lang-toggle {
  padding: 8px 16px;
  font-size: 0.85rem;
}

.lang-toggle b {
  color: var(--ink);
  background: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

/* Layout columns */
.layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 24px;
  max-width: 1240px;
  margin: 24px auto;
  padding: 0 24px;
  align-items: start;
}

/* Sidebar & Navigation Dashboard */
.sidebar {
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-aux);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
}

.sidebar-title {
  padding: 20px 24px 12px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 16px;
}

.group {
  border: none;
  background: var(--bg);
  border-radius: var(--radius-card);
  margin-bottom: 12px;
  overflow: hidden;
}

.group-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  color: var(--ink);
  text-align: left;
}

.group-head:hover {
  background: rgba(0, 0, 0, 0.02);
}

.group-head h2 {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.badge {
  display: inline-block;
  min-width: 22px;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--accent);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
}

.chev {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg-aux);
  color: var(--ink);
  font-size: 0;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chev::before {
  content: "+";
  font-size: 1.2rem;
  font-weight: 800;
}

.group.open .chev {
  background: var(--ink);
  color: #fff;
}

.group.open .chev::before {
  content: "−";
}

.group-body {
  display: none;
  padding: 0 8px 12px;
  background: var(--bg);
}

.group.open .group-body {
  display: block;
}

.chapter, .sp-item {
  width: 100%;
  border: none;
  background: var(--bg-aux);
  color: inherit;
  text-align: left;
  text-decoration: none;
  margin-top: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.chapter {
  display: block;
  border-radius: var(--radius-small);
  padding: 14px 16px;
}

.chapter:hover, .sp-item:hover {
  background: #fdfdfd;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.chapter.active, .sp-item.active {
  background: var(--accent-opacity);
  box-shadow: 0 0 0 2px var(--accent);
}

.chapter-name {
  display: block;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
}

.chapter.active .chapter-name, .sp-item.active .sp-name {
  color: var(--ink);
}

.chapter-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.75rem;
}

.kapitel {
  flex: 1;
}

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

.stat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 700;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot.g { background: var(--green); }
.dot.a { background: var(--amber); }
.dot.r { background: var(--red); }

.sp-item {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius-small);
  padding: 12px 16px;
}

.sp-icon {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f3f4f6;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 800;
}

.sp-item.active .sp-icon {
  background: var(--accent);
}

.sp-text {
  min-width: 0;
  flex: 1;
}

.sp-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-count {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.75rem;
}

.sp-arrow {
  flex: none;
  color: #cbd5e1;
  font-size: 0.85rem;
  font-weight: 700;
}

/* Exams list grid layout */
.group.open #examItems {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

#examItems .sp-item {
  gap: 8px;
  padding: 10px 12px;
}

#examItems .sp-icon {
  width: 28px;
  height: 28px;
  font-size: 0.78rem;
}

#examItems .sp-name {
  font-size: 0.85rem;
}

#examItems .sp-count {
  font-size: 0.7rem;
}

#examItems .sp-arrow {
  display: none !important;
}

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 16px 20px;
}

.sidebar-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.sidebar-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
}

.sidebar-progress-track {
  height: 6px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 99px;
  overflow: hidden;
  width: 100%;
}

.sidebar-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #FBBF24, #D97706);
  border-radius: 99px;
  width: 0%;
  transition: width 0.3s ease;
}

.btn-reset {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  border-radius: var(--radius-small);
  padding: 8px 14px;
  font-weight: 700;
  font-size: 0.82rem;
  transition: all 0.15s ease;
}

.btn-reset:hover {
  background: #fee2e2;
  color: var(--red);
  border-color: transparent;
}

/* Main Area Container */
.main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.progress-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.source-pill {
  flex: none;
  border-radius: var(--radius-btn);
  background: var(--accent-opacity);
  color: var(--ink);
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 800;
}

.progress-track {
  flex: 1;
  height: 6px;
  overflow: hidden;
  border-radius: var(--radius-btn);
  background: rgba(0, 0, 0, 0.05);
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: var(--radius-btn);
  background: var(--ink);
  transition: width 0.3s ease;
}

/* Cards & Content blocks */
.card {
  border-radius: var(--radius-card);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 24px 28px;
  transition: transform 0.2s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.2s ease;
}

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

.q-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.qid-tag {
  background: var(--bg);
  color: var(--ink);
  padding: 6px 14px;
  border-radius: var(--radius-btn);
  font-weight: 800;
  font-size: 0.85rem;
}

.points {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.star-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg);
  color: #a1a1aa;
}

.star-btn:hover {
  background: var(--accent-opacity);
  color: var(--ink);
}

.star-btn.marked {
  color: var(--ink);
  background: var(--accent);
}

.star-icon {
  width: 20px;
  height: 20px;
  fill: transparent;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.star-btn.marked .star-icon {
  fill: currentColor;
}

.q-code {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.q-id {
  color: var(--ink);
  font-weight: 800;
}

.q-de {
  margin-bottom: 12px;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.4;
  color: var(--ink);
}

.q-vi {
  margin-bottom: 20px;
  border-left: 3px solid var(--accent);
  padding-left: 14px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
}

/* Media styling inside card */
.q-img-btn {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 8px auto 20px;
  border-radius: var(--radius-small);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.q-img {
  display: block;
  width: 100%;
  max-width: 560px;
  max-height: 35vh;
  object-fit: contain;
}

.q-img-hint {
  position: absolute;
  right: 12px;
  bottom: 12px;
  border-radius: var(--radius-btn);
  background: rgba(26, 26, 26, 0.8);
  color: #fff;
  padding: 6px 12px;
  font-size: 0.7rem;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

.q-video-wrap {
  position: relative;
  display: block;
  width: 100%;
  max-width: 560px;
  margin: 8px auto 20px;
  border-radius: var(--radius-small);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.q-video {
  display: block;
  width: 100%;
  max-height: 45vh;
  background: #000;
}

.q-video-hint {
  display: inline-block;
  margin-top: 8px;
  border-radius: var(--radius-btn);
  background: rgba(26, 26, 26, 0.8);
  color: #fff;
  padding: 6px 12px;
  font-size: 0.7rem;
  font-weight: 700;
}

.vq-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0 20px;
}

.vq-btn {
  flex: 1 1 180px;
  border-radius: var(--radius-btn);
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 700;
}

.vq-replay {
  background: var(--bg);
  color: var(--ink);
}

.vq-goto {
  background: var(--accent);
  color: var(--ink);
}

/* Answers block styling */
.answers {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.answer {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  width: 100%;
  border-radius: var(--radius-small);
  background: var(--bg);
  border: 2px solid transparent;
  color: inherit;
  padding: 16px 20px;
  text-align: left;
  box-shadow: 0 2px 8px rgba(0,0,0,0.01);
  transition: transform 0.1s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.answer:hover {
  background: #fdfdfd;
  border-color: var(--line);
}

.answer.picked {
  background: #ffffff;
  border-color: var(--ink);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

.answer.correct {
  border-color: var(--green);
  background: var(--green-light);
}

.answer.incorrect {
  border-color: var(--line);
  opacity: 0.6;
}

.answer.wrong {
  border-color: var(--red);
  background: var(--red-light);
}

.check-square {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 2px solid #a1a1aa;
  border-radius: 50%; /* Circle checkboxes */
  background: #fff;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  transition: 0.15s ease;
}

.answer.picked .check-square {
  border-color: var(--ink);
  background: var(--ink);
}

.answer.correct .check-square {
  border-color: var(--green);
  background: var(--green);
}

.answer.wrong .check-square {
  border-color: var(--red);
  background: var(--red);
}

.answer-copy {
  display: grid;
  gap: 4px;
}

.a-de {
  font-size: 0.95rem;
  font-weight: 750;
  line-height: 1.35;
  color: var(--ink);
}

.a-vi {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.4;
}

/* Fill-in-the-blank Card */
.fill-card {
  border-radius: var(--radius-card);
  background: var(--bg);
  padding: 20px;
  margin-bottom: 16px;
}

.fill-card.correct {
  background: var(--green-light);
  border: 2px solid var(--green);
}

.fill-card.wrong {
  background: var(--red-light);
  border: 2px solid var(--red);
}

.fill-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
}

.fill-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fill-input {
  width: 140px;
  min-height: 48px;
  border: 2px solid var(--line);
  border-radius: var(--radius-small);
  background: #fff;
  padding: 8px 12px;
  font-size: 1.3rem;
  font-weight: 800;
  text-align: center;
  color: var(--ink);
}

.fill-input:focus {
  border-color: var(--ink);
}

.fill-unit {
  color: var(--ink);
  font-weight: 700;
}

.fill-correct {
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--green);
  font-weight: 700;
}

/* Explanation & Results validation */
.btn-check {
  display: block;
  width: 100%;
  margin-top: 12px;
  border-radius: var(--radius-btn);
  background: var(--ink);
  color: #fff;
  padding: 14px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
}

.btn-check:hover {
  opacity: 0.9;
}

.btn-check:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.result {
  margin-top: 16px;
  border-radius: var(--radius-small);
  padding: 14px 18px;
  font-size: 0.9rem;
  font-weight: 700;
}

.result.ok {
  background: var(--green-light);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.result.no {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.explain {
  margin-top: 16px;
  border-radius: var(--radius-card);
  background: var(--bg);
  padding: 18px 20px;
  border: 1px solid var(--line);
}

.explain-title {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.explain p {
  margin-bottom: 8px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
}

/* Hint box */
.hint {
  display: none;
  border-radius: var(--radius-card);
  background: var(--accent-opacity);
  border: 1px solid rgba(245, 215, 4, 0.3);
  padding: 20px;
  margin-top: 16px;
}

.hint.show {
  display: block;
}

.hint-title {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hint p {
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.45;
}

/* Navigation jumps (Desktop / Non-study layout) */
.nav-jump {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.btn-jump, .btn-prev, .btn-next {
  border-radius: var(--radius-btn);
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
  white-space: nowrap;
}

.btn-jump {
  flex: 1;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 10px 8px;
}

.btn-jump:hover {
  background: rgba(0, 0, 0, 0.02);
}

.jump-box {
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-btn);
  background: #fff;
  padding: 2px 10px;
}

.jump-box input {
  width: 40px;
  border: none;
  color: var(--ink);
  padding: 6px 2px;
  font-size: 0.95rem;
  font-weight: 800;
  text-align: center;
}

.jump-total {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.btn-prev, .btn-next {
  padding: 12px 24px;
}

.btn-prev {
  background: var(--bg-aux);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-next {
  background: var(--accent);
  color: var(--ink);
  font-weight: 800;
}

.btn-next:hover {
  background: var(--accent-hover);
}

/* Bottom Navigation Bar Styles */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(64px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 1000;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.03);
}

.nav-item {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  text-decoration: none;
  transition: transform 0.1s ease, color 0.15s ease;
}

.nav-icon {
  font-size: 1.35rem;
  line-height: 1.2;
}

.nav-label {
  font-size: 0.65rem;
  font-weight: 700;
  margin-top: 2px;
}

.nav-item.active {
  color: var(--ink);
}

.nav-center {
  height: 100%;
}

.nav-center .nav-icon {
  font-size: 1.6rem;
  z-index: 2;
}

.nav-center .nav-label {
  z-index: 2;
}

.cocoon-effect {
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--accent-opacity);
  transform: scale(0);
  transform-origin: center center;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s ease;
}

.nav-item.active-cocoon .cocoon-effect {
  transform: scale(1.1);
  opacity: 1;
}

/* Toast component */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 9999;
  transform: translateX(-50%) translateY(10px);
  border-radius: var(--radius-btn);
  background: var(--ink);
  color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.25s ease;
}

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

/* Exam Summary Page */
.exam-summary {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
  border-radius: var(--radius-card);
  padding: 20px;
  text-align: left;
}

.exam-summary.pass {
  background: var(--green-light);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: var(--green);
}

.exam-summary.fail {
  background: var(--red-light);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--red);
}

.exam-summary strong {
  font-size: 1.25rem;
  font-weight: 850;
}

.exam-summary span {
  font-size: 0.9rem;
  font-weight: 600;
}

.exam-reset-btn {
  justify-self: start;
  margin-top: 8px;
  border-radius: var(--radius-btn);
  background: var(--ink);
  color: #fff;
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 700;
}

/* Vocabulary View Card styling */
.vocab-page, .practice-errors-page {
  padding: 8px 0 24px;
}

.vocab-page h2, .practice-errors-page h2 {
  font-size: 1.4rem;
  font-weight: 850;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.vocab-page > p, .practice-errors-page > p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.vocab-section {
  margin-top: 24px;
}

.vocab-section h3 {
  position: sticky;
  top: 70px;
  z-index: 10;
  margin: 0 -28px 12px;
  padding: 12px 28px;
  background: rgba(248, 249, 250, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 800;
}

.vocab-list {
  display: grid;
  gap: 10px;
}

.vocab-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  background: var(--bg);
  border-radius: var(--radius-small);
  padding: 14px 16px;
}

.vocab-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.vocab-main strong {
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
}

.vocab-main span {
  font-size: 0.72rem;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  color: var(--muted);
}

.vocab-vi {
  grid-column: 1 / -1;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.4;
}

.vocab-count {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  border-radius: var(--radius-btn);
  background: var(--accent);
  color: var(--ink);
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

/* Practice errors screen */
.practice-error-group {
  margin-top: 20px;
  background: var(--bg);
  border-radius: var(--radius-card);
  padding: 16px;
}

.practice-error-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  color: var(--ink);
  font-weight: 850;
  font-size: 1rem;
}

.practice-error-group-title b {
  font-size: 0.75rem;
  background: var(--ink);
  color: #fff;
  padding: 2px 8px;
  border-radius: var(--radius-btn);
}

.practice-error-section {
  margin-top: 16px;
  margin-bottom: 16px;
}

.practice-error-section h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.95rem;
  font-weight: 800;
}

.practice-section-number {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 800;
}

.practice-error-section p {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 10px;
  margin-left: 34px;
}

.practice-error-list {
  display: grid;
  gap: 8px;
  margin-left: 34px;
}

.practice-error-card {
  background: #fff;
  border-radius: var(--radius-small);
  padding: 12px 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.01);
}

.practice-error-group.fatal .practice-error-card {
  border-left: 4px solid var(--red);
}

.practice-error-group.minor .practice-error-card {
  border-left: 4px solid var(--accent);
}

.practice-error-card strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 750;
  margin-bottom: 4px;
  color: var(--ink);
}

.practice-error-card span {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
}

/* Floating guides panel */
.fab-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1001;
  display: none;
}

body.license-active .fab-stack {
  display: flex;
}

.fab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-btn);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  font-weight: 700;
  font-size: 0.8rem;
}

.fab-ico {
  font-size: 1.1rem;
}

/* Sheets & Modal dialogs */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
}

.sheet.open {
  display: block;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
}

.sheet-box {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(90vw, 420px);
  max-height: 85vh;
  overflow-y: auto;
  background: #fff;
  border-radius: var(--radius-card);
  padding: 28px 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.sheet-close {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--ink);
  font-weight: 700;
  display: grid;
  place-items: center;
}

.sheet-title {
  font-size: 1.2rem;
  font-weight: 850;
  margin-bottom: 20px;
  color: var(--ink);
}

.guide-block {
  text-align: left;
  margin-bottom: 18px;
}

.guide-block h4 {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.guide-block ol {
  padding-left: 20px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--muted);
}

/* Image Viewer Modal */
.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  background: rgba(26, 26, 26, 0.95);
  backdrop-filter: blur(10px);
}

.image-viewer.open {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.image-viewer-stage {
  grid-row: 1;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 24px;
}

.image-viewer-stage img {
  max-width: 95vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-small);
}

.image-viewer-bar {
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.2);
}

.image-tool-btn, .image-close-btn {
  height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-btn);
  font-weight: 700;
  font-size: 0.9rem;
}

.image-tool-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.image-close-btn {
  background: var(--accent);
  color: var(--ink);
  font-weight: 800;
}

/* License Gate */
.license-gate {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 24px;
}

.license-panel {
  width: min(100%, 380px);
  text-align: center;
}

.license-panel h1 {
  font-size: 1.6rem;
  font-weight: 850;
  margin-bottom: 8px;
}

.license-panel p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.license-form {
  display: grid;
  gap: 12px;
}

.license-input {
  width: 100%;
  height: 50px;
  border-radius: var(--radius-small);
  border: 2px solid var(--line);
  background: #fff;
  padding: 0 16px;
  font-size: 1rem;
  text-align: center;
}

.license-input:focus {
  border-color: var(--ink);
}

.license-submit {
  width: 100%;
  height: 50px;
  border-radius: var(--radius-btn);
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
}

.license-status {
  min-height: 24px;
  margin-top: 12px;
  color: var(--red);
  font-weight: 700;
}

/* Active Language overrides */
body.lang-de .q-vi, body.lang-de .a-vi, body.lang-de .r-vi { display: none; }
body.lang-vi .q-de, body.lang-vi .a-de, body.lang-vi .r-de { display: none; }

body.lang-vi .q-vi {
  border-left: none;
  padding-left: 0;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ink);
}

/* Study mode specific overrides (Dual View & Fixed bottom controls) */

body.study-focus .layout {
  grid-template-columns: minmax(0, 1fr);
  max-width: 760px;
  margin: 16px auto;
}

body.study-focus .sidebar {
  display: none;
}

body.study-focus.menu-open .sidebar {
  position: fixed;
  left: 20px;
  right: 20px;
  top: 80px;
  bottom: calc(80px + env(safe-area-inset-bottom));
  z-index: 1005;
  display: flex;
  max-height: none;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

body.study-focus.menu-open::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1004;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
}

body.study-focus .progress-bar {
  display: none;
}

body.study-focus {
  padding-bottom: calc(230px + env(safe-area-inset-bottom)) !important;
}

body.study-focus .card {
  min-height: calc(100vh - 250px);
  padding: 20px 20px 30px;
  background: var(--card);
}

body.study-focus .q-head {
  min-height: 48px;
}

body.study-focus .q-head .star-btn {
  position: fixed;
  right: 20px;
  bottom: calc(154px + env(safe-area-inset-bottom));
  z-index: 900;
  width: 46px;
  height: 46px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  background: #fff;
  border: 1px solid var(--line);
}

body.study-focus .q-head .star-btn.marked {
  background: var(--accent);
  border-color: transparent;
}

body.study-focus .theme-back-btn {
  display: inline-flex;
  align-items: center;
  background: var(--bg);
  padding: 8px 16px;
  border-radius: var(--radius-btn);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--ink);
}

body.study-focus .study-lang-btn,
body.study-focus .study-font-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--ink);
  height: 36px;
  border-radius: var(--radius-btn);
  font-weight: 800;
  font-size: 0.78rem;
  padding: 0 12px;
}

body.study-focus .study-lang-btn {
  padding: 0 14px;
}

body.study-focus .study-font-btn {
  width: 36px;
  padding: 0;
}

body.study-focus .q-de {
  font-size: 1.25rem;
  font-weight: 850;
  margin-top: 14px;
}

body.study-focus.lang-vi .q-vi {
  font-size: 1.15rem;
  font-weight: 800;
}

body.study-focus .answers {
  gap: 14px;
}

body.study-focus .btn-check {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: calc(154px + env(safe-area-inset-bottom));
  z-index: 900;
  width: calc(100% - 40px - 58px); /* Account for floating star-btn */
  height: 46px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-btn);
}

body.study-focus .nav-jump,
body.study-focus .nav-row {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 900;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
}

body.study-focus .nav-jump {
  bottom: calc(64px + env(safe-area-inset-bottom));
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

body.study-focus .nav-row {
  bottom: calc(114px + env(safe-area-inset-bottom));
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

body.study-focus .nav-row::before {
  content: attr(data-count);
  font-weight: 800;
  color: var(--ink);
}

body.study-focus .btn-prev,
body.study-focus .btn-next,
body.study-focus .btn-jump {
  height: 34px;
  padding: 0 12px;
  font-size: 0.78rem;
  border-radius: var(--radius-btn);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body.study-focus .btn-prev::before {
  content: "◀";
  font-size: 0.7rem;
}
body.study-focus .btn-next::before {
  content: "▶";
  font-size: 0.7rem;
}

body.study-focus .btn-prev, body.study-focus .btn-next {
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
}

body.study-focus .jump-box {
  height: 34px;
  border-width: 1px;
}

body.study-focus .jump-box input {
  padding: 0;
  font-size: 0.85rem;
}

body.study-focus .jump-total {
  display: inline;
}

/* Tab screens container and routing classes */
body.vocab-mode .card, body.practice-errors-mode .card {
  min-height: auto;
  padding-bottom: 24px;
}

body.vocab-mode .nav-jump, body.vocab-mode .nav-row,
body.vocab-mode .progress-bar,
body.practice-errors-mode .nav-jump, body.practice-errors-mode .nav-row,
body.practice-errors-mode .progress-bar {
  display: none !important;
}

/* === Responsive adaptation for desktop === */
@media (max-width: 860px) {
  body {
    font-size: 14px;
  }
  
  header {
    padding: 12px 16px;
  }
  
  .brand h1 {
    font-size: 1.1rem;
  }
  
  .brand p {
    display: none;
  }
  
  /* Mobile menu button removed */
  
  .layout {
    display: block;
    margin: 8px auto;
    padding: 0 12px;
  }
  
  /* On mobile, when not studying, sidebar fills content */
  .sidebar {
    position: fixed;
    left: 12px;
    right: 12px;
    top: 72px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    z-index: 95;
    max-height: none;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s ease;
  }
  
  body.menu-open .sidebar {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
  
  body.menu-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(4px);
  }
  
  body.home-menu .sidebar {
    position: static;
    display: flex;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    box-shadow: none;
    border-radius: var(--radius-card);
  }
  
  body.home-menu::before {
    display: none;
  }
  
  .main {
    width: 100%;
  }
  
  .card {
    padding: 18px 20px;
  }
  
  .q-de {
    font-size: 1.05rem;
  }
  
  .q-vi {
    font-size: 0.9rem;
  }
}

body:not(.study-focus) {
  background: var(--bg);
}

body:not(.study-focus) .layout {
  display: block;
  max-width: 760px;
  margin: 20px auto;
}

body:not(.study-focus) .main {
  display: none;
}

body:not(.study-focus) .sidebar {
  position: static;
  display: flex;
  width: 100%;
  max-height: none;
  overflow: hidden;
  box-shadow: var(--shadow);
}

body:not(.study-focus) .sidebar-scroll {
  max-height: calc(100vh - 200px);
}

body:not(.study-focus) .group {
  margin-bottom: 12px;
}

body:not(.study-focus) .group-head {
  background: var(--bg);
  padding: 16px 20px;
}

body:not(.study-focus) .group-body {
  padding: 8px 12px 14px;
}

body:not(.study-focus) .chapter, body:not(.study-focus) .sp-item {
  border: 1px solid var(--line);
}

body:not(.study-focus) .chapter {
  padding: 14px 16px;
}

body:not(.study-focus) .sp-item {
  padding: 12px 14px;
}

body:not(.study-focus) .chapter.active, body:not(.study-focus) .sp-item.active {
  box-shadow: 0 0 0 2px var(--accent);
}

@media (max-width: 860px) {
  body:not(.study-focus) .sidebar {
    box-shadow: none;
  }
  
  body:not(.study-focus) .sidebar-scroll {
    max-height: none;
  }
}

/* Safe Area adjustments for status bars */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: env(safe-area-inset-top);
  background: var(--bg-aux);
  z-index: 9999;
  pointer-events: none;
}

body {
  padding-top: env(safe-area-inset-top);
}

body.home-menu .sidebar {
  padding-top: env(safe-area-inset-top);
}

/* Exams list and settings items rendered in content */
.custom-list-title {
  font-size: 1.4rem;
  font-weight: 850;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.custom-list-desc {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.exams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.exam-card-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border-radius: var(--radius-small);
  padding: 16px;
  text-align: left;
  border: 2px solid transparent;
}

.exam-card-btn:hover {
  background: #fff;
  border-color: var(--line);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.exam-card-btn.active {
  background: var(--accent-opacity);
  border-color: var(--accent);
}

.exam-card-icon {
  width: 36px;
  height: 36px;
  background: #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.exam-card-btn.active .exam-card-icon {
  background: var(--accent);
}

.exam-card-title {
  font-size: 0.92rem;
  font-weight: 750;
  color: var(--ink);
  display: block;
}

.exam-card-sub {
  font-size: 0.75rem;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

/* Settings elements */
.settings-list {
  display: grid;
  gap: 20px;
  margin-top: 16px;
}

.settings-section {
  background: var(--bg);
  border-radius: var(--radius-card);
  padding: 20px;
}

.settings-section h3 {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-info {
  display: grid;
  gap: 2px;
}

.settings-label {
  font-size: 0.92rem;
  font-weight: 750;
  color: var(--ink);
}

.settings-desc {
  font-size: 0.78rem;
  color: var(--muted);
}

.settings-control button, .settings-control select {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
}

.settings-control button:hover {
  background: var(--bg);
}

.settings-control button.danger {
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.2);
}

.settings-control button.danger:hover {
  background: #fee2e2;
  border-color: transparent;
}

/* Community view elements */
.community-container {
  display: grid;
  gap: 24px;
  margin-top: 16px;
}

.community-main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 650px) {
  .community-main-grid {
    grid-template-columns: 1fr;
  }
}

.community-card {
  background: var(--bg);
  border-radius: var(--radius-card);
  padding: 24px;
  text-align: center;
}

.community-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.community-card h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.community-card p {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 18px;
  line-height: 1.5;
}

.community-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-btn);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
}

.community-btn:hover {
  opacity: 0.9;
}

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

.community-info-box {
  background: #fff;
  border-radius: var(--radius-small);
  padding: 16px;
  border: 1px solid var(--line);
  text-align: left;
}

.community-info-box h4 {
  font-size: 0.9rem;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--ink);
}

.community-info-box p {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

@media (max-width: 600px) {
  .community-grid {
    grid-template-columns: 1fr;
  }
}

/* Custom Redesigned Search Input styling */
.q-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 20px;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-btn);
  padding: 6px 6px 6px 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.q-search:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--accent-opacity);
}

.q-search input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 500;
  outline: none;
}

.q-search input::placeholder {
  color: var(--muted);
}

.q-search button {
  flex: none;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-btn);
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 700;
  transition: opacity 0.15s ease;
}

.q-search button:hover {
  opacity: 0.9;
}

/* Close Button Overrides for Drawer menu on Mobile */
.close-btn {
  display: none;
}

@media (max-width: 860px) {
  body.menu-open .close-btn {
    display: grid;
    place-items: center;
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg);
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 700;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: none;
  }
}

/* Unified SVG navigation icon styling */
.nav-svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  transition: color 0.15s ease, stroke 0.15s ease;
}

.nav-item.active .nav-svg {
  stroke: var(--ink);
  color: var(--ink);
}

.nav-center .nav-svg {
  width: 28px;
  height: 28px;
  z-index: 2;
}

/* Community view SVG styling */
.community-card-svg {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  stroke: var(--ink);
  display: block;
}

/* Brightness Theme - Eye Comfort mode (Dịu mắt) */
body.font-comfort {
  --bg: #FAF5EB;        /* Warm reader sepia background */
  --bg-aux: #FAF5EB;    /* Warm sepia containers */
  --card: #FFFDF9;      /* Bright sepia card container */
  --line: rgba(0, 0, 0, 0.03);
  line-height: 1.55;
}

body.font-comfort .answers {
  gap: 16px;
}

body.font-comfort .answer {
  padding: 18px 22px;
  background: rgba(0, 0, 0, 0.02);
}

body.font-comfort .answer:hover {
  background: rgba(0, 0, 0, 0.01);
}

body.font-comfort .answer.picked {
  background: #FFFDF9;
  border-color: var(--ink);
}

body.font-comfort .q-de {
  line-height: 1.48;
}

body.font-comfort .q-vi {
  line-height: 1.52;
}

body.font-comfort header {
  background: rgba(250, 245, 235, 0.85);
}

body.font-comfort .bottom-nav {
  background: rgba(250, 245, 235, 0.75);
}

body.font-comfort .vocab-section h3 {
  background: rgba(250, 245, 235, 0.9);
}

/* Firebase Auth Overlay and Card Styles */
.auth-loading, .auth-gate {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-loading {
  background: var(--bg);
}

.auth-loading p {
  margin-top: 16px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.auth-gate {
  background: radial-gradient(circle at 50% 50%, var(--bg) 0%, rgba(254, 252, 232, 0.55) 100%);
  position: relative;
  overflow: hidden;
}

.auth-floating-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.auth-floating-bg svg {
  position: absolute;
  width: var(--size);
  height: var(--size);
  color: var(--accent);
  opacity: 0.15;
  pointer-events: none;
  animation: fallDown var(--duration) linear infinite;
}

@keyframes fallDown {
  0% {
    transform: translateY(-100px) rotate(0deg);
    opacity: 0;
  }
  15% {
    opacity: 0.16;
  }
  85% {
    opacity: 0.16;
  }
  100% {
    transform: translateY(110vh) rotate(var(--rotation-end));
    opacity: 0;
  }
}

.auth-box {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-card);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  position: relative;
  z-index: 10;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.auth-logo {
  width: 84px;
  height: 84px;
  object-fit: contain;
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(245, 215, 4, 0.25);
  animation: floatLogo 4s ease-in-out infinite;
}

@keyframes floatLogo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.auth-brand h2 {
  font-size: 1.65rem;
  font-weight: 900;
  color: var(--ink);
  letter-spacing: -0.5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
  text-align: center;
}

.auth-subtitle {
  font-size: 0.88rem;
  color: var(--muted);
  text-align: center;
  margin-bottom: 4px;
  line-height: 1.45;
}

.auth-subtitle strong {
  color: var(--ink);
  font-weight: 700;
}

.auth-tabs {
  display: flex;
  background: var(--bg);
  padding: 4px;
  border-radius: 999px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
}

.auth-tab-btn {
  flex: 1;
  padding: 10px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  transition: all 0.2s ease;
}

.auth-tab-btn.active {
  background: var(--accent);
  color: var(--ink);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-input-group label {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink);
}

.auth-input-group input {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  transition: all 0.15s ease;
  width: 100%;
}

.auth-input-group input:focus {
  border-color: var(--accent-hover);
  background: var(--card);
  box-shadow: 0 0 0 3px var(--accent-opacity);
}

.auth-error {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--red);
  min-height: 1.2rem;
  line-height: 1.35;
  text-align: center;
}

.auth-submit-btn {
  background: var(--accent);
  color: var(--ink);
  font-weight: 800;
  padding: 14px;
  border-radius: var(--radius-btn);
  font-size: 0.95rem;
  text-align: center;
  transition: background-color 0.15s ease, transform 0.1s ease;
  border: none;
  width: 100%;
  margin-top: 8px;
}

.auth-submit-btn:hover {
  background: var(--accent-hover);
}

.auth-submit-btn:active {
  transform: scale(0.97);
}

/* Car Loader */
.car-loader {
  position: relative;
  width: 90px;
  height: 50px;
  margin-bottom: 20px;
}

.car-container {
  position: absolute;
  bottom: 12px;
  left: 15px;
  width: 60px;
  height: 30px;
  animation: carBounce 0.4s ease-in-out infinite;
}

.car-body {
  width: 60px;
  height: 30px;
}

.car-wheel {
  position: absolute;
  bottom: 0px;
  width: 12px;
  height: 12px;
  animation: wheelSpin 0.35s linear infinite;
}

.wheel-back {
  left: 10px;
}

.wheel-front {
  left: 38px;
}

.road-lines {
  position: absolute;
  bottom: 8px;
  left: 0;
  width: 90px;
  height: 2px;
  background: linear-gradient(90deg, 
    var(--muted) 0%, var(--muted) 50%, 
    transparent 50%, transparent 100%
  );
  background-size: 20px 2px;
  opacity: 0.4;
  animation: roadSlide 0.4s linear infinite;
}

@keyframes carBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2.5px); }
}

@keyframes wheelSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes roadSlide {
  0% { background-position: 20px 0; }
  100% { background-position: 0 0; }
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 12px 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1.5px solid var(--line);
}

.auth-divider:not(:empty)::before {
  margin-right: .5em;
}

.auth-divider:not(:empty)::after {
  margin-left: .5em;
}

.auth-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--card);
  color: var(--ink);
  font-weight: 700;
  padding: 12px;
  border-radius: var(--radius-btn);
  font-size: 0.9rem;
  border: 1.5px solid var(--line);
  width: 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.auth-google-btn:hover {
  background: var(--bg);
}

.auth-google-btn:active {
  transform: scale(0.97);
}

.google-icon {
  width: 18px;
  height: 18px;
}

/* Account Upgrade (Pro) Screen Styles */
.upgrade-page {
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.upgrade-header {
  text-align: center;
}

.upgrade-header h2 {
  font-size: 1.6rem;
  font-weight: 850;
  color: var(--ink);
  margin-bottom: 6px;
}

.upgrade-header p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.upgrade-benefits {
  background: var(--card);
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  padding: 24px;
  box-shadow: var(--shadow);
}

.upgrade-benefits h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--ink);
}

.benefit-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.benefit-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.92rem;
  line-height: 1.45;
}

.benefit-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--green-light);
  color: var(--green);
  font-weight: bold;
  font-size: 0.75rem;
  margin-top: 2px;
  flex-shrink: 0;
}

.benefit-text strong {
  color: var(--ink);
}

.benefit-text span {
  color: var(--muted);
  display: block;
  font-size: 0.85rem;
  margin-top: 2px;
}

.bank-card {
  background: linear-gradient(135deg, #1A1A1A 0%, #333333 100%);
  color: #FFFFFF;
  border-radius: var(--radius-card);
  padding: 28px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  overflow: hidden;
  text-align: left;
}

.bank-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  pointer-events: none;
}

.bank-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 12px;
}

.bank-name {
  font-weight: 850;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
}

.bank-chip {
  width: 35px;
  height: 25px;
  background: #E5C158;
  border-radius: 4px;
  opacity: 0.7;
}

.bank-details {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bank-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bank-row-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: #A0A0A0;
  letter-spacing: 0.8px;
  font-weight: 700;
}

.bank-row-value {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bank-row-value.amount {
  font-size: 1.5rem;
  color: var(--accent);
  font-weight: 850;
}

.bank-row-value.code {
  font-family: monospace;
  font-size: 1.3rem;
  color: #58B6E5;
  background: rgba(88, 182, 229, 0.1);
  padding: 4px 8px;
  border-radius: 6px;
  width: max-content;
  letter-spacing: 1px;
}

.copy-badge {
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  padding: 2px 8px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.15s ease;
  user-select: none;
}

.copy-badge:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.copy-badge:active {
  transform: translateY(0);
}

.payment-qr-section {
  background: var(--card);
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  padding: 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.payment-qr-container {
  background: #ffffff;
  padding: 12px;
  border-radius: var(--radius-small);
  border: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.payment-qr-image {
  width: 200px;
  height: 200px;
  display: block;
}

.payment-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
}

.payment-status .status-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--accent-hover);
  border-radius: 50%;
  animation: auth-spin 1s linear infinite;
}

.success-upgrade-box {
  background: var(--card);
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  padding: 40px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.success-upgrade-icon {
  font-size: 3rem;
  animation: success-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes success-pop {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

/* Header Username & Pulsing Badge Styles */
.brand h1.is-user {
  font-family: monospace;
  font-weight: 750;
  letter-spacing: -0.5px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
  line-height: 1;
}

.role-badge.free {
  background: var(--bg);
  color: var(--muted);
  border: 1.5px solid var(--line);
}

.role-badge.pro {
  background: #FEF3C7; /* Soft gold background */
  color: #D97706; /* Rich gold amber */
  border: 1.5px solid rgba(217, 119, 6, 0.3);
  box-shadow: 0 0 10px rgba(245, 215, 4, 0.2);
  animation: pro-badge-pulse 2s infinite ease-in-out;
}

@keyframes pro-badge-pulse {
  0% {
    box-shadow: 0 0 4px rgba(245, 215, 4, 0.2);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 12px rgba(245, 215, 4, 0.45);
    transform: scale(1.04);
  }
  100% {
    box-shadow: 0 0 4px rgba(245, 215, 4, 0.2);
    transform: scale(1);
  }
}

/* Prominent Upgrade Nav Button Style */
#navUpgradeBtn {
  position: relative;
  font-weight: 850;
  transition: all 0.2s ease;
}

#navUpgradeBtn .nav-svg {
  color: #D97706; /* Gold border */
  fill: #FEF3C7; /* Soft gold fill */
  stroke: #D97706;
  filter: drop-shadow(0 0 1px rgba(217, 119, 6, 0.2));
  animation: pro-button-pulse 2s infinite ease-in-out;
}

#navUpgradeBtn.active .nav-svg {
  fill: #F5D704; /* Bright gold on active */
  stroke: var(--ink);
  color: var(--ink);
  animation: none; /* stop pulse when active */
}

@keyframes pro-button-pulse {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 2px rgba(217, 119, 6, 0.2));
  }
  50% {
    transform: scale(1.12);
    filter: drop-shadow(0 0 8px rgba(217, 119, 6, 0.5));
  }
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 2px rgba(217, 119, 6, 0.2));
  }
}

/* Animated Upgrade Pointer/Tooltip Styles */
.upgrade-tooltip {
  position: fixed;
  z-index: 10000;
  background: linear-gradient(135deg, #FBBF24, #D97706);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(217, 119, 6, 0.45);
  font-weight: 700;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  transition: opacity 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-size: 0.85rem;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.upgrade-tooltip::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px 6px 0;
  border-style: solid;
  border-color: #D97706 transparent;
  display: block;
  width: 0;
}

.upgrade-tooltip.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.upgrade-tooltip .arrow-down {
  display: inline-block;
  margin-left: 4px;
  animation: pulse-arrow-vertical 0.8s infinite alternate ease-in-out;
}

@keyframes pulse-arrow-vertical {
  0% { transform: translateY(0); }
  100% { transform: translateY(4px); }
}

/* Aggressive pulse animation for upgrade button highlight */
.upgrade-highlight-active {
  animation: aggressive-button-pulse 0.4s 6 alternate ease-in-out !important;
}

@keyframes aggressive-button-pulse {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(1.25);
    background: rgba(245, 215, 4, 0.35);
  }
}

/* Unified Payment QR Section Styles */
.payment-content-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  width: 100%;
  margin: 16px 0;
  text-align: left;
}

.payment-qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #ffffff;
  padding: 16px;
  border-radius: var(--radius-card);
  border: 1.5px solid var(--line);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
  flex-shrink: 0;
}

.payment-qr-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.payment-info-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.p-info-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1.5px dashed var(--line);
  padding-bottom: 10px;
}

.p-info-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.p-info-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.p-info-value {
  font-size: 0.95rem;
  font-weight: 750;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.p-info-value.accent-text {
  color: #D97706;
  font-size: 1.25rem;
  font-weight: 850;
}

.p-info-value.code-wrapper {
  background: rgba(88, 182, 229, 0.08);
  padding: 4px 10px;
  border-radius: 6px;
  width: max-content;
}

.monospace-code {
  font-family: monospace;
  font-size: 1.15rem;
  color: #3b82f6;
  letter-spacing: 0.5px;
  font-weight: 800;
}

.payment-status-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
}

.payment-note {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

@media (max-width: 640px) {
  .payment-content-wrapper {
    flex-direction: column;
    gap: 24px;
  }
  .payment-info-list {
    width: 100%;
  }
}

/* Premium Lock Screen Card */
.premium-lock-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  background: radial-gradient(circle at top, rgba(253, 230, 138, 0.15) 0%, rgba(255, 255, 255, 0) 70%), var(--card);
  border-radius: var(--radius-card);
  border: 1px solid rgba(217, 119, 6, 0.15);
  box-shadow: 0 10px 30px rgba(0,0,0,0.02);
  margin: 12px 0;
  position: relative;
  overflow: hidden;
  animation: card-fade-in 0.4s ease-out;
}

@keyframes card-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.lock-visual {
  position: relative;
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  margin-bottom: 24px;
}

.lock-glow-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(217, 119, 6, 0.1);
  border: 1.5px dashed rgba(217, 119, 6, 0.3);
  animation: rotate-ring 8s linear infinite;
}

@keyframes rotate-ring {
  to { transform: rotate(360deg); }
}

.lock-icon-wrapper {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
  border: 1.5px solid rgba(217, 119, 6, 0.2);
  display: grid;
  place-items: center;
  color: #D97706;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.15);
  animation: lock-pulse-glowing 2s infinite ease-in-out;
}

@keyframes lock-pulse-glowing {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.15);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 4px 20px rgba(217, 119, 6, 0.35);
  }
}

.premium-lock-svg {
  width: 24px;
  height: 24px;
}

.premium-lock-card h3 {
  font-size: 1.35rem;
  font-weight: 850;
  color: var(--ink);
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.lock-subtitle {
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 440px;
  line-height: 1.5;
  margin-bottom: 24px;
}

.lock-benefits-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 440px;
  margin-bottom: 30px;
}

@media (max-width: 480px) {
  .lock-benefits-grid {
    grid-template-columns: 1fr;
  }
}

.lock-benefit-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--line);
  padding: 10px 14px;
  border-radius: 10px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
}

.pill-icon {
  font-size: 1rem;
}

.lock-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 300px;
}

.lock-action-btn {
  height: 46px;
  border-radius: var(--radius-btn);
  font-size: 0.88rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  width: 100%;
  border: none;
}

.lock-action-btn.upgrade-cta {
  background: linear-gradient(135deg, #FBBF24, #D97706);
  color: #fff;
  box-shadow: 0 4px 15px rgba(217, 119, 6, 0.3);
}

.lock-action-btn.upgrade-cta:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.lock-action-btn.upgrade-cta:active {
  transform: translateY(0);
}

.lock-action-btn.back-cta {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--line);
}

.lock-action-btn.back-cta:hover {
  background: var(--line);
  color: var(--ink);
}

/* Hide main app elements in auth-gate mode */
body.auth-mode header,
body.auth-mode .layout,
body.auth-mode .bottom-nav,
body.auth-mode .fab-group {
  display: none !important;
}

body.auth-mode {
  overflow: hidden !important;
  height: 100vh !important;
  padding-bottom: 0 !important;
}

/* Empty State Card Redesign */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  min-height: 380px;
}

.empty-state-icon {
  position: relative;
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  background: var(--bg);
  border-radius: 24px;
  border: 1.5px dashed rgba(245, 215, 4, 0.5);
  box-shadow: var(--shadow);
  animation: floatLogo 4s ease-in-out infinite;
  color: var(--accent);
}

.empty-state-icon svg {
  width: 38px;
  height: 38px;
}

.empty-state h3 {
  font-size: 1.3rem;
  font-weight: 850;
  color: var(--ink);
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.empty-state p {
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 340px;
  line-height: 1.5;
  margin-bottom: 24px;
}

.empty-action-btn {
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  padding: 12px 28px;
  border-radius: var(--radius-btn);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.empty-action-btn:hover {
  opacity: 0.95;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.empty-action-btn:active {
  transform: translateY(0);
}

/* AI Chatbot Styles */
.ai-chat-trigger {
  position: fixed;
  bottom: 80px;
  left: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  z-index: 10000;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
  backdrop-filter: blur(10px);
}

.ai-chat-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 32px rgba(245, 158, 11, 0.25);
}

.ai-chat-trigger:active {
  cursor: grabbing;
}

.ai-chat-trigger .ai-icon {
  width: 28px;
  height: 28px;
  color: var(--accent);
  transition: transform 0.3s;
}

.ai-chat-trigger:hover .ai-icon {
  transform: rotate(15deg);
}

.ai-chat-trigger .ai-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #22c55e;
  color: #fff;
  font-size: 8px;
  font-weight: 900;
  padding: 3px 6px;
  border-radius: 10px;
  border: 2px solid var(--bg);
  box-shadow: 0 2px 6px rgba(34, 197, 94, 0.4);
  line-height: 1;
  letter-spacing: 0.5px;
  animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

.ai-chat-window {
  position: fixed;
  bottom: 150px;
  left: 20px;
  width: 350px;
  height: 480px;
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10001;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  backdrop-filter: blur(20px);
}

.ai-chat-window.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.ai-chat-header {
  background: var(--bg);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  cursor: move;
  user-select: none;
}

.ai-chat-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--ink);
}

.ai-chat-header-title svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.ai-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-chat-hdr-btn {
  background: none;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}

.ai-chat-hdr-btn:hover {
  background: var(--line);
  color: var(--ink);
}

.ai-chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(249, 250, 251, 0.5);
}

.ai-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.45;
  word-wrap: break-word;
  animation: msgFadeIn 0.25s ease-out forwards;
}

@keyframes msgFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-msg.user {
  background: var(--ink);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.ai-msg.assistant {
  background: #fff;
  color: var(--ink);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--line);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.ai-msg.assistant p {
  margin: 0 0 8px 0;
}
.ai-msg.assistant p:last-child {
  margin-bottom: 0;
}

.ai-msg.assistant ol, .ai-msg.assistant ul {
  margin: 6px 0;
  padding-left: 20px;
}

.ai-msg.assistant li {
  margin-bottom: 4px;
}

.ai-msg.assistant strong {
  color: var(--accent);
}

.ai-chat-context-box {
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.78rem;
  color: #92400e;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ai-chat-context-btn {
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}

.ai-chat-context-btn:hover {
  opacity: 0.9;
}

.ai-chat-typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}

.ai-chat-typing span {
  width: 6px;
  height: 6px;
  background: var(--muted);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite both;
}

.ai-chat-typing span:nth-child(2) {
  animation-delay: .2s;
}

.ai-chat-typing span:nth-child(3) {
  animation-delay: .4s;
}

@keyframes typingBounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.ai-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding: 8px 16px;
  background: rgba(249, 250, 251, 0.7);
  border-top: 1px dashed var(--line);
}

.ai-suggest-btn {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px 12px;
  font-size: 0.75rem;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 700;
}

.ai-suggest-btn:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.ai-chat-input-area {
  padding: 12px 16px;
  background: var(--bg);
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  align-items: center;
}

.ai-chat-textarea {
  flex: 1;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-btn);
  padding: 8px 12px;
  font-size: 0.85rem;
  resize: none;
  height: 36px;
  line-height: 1.4;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
  background: #fff;
}

.ai-chat-textarea:focus {
  border-color: var(--accent);
}

.ai-chat-send-btn {
  background: var(--ink);
  color: #fff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.ai-chat-send-btn:hover {
  background: var(--accent);
  transform: scale(1.05);
}

.ai-chat-send-btn svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 480px) {
  .ai-chat-window {
    width: calc(100vw - 32px);
    height: 400px;
    left: 16px !important;
    bottom: 90px !important;
  }
}

/* Coupon Styles */
.coupon-section {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.coupon-section:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.coupon-input-group input {
  transition: all 0.2s ease;
}
.coupon-input-group input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-opacity) !important;
  outline: none;
}
.coupon-input-group button {
  transition: all 0.2s ease;
}
.coupon-input-group button:hover {
  transform: translateY(-1px);
}



