/* ==========================================================================
   LỊCH SỬ STUDIO V15 — LỚP TINH GỌN CUỐI CÙNG
   Nạp SAU v7.css và v14.css. Mục tiêu: ít hiệu ứng, ít bóng đổ, mật độ thông tin
   dễ đọc, một hệ màu thống nhất; thêm style cho Tiện ích (trò chơi, đồng hồ) và AI.
   ========================================================================== */

:root {
  --mt-radius: 12px;
  --mt-ok: var(--ex-good, #13734C);
  --mt-ok-soft: var(--ex-good-soft, rgba(19, 115, 76, 0.10));
  --mt-bad: var(--ex-bad, #B42318);
  --mt-bad-soft: var(--ex-bad-soft, rgba(180, 35, 24, 0.09));
}

/* ---------- Tinh giản chung: bớt nhiễu thị giác ---------- */
html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

.card { box-shadow: var(--shadow-xs); }
.card:hover { box-shadow: var(--shadow-sm); }

/* Tắt các hiệu ứng nghiêng/nhịp 3D liên tục gây rối mắt (vẫn giữ chuyển động khi tương tác). */
.v13-stage-in { animation-duration: 0.2s !important; }
.v15-kw-highlight.pulse { animation: none !important; }
[data-tilt-stage] { transform: none !important; }

@media (prefers-reduced-motion: reduce) {
  *:not(.bc3d-card):not(.boardcard-inner):not(.mt-flip-inner):not(.v25-time-pill),
  *:not(.bc3d-card):not(.boardcard-inner):not(.mt-flip-inner)::before,
  *:not(.bc3d-card):not(.boardcard-inner):not(.mt-flip-inner)::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

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

/* Nút gọn và đều nhau hơn */
.btn { letter-spacing: -0.005em; }
.badge { font-weight: 700; }

/* ---------- AI dock ---------- */
.v19-ai-status-dot.offline {
  background: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
}
.ai-msg .ai-list {
  margin: 0.25rem 0 0.35rem;
  padding-left: 1.15rem;
}
.ai-msg .ai-list li { margin: 0.12rem 0; }
.ai-msg .ai-h {
  font-weight: 800;
  margin: 0.45rem 0 0.15rem;
}
.ai-msg .ai-gap { height: 0.4rem; }
.ai-msg code {
  font-size: 0.86em;
  padding: 0.05rem 0.3rem;
  border-radius: 5px;
  background: rgba(127, 127, 127, 0.18);
}
.ai-msg pre.ai-code {
  margin: 0.4rem 0;
  padding: 0.6rem 0.7rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  overflow-x: auto;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre;
}
.ai-msg pre.ai-code code { background: none; padding: 0; }

/* ---------- Tiện ích (Đa nhiệm) ---------- */
.mt-shell { background: var(--bg); }
.mt-topbar { gap: 0.6rem; }
.mt-topbar-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.mt-topbar-title strong { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-tabs { align-self: center; }
.mt-body { max-width: 1040px; }

.mt-muted { font-size: 0.8rem; color: var(--ink-muted); }
.mt-row-between { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.mt-row-center { display: flex; justify-content: center; align-items: center; gap: 0.5rem; margin-top: 0.75rem; }

.mt-game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.9rem;
}
.mt-game-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--mt-radius);
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.mt-game-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.mt-game-card img { width: 100%; height: 110px; object-fit: cover; filter: saturate(0.85); }
.mt-game-card-body { padding: 0.75rem 0.9rem 0.9rem; display: flex; flex-direction: column; gap: 0.25rem; }
.mt-game-card-title { font-weight: 800; font-size: 0.95rem; display: flex; gap: 0.4rem; align-items: center; }

.mt-play {
  max-width: 680px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--mt-radius);
  padding: 1.1rem 1.2rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.mt-play-wide { max-width: 920px; }

.mt-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.mt-progress span { display: block; height: 100%; background: var(--accent); transition: width 0.25s ease; }

.mt-hero-img { width: 100%; max-height: 190px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.mt-question { font-size: 1.08rem; font-weight: 800; line-height: 1.45; }
.mt-statement { font-size: 1.15rem; padding: 0.5rem 0; }

.mt-options { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }
.mt-options-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .mt-options { grid-template-columns: 1fr; } }

.mt-option {
  font: inherit;
  font-weight: 600;
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.mt-option:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.mt-option:disabled { cursor: default; }
.mt-option.is-correct { border-color: var(--mt-ok); background: var(--mt-ok-soft); color: var(--mt-ok); }
.mt-option.is-wrong { border-color: var(--mt-bad); background: var(--mt-bad-soft); color: var(--mt-bad); }
.mt-option.is-dim { opacity: 0.55; }

.mt-feedback {
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
}
.mt-feedback.ok { background: var(--mt-ok-soft); color: var(--mt-ok); }
.mt-feedback.bad { background: var(--mt-bad-soft); color: var(--mt-bad); }

.mt-result {
  text-align: center;
  padding: 1.4rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-width: 520px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--mt-radius);
}
.mt-result-title { font-size: 1.2rem; font-weight: 800; }
.mt-result-line { font-size: 0.98rem; }

/* Lật thẻ */
.mt-flip-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}
@media (max-width: 640px) { .mt-flip-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.mt-flip {
  aspect-ratio: 4 / 3;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  perspective: 800px;
  font: inherit;
}
.mt-flip-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transition: transform 0.35s ease;
  transform-style: preserve-3d;
}
.mt-flip.flipped .mt-flip-inner { transform: rotateY(180deg); }
.mt-flip-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.45rem;
  border-radius: 10px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  font-weight: 700;
  font-size: 0.86rem;
  line-height: 1.3;
}
.mt-flip-front {
  background: var(--accent);
  color: #fff;
  font-size: 1.5rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.mt-flip-back {
  transform: rotateY(180deg);
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  color: var(--ink);
}
.mt-flip-back.date { color: var(--accent); font-size: 1rem; font-variant-numeric: tabular-nums; }
.mt-flip.matched .mt-flip-back { border-color: var(--mt-ok); background: var(--mt-ok-soft); }

/* Xếp niên đại */
.mt-tower-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: stretch; }
@media (max-width: 720px) { .mt-tower-layout { grid-template-columns: 1fr; } }
.mt-tower-choices { display: flex; flex-direction: column; gap: 0.45rem; }
.mt-tower-btn { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.mt-year { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--ink-faint); }
.mt-option.is-correct .mt-year { color: inherit; }
.mt-tower-stage {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  min-height: 280px;
  padding: 0.75rem;
  border-radius: 10px;
  background: var(--surface-2);
}
.mt-tower-top { font-weight: 800; color: var(--mt-ok); margin-bottom: 0.4rem; }
.mt-tower-stack { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mt-tier {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 0.78rem;
}
.mt-tier.is-new { animation: mtDrop 0.25s ease-out; }
.mt-tier span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes mtDrop { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
.mt-tower-base { width: 100%; height: 8px; margin-top: 4px; border-radius: 4px; background: var(--border-strong); }

/* Ảnh tư liệu */
.mt-photo-frame {
  border-radius: 10px;
  overflow: hidden;
  background: #111;
  display: flex;
  justify-content: center;
  border: 1px solid var(--border);
}
.mt-photo-frame img { max-height: 280px; width: auto; max-width: 100%; object-fit: contain; }

/* Gợi ý */
.mt-clues { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 0.35rem; }
.mt-clues li { color: var(--ink-faint); font-style: italic; }
.mt-clues li.open { color: var(--ink); font-style: normal; font-weight: 600; }

/* Đồng hồ */
.mt-clock-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
@media (max-width: 760px) { .mt-clock-layout { grid-template-columns: 1fr; } }
.clock-widget-card.studio-variant { padding: 1rem 1.1rem; }
.clock-widget-card.studio-variant .clock-stage { min-height: 200px; }
.mt-timer-card {
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  text-align: center;
}
.mt-timer-big {
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  letter-spacing: 0.01em;
  line-height: 1.1;
}

/* Ghi chú & danh sách */
.mt-note-form { display: grid; grid-template-columns: 1fr 2fr 110px auto; gap: 0.5rem; }
@media (max-width: 640px) { .mt-note-form { grid-template-columns: 1fr; } }
.mt-notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; }
.mt-note {
  color: #18181b;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  font-size: 0.86rem;
  line-height: 1.5;
  border: 1px solid rgba(0, 0, 0, 0.06);
  word-break: break-word;
}
.mt-pinned { padding: 0.9rem 1rem; margin-bottom: 1rem; border-left: 3px solid var(--accent); }
.mt-pinned-body { margin-top: 0.5rem; font-size: 0.84rem; line-height: 1.55; max-height: 260px; overflow: auto; display: flex; flex-direction: column; gap: 0.2rem; }
.mt-list { display: flex; flex-direction: column; gap: 0.45rem; max-height: 340px; overflow: auto; }
.mt-list-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 0.84rem;
}

/* Gemini admin card */
.v15-gemini-card code { font-size: 0.82em; }

/* Không phát lại hiệu ứng mở mỗi lần render lại (trước đây gây nháy mờ khi bấm trong trò chơi) */
.v18-mini-fullscreen.mt-shell { animation: none; }
.clock-widget-foot[hidden] { display: none !important; }
.clock-widget-card.studio-variant .clock-stage {
  display: flex;
  align-items: center;
  justify-content: center;
}
.clock-widget-card.studio-variant .clock-4d-orbit,
.clock-widget-card.studio-variant .clock-flip-grid,
.clock-widget-card.studio-variant .clock-analog-wrap,
.clock-widget-card.studio-variant .clock-ring-wrap {
  transform: scale(1.35);
  transform-origin: center;
  margin: 1.4rem 0;
}

/* ---------- Thẻ Vấn đề: công cụ Admin chỉ hiện khi rê chuột (thiết bị có chuột) ---------- */
.topic-admin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.3rem;
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px dashed var(--border);
}
@media (hover: hover) and (pointer: fine) {
  .topic-card .topic-admin-actions,
  .topic-card .v17-admin-img-btn {
    opacity: 0;
    transition: opacity 0.15s ease;
  }
  .topic-card:hover .topic-admin-actions,
  .topic-card:hover .v17-admin-img-btn,
  .topic-card:focus-within .topic-admin-actions,
  .topic-card:focus-within .v17-admin-img-btn {
    opacity: 1;
  }
}

