:root {
  --bg: #0f1115;
  --panel: #171a21;
  --border: #2a2e38;
  --text: #e6e8ee;
  --muted: #8a8f9c;
  --accent: #5b8cff;
  --bubble-user: #5b8cff;
  --bubble-bot: #232734;
}

* { box-sizing: border-box; }

.hidden { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
}


header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 16px;
  margin: 0;
  flex-shrink: 0;
}

nav {
  display: flex;
  gap: 6px;
  flex: 1;
}

.tab {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

.tab.active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(91, 140, 255, 0.1);
}


.panel {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  padding: 16px;
}

.panel.active { display: flex; }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.panel-header h2 { margin: 0; font-size: 15px; }
.panel-header button {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}

/* --- Board --- */
.app:has(#board.active) { height: auto; min-height: 100vh; }
.panel#board { overflow: visible; }
.board-shell { width: min(980px, 100%); margin: 0 auto; min-height: 0; display: flex; flex-direction: column; flex: 1; }
.board-header { flex: 0 0 auto; }
.board-header > div:first-child { min-width: 0; flex: 1; }
.board-header-actions { display: flex; gap: 8px; margin-left: auto; flex: 0 0 auto; }
.board-settings { padding: 18px; margin-bottom: 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.board-settings h3 { margin-top: 0; }
.board-config-summary { display: grid; gap: 10px; font-size: 12px; }
.board-config-summary > div { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.board-config-summary dt { color: var(--muted); min-width: 130px; }
.board-config-summary dd { margin: 0; }
#boardSettingsStatus { font-size: 12px; color: var(--muted); }
.board-settings .board-interests { flex-direction: column; }
.board-interest-row { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; }
.board-interest-description { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.board-interest-description small { display: block; margin-top: 4px; color: var(--muted); }
.board-interest-actions { display: flex; gap: 8px; }
.board-settings button { cursor: pointer; color: var(--text); background: transparent; border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; }
.board-settings button:disabled { opacity: .5; cursor: wait; }
@media (max-width: 600px) {
  .board-header { flex-wrap: wrap; gap: 10px; }
  .board-header > div:first-child { flex-basis: 100%; }
  .board-header-actions { justify-content: flex-end; width: 100%; }
  .board-settings { padding: 12px; }
  .board-interest-form input { min-width: 0 !important; width: 100%; }
}
.board-header h2 { margin: 0 0 3px; font-size: 18px; }
.board-status { color: var(--muted); font-size: 11px; max-width: 70vw; }
.board-update-btn { color: var(--text) !important; border-color: var(--accent) !important; background: rgba(91,140,255,.1) !important; }
.board-update-btn:disabled { opacity: .6; cursor: wait; }
.board-interest-form { display: flex; gap: 7px; flex-wrap: wrap; padding: 10px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.025); }
.board-interest-form select, .board-interest-form input { min-height: 32px; border: 1px solid var(--border); border-radius: 7px; background: var(--panel); color: var(--text); padding: 6px 9px; font-size: 12px; }
.board-interest-form input:not(.board-keywords) { flex: 1 1 260px; min-width: 190px; }
.board-interest-form .board-keywords { flex: 1 1 220px; min-width: 180px; }
.board-interest-form button { min-height: 32px; border: 1px solid var(--accent); border-radius: 7px; background: rgba(91,140,255,.13); color: var(--text); padding: 6px 10px; cursor: pointer; font-size: 12px; }
.board-interest-form button:disabled { opacity: .5; cursor: wait; }
.board-interests { display: flex; gap: 6px; flex-wrap: wrap; min-height: 24px; margin-bottom: 9px; }
.board-interest-chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); border-radius: 999px; padding: 4px 8px 4px 10px; color: var(--muted); font-size: 11px; background: rgba(255,255,255,.025); }
.board-interest-chip button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 1px; font-size: 15px; line-height: 1; }
.board-interest-chip button:hover { color: #ff7b8b; }
.board-interest-hint { color: var(--muted); font-size: 11px; }
.board-feed { padding: 4px max(2px, 1vw) 32px; }
.board-tag-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin: 12px 0; }
.board-tag-options label { padding: 8px; border: 1px solid var(--border); border-radius: 6px; }
.board-post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 16px; }
.board-post-tags span { padding: 4px 9px; border-radius: 6px; background: rgba(91,140,255,.1); font-size: 12px; color: var(--text); }
.board-post-tags .spoiler { border: 1px dashed #b99164; }
.board-card { display: grid; grid-template-columns: 1fr; overflow: hidden; margin: 0 auto 14px; border: 1px solid var(--border); border-radius: 14px; background: linear-gradient(135deg, rgba(255,255,255,.055), rgba(255,255,255,.018)); box-shadow: 0 7px 25px rgba(0,0,0,.14); animation: board-in .24s ease-out; }
.board-card-image { display: block; width: 100%; aspect-ratio: 3 / 1; object-fit: cover; object-position: center; background: #222733; }
.board-trailer-video { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 10px; margin-top: 18px; background: #000; }
.board-card-body { min-width: 0; padding: 16px 18px 15px; }
.board-card:not(:has(.board-card-image)) { grid-template-columns: 1fr; }
.board-activity { margin-bottom: 12px; color: var(--muted); font-size: 12px; }
.board-card-meta { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; }
.board-kind { color: #9ebaff; font-weight: 700; }
.board-card h3 { margin: 7px 0 8px; color: var(--text); font-family: 'Inter', 'Segoe UI', Arial, sans-serif; font-weight: 700; font-size: 20px; line-height: 1.45; }
.board-card-content { color: #cdd1dc; font-family: 'Literata', Georgia, serif; font-size: 14px; line-height: 1.7; }
.board-card-content p { margin: 0 0 9px; }
.board-card-content p:last-child { margin-bottom: 0; }
.board-card-content ul { margin: 7px 0 9px 20px; padding: 0; }
.board-card-content blockquote { margin: 9px 0; padding: 7px 11px; border-left: 3px solid var(--accent); color: #b9c5e9; background: rgba(91,140,255,.08); }
.board-card-links { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; font-size: 11px; }
.board-card-links a { color: #9ebaff; text-decoration: none; }
.board-card-links a:hover { text-decoration: underline; }
.board-loading, .board-empty { text-align: center; color: var(--muted); padding: 22px; font-size: 12px; }
.board-sentinel { height: 1px; flex: 0 0 1px; }
@keyframes board-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) {
  .board-card { grid-template-columns: 1fr; }
  .board-card-image { aspect-ratio: 16 / 7; }
  .board-card-body { padding: 13px 14px; }
  .board-card h3 { font-size: 18px; }
  .board-card-content { font-size: 13px; }
}

.tree-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 12px;
}

.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.5;
  font-size: 14px;
}

.msg .msg-text { white-space: pre-wrap; }

.msg.user {
  align-self: flex-end;
  background: var(--bubble-user);
  color: white;
  border-bottom-right-radius: 4px;
}

.msg.bot {
  align-self: flex-start;
  background: var(--bubble-bot);
  border-bottom-left-radius: 4px;
}

/* Noi dung markdown da render trong tin nhan bot (tra loi cua AI) */
.msg-html { line-height: 1.55; }
.msg-html > *:first-child { margin-top: 0; }
.msg-html > *:last-child { margin-bottom: 0; }
.msg-html p { margin: 6px 0; }
.msg-html ul, .msg-html ol { margin: 6px 0; padding-left: 20px; }
.msg-html li { margin: 2px 0; }
.msg-html strong { color: var(--text); }
.msg-html code {
  background: rgba(255,255,255,0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12.5px;
}
.msg-html pre {
  background: rgba(0,0,0,0.3);
  padding: 10px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 6px 0;
}
.msg-html pre code { background: none; padding: 0; }
.msg-html a { color: var(--accent); }
.msg-html blockquote {
  border-left: 2px solid var(--border);
  margin: 6px 0;
  padding-left: 10px;
  color: var(--muted);
}

#chatForm {
  display: flex;
  gap: 8px;
}

#chatInput {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
}

#chatForm button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
}

.todo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.todo-list li {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.todo-list .due {
  color: var(--accent);
  font-weight: 600;
  margin-right: 6px;
}

.todo-list .path {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

/* Duyet Vault */
.browse-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 12px;
}

.tree-pane {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tree {
  flex: 1;
  overflow-y: auto;
  font-size: 13px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
}

.tree-folder > .tree-folder-label {
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  user-select: none;
  white-space: nowrap;
}

.tree-folder > .tree-folder-label:hover { background: rgba(255,255,255,0.05); }

.tree-folder-label .caret {
  display: inline-block;
  width: 12px;
  color: var(--muted);
}

.tree-children {
  margin-left: 14px;
  border-left: 1px solid var(--border);
  padding-left: 6px;
}

.tree-children.collapsed { display: none; }

.tree-file {
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-file:hover { background: rgba(91,140,255,0.12); color: var(--text); }
.tree-file.active { background: rgba(91,140,255,0.2); color: var(--text); }

.note-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  overflow-y: auto;
}

.note-empty { color: var(--muted); font-size: 13px; }
.note-view.hidden { display: none; }

.note-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.note-header h2 { margin: 0; font-size: 16px; }

.properties-panel {
  margin: 12px 0;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.properties-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.prop-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  padding: 4px 0;
  font-size: 13px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.prop-row:first-of-type { border-top: none; }

.prop-key {
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-wrap: break-word;
}

.prop-icon { flex-shrink: 0; opacity: 0.7; }

.prop-value {
  overflow-wrap: break-word;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.prop-value a { color: var(--accent); }
.prop-checkbox { font-size: 15px; }
.prop-empty { color: var(--muted); font-style: italic; }

.prop-value .tag-chip {
  font-size: 11px;
  color: var(--muted);
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 2px 8px;
}

.note-content {
  font-size: 14px;
  line-height: 1.6;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.note-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 6px 0;
}
.note-content .wikilink {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed rgba(91,140,255,0.5);
  cursor: pointer;
}
.note-content .wikilink:hover { border-bottom-style: solid; }

.note-content .broken-wikilink {
  color: var(--muted);
  border-bottom: 1px dashed rgba(255,255,255,0.2);
  cursor: help;
}

.note-content .broken-embed {
  display: inline-block;
  color: #e0a030;
  background: rgba(224, 160, 48, 0.1);
  border: 1px solid rgba(224, 160, 48, 0.3);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
}
.note-content pre {
  background: rgba(0,0,0,0.3);
  padding: 10px;
  border-radius: 8px;
  overflow-x: auto;
}
.note-content code { font-size: 13px; }
.note-content a { color: var(--accent); }


/* Sua ghi chu bang AI */
.note-edit {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.edit-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
}
.edit-toggle:hover { color: var(--text); }

.edit-box { margin-top: 10px; }
.edit-box.hidden { display: none; }

.edit-box textarea {
  width: 100%;
  min-height: 60px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}

.edit-box #proposeEditBtn {
  margin-top: 8px;
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

.edit-proposal {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.edit-target {
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.edit-target .edit-path { color: var(--muted); font-size: 11px; }

.diff-view {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.diff-view > div { padding: 0 12px; }
.diff-add { background: rgba(63, 185, 80, 0.15); color: #7ee2a8; }
.diff-del { background: rgba(248, 81, 73, 0.15); color: #ff9492; }
.diff-hunk { color: var(--accent); opacity: 0.8; }
.diff-meta { color: var(--muted); }
.diff-ctx { color: var(--muted); }

.edit-actions {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

.edit-actions button {
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}
.edit-apply { background: #3fb950; color: #06280f; }
.edit-cancel { background: rgba(255,255,255,0.08); color: var(--text); }
.edit-actions button:disabled { opacity: 0.5; cursor: default; }

.edit-status {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--muted);
}

/* Nguon trong chat */
.msg .sources {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}
.msg .sources a {
  color: var(--accent);
  font-size: 12px;
  text-decoration: none;
}
.msg .sources a:hover { text-decoration: underline; }

/* Theo doi: Game / Phim / Anime / Comic / Novel / Book (giao dien kieu thu vien Steam) */
.tracking-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 12px;
}

/* Scrollbars stay subtle and only occupy space when the element actually
   overflows (all scroll containers use overflow:auto/overlay). */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(145,153,174,0.55) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(145,153,174,0.48);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(180,188,208,0.72); border-width: 1px; }

.tracking-sidebar {
  width: var(--tracking-sidebar-width, 300px);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tracking-resizer {
  width: 6px;
  flex: 0 0 6px;
  border-radius: 4px;
  cursor: col-resize;
  touch-action: none;
  background: transparent;
  transition: background 0.15s;
}
.tracking-resizer:hover, .tracking-resizer.active { background: var(--accent); }
body.resizing-tracking-sidebar { cursor: col-resize; user-select: none; }

.tracking-search { margin-bottom: 10px; flex-shrink: 0; }
.tracking-search input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  box-sizing: border-box;
}
.tracking-search input:focus { outline: none; border-color: var(--accent); }
.tracking-search input::placeholder { color: var(--muted); }

.tracking-list {
  flex: 1;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
}

.tracking-group + .tracking-group { margin-top: 12px; }

.tracking-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  user-select: none;
}

.tracking-toggle {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
}
.tracking-toggle:hover { background: rgba(255,255,255,0.1); color: var(--text); }

.tracking-group-label {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  padding: 4px 2px;
  border-radius: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tracking-group-label:hover { color: var(--text); background: rgba(255,255,255,0.05); }

.tracking-count {
  flex-shrink: 0;
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
}

.tracking-divider {
  height: 1px;
  background: var(--border);
  margin: 10px 4px;
}

.tracking-group-items { margin-top: 2px; }
.tracking-group-items.collapsed { display: none; }

.tracking-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
}
.tracking-item:hover { background: rgba(91,140,255,0.12); }
.tracking-item.active { background: rgba(91,140,255,0.22); }

.tracking-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.06);
  font-size: 16px;
}

.tracking-item-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
}
.tracking-item-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }

.tracking-item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tracking-empty-group {
  padding: 6px 10px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.tracking-main {
  flex: 1;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-y: auto;
}

.tracking-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 16px;
}

.tracking-view.hidden { display: none; }

.tracking-hero {
  width: 100%;
  max-height: 360px;
  overflow: hidden;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px 10px 0 0;
}

.tracking-cover {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  display: block;
}

.tracking-info { padding: 16px 20px 0; }
.tracking-info h2 { margin: 0 0 10px; font-size: 20px; }

.tracking-rating { margin-bottom: 10px; font-size: 15px; }
.tracking-rating .stars { color: #ffce54; letter-spacing: 2px; }
.tracking-rating .rating-value { margin-left: 8px; color: var(--muted); font-size: 12px; }
.tracking-rating .rating-empty { color: var(--muted); font-size: 12px; font-style: italic; }

.tracking-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

.tracking-meta { color: var(--muted); font-size: 12px; margin-bottom: 12px; }

.tracking-links { display: flex; gap: 8px; margin-bottom: 14px; }
.tracking-links a {
  background: var(--accent);
  color: white;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
}
.tracking-links a:hover { opacity: 0.9; }

.tracking-content {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* Luoi cover kieu Steam "All Games" khi bam vao ten 1 category/shelf */
.tracking-grid-view.hidden { display: none; }

.tracking-grid-header {
  padding: 16px 20px 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}
.tracking-grid-header h2 { margin: 0; font-size: 17px; }

/* Shelves shown in the All view, inspired by the compact Steam home layout. */
.tracking-content-shelf {
  border-bottom: 1px solid var(--border);
  padding: 0 0 14px;
  margin-bottom: 14px;
}
.tracking-content-shelf:last-child { border-bottom: 0; margin-bottom: 0; }
.tracking-content-shelf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 20px 10px;
  cursor: grab;
}
.tracking-content-shelf-header:active { cursor: grabbing; }
.tracking-content-shelf.dragging { opacity: 0.45; }
.tracking-shelf-drop-indicator {
  height: 4px;
  margin: 2px 20px 10px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(91,140,255,0.8);
}
.tracking-content-shelf-header h3 {
  margin: 0;
  font-size: 15px;
  color: var(--text);
}
.tracking-content-shelf-toggle {
  width: 28px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.tracking-content-shelf-toggle:hover { color: var(--text); background: rgba(255,255,255,0.1); }
.tracking-content-shelf-body.collapsed { display: none; }
.tracking-content-shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--tracking-card-min, 150px), 1fr));
  gap: 16px;
  padding: 0 20px;
}

.tracking-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--tracking-card-min, 150px), 1fr));
  gap: 16px;
  padding: 16px 20px 20px;
}
.tracking-grid.tracking-grid-shelves {
  display: block;
  padding: 16px 0 20px;
}

.tracking-card { cursor: pointer; }
.tracking-item, .tracking-card, .tracking-group[data-kind="shelf"] .tracking-group-header { -webkit-touch-callout: none; user-select: none; }

.tracking-card-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 6px;
  border: 1px solid transparent;
}
.tracking-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; image-rendering: auto; }
.tracking-card:hover .tracking-card-cover { border-color: var(--accent); }
.tracking-card-kind {
  position: absolute; top: 8px; left: 8px; z-index: 1;
  padding: 4px 9px; border: 1px solid rgba(255,255,255,0.22); border-radius: 999px;
  color: #fff; background: rgba(14,17,24,0.84); box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  backdrop-filter: blur(5px); font-size: 10px; font-weight: 800; line-height: 1; letter-spacing: 0.08em; text-transform: uppercase;
}
.tracking-card-kind.anime { background: rgba(94,72,190,0.88); }
.tracking-card-kind.film { background: rgba(26,112,153,0.88); }
.tracking-card-kind.novel { background: rgba(145,75,33,0.88); }

.tracking-card-fallback {
  font-size: 40px;
  font-weight: 700;
  color: var(--muted);
}

.tracking-card-title {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tracking-card-date {
  position: absolute;
  left: 6px;
  bottom: 6px;
  max-width: calc(100% - 12px);
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(15,17,23,0.82);
  color: #e6e8ee;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Menu chuot phai "Them vao bo suu tap" */
.context-menu {
  position: fixed;
  z-index: 1000;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  min-width: 210px;
  max-width: 280px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  font-size: 13px;
}

.context-menu-header {
  padding: 6px 10px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.context-menu-item:hover { background: rgba(91,140,255,0.15); }

.context-check {
  width: 14px;
  flex-shrink: 0;
  color: var(--accent);
  font-weight: 700;
}

.context-menu-new {
  color: var(--accent);
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 8px;
}

.context-menu-danger { color: #ff6b6b; }
.context-menu-danger:hover { background: rgba(255,107,107,0.15); }

/* Keo-tha sap xep category o sidebar Theo doi */
.draggable-category { cursor: grab; }
.draggable-category:active { cursor: grabbing; }
.draggable-category.dragging { opacity: 0.4; }

.tracking-drop-indicator {
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin: 3px 4px;
  box-shadow: 0 0 6px rgba(91,140,255,0.8);
}

/* Responsive: dien thoai / man hinh hep */
@media (max-width: 720px) {
  .app { max-width: 100%; }

  .tracking-resizer { display: none; }
  .tracking-sidebar { width: 100% !important; }

  header {
    flex-wrap: wrap;
    padding: 10px 12px;
    row-gap: 8px;
  }

  header h1 { font-size: 14px; }

  nav {
    width: 100%;
    flex: none;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }


  nav::-webkit-scrollbar { display: none; }

  .tab { flex-shrink: 0; }

  .panel { padding: 10px; }

  .browse-layout { flex-direction: column; }

  .tree-pane { width: 100%; flex-shrink: 0; }

  .tree { max-height: 200px; }

  .note-pane { padding: 12px; }

  .tracking-layout { flex-direction: column; }

  .tracking-sidebar { width: 100% !important; flex-shrink: 0; }

  .tracking-list { max-height: 240px; }

  .tracking-hero { max-height: 220px; }
  .tracking-cover { max-height: 220px; }

  .tracking-info { padding: 12px 14px 0; }
  .tracking-content { padding: 12px 14px 16px; }

  .tracking-grid-header { padding: 12px 14px 10px; }
  .tracking-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; padding: 12px 14px 16px; }
  .tracking-content-shelf-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; padding: 0 14px; }

  .prop-row { grid-template-columns: 110px 1fr; }

  .msg { max-width: 92%; }

  .diff-view { max-height: 220px; }
}

@media (max-width: 420px) {
  header h1 { display: none; }
  .panel-header h2 { font-size: 14px; }
  .tree-actions button { padding: 6px 8px; font-size: 11px; }
}

/* --- Novel --- */
.novel-hero { display: flex; gap: 20px; padding: 18px 20px 8px; align-items: flex-start; }
.novel-cover { width: 170px; flex-shrink: 0; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 8px; background: rgba(0,0,0,0.35); }
.novel-hero-info { flex: 1; min-width: 0; }
.novel-hero-info h2 { margin: 0 0 6px; font-size: 22px; }
.novel-original { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.novel-intro { padding: 4px 20px 8px; }
.novel-lang { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.lang-btn {
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 12px; font-size: 12px; cursor: pointer;
}
.lang-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.lang-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.novel-progress { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
.novel-bar, .reader-progress { flex: 1; height: 6px; background: var(--bubble-bot); border-radius: 999px; overflow: hidden; }
.novel-bar-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.novel-progress-text { font-size: 12px; color: var(--muted); white-space: nowrap; }
.novel-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.novel-primary {
  background: var(--accent); color: #fff; border: 0; border-radius: 6px;
  padding: 8px 16px; font-size: 13px; cursor: pointer;
}
.novel-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.novel-link { color: var(--accent); font-size: 13px; text-decoration: none; }
.novel-info { padding: 4px 20px 8px; }
.novel-desc { color: var(--muted); font-size: 13px; line-height: 1.6; }
.novel-info-section h4 { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.05em; }
.novel-field { display: grid; grid-template-columns: 150px 1fr; gap: 8px; padding: 4px 0; font-size: 13px; align-items: start; }
.novel-field-label { color: var(--muted); font-size: 12px; padding-top: 3px; }
.novel-field-values { display: flex; flex-wrap: wrap; gap: 5px; }
.novel-chip { background: var(--bubble-bot); border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.novel-section-title { margin: 16px 20px 8px; font-size: 15px; }
.novel-chapters { padding: 0 20px 20px; display: flex; flex-direction: column; gap: 2px; }
.novel-chapter {
  display: flex; gap: 10px; align-items: baseline; padding: 8px 10px;
  border-radius: 6px; font-size: 13px; cursor: pointer;
}
.novel-chapter:hover { background: var(--bubble-bot); }
.novel-chapter.read .novel-chapter-title { color: var(--muted); }
.novel-chapter.current { background: rgba(91,140,255,0.15); border-left: 3px solid var(--accent); }
.novel-chapter.missing .novel-chapter-title { opacity: 0.55; }
.novel-chapter-note { font-size: 11px; color: var(--muted); margin-left: auto; }

.novel-reader {
  --r-bg: #0f1115; --r-text: #d9dce4; --r-muted: #8a8f9c; --r-panel: rgba(23,26,33,0.96); --r-border: #2a2e38;
  --r-font: 18px; --r-lh: 1.85;
  position: fixed; inset: 0; z-index: 200;
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--r-bg); color: var(--r-text);
  cursor: pointer;
}
.novel-reader[data-theme="black"] { --r-bg: #000; --r-text: #cfd2d8; --r-panel: rgba(28,28,30,0.97); --r-border: #2c2c2e; }
.novel-reader[data-theme="sepia"] { --r-bg: #f4ecd8; --r-text: #4a3b28; --r-muted: #8a7a62; --r-panel: rgba(236,224,196,0.97); --r-border: #d6c9a8; }
.novel-reader[data-theme="light"] { --r-bg: #ffffff; --r-text: #1d1f24; --r-muted: #6b7080; --r-panel: rgba(245,246,249,0.97); --r-border: #dcdfe6; }
.reader-top, .reader-bottom {
  position: fixed; left: 0; right: 0; z-index: 4; background: var(--r-panel); color: var(--r-text);
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.reader-top { top: 0; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--r-border); }
.reader-bottom { bottom: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--r-border); }
.reader-bottom-row { display: flex; align-items: center; gap: 12px; max-width: 720px; margin: 0 auto; }
.novel-reader:not(.controls-shown) .reader-top { transform: translateY(-100%); opacity: 0; pointer-events: none; }
.novel-reader:not(.controls-shown) .reader-bottom { transform: translateY(100%); opacity: 0; pointer-events: none; }
.novel-reader button {
  background: transparent; color: var(--r-text); border: 1px solid var(--r-border);
  border-radius: 6px; padding: 6px 12px; font-size: 13px; cursor: pointer;
}
.novel-reader button:disabled { opacity: 0.35; cursor: not-allowed; }
.novel-reader button.active, .novel-reader .lang-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.reader-book-title { flex: 1; min-width: 0; font-size: 13px; color: var(--r-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-slider { flex: 1; accent-color: var(--accent); }
.reader-pos { text-align: center; font-size: 12px; color: var(--r-muted); margin-top: 4px; }
.reader-chapters { max-width: 720px; margin: 0 auto; padding: 48px calc(20px + var(--r-margin, 0px)) 0; }
.reader-chapter { padding-bottom: 48px; }
.reader-chapter + .reader-chapter { border-top: 1px solid var(--r-border); padding-top: 40px; }
.reader-chapter h2 { font-size: 22px; margin: 0 0 22px; }
@font-face {
  font-family: 'OpenDyslexic'; font-weight: 400; font-display: swap;
  src: url('https://cdn.jsdelivr.net/npm/@fontsource/opendyslexic/files/opendyslexic-latin-400-normal.woff2') format('woff2');
}
.reader-chapters { font-family: var(--r-family, serif); }
.reader-content { font-size: var(--r-font); line-height: var(--r-lh); }
.reader-fonts { display: flex; gap: 4px; overflow-x: auto; padding: 4px 0 8px; }
.novel-reader .reader-fonts button { flex: 0 0 auto; min-width: 84px; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; font-size: 12px; color: var(--r-muted); }
.reader-fonts button .aa { font-size: 30px; line-height: 1.1; color: var(--r-text); }
.novel-reader .reader-fonts button.active { background: transparent; color: var(--accent); }
.novel-reader .reader-fonts button.active .aa { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.reader-content p { margin: 0 0 0.7em; text-indent: 1.5em; text-align: var(--r-align, left); }
.reader-status, .reader-foot {
  position: fixed; left: 0; right: 0; z-index: 2; display: flex; justify-content: space-between; gap: 12px;
  padding: 6px 16px; font-size: 11px; color: var(--r-muted); background: var(--r-bg); pointer-events: none;
}
.reader-status { top: 0; }
.reader-status-title { flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.02em; }
.reader-foot { bottom: 0; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
.reader-sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: min(680px, 100%); z-index: 6;
  background: var(--r-panel); color: var(--r-text); border: 1px solid var(--r-border); border-bottom: 0;
  border-radius: 14px 14px 0 0; padding: 8px 18px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,0.35);
}
.sheet-handle { width: 40px; height: 4px; border-radius: 4px; background: var(--r-muted); opacity: 0.6; margin: 0 auto 10px; }
.sheet-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--r-border); margin-bottom: 12px; }
.novel-reader .sheet-tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 8px 2px; font-size: 15px; color: var(--r-text); }
.novel-reader .sheet-tabs button.active { background: transparent; color: var(--accent); border-bottom-color: var(--accent); }
.sheet-label { font-size: 14px; margin: 10px 0 4px; }
.sheet-slider { display: flex; align-items: center; gap: 14px; }
.sheet-slider input { flex: 1; accent-color: var(--accent); }
.sheet-slider .a-small { font-size: 14px; } .sheet-slider .a-big { font-size: 24px; }
.sheet-seg { display: flex; gap: 8px; }
.novel-reader .sheet-seg button { flex: 1; padding: 10px; }
.novel-reader .sheet-seg button.active { background: transparent; border-color: var(--accent); color: var(--accent); }
.reader-themes { display: flex; gap: 10px; }
.novel-reader .reader-themes button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px; font-size: 12px; }
.novel-reader .reader-themes button.active { background: transparent; border-color: var(--accent); color: var(--accent); }
.reader-themes .sw { width: 100%; padding: 10px 0; border-radius: 6px; font-size: 18px; text-align: center; border: 1px solid #555; }
.sw-black { background: #000; color: #cfd2d8; } .sw-dark { background: #0f1115; color: #d9dce4; }
.sw-sepia { background: #f4ecd8; color: #4a3b28; } .sw-light { background: #fff; color: #1d1f24; }
.reader-footer { max-width: 720px; margin: 0 auto; padding: 0 20px 110px; text-align: center; font-size: 13px; color: var(--r-muted); }

@media (max-width: 720px) {
  .novel-hero { flex-direction: column; align-items: center; padding: 12px 14px 6px; }
  .novel-cover { width: 130px; }
  .novel-hero-info { width: 100%; }
  .novel-intro { padding-left: 14px; padding-right: 14px; }
  .novel-info, .novel-chapters { padding-left: 14px; padding-right: 14px; }
  .novel-section-title { margin-left: 14px; }
  .novel-field { grid-template-columns: 1fr; gap: 2px; }
  .reader-chapters { padding-left: 16px; padding-right: 16px; }
}

/* Hoi dap: nut + noi o goc duoi phai, bam mo khung chat kieu CSKH */
.chat-fab {
  position: fixed; right: 20px; bottom: 20px; width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent); color: #fff; border: 0; font-size: 28px; line-height: 1; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45); z-index: 160; transition: transform 0.2s ease;
}
.chat-fab.open { transform: rotate(45deg); }
.chat-box {
  position: fixed; right: 20px; bottom: 84px; width: 380px; height: min(560px, calc(100vh - 110px));
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); z-index: 160; overflow: hidden;
}
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--bubble-bot); }
.chat-head-actions { display: flex; gap: 6px; }
.chat-head button { background: transparent; border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 3px 9px; font-size: 12px; cursor: pointer; }
.chat-box .messages { padding: 12px; }
.chat-box #chatForm { padding: 10px; border-top: 1px solid var(--border); }
.chat-empty { margin: auto; text-align: center; color: var(--muted); font-size: 13px; padding: 0 20px; }
@media (max-width: 720px) {
  .chat-box { right: 0; left: 0; bottom: 0; width: 100%; top: 0; height: auto; border-radius: 0; border: 0; z-index: 170; }
  .chat-fab { right: 14px; bottom: 14px; }
  .chat-fab.open { display: none; }
}

body.reader-open { overflow: hidden; }

/* Tom tat truyen */
.novel-secondary {
  background: transparent; color: var(--text); border: 1px solid var(--border);
  padding: 10px 16px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.novel-secondary:hover { border-color: var(--accent); }
.sum-modal { position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.sum-dialog {
  width: min(720px, 100%); max-height: 100%; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
}
.sum-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.sum-head button, .sum-foot button, .sum-presets button, .sum-stepper button {
  background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 13px; cursor: pointer;
}
.sum-body { padding: 14px 16px; overflow-y: auto; flex: 1; min-height: 0; }
.sum-label { font-size: 12px; color: var(--muted); margin: 12px 0 6px; }
.sum-label:first-child { margin-top: 0; }
.sum-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.sum-presets button.active { border-color: var(--accent); color: var(--accent); background: rgba(91,140,255,0.12); }
.sum-upgrade { background: rgba(255,170,60,0.12); border: 1px solid rgba(255,170,60,0.5); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; }
.sum-upgrade label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.sum-upgrade input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); }
.sum-grid { max-height: 240px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 8px; background: var(--bg); user-select: none; }
.sum-row { display: grid; grid-template-columns: 38px repeat(10, 1fr); gap: 3px; margin-bottom: 3px; align-items: center; }
.sum-row-label { font-size: 10px; color: var(--muted); text-align: right; padding-right: 6px; }
.sum-cell {
  height: 30px; border-radius: 5px; border: 1px solid transparent; font-size: 11px; padding: 0;
  background: #1b1e27; color: #6d7382; cursor: pointer; position: relative;
}
.sum-cell.vi { background: rgba(63,185,80,0.28); color: #b6f0c4; }
.sum-cell.other { background: rgba(120,150,210,0.4); color: #d5e0f7; }
.sum-cell.up { background: rgba(255,170,60,0.35); color: #ffd9a8; }
.sum-cell.sel { background: var(--accent); color: #fff; }
.sum-cell.edge { outline: 2px solid #fff; outline-offset: -2px; font-weight: 700; }
.sum-cell.read::after { content: ''; position: absolute; right: 3px; top: 3px; width: 6px; height: 6px; border-radius: 50%; background: #ff5b8c; }
.sum-cell.empty { visibility: hidden; }
.sum-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.sum-legend .lg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.lg-none { background: #1b1e27; border: 1px solid var(--border); } .lg-vi { background: rgba(63,185,80,0.6); } .lg-other { background: rgba(120,150,210,0.7); }
.lg-up { background: rgba(255,170,60,0.7); } .lg-read { background: #ff5b8c; border-radius: 50% !important; }
.sum-steppers { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 14px; }
.sum-stepper { display: flex; align-items: center; gap: 6px; }
.sum-stepper button { padding: 8px 10px; min-width: 40px; }
.sum-stepper b { min-width: 42px; text-align: center; font-size: 16px; }
.sum-step-label { font-size: 12px; color: var(--muted); margin-right: 4px; }
.sum-impact { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: rgba(255,255,255,0.04); font-size: 13px; line-height: 1.6; min-height: 20px; }
.sum-impact .warn { color: #ffd60a; }
.sum-foot { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); }
.sum-foot-spacer { flex: 1; }
.sum-foot .sum-go { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.sum-foot .sum-go:disabled { opacity: 0.4; cursor: not-allowed; }
.sum-run { display: flex; align-items: center; gap: 14px; padding: 30px 6px 8px; font-size: 14px; }
.sum-run-note { font-size: 12px; color: var(--muted); padding: 0 6px 20px; }
.sum-spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: sum-spin 0.8s linear infinite; flex: none; }
@keyframes sum-spin { to { transform: rotate(360deg); } }
.sum-review-note { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.sum-review-note mark, .sum-block.new, .sum-block.changed { background: rgba(255,214,10,0.2); }
.sum-review-note mark { color: #ffd60a; padding: 0 3px; border-radius: 3px; }
.sum-block { border-left: 3px solid var(--border); border-radius: 6px; padding: 10px 12px; margin-bottom: 10px; }
.sum-block.new, .sum-block.changed { border-left-color: #ffd60a; }
.sum-block.removed { opacity: 0.55; }
.sum-block.removed .sum-block-text { text-decoration: line-through; }
.sum-block-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.sum-badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: #ffd60a; color: #222; }
.sum-badge.removed { background: var(--bubble-bot); color: var(--muted); }
.sum-badge.plain { background: transparent; border: 1px solid var(--border); color: var(--muted); font-weight: 500; }
.sum-block-text p { margin: 0 0 8px; line-height: 1.6; font-size: 13.5px; }
.sum-block.unchanged .sum-block-text { max-height: 4.8em; overflow: hidden; cursor: pointer; }
.sum-block.unchanged.open .sum-block-text { max-height: none; }
@media (max-width: 720px) {
  .sum-modal { padding: 0; }
  .sum-dialog { height: 100%; border-radius: 0; border: 0; }
  .sum-cell { height: 34px; }
}

/* Anime: danh sach tap + trinh phat */
.anime-box { padding-bottom: 8px; }
.anime-box-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-right: 20px; }
.anime-release-status { background: var(--bubble-bot); color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 4px 7px; font-size: 11px; }
.anime-release-status:focus { outline: 1px solid var(--accent); }
.anime-note { margin: 0 20px 8px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.anime-note code { background: var(--bubble-bot); padding: 1px 5px; border-radius: 4px; }
.anime-ep-bar { width: 60px; height: 4px; background: var(--bubble-bot); border-radius: 999px; overflow: hidden; margin-left: auto; align-self: center; }
.anime-ep-bar > i { display: block; height: 100%; background: var(--accent); }
.novel-chapter.watched .novel-chapter-title { color: var(--muted); }

.anime-ep-play { margin-left: auto; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 0 8px; font-size: 11px; cursor: pointer; align-self: center; }
.anime-ep-bar + .anime-ep-play { margin-left: 8px; }
.anime-ep-play:hover { border-color: var(--accent); color: var(--accent); }
.anime-ep.open > .novel-chapter { background: var(--bubble-bot); }
.anime-ep-panel { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 10px 12px 14px; }
.anime-shot { position: relative; width: 112px; padding: 0; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: #000; cursor: pointer; }
.anime-shot:hover { border-color: var(--accent); }
.anime-shot img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.anime-shot span { position: absolute; right: 3px; bottom: 3px; background: rgba(0,0,0,0.7); color: #fff; font-size: 11px; padding: 0 5px; border-radius: 4px; }
.anime-shot.none { width: auto; padding: 4px 10px; font-size: 12px; color: var(--muted); cursor: default; background: none; }
.anime-shot-empty { font-size: 12px; color: var(--muted); }
body.shot-open { overflow: hidden; }
.shot-viewer { overscroll-behavior: contain; touch-action: none; position: fixed; inset: 0; z-index: 600; background: rgba(0,0,0,0.92); display: flex; align-items: center; justify-content: center; }
.shot-img { max-width: 100vw; max-height: 86vh; object-fit: contain; user-select: none; touch-action: none; }
.shot-close, .shot-nav, .shot-del { background: rgba(30,33,42,0.8); color: #fff; border: 1px solid rgba(255,255,255,0.25); border-radius: 50%; cursor: pointer; }
.shot-close { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; font-size: 18px; z-index: 2; }
.shot-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 30px; line-height: 1; z-index: 2; }
.shot-prev { left: 12px; }
.shot-next { right: 12px; }
.shot-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; color: #fff; font-size: 13px; background: linear-gradient(transparent, rgba(0,0,0,0.7)); }
.shot-del { width: 34px; height: 34px; font-size: 15px; }
body.player-open { overflow: hidden; }
.anime-player { position: fixed; inset: 0; z-index: 400; background: #0f0f0f; overflow-y: auto; }
.anime-watch-layout { width: calc(100% - 24px); min-height: 100%; margin: 0 auto; padding: 12px 0; display: grid; grid-template-columns: minmax(0, 1fr) clamp(360px, 27vw, 560px); align-content: start; align-items: start; gap: 14px; }
.anime-watch-main { min-width: 0; }
.anime-stage { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: calc(100dvh - 24px); background: #000; overflow: hidden; border-radius: 10px; }
.anime-stage video { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; object-fit: contain; background: #000; touch-action: manipulation; }
.anime-stage > .JASSUB { position: absolute !important; inset: 0; z-index: 3; pointer-events: none; }
.anime-outside-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 2px 0; color: #aaa; font-size: 12px; }
.anime-outside-tools label { display: inline-flex; align-items: center; gap: 7px; }
.anime-outside-tools button, .anime-outside-tools select { min-height: 34px; padding: 6px 10px; border: 1px solid #393939; border-radius: 8px; background: #272727; color: #f1f1f1; font: inherit; cursor: pointer; }
.anime-outside-tools button:hover, .anime-outside-tools select:hover { background: #383838; }
.anime-outside-tools select { max-width: min(240px, 42vw); font-size: 13px; }
.anime-outside-tools button.is-running { color: #c9d6ff; }
.anime-watch-info { padding: 12px 2px 4px; color: #f1f1f1; }
.anime-watch-info h2 { margin: 0; font-size: 19px; line-height: 1.35; }
.anime-watch-info p { margin: 4px 0 0; color: #aaa; font-size: 13px; }
.anime-watch-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 12px; color: #c8c8c8; font-size: 13px; }
.anime-watch-meta span + span::before { content: '·'; margin-right: 14px; color: #777; }
.anime-watch-description { max-width: 880px; margin-top: 12px; color: #d1d1d1; font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.anime-watch-description:not(.expanded) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.anime-watch-more { display: block; margin-top: 4px; padding: 0; border: 0; background: none; color: #eee; font-size: 13px; font-weight: 600; cursor: pointer; }
.anime-watch-sidebar { min-width: 0; color: #f1f1f1; }
.anime-watch-group { margin-bottom: 8px; }
.anime-watch-episode { display: grid; grid-template-columns: minmax(0, 64%) minmax(0, 1fr); align-items: start; gap: 8px; width: 100%; margin-bottom: 8px; padding: 0; border: 0; background: transparent; color: #f1f1f1; text-align: left; cursor: pointer; }
.anime-watch-episode:hover .anime-watch-thumb { filter: brightness(1.12); }
.anime-watch-episode:disabled { opacity: 0.48; cursor: default; }
.anime-watch-thumb { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 8px; background: #272727; }
.anime-watch-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.anime-watch-playing { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 28px; background: rgba(0,0,0,0.25); }
.anime-watch-duration { position: absolute; right: 5px; bottom: 5px; padding: 2px 4px; border-radius: 3px; background: rgba(0,0,0,0.82); color: #fff; font-size: 11px; font-weight: 700; }
.anime-watch-text { min-width: 0; padding: 2px 0; }
.anime-watch-text strong { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.35; font-size: 14px; font-weight: 600; }
.anime-watch-text small { display: block; overflow: hidden; margin-top: 5px; color: #aaa; font-size: 12px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.anime-watch-text small:empty { display: none; }
.anime-watch-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,0.28); }
.anime-watch-progress i { display: block; height: 100%; background: var(--accent); }
.anime-watch-empty { color: #a9adba; font-size: 13px; }
.anime-stage:fullscreen, .anime-stage:-webkit-full-screen, .anime-stage.pseudo-full { position: fixed; inset: 0; z-index: 500; width: 100%; height: 100%; max-height: none; aspect-ratio: auto; border-radius: 0; }
@media (max-width: 1100px) {
  .anime-watch-layout { grid-template-columns: minmax(0, 1fr) 360px; gap: 12px; }
}
@media (max-width: 900px) {
  .anime-watch-layout { display: block; width: 100%; padding: 0; }
  .anime-stage { max-height: none; border-radius: 0; }
  .anime-outside-tools { padding: 12px 16px 0; }
  .anime-watch-sidebar { padding: 16px; }
}
.anime-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px; padding: 10px 14px 28px;
  background: linear-gradient(rgba(0,0,0,0.75), transparent);
  transition: opacity 0.25s;
}
.anime-stage.idle .anime-top, .anime-stage.idle .anime-bar { opacity: 0; pointer-events: none; }
.anime-stage.idle { cursor: none; }
.anime-top button, .anime-top select {
  background: rgba(30,33,42,0.85); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px; font-size: 13px; cursor: pointer; max-width: 220px;
}
.anime-top button:hover, .anime-top select:hover { border-color: var(--accent); }
.anime-top button:disabled { opacity: 0.35; cursor: not-allowed; }
.anime-top-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; font-size: 14px; color: #fff; text-shadow: 0 1px 3px #000; }
.anime-top-title #animeTitle { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anime-ep-label { display: flex; align-items: center; gap: 4px; flex: 0 1 auto; min-width: 0; margin-left: 10px; color: #c5c9d4; font-size: 13px; background: none; border: 0; padding: 2px 6px; border-radius: 6px; cursor: pointer; text-shadow: 0 1px 3px #000; }
.anime-ep-label-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anime-ep-label-arrow { flex: none; }
.anime-ep-label:hover { background: rgba(255,255,255,0.14); color: #fff; }
.anime-ep-menu { position: absolute; z-index: 8; top: 52px; left: 14px; width: min(380px, calc(100% - 28px)); max-height: 60%; overflow-y: auto; overscroll-behavior: contain; background: rgba(20,22,28,0.97); border: 1px solid var(--border); border-radius: 10px; padding: 6px; }
.anime-ep-item { display: flex; gap: 10px; align-items: baseline; min-width: 0; width: 100%; text-align: left; background: none; border: 0; color: #fff; padding: 8px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.anime-ep-item:hover { background: rgba(255,255,255,0.12); }
.anime-ep-item.current { background: rgba(91,140,255,0.22); }
.anime-ep-item-label { flex: none; white-space: nowrap; }
.anime-ep-item-title { flex: 1; min-width: 0; font-size: 11px; color: #9aa0ad; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anime-msg {
  position: absolute; left: 50%; top: 64px; transform: translateX(-50%); z-index: 5;
  max-width: min(640px, 92%); background: rgba(20,22,28,0.92); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 14px; font-size: 13px; line-height: 1.5; color: #f0d9a0; text-align: center;
}
.anime-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; padding: 26px 16px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8)); color: #fff; transition: opacity 0.25s;
}
.anime-seek { position: relative; height: 18px; cursor: pointer; touch-action: none; display: flex; align-items: center; }
.anime-seek::before { content: ''; position: absolute; left: 0; right: 0; height: 4px; border-radius: 999px; background: rgba(255,255,255,0.22); transition: height 0.12s; }
.anime-seek:hover::before, .anime-seek.drag::before { height: 6px; }
.anime-seek-buf, .anime-seek-fill { position: absolute; left: 0; height: 4px; border-radius: 999px; pointer-events: none; transition: height 0.12s; }
.anime-seek:hover .anime-seek-buf, .anime-seek:hover .anime-seek-fill, .anime-seek.drag .anime-seek-buf, .anime-seek.drag .anime-seek-fill { height: 6px; }
.anime-seek-buf { background: rgba(255,255,255,0.32); width: 0; }
.anime-seek-fill { background: var(--accent); width: 0; }
.anime-seek-thumb { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--accent); left: 0; pointer-events: none; transform: scale(0); transition: transform 0.12s; }
.anime-seek:hover .anime-seek-thumb, .anime-seek.drag .anime-seek-thumb { transform: scale(1); }
.anime-seek-tip { position: absolute; bottom: 20px; transform: translateX(-50%); background: rgba(20,22,28,0.92); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; font-size: 12px; pointer-events: none; white-space: nowrap; }
.anime-marks { position: absolute; inset: 0; pointer-events: none; }
.anime-mark { position: absolute; top: 50%; width: 14px; height: 18px; margin: -12px 0 0 -7px; padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto; color: #ffc857; }
.anime-mark::after { content: ''; position: absolute; left: 5px; top: 1px; width: 4px; height: 12px; border-radius: 2px; background: currentColor; box-shadow: 0 0 4px rgba(0,0,0,0.8); }
.anime-mark:hover { color: #fff; }
.anime-bar-row { display: flex; align-items: center; gap: 6px; margin-top: 2px; flex-wrap: wrap; }
.anime-bar select { background: rgba(30,33,42,0.85); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; font-size: 12px; cursor: pointer; max-width: 190px; }
.anime-bar select:hover { border-color: var(--accent); }
.anime-bar button:disabled { opacity: 0.35; cursor: not-allowed; }
.anime-bar-gap { flex: 1; }
.anime-bar button { background: none; border: 0; color: #fff; font-size: 17px; cursor: pointer; padding: 4px 8px; border-radius: 6px; line-height: 1; }
.anime-bar button:hover { background: rgba(255,255,255,0.14); }
.anime-time { font-size: 13px; font-variant-numeric: tabular-nums; color: #e6e8ee; text-shadow: 0 1px 3px #000; }
.anime-vol { width: 80px; accent-color: var(--accent); }
.anime-bookmark-fab {
  position: absolute; right: 16px; bottom: 96px; z-index: 6; width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
  background: rgba(20,22,28,0.35); color: #fff; border: 1px solid rgba(255,255,255,0.28);
  opacity: 0.5; transition: opacity 0.25s, color 0.15s, background 0.15s; -webkit-tap-highlight-color: transparent;
}
.anime-bookmark-fab:hover, .anime-bookmark-fab:active { opacity: 1; background: rgba(20,22,28,0.6); }
.anime-stage.idle .anime-bookmark-fab { opacity: 0; pointer-events: none; }
.anime-bar .anime-skip { font-size: 13px; font-weight: 600; padding: 4px 6px; }
.anime-bookmark-fab.pop { opacity: 1 !important; color: #ffc857; animation: bookmark-pop 0.45s ease; }
.anime-bookmark-fab.pop path { fill: currentColor; }
@keyframes bookmark-pop { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 100% { transform: scale(1); } }
.anime-toast {
  position: absolute; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 6; pointer-events: none;
  background: rgba(20,22,28,0.92); border: 1px solid var(--border); border-radius: 999px; padding: 6px 16px; font-size: 13px; color: #fff;
}
.anime-primary-cue, .anime-secondary-cue {
  position: absolute;
  z-index: 4;
  bottom: 76px;
  left: 5%;
  right: 5%;
  max-width: none;
  color: #fff;
  font-weight: 600;
  line-height: 1.25;
  white-space: pre-line;
  text-shadow: 0 2px 3px #000, 0 0 5px #000;
  pointer-events: none;
  text-align: center;
}
.anime-primary-cue { bottom: var(--anime-primary-bottom, 76px); font-size: clamp(16px, 2.2vw, 30px); }
.anime-secondary-cue { bottom: var(--anime-secondary-bottom, 42px); font-size: clamp(12px, 1.55vw, 22px); }
.anime-primary-cue:empty, .anime-secondary-cue:empty { display: none; }
.anime-merged-cue {
  position: absolute; z-index: 4; left: 5%; right: 5%; bottom: var(--anime-merged-bottom, 42px);
  display: flex; flex-direction: column; align-items: center; gap: clamp(3px, 0.45vh, 8px);
  color: #fff; font-weight: 600; line-height: 1.2; text-align: center; white-space: pre-line;
  text-shadow: 0 2px 3px #000, 0 0 5px #000; pointer-events: none;
}
.anime-merged-cue.hidden, .anime-merged-cue:empty { display: none; }
.anime-merged-primary { font-size: clamp(17px, 2.25vw, 34px); }
.anime-merged-secondary { font-size: clamp(13px, 1.55vw, 23px); opacity: 0.96; }
.anime-merged-primary:empty, .anime-merged-secondary:empty { display: none; }
.anime-translate-sub { white-space: nowrap; }
.anime-translate-sub.is-running { color: #d9e3ff; border-color: #7d99fa; background: rgba(109,143,255,0.2); }
#subtitleTranslateModal { z-index: 500; }
.subtitle-translate-dialog { width: min(460px, 100%); }
.subtitle-translate-body { display: flex; flex-direction: column; gap: 14px; }
.subtitle-translate-body label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; }
.subtitle-translate-body select { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px; font-size: 13px; }
.subtitle-translate-progress { height: 7px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,0.1); }
.subtitle-translate-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #6d8fff, #8fb3ff); transition: width 0.25s ease; }
.anime-mark-menu {
  position: absolute; z-index: 7; transform: translateX(-50%); display: flex; align-items: center; gap: 6px;
  background: rgba(20,22,28,0.96); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; font-size: 13px; color: #fff;
}
.anime-mark-menu button { background: rgba(255,255,255,0.08); border: 0; color: #fff; border-radius: 6px; padding: 4px 8px; font-size: 13px; cursor: pointer; }
.anime-mark-menu button:hover { background: rgba(255,255,255,0.2); }
video::cue { font-size: 1.3em; background: rgba(0,0,0,0.55); }
@media (max-width: 640px) {
  .anime-top { flex-wrap: wrap; }
  .anime-top-title { flex-basis: 100%; order: -1; }
  .anime-vol { display: none; }
}

.sum-stats { font-size: 11px; color: var(--muted); margin-top: 6px; }

/* --- Cinema Room + dat ve --- */
.anime-box-actions { display: flex; gap: 8px; align-items: center; }
.anime-ticket-btn {
  background: transparent; color: #ffc857; border: 1px solid #ffc857; border-radius: 6px;
  padding: 8px 14px; font-size: 13px; cursor: pointer;
}
.anime-ticket-btn:hover { background: rgba(255,200,87,0.12); }
.ticket-dialog { width: min(520px, 100%); }
.ticket-row { display: flex; gap: 12px; align-items: baseline; margin: 6px 0; font-size: 13px; }
.ticket-row b { min-width: 120px; color: var(--muted); font-weight: 400; }
.ticket-lead { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bubble-bot); font-size: 13px; line-height: 1.6; }
.ticket-lead strong { color: #ffc857; }
.ticket-pick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.ticket-pick input, .ticket-pick select {
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 14px;
}
.ticket-msg { font-size: 12px; color: #f0a0a0; }
.ticket-msg.ok { color: #8fd6a0; }
.ticket-existing { padding: 10px 12px; border: 1px solid #ffc857; border-radius: 10px; font-size: 13px; line-height: 1.7; }

.panel#cinema { gap: 16px; }
/* Cinema Room khong tu cuon rieng: de trang cuon bang thanh cuon cua trinh duyet, thanh tab dinh o tren */
.app:has(#cinema.active) { height: auto; min-height: 100vh; }
.app:has(#cinema.active) header { position: sticky; top: 0; z-index: 20; background: var(--bg); }
.cinema-schedule { display: flex; flex-direction: column; gap: 18px; }
.cinema-day { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.cinema-show {
  display: flex; align-items: center; gap: 14px; padding: 10px 12px; margin-bottom: 8px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--panel);
}
.cinema-show.showing { border-color: #8fd6a0; }
.cinema-time { font-size: 20px; font-variant-numeric: tabular-nums; font-weight: 600; min-width: 64px; }
.cinema-cover { width: 44px; height: 62px; border-radius: 6px; object-fit: cover; background: var(--bubble-bot); flex: none; }
.cinema-info { flex: 1; min-width: 0; }
.cinema-title { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cinema-status { font-size: 12px; color: var(--muted); margin-top: 3px; }
.cinema-status.ok { color: #8fd6a0; }
.cinema-status.bad { color: #f0a0a0; }
.cinema-bar { height: 4px; border-radius: 999px; background: var(--bubble-bot); margin-top: 6px; overflow: hidden; }
.cinema-bar > i { display: block; height: 100%; background: var(--accent); }
.cinema-actions { display: flex; gap: 8px; flex: none; }
.cinema-actions button {
  background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; font-size: 13px; cursor: pointer;
}
.cinema-actions .watch { background: #2f9e5a; border-color: #2f9e5a; color: #fff; font-weight: 600; }
.cinema-actions button:disabled { opacity: 0.4; cursor: not-allowed; }
.cinema-count { margin-left: 6px; padding: 0 7px; border-radius: 999px; background: var(--bubble-bot); letter-spacing: 0; }
.cinema-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 16px; }
.cinema-grid.big { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.cinema-grid.small { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 12px; }
.cinema-grid.small .cinema-card-title { font-size: 12px; }
.cinema-grid.small .cinema-card-title-vi { font-size: 11px; }
.cinema-grid.small .cinema-badge, .cinema-grid.small .cinema-eps { font-size: 10px; }
.cinema-card { display: flex; flex-direction: column; gap: 8px; }
.cinema-card.late .cinema-poster, .cinema-card.error .cinema-poster { outline: 2px solid #e06c6c; outline-offset: -2px; }
.cinema-poster { cursor: pointer; position: relative; aspect-ratio: 2 / 3; border-radius: 8px; overflow: hidden; background: var(--bubble-bot); }
.cinema-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cinema-poster-empty { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 40px; opacity: 0.5; }
.cinema-card.ended .cinema-poster img { filter: grayscale(0.85) brightness(0.75); }
.cinema-badge { position: absolute; left: 6px; top: 6px; max-width: calc(100% - 12px); padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: rgba(15,17,23,0.85); color: #ffc857; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cinema-badge.live { background: #2f9e5a; color: #fff; }
.cinema-poster .cinema-bar { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; border-radius: 0; height: 5px; }
.cinema-eps { position: absolute; right: 6px; bottom: 12px; max-width: calc(100% - 12px); padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: rgba(15,17,23,0.85); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cinema-expiry { position: absolute; left: 6px; top: 32px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; color: #ffc857; background: rgba(15,17,23,0.85); }
.cinema-card-title { font-size: 14px; font-weight: 600; line-height: 1.3; overflow: hidden; white-space: nowrap; }
.cinema-card-names { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cinema-card-title-vi { color: var(--muted); font-size: 13px; font-weight: 400; }
.cinema-card-title > span { display: inline-block; }
/* Ten dai: mo dan o mep phai, chi chay khi re chuot vao (hoac cham giu tren di dong) */
.cinema-card-title.marquee:not(:hover) { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
.cinema-card-title.marquee:hover > span, .cinema-card-title.marquee:active > span { animation: cinema-marquee var(--dur, 8s) ease-in-out infinite alternate; }
@keyframes cinema-marquee { 0%, 10% { transform: translateX(0); } 90%, 100% { transform: translateX(var(--shift, 0)); } }
.cinema-card .cinema-status { margin-top: 0; line-height: 1.4; }
.cinema-card .cinema-actions { flex-wrap: wrap; margin-top: auto; }
.cinema-card .cinema-actions button { padding: 6px 10px; }
.cinema-card .cinema-actions .watch { flex: 1 1 100%; }
.cinema-note { font-size: 12px; color: var(--muted); line-height: 1.7; }

.ticket-note { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.6; }
.ticket-heavy { border-color: #f0a05a; }
.ticket-heavy .ticket-pick { align-items: center; }
.ticket-heavy select { max-width: 100%; }
.cinema-alerts { display: flex; flex-direction: column; gap: 10px; }
.cinema-alerts:empty { display: none; }
.cinema-alert {
  padding: 12px 14px; border: 1px solid #e06c6c; border-radius: 12px; background: rgba(224,108,108,0.1);
  font-size: 14px; line-height: 1.6; display: flex; flex-direction: column; gap: 10px;
}
.cinema-alert-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cinema-alert-actions button {
  background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; font-size: 13px; cursor: pointer;
}
.cinema-alert-actions .watch { background: #2f9e5a; border-color: #2f9e5a; color: #fff; font-weight: 600; }
.cinema-show.late, .cinema-show.error { border-color: #e06c6c; }
@media (max-width: 640px) {
  .cinema-grid.big { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .cinema-grid.small { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
  .cinema-show { flex-wrap: wrap; }
  .cinema-actions { width: 100%; justify-content: flex-end; }
  .anime-bookmark-fab { right: 12px; bottom: 92px; width: 56px; height: 56px; }
}
@media (max-width: 640px) {
  .anime-bar { padding: 22px 10px 8px; }
  .anime-seek { height: 30px; }
  .anime-bar button { padding: 9px 12px; font-size: 18px; }
  .anime-top button, .anime-top select { padding: 9px 12px; font-size: 14px; }
}
.novel-chapter.locked { opacity: 0.55; cursor: default; }
.ticket-remeasure { margin-left: 6px; color: var(--accent); font-size: 12px; white-space: nowrap; }

/* --- Trang gioi thieu Anime / Film kieu Netflix --- */
.tracking-view.tv-title .tracking-hero, .tracking-view.tv-title .tracking-info { display: none; }
.title-hero { position: relative; min-height: 420px; display: flex; align-items: flex-end; overflow: hidden; border-radius: 12px 12px 0 0; background: #0b0d12; }
.title-backdrop { position: absolute; inset: 0; background-size: cover; background-position: center 25%; }
.title-backdrop.blur { filter: blur(28px) brightness(0.55); transform: scale(1.15); }
.title-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(11,13,18,0.92) 0%, rgba(11,13,18,0.55) 45%, rgba(11,13,18,0.1) 100%), linear-gradient(0deg, var(--panel, #1b1f2b) 0%, transparent 38%); pointer-events: none; }
.title-hero-body { position: relative; z-index: 1; width: min(720px, 100%); padding: 120px 28px 26px; display: flex; flex-direction: column; gap: 12px; }
.title-hero-body h1 { margin: 0; font-size: 40px; line-height: 1.1; font-weight: 800; text-shadow: 0 2px 12px rgba(0,0,0,0.7); }
.title-metarow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; font-size: 14px; color: #d7dae3; }
.title-metarow .tm-score { color: #46d369; font-weight: 700; }
.title-metarow .tm-box { border: 1px solid rgba(255,255,255,0.45); padding: 0 6px; border-radius: 3px; font-size: 12px; }
.title-metarow .tm-mine { color: #ffc857; }
.title-genres { display: flex; flex-wrap: wrap; gap: 6px; }
.title-synopsis-box { display: flex; flex-direction: column; gap: 8px; }
.title-synopsis { margin: 0; font-size: 15px; line-height: 1.55; color: #e6e8ee; white-space: pre-line; text-shadow: 0 1px 8px rgba(0,0,0,0.8); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
.title-synopsis.expanded { display: block; -webkit-line-clamp: unset; }
.title-more { align-self: flex-start; background: none; border: 0; padding: 0; color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.title-more:hover { color: var(--accent); }
.title-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 6px; }
.title-actions .anime-box-actions { flex-wrap: wrap; }
.title-actions .novel-primary { font-size: 16px; padding: 10px 22px; }
.title-actions .anime-ticket-btn { padding: 10px 18px; font-size: 15px; }
.title-links { display: flex; flex-wrap: wrap; gap: 8px; }
.title-links a { padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,0.12); color: #fff; font-size: 12px; text-decoration: none; }
.title-links a:hover { background: rgba(255,255,255,0.24); }
.title-extra { padding: 6px 20px 16px; }
.title-info { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 24px; font-size: 14px; }
.title-info span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.title-cast { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.title-cast-item { flex: none; width: 92px; text-align: center; font-size: 12px; }
.title-cast-item img, .title-cast-empty { width: 92px; height: 92px; border-radius: 50%; object-fit: cover; background: var(--bubble-bot); display: block; margin-bottom: 6px; }
.tracking-view.tv-title .anime-box, .tracking-view.tv-title .novel-chapters { padding-left: 20px; }
@media (max-width: 720px) {
  .title-hero { min-height: 360px; }
  .title-hero-body { padding: 90px 16px 18px; }
  .title-hero-body h1 { font-size: 28px; }
}
.title-refresh-note { margin-left: 10px; font-size: 12px; color: var(--muted); }

/* --- Khung xuong (skeleton) khi chuyen phim --- */
@keyframes skel-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skel { display: block; border-radius: 6px; background: linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.14) 37%, rgba(255,255,255,0.06) 63%); background-size: 400% 100%; animation: skel-shimmer 1.4s ease infinite; }
.title-skel { display: none; flex-direction: column; gap: 14px; width: 100%; }
.title-hero.loading .title-hero-body > :not(.title-skel) { display: none; }
.title-hero.loading .title-skel { display: flex; }
.skel-title { height: 40px; width: 55%; }
.skel-row { height: 16px; width: 45%; }
.skel-chips { height: 24px; width: 30%; border-radius: 999px; }
.skel-line { height: 14px; width: 100%; }
.skel-line.short { width: 60%; }
.skel-btn { height: 42px; width: 140px; border-radius: 8px; margin-top: 6px; }
.skel-eps { display: flex; flex-direction: column; gap: 10px; padding: 8px 0; }
.skel-ep { height: 34px; width: 100%; }

/* Goi y cau hoi ve muc dang xem trong hop hoi dap */
.chat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chat-chips button { background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; font-size: 12px; cursor: pointer; }
.chat-chips button:hover { border-color: var(--accent); color: var(--accent); }

.anime-ep-nobook { margin-left: auto; font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; white-space: nowrap; align-self: center; }
.anime-ep-item:disabled { opacity: 0.4; cursor: not-allowed; }

.anime-sub-delay { color: var(--text); font-size: 12px; }
.anime-bar .anime-sub-delay { color: #fff; padding: 4px 8px; background: rgba(20,22,28,.9); border-radius: 6px; }
.anime-sub-delay summary { cursor: pointer; padding: 4px 0; }
.anime-sub-delay p { margin: 5px 0; max-width: 440px; }
.anime-sub-delay > div { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 0; }
.anime-sub-delay > div.hidden { display: none; }
.anime-sub-delay input { width: 76px; padding: 5px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 5px; }
.anime-sub-delay button { padding: 5px 7px; font-size: 12px; }