/* Ảnh thẻ đồng bộ tông, bớt tương phản gắt */
.topic-card .topic-thumb-wrap img { filter: saturate(0.9) contrast(0.97); }
.card-interactive:hover { transform: translateY(-2px); }

/* Hero/thanh tiêu đề: nền phẳng thay cho ảnh mờ chồng lớp */
.v15-clean-hero { background-image: none !important; }

/* ==========================================================================
   V16 — TRỢ LÝ AI KIỂU GEMINI
   ========================================================================== */
:root {
  --gx-bg: #ffffff;
  --gx-bg-2: #f0f4f9;
  --gx-ink: #1f1f1f;
  --gx-muted: #5f6368;
  --gx-line: #e3e3e3;
  --gx-user: #e9eef6;
  --gx-accent: #0b57d0;
  --gx-grad: linear-gradient(74deg, #4285f4 0%, #9b72cb 45%, #d96570 75%);
}
[data-theme="dark"] {
  --gx-bg: #131314;
  --gx-bg-2: #1e1f20;
  --gx-ink: #e3e3e3;
  --gx-muted: #a8abb0;
  --gx-line: #2f3134;
  --gx-user: #282a2c;
  --gx-accent: #a8c7fa;
}

.gx-fab {
  background: var(--gx-bg) !important;
  border: 1px solid var(--gx-line) !important;
  color: var(--gx-ink);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14) !important;
}
.gx-fab::after { display: none !important; }

.gx-panel {
  position: relative;
  width: min(440px, calc(100vw - 24px));
  height: min(680px, calc(100vh - 110px));
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  background: var(--gx-bg);
  color: var(--gx-ink);
  border: 1px solid var(--gx-line);
  border-radius: 24px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.gx-panel.expanded {
  position: fixed;
  inset: 16px;
  width: auto;
  height: auto;
  margin: 0 auto;
  max-width: 960px;
  z-index: 1300;
}
@keyframes gxIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) {
  .gx-panel:not(.expanded) { height: min(620px, calc(100vh - 150px)); }
}

.gx-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 10px 14px;
  flex-shrink: 0;
}
.gx-head-left, .gx-head-right { display: flex; align-items: center; gap: 4px; }
.gx-logo { display: inline-flex; }
.gx-model-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: var(--gx-ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.gx-model-btn:hover { background: var(--gx-bg-2); }
.gx-caret { font-size: 0.7rem; color: var(--gx-muted); }
.gx-dot { width: 8px; height: 8px; border-radius: 50%; background: #1e8e3e; }
.gx-dot.off { background: #f29900; }

.gx-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--gx-muted);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.gx-icon:hover, .gx-icon.on { background: var(--gx-bg-2); color: var(--gx-ink); }
.gx-icon.sm { width: 30px; height: 30px; }
.gx-icon.ok { color: #1e8e3e; }
.gx-icon.rec { color: #d93025; background: rgba(217, 48, 37, 0.1); }

.gx-menu {
  position: absolute;
  z-index: 5;
  background: var(--gx-bg);
  border: 1px solid var(--gx-line);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  padding: 6px;
  max-height: 60vh;
  overflow: auto;
}
.gx-model-menu { top: 52px; left: 10px; width: min(330px, calc(100% - 20px)); }
.gx-tools-menu { bottom: calc(100% + 6px); left: 12px; right: 12px; }
.gx-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--gx-ink);
  text-align: left;
  font: inherit;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
}
.gx-menu-item:hover { background: var(--gx-bg-2); }
.gx-menu-item.active { background: var(--gx-user); }
.gx-menu-item strong { display: block; font-size: 0.88rem; font-weight: 600; }
.gx-menu-item small { display: block; font-size: 0.74rem; color: var(--gx-muted); line-height: 1.35; }
.gx-menu-item > span:not(.gx-tool-ico):not(.gx-check) { flex: 1; min-width: 0; }
.gx-tool-ico { width: 26px; text-align: center; font-size: 1.05rem; flex-shrink: 0; }
.gx-check { color: var(--gx-accent); font-weight: 700; }
.gx-menu-sep { font-size: 0.72rem; color: var(--gx-muted); padding: 8px 10px 4px; }
.gx-seg { display: flex; gap: 4px; padding: 0 6px 6px; }
.gx-seg button {
  flex: 1;
  border: 1px solid var(--gx-line);
  background: transparent;
  color: var(--gx-ink);
  border-radius: 999px;
  padding: 5px 0;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.gx-seg button.active { background: var(--gx-user); border-color: transparent; font-weight: 600; }
.gx-menu-foot { font-size: 0.7rem; color: var(--gx-muted); padding: 6px 10px 4px; border-top: 1px solid var(--gx-line); }

.gx-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px 16px 12px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}
.gx-panel.expanded .gx-scroll { padding: 12px max(16px, calc((100% - 760px) / 2)); }

.gx-empty { padding: 28px 4px 8px; }
.gx-hello {
  font-size: 1.9rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 4px;
  background: var(--gx-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.gx-sub { color: var(--gx-muted); font-size: 1rem; margin: 0 0 18px; }
.gx-suggest { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 420px) { .gx-suggest { grid-template-columns: 1fr; } }
.gx-chip {
  text-align: left;
  border: none;
  background: var(--gx-bg-2);
  color: var(--gx-ink);
  border-radius: 14px;
  padding: 12px;
  font: inherit;
  font-size: 0.84rem;
  line-height: 1.4;
  cursor: pointer;
  min-height: 64px;
  transition: background 0.12s ease;
}
.gx-chip:hover { background: var(--gx-user); }
.gx-warn { margin-top: 14px; font-size: 0.8rem; color: #b06000; background: rgba(242, 153, 0, 0.1); padding: 8px 12px; border-radius: 10px; }

.gx-msg { display: flex; margin: 14px 0; }
.gx-msg.user { justify-content: flex-end; }
.gx-bubble {
  max-width: 82%;
  background: var(--gx-user);
  color: var(--gx-ink);
  padding: 10px 16px;
  border-radius: 20px 20px 6px 20px;
  font-size: 0.93rem;
  line-height: 1.55;
  white-space: normal;
  word-break: break-word;
}
.gx-msg.bot { gap: 10px; align-items: flex-start; }
.gx-avatar {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #4285f4;
  margin-top: 1px;
}
.gx-content { flex: 1; min-width: 0; }
.gx-body { font-size: 0.94rem; line-height: 1.68; word-break: break-word; }
.gx-body .ai-list { margin: 4px 0 8px; padding-left: 1.25rem; }
.gx-body .ai-list li { margin: 3px 0; }
.gx-body .ai-h { font-weight: 700; margin: 12px 0 4px; font-size: 1rem; }
.gx-body .ai-gap { height: 8px; }
.gx-body code { background: var(--gx-bg-2); padding: 1px 5px; border-radius: 5px; font-size: 0.86em; }
.gx-body pre.ai-code { background: var(--gx-bg-2); color: var(--gx-ink); border-radius: 12px; padding: 12px; overflow-x: auto; font-size: 0.8rem; }
.gx-body em { color: var(--gx-muted); }
.gx-msg.err .gx-body { color: #d93025; }
.gx-img { max-width: 100%; border-radius: 12px; margin-top: 8px; cursor: zoom-in; }
.gx-caret-blink {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: text-bottom;
  border-radius: 2px;
  background: var(--gx-grad);
  animation: gxBlink 1s steps(2, start) infinite;
}
@keyframes gxBlink { to { visibility: hidden; } }
.gx-thinking { display: flex; align-items: center; gap: 5px; color: var(--gx-muted); font-size: 0.85rem; }
.gx-thinking span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gx-grad);
  animation: gxPulse 1.2s ease-in-out infinite;
}
.gx-thinking span:nth-child(2) { animation-delay: 0.15s; }
.gx-thinking span:nth-child(3) { animation-delay: 0.3s; }
.gx-thinking em { margin-left: 6px; font-style: normal; }
@keyframes gxPulse { 0%, 100% { opacity: 0.25; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1); } }

.gx-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.gx-src {
  border: 1px solid var(--gx-line);
  background: transparent;
  color: var(--gx-ink);
  border-radius: 999px;
  padding: 3px 10px;
  font: inherit;
  font-size: 0.74rem;
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gx-src:hover { background: var(--gx-bg-2); }
.gx-tools { display: inline-flex; align-items: center; gap: 2px; }
.gx-model-tag { font-size: 0.7rem; color: var(--gx-muted); margin-left: 4px; }

.gx-composer-wrap { position: relative; padding: 4px 12px 8px; flex-shrink: 0; }
.gx-panel.expanded .gx-composer-wrap { padding: 4px max(12px, calc((100% - 760px) / 2)) 10px; }
.gx-composer {
  background: var(--gx-bg-2);
  border-radius: 24px;
  padding: 10px 10px 6px 16px;
  border: 1px solid transparent;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.gx-composer:focus-within { border-color: var(--gx-line); background: var(--gx-bg); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06); }
.gx-input {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--gx-ink);
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  max-height: 180px;
  min-height: 24px;
  padding: 2px 0;
}
.gx-input::placeholder { color: var(--gx-muted); }
.gx-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.gx-actions-left, .gx-actions-right { display: flex; align-items: center; gap: 4px; }
.gx-lv { font-size: 0.74rem; color: var(--gx-muted); }
.gx-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gx-accent);
  color: var(--gx-bg);
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.12s ease;
}
.gx-send:active { transform: scale(0.94); }
.gx-send.stop { background: var(--gx-ink); }
.gx-mode-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  background: var(--gx-user);
  border-radius: 999px;
  padding: 3px 4px 3px 10px;
  margin-bottom: 6px;
}
.gx-mode-tag button { border: none; background: transparent; color: var(--gx-muted); cursor: pointer; padding: 0 6px; }
.gx-disclaimer { text-align: center; font-size: 0.68rem; color: var(--gx-muted); margin-top: 6px; }
.gx-teach { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; padding: 10px; border-radius: 16px; background: var(--gx-bg-2); }
.gx-row-end { display: flex; justify-content: flex-end; gap: 6px; }
#ai-dock-live-citations:empty { display: none; }
#ai-dock-live-citations { padding: 0 14px; }

/* ==========================================================================
   V16 — THÔNG BÁO ĐỔI QUYỀN TÀI KHOẢN
   ========================================================================== */
.acct-notice-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(15, 17, 21, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: gxIn 0.2s ease-out;
}
.acct-notice {
  width: min(420px, 100%);
  background: var(--surface);
  color: var(--ink);
  border-radius: 20px;
  padding: 26px 24px 20px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.acct-notice h2 { font-size: 1.15rem; margin: 4px 0 0; }
.acct-notice p { margin: 0 0 8px; color: var(--ink-muted); font-size: 0.9rem; line-height: 1.55; }
.acct-notice-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
}
.acct-notice.ok .acct-notice-icon { background: linear-gradient(135deg, #1e8e3e, #34a853); }
.acct-notice.warn .acct-notice-icon { background: linear-gradient(135deg, #b06000, #f29900); }
.acct-notice .btn-primary { min-width: 200px; }

/* ==========================================================================
   V16 — CODE STUDIO
   ========================================================================== */
.cs-card { padding: 0.9rem 1rem; }
.cs-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.cs-file-title { display: flex; align-items: baseline; gap: 0.6rem; min-width: 0; }
.cs-file-title strong { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-actions, .cs-row-end { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.cs-row-between { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.cs-banner { padding: 0.45rem 0.75rem; border-radius: 10px; font-size: 0.82rem; margin-bottom: 0.55rem; white-space: pre-wrap; word-break: break-word; }
.cs-banner.ok { background: var(--mt-ok-soft); color: var(--mt-ok); }
.cs-banner.bad { background: var(--mt-bad-soft); color: var(--mt-bad); }
.cs-banner.info { background: var(--surface-2); color: var(--ink-muted); }
.cs-grid { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 0.75rem; }
@media (max-width: 820px) { .cs-grid { grid-template-columns: 1fr; } .cs-file-list { max-height: 220px; } }
.cs-side { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.cs-filter { font-size: 0.8rem; padding: 0.35rem 0.6rem; }
.cs-file-list { max-height: 640px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: 0.3rem; }
.cs-dir { font-size: 0.68rem; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; padding: 0.45rem 0.4rem 0.15rem; }
.cs-file {
  display: flex; justify-content: space-between; align-items: center; gap: 0.4rem; width: 100%;
  border: none; background: transparent; color: var(--ink); text-align: left; cursor: pointer;
  font: inherit; font-size: 0.8rem; padding: 0.28rem 0.5rem; border-radius: 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.cs-file small { color: var(--ink-faint); font-size: 0.68rem; }
.cs-file:hover { background: var(--surface-2); }
.cs-file.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.cs-main { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.cs-ai-bar { display: flex; gap: 0.4rem; }
.cs-ai-bar .input { flex: 1; font-size: 0.82rem; }
.cs-editor {
  width: 100%; min-height: 560px; resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8rem; line-height: 1.55;
  tab-size: 2; padding: 0.75rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--ink); white-space: pre; overflow: auto;
}
.cs-editor:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.cs-empty { padding: 3rem 1rem; text-align: center; border: 1px dashed var(--border); border-radius: 10px; }
.cs-ai-result { border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 0.75rem; display: flex; flex-direction: column; gap: 0.45rem; font-size: 0.84rem; }
.cs-diff { max-height: 360px; overflow: auto; border-radius: 8px; background: var(--surface-2); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.74rem; line-height: 1.5; padding: 0.4rem 0; }
.cs-dl { padding: 0 0.6rem; white-space: pre; }
.cs-dl.add { background: rgba(30, 142, 62, 0.14); color: var(--mt-ok); }
.cs-dl.del { background: rgba(217, 48, 37, 0.12); color: var(--mt-bad); }
.cs-dl.at { color: #1a73e8; }
.cs-dl.h { color: var(--ink-faint); }
.cs-upload, .cs-backups { border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 0.75rem; margin-bottom: 0.6rem; display: flex; flex-direction: column; gap: 0.45rem; font-size: 0.84rem; }
.cs-backup-row { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.3rem 0; border-top: 1px solid var(--border); }
.gx-key-table td { vertical-align: top; font-size: 0.8rem; }
.gx-task-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.gx-task-chips .ex-chip { font-size: 0.7rem; padding: 0.15rem 0.5rem; min-height: 0; }
.gx-task-row { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 0.5rem; font-size: 0.82rem; }
.gx-ok { color: var(--mt-ok); font-size: 0.76rem; font-weight: 600; }
.gx-bad { color: var(--mt-bad); font-size: 0.76rem; }
.adm-tabbar { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.adm-tabs { flex-wrap: wrap; }
.adm-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #d93025; color: #fff; font-size: 0.68rem; margin-left: 4px; }
.adm-online { margin-bottom: 0.75rem; padding: 0.6rem 0.8rem; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
/* Điện thoại: khung chat chiếm toàn màn hình như ứng dụng Gemini */
@media (max-width: 640px) {
  #ai-dock:has(.gx-panel) { z-index: 1400; }
  .gx-panel:not(.expanded), .gx-panel.expanded {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    border-radius: 0;
    border: none;
    z-index: 1400;
  }
  #ai-dock:has(.gx-panel) .gx-fab { display: none; }
  .gx-hello { font-size: 1.6rem; }
}

/* Hàng tiến trình 1 dòng (bấm để xem các bước) */
.gx-task-wrap { margin: 0 0 6px; }
.gx-task {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  border: none;
  background: transparent;
  color: var(--gx-muted);
  font: inherit;
  font-size: 0.82rem;
  padding: 4px 8px 4px 2px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}
.gx-task:hover { background: var(--gx-bg-2); color: var(--gx-ink); }
.gx-task-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; color: var(--gx-ink); }
.gx-task.done .gx-task-label { color: var(--gx-muted); }
.gx-task-time { white-space: nowrap; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.gx-task-eta { white-space: nowrap; flex-shrink: 0; font-size: 0.74rem; padding: 1px 7px; border-radius: 999px; background: var(--gx-bg-2); }
.gx-chev { flex-shrink: 0; transition: transform 0.15s ease; font-size: 1rem; line-height: 1; }
.gx-chev.open { transform: rotate(90deg); }
.gx-spin {
  width: 12px; height: 12px; flex-shrink: 0; border-radius: 50%;
  border: 2px solid rgba(217, 101, 112, 0.25); border-top-color: #d96570;
  animation: gxSpin 0.8s linear infinite;
}
@keyframes gxSpin { to { transform: rotate(360deg); } }
.gx-done-dot { width: 8px; height: 8px; border-radius: 50%; background: #1e8e3e; flex-shrink: 0; margin: 0 2px; }
.gx-steps {
  list-style: none;
  margin: 4px 0 8px 6px;
  padding: 2px 0 2px 12px;
  border-left: 2px solid var(--gx-line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--gx-muted);
}
.gx-step-t { display: inline-block; min-width: 42px; font-variant-numeric: tabular-nums; color: var(--gx-muted); opacity: 0.8; }

/* Danh sách API key */
.gk-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.gk-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr) auto; gap: 0.6rem; align-items: center; padding: 0.55rem 0.75rem; border-top: 1px solid var(--border); font-size: 0.84rem; }
.gk-row:first-child { border-top: none; }
.gk-row.bad { background: var(--mt-bad-soft); }
.gk-key code { font-size: 0.78rem; }
.gk-actions { display: flex; gap: 0.3rem; }
.gk-running { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.gk-replace { grid-column: 1 / -1; display: flex; gap: 0.4rem; }
.gk-replace .input { flex: 1; }
.gk-model { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; font-weight: 600; }
.gk-model .select { max-width: 340px; }
.gk-add summary { cursor: pointer; font-size: 0.82rem; color: var(--ink-muted); }
@media (max-width: 720px) { .gk-row { grid-template-columns: 1fr; } }


/* ==========================================================================
   V16.2 — TINH GỌN HỌC LIỆU CHIẾU THẲNG KIẾN THỨC NỀN RA GIỮA (ẢNH 1)
   ========================================================================== */
.v16-study-center-wrap {
  max-width: 880px;
  margin: 0 auto 2rem;
  width: 100%;
}
.v16-study-doc-switcher {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.v16-study-center-card {
  padding: 1.5rem 1.85rem;
  border-top: 4px solid var(--accent);
  border-radius: 16px;
}
@media (max-width: 640px) {
  .v16-study-center-card { padding: 1.1rem 1rem; }
}
.v16-study-doc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-bottom: 0.9rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--border);
}
.v16-study-doc-title {
  font-size: 1.38rem;
  line-height: 1.32;
  margin: 0;
  color: var(--ink);
}
.v16-study-sections {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}
.v16-study-sec-block {
  padding: 0.95rem 1.15rem;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.v16-study-sec-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent);
  margin: 0 0 0.55rem;
  line-height: 1.4;
}
.v16-study-subsec {
  margin-top: 0.7rem;
  padding-left: 0.85rem;
  border-left: 3px solid var(--accent);
}
.v16-study-subsec-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 0.35rem;
}
.v16-study-minor-block {
  margin-top: 0.45rem;
  padding-left: 0.75rem;
  border-left: 2px dashed var(--border-strong);
}
.v16-study-minor-title {
  font-size: 0.88rem;
  color: var(--gold);
  display: block;
  margin-bottom: 0.2rem;
}
.v16-study-prose {
  font-size: 0.96rem;
  line-height: 1.72;
  color: var(--ink);
}
.v16-study-prose p {
  margin: 0 0 0.55rem;
  text-align: justify;
}
.v16-study-prose p:last-child { margin-bottom: 0; }

/* ==========================================================================
   V16.2 — PILL ÂM THANH & PILL HIỂN THỊ THỜI LƯỢNG KHI TUA GIỌNG ĐỌC (ẢNH 2)
   ========================================================================== */
.v25-tts-dock-wrap {
  position: fixed;
  bottom: 22px;
  left: 22px;
  z-index: 1250;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.v25-tts-dock-wrap .v25-audio-pill-dock {
  position: static !important;
  margin: 0 !important;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 14px 0 6px;
  border-radius: 999px;
  background: rgba(28, 30, 36, 0.94);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
}
.v25-playpause-mini {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.v25-playpause-mini:hover { background: rgba(255, 255, 255, 0.26); }
.v25-time-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  background: rgba(24, 26, 31, 0.95);
  color: #ffffff;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 1.02rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translateX(-8px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  white-space: nowrap;
}
.v25-time-pill.visible {
  opacity: 1;
  transform: translateX(0) scale(1);
}

/* ==========================================================================
   V16.2 — PHÒNG ÔN THI TINH GỌN (ẢNH 3) & BOARDCARD 3D LẬT 180 ĐỘ THẬT
   ========================================================================== */
.v16-exam-filter-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border);
}
.v16-exam-control-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 0.7rem;
  padding: 0.6rem 0.85rem;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.v16-exam-clock-group {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.v16-exam-preset-col {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}
.v16-exam-action-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* Hiệu ứng Lật 3D 180 độ mượt mà cho Boardcard 3D */
.bc3d-stage {
  perspective: 1400px !important;
  -webkit-perspective: 1400px !important;
  cursor: pointer;
  user-select: none;
  margin: 0.6rem 0 0.85rem;
}
.bc3d-card {
  position: relative;
  width: 100%;
  min-height: 300px;
  transform-style: preserve-3d !important;
  -webkit-transform-style: preserve-3d !important;
  transition: transform 0.62s cubic-bezier(0.22, 1, 0.36, 1) !important;
  will-change: transform;
}
.bc3d-card.is-flipped {
  transform: rotateY(180deg) !important;
  -webkit-transform: rotateY(180deg) !important;
}
.bc3d-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden !important;
  -webkit-backface-visibility: hidden !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.15rem 1.35rem;
  border-radius: 16px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.bc3d-front {
  transform: rotateY(0deg) translateZ(1px);
  z-index: 2;
}
.bc3d-back {
  transform: rotateY(180deg) translateZ(1px) !important;
  -webkit-transform: rotateY(180deg) translateZ(1px) !important;
  background: var(--surface-2);
  border-color: var(--accent);
}
.bc3d-side-tag {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.bc3d-q-hint {
  margin: 0.45rem 0 0;
  font-size: 0.84rem;
  color: var(--ink-muted);
}
.bc3d-back-scroll {
  overflow-y: auto;
  max-height: 195px;
  padding-right: 4px;
}
.bc3d-back-overview {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.52;
  margin: 0 0 0.45rem;
  color: var(--ink);
}
.bc3d-back-note {
  margin-top: 0.5rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  background: var(--accent-soft);
  font-size: 0.82rem;
}
.bc3d-flip-cue {
  font-weight: 700;
  color: var(--accent);
}

/* ==========================================================================
   V16.2 — THANH LƯU TRỮ CUỘC TRÒ CHUYỆN CŨ TRONG AI DOCK (NÚT + VÀ -)
   ========================================================================== */
.gx-body-split {
  flex: 1;
  min-height: 0;
  display: flex;
  position: relative;
  overflow: hidden;
}
.gx-history-sidebar {
  width: 235px;
  max-width: 78%;
  border-right: 1px solid var(--gx-line);
  background: var(--gx-bg-2);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 3;
  animation: gxIn 0.16s ease-out;
}
.gx-panel:not(.expanded) .gx-history-sidebar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 255px;
  box-shadow: 8px 0 24px rgba(0, 0, 0, 0.16);
}
.gx-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--gx-line);
  font-size: 0.82rem;
}
.gx-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gx-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.gx-history-item:hover { background: var(--gx-user); }
.gx-history-item.active {
  background: var(--gx-user);
  border-left: 3px solid var(--gx-accent);
}
.gx-history-item-main { min-width: 0; flex: 1; }
.gx-history-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gx-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gx-history-meta {
  font-size: 0.7rem;
  color: var(--gx-muted);
  margin-top: 2px;
}
.gx-history-del {
  border: none;
  background: transparent;
  color: var(--gx-muted);
  font-size: 0.75rem;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
}
.gx-history-del:hover {
  background: rgba(217, 48, 37, 0.12);
  color: #d93025;
}

/* ==========================================================================
   V16.2 — BẢNG THỜI KHÓA BIỂU ĐẠI HỌC TIẾT 1–10 × THỨ 2–CHỦ NHẬT (CHUẨN ẢNH 4)
   ========================================================================== */
.tkb-workspace {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.tkb-top-banner {
  padding: 0.8rem 1rem;
  border-left: 4px solid #335c85;
}
.tkb-status-note {
  margin-top: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  background: var(--mt-ok-soft);
  color: var(--mt-ok);
  font-size: 0.82rem;
  font-weight: 600;
}
.tkb-scan-box, .tkb-editor-modal {
  margin-top: 0.65rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.tkb-editor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}
@media (max-width: 680px) {
  .tkb-editor-grid { grid-template-columns: 1fr; }
}
.tkb-editor-grid label {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink-muted);
  margin-bottom: 0.2rem;
}
.tkb-sheet-card {
  padding: 0.75rem;
  background: #ffffff;
  color: #111827;
  border: 1px solid #9ca3af;
}
[data-theme="dark"] .tkb-sheet-card {
  background: #181a20;
  color: #f3f4f6;
  border-color: #374151;
}
.tkb-table-wrap {
  width: 100%;
  overflow-x: auto;
}
.tkb-grid-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: Tahoma, Arial, "Be Vietnam Pro", sans-serif;
  font-size: 0.82rem;
}
.tkb-grid-table th,
.tkb-grid-table td {
  border: 1px solid #9ca3af;
  padding: 5px 7px;
  vertical-align: middle;
}
[data-theme="dark"] .tkb-grid-table th,
[data-theme="dark"] .tkb-grid-table td {
  border-color: #4b5563;
}
.tkb-grid-table thead th {
  background: #355c87;
  color: #ffffff;
  font-weight: 700;
  text-align: center;
  height: 30px;
}
.tkb-grid-table thead th.is-today-head {
  background: #1d4ed8;
  box-shadow: inset 0 -3px 0 #fbbf24;
}
.tkb-th-period {
  width: 44px;
}
.tkb-period-col {
  text-align: center;
  font-weight: 700;
  width: 44px;
  height: 30px;
  background: rgba(53, 92, 135, 0.06);
}
.tkb-session-divider td {
  height: 16px;
  padding: 0;
  background: rgba(53, 92, 135, 0.08);
}
.tkb-cell {
  cursor: pointer;
  transition: background 0.12s ease;
  position: relative;
}
.tkb-cell.empty-cell {
  height: 30px;
  text-align: center;
}
.tkb-cell.empty-cell .tkb-add-hint {
  opacity: 0;
  color: #355c87;
  font-weight: 800;
  font-size: 0.9rem;
}
.tkb-cell.empty-cell:hover {
  background: rgba(53, 92, 135, 0.09);
}
.tkb-cell.empty-cell:hover .tkb-add-hint {
  opacity: 0.75;
}
.tkb-cell.has-class {
  background: #ffffff;
  text-align: left;
  line-height: 1.38;
  vertical-align: top;
  padding: 6px 8px;
}
[data-theme="dark"] .tkb-cell.has-class {
  background: #1f2430;
}
.tkb-cell.has-class:hover {
  background: #eff6ff;
  outline: 2px solid #355c87;
}
[data-theme="dark"] .tkb-cell.has-class:hover {
  background: #273042;
}
.tkb-cell.is-today-col.has-class {
  background: #f0f7ff;
}
[data-theme="dark"] .tkb-cell.is-today-col.has-class {
  background: #232d3f;
}
.tkb-class-code {
  font-weight: 700;
  color: #111827;
}
[data-theme="dark"] .tkb-class-code { color: #e5e7eb; }
.tkb-class-name {
  color: #111827;
}
[data-theme="dark"] .tkb-class-name { color: #f9fafb; }
.tkb-class-room {
  color: #1f2937;
}
[data-theme="dark"] .tkb-class-room { color: #cbd5e1; }

.tkb-unsched-section {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
}
.tkb-unsched-title {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}
.tkb-unsched-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.tkb-unsched-table th {
  text-align: left;
  padding: 4px 8px;
  border-bottom: 1px solid #d1d5db;
  font-weight: 600;
}
.tkb-unsched-table td {
  padding: 5px 8px;
}

/* ==========================================================================
   V16.2 — Nút "Cuộc trò chuyện" gộp (+ / −) trong khung AI
   ========================================================================== */
.gx-history-head { padding: 10px; }
.gx-new-chat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--gx-line);
  border-radius: 999px;
  background: var(--gx-user);
  color: var(--gx-ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.gx-new-chat-btn:hover { border-color: var(--gx-accent); }
.gx-new-chat-btn:focus-visible { outline: 2px solid var(--gx-accent); outline-offset: 2px; }
.gx-history-caption {
  padding: 8px 14px 2px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--gx-muted);
}

/* V16.3 — Thẻ báo "đã được duyệt" không chặn màn hình */
.acct-toast {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  width: min(520px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  animation: gxIn 0.18s ease-out;
}
.acct-toast-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, #1e8e3e, #34a853);
}
.acct-toast-text { display: flex; flex-direction: column; min-width: 0; flex: 1; font-size: 0.82rem; line-height: 1.4; }
.acct-toast-text span { color: var(--ink-muted); }
