/* ==========================================================================
   GOOGLE SHEETS PIXEL-PERFECT CLONE STYLES (MATERIAL DESIGN 3)
   ========================================================================== */

:root {
  --green-primary: #0f9d58;
  --green-hover: #0b8043;
  --sheets-blue: #1a73e8;
  --sheets-blue-light: #e8f0fe;
  --sheets-blue-hover: #d2e3fc;
  
  --sheet-border: #e0e2e6;
  --cell-border: #e1e3e1;
  --header-bg: #f8f9fa;
  --header-hover: #f1f3f4;
  --header-selected: #e8f0fe;
  
  --text-main: #1f1f1f;
  --text-muted: #5f6368;
  --text-header: #444746;
  
  --toolbar-bg: #edf2fa;
  --toolbar-btn-hover: #dfe4ec;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: "Roboto", Arial, sans-serif;
  font-size: 13px;
  color: var(--text-main);
  background: #f8f9fa;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ==========================================================================
   1. GOOGLE SHEETS HEADER (Logo, Doc title, Menu bar, Search, Actions)
   ========================================================================== */
.sheets-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 4px 16px;
  background: var(--white);
  border-bottom: 1px solid transparent;
  gap: 12px;
  user-select: none;
  height: 56px;
  box-sizing: border-box;
}

.header-right-actions {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 6px !important;
  margin-left: auto !important;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}

.header-right-actions > * {
  flex-shrink: 0 !important;
}

.sheets-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
}

.header-main-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Dòng tiêu đề tài liệu */
.doc-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
}

.doc-title-input {
  font-size: 18px;
  font-weight: 400;
  color: var(--text-main);
  border: 1px solid transparent;
  padding: 2px 6px;
  border-radius: 4px;
  width: 360px;
  outline: none;
  background: transparent;
  font-family: "Roboto", Arial, sans-serif;
}

.doc-title-input:hover {
  border-color: #dadce0;
}

.doc-title-input:focus {
  border-color: var(--sheets-blue);
  background: var(--white);
}

.icon-btn-compact {
  background: transparent;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn-compact:hover {
  background: #f1f3f4;
}

.save-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.save-status:hover {
  background: #f1f3f4;
}

.current-story-badge {
  font-size: 11px;
  color: #137333;
  background: #e6f4ea;
  padding: 2px 8px;
  border-radius: 10px;
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid #ceead6;
  font-weight: 500;
}

/* Thanh Menu 9 mục */
.menu-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 2px;
  white-space: nowrap;
}

.menu-item {
  font-size: 13px;
  color: #444746;
  padding: 3px 7px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.menu-item:hover {
  background: #f1f3f4;
}

/* Ô Ngụy trang Tìm kiếm trong bảng tính */
.search-box-disguised {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f3f4;
  border-radius: 24px;
  padding: 0 12px;
  height: 36px;
  width: 320px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.search-box-disguised:focus-within {
  background: #fff;
  border-color: #dadce0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.search-box-disguised input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text-main);
  width: 100%;
}

.quick-search-btn {
  background: var(--green-primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.quick-search-btn:hover {
  background: var(--green-hover);
}

/* Khu vực hành động bên phải */
.theme-switch-btn,
.circle-icon-btn,
.boss-key-btn,
.share-btn,
.user-avatar,
.mobile-touch-btn {
  user-select: none;
  cursor: pointer;
}

.theme-switch-btn *,
.circle-icon-btn *,
.boss-key-btn *,
.share-btn *,
.mobile-touch-btn * {
  pointer-events: none;
}

.theme-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f3f4;
  color: #1a73e8;
  border: 1px solid #dadce0;
  border-radius: 18px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.theme-switch-btn:hover {
  background: #e8f0fe;
  border-color: #1a73e8;
}

#btn-switch-theme-sheets > svg,
#btn-switch-theme-gmail > svg {
  display: none;
}

#btn-switch-theme-sheets::before,
#btn-switch-theme-gmail::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h4v4H4V4zm6 0h4v4h-4V4zm6 0h4v4h-4V4zM4 10h4v4H4v-4zm6 0h4v4h-4v-4zm6 0h4v4h-4v-4zM4 16h4v4H4v-4zm6 0h4v4h-4v-4zm6 0h4v4h-4v-4z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h4v4H4V4zm6 0h4v4h-4V4zm6 0h4v4h-4V4zM4 10h4v4H4v-4zm6 0h4v4h-4v-4zm6 0h4v4h-4v-4zM4 16h4v4H4v-4zm6 0h4v4h-4v-4zm6 0h4v4h-4v-4z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.circle-icon-btn {
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.circle-icon-btn:hover {
  background: #f1f3f4;
}

.boss-key-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #fce8e6;
  color: #c5221f;
  border: 1px solid #f5c2c7;
  border-radius: 18px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.boss-key-btn:hover {
  background: #fad2cf;
}

.share-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #c2e7ff;
  color: #001d35;
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.share-btn:hover {
  background: #b3d7f0;
}

.user-avatar {
  width: 34px;
  height: 34px;
  background: #0b57d0;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

/* ==========================================================================
   2. THANH CÔNG CỤ TOOLBAR (Floating Pill Material 3)
   ========================================================================== */
.sheets-toolbar {
  display: flex;
  align-items: center;
  background: var(--toolbar-bg);
  border-radius: 24px;
  margin: 2px 16px 4px 16px;
  padding: 3px 8px;
  height: 38px;
  gap: 3px;
  user-select: none;
}

.tool-btn {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.1s ease;
}

.tool-btn:hover {
  background: var(--toolbar-btn-hover);
}

.tool-dropdown-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 14px;
  font-size: 12px;
  color: var(--text-header);
  cursor: pointer;
}

.tool-dropdown-pill:hover {
  background: var(--toolbar-btn-hover);
}

.toolbar-sep {
  width: 1px;
  height: 18px;
  background: #c7c7c7;
  margin: 0 4px;
}

.reading-hint-badge {
  margin-left: auto;
  font-size: 11px;
  color: #444746;
  background: rgba(255, 255, 255, 0.6);
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   3. THANH CÔNG THỨC FORMULA BAR (Name Box, fx, Input)
   ========================================================================== */
.formula-bar {
  display: flex;
  align-items: center;
  background: var(--white);
  border-top: 1px solid var(--sheet-border);
  border-bottom: 1px solid var(--sheet-border);
  height: 28px;
  padding: 0 8px;
  gap: 6px;
  user-select: none;
}

.name-box-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 64px;
  height: 22px;
  border: 1px solid #dadce0;
  border-radius: 2px;
  padding: 0 4px;
  background: var(--white);
  cursor: pointer;
}

.name-box {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  text-align: center;
  flex: 1;
}

.fx-symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 22px;
  color: #5f6368;
}

.fx-text {
  font-family: "Georgia", serif;
  font-style: italic;
  font-size: 14px;
  font-weight: bold;
}

.formula-input {
  flex: 1;
  height: 22px;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--text-main);
  background: transparent;
  font-family: "Roboto", Arial, sans-serif;
  padding: 0 4px;
}

.formula-expand-btn {
  background: transparent;
  border: none;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 2px;
}

.formula-expand-btn:hover {
  background: #f1f3f4;
}

/* ==========================================================================
   4. LƯỚI BẢNG TÍNH SPREADSHEET GRID
   ========================================================================== */
.grid-wrapper {
  flex: 1;
  display: grid;
  grid-template-columns: 46px 1fr;
  grid-template-rows: 24px 1fr;
  overflow: hidden;
  background: var(--white);
  position: relative;
}

/* Ô góc trên cùng bên trái (Select All) */
.corner-cell {
  background: var(--header-bg);
  border-right: 1px solid var(--sheet-border);
  border-bottom: 1px solid var(--sheet-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.select-all-triangle {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 8px 8px;
  border-color: transparent transparent #5f6368 transparent;
  opacity: 0.5;
}

.col-headers {
  display: flex;
  background: var(--header-bg);
  border-bottom: 1px solid var(--sheet-border);
  overflow: hidden;
  user-select: none;
}

.col-header {
  flex-shrink: 0;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--sheet-border);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-header);
  background: var(--header-bg);
  cursor: pointer;
  transition: background 0.1s ease;
}

.col-header:hover {
  background: var(--header-hover);
}

.col-header.selected {
  background: var(--sheets-blue-light) !important;
  color: var(--sheets-blue) !important;
  font-weight: 700;
}

.row-headers {
  display: flex;
  flex-direction: column;
  background: var(--header-bg);
  border-right: 1px solid var(--sheet-border);
  overflow: hidden;
  user-select: none;
}

.row-header {
  flex-shrink: 0;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--sheet-border);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-header);
  background: var(--header-bg);
  cursor: pointer;
  transition: background 0.1s ease;
}

.row-header:hover {
  background: var(--header-hover);
}

.row-header.selected {
  background: var(--sheets-blue-light) !important;
  color: var(--sheets-blue) !important;
  font-weight: 700;
}

.grid-cells {
  overflow: auto;
  position: relative;
  background: var(--white);
}

.grid-row {
  display: flex;
  height: 24px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--cell-border);
}

.grid-cell {
  flex-shrink: 0;
  height: 24px;
  box-sizing: border-box;
  border-right: 1px solid var(--cell-border);
  padding: 3px 6px;
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: cell;
  user-select: none;
  position: relative;
}

/* ==========================================================================
   CHẾ ĐỘ XUỐNG DÒNG TỰ ĐỘNG (WRAP TEXT) CHO Ô EXCEL
   Khi nội dung dài, hàng tự động co giãn và text xuống nhiều dòng mượt mà
   ========================================================================== */
.grid-cells.wrap-text .grid-row {
  min-height: 24px;
  height: auto;
  align-items: stretch;
}

.grid-cells.wrap-text .grid-cell {
  min-height: 24px;
  height: auto;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  text-overflow: clip;
}

/* Riêng cột A (nội dung câu văn truyện): căn trái 100%, text nhiều dòng hiển thị tự nhiên */
.grid-cells.wrap-text .grid-cell.col-A,
.grid-cell.col-A {
  display: block !important;
  text-align: left !important;
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  line-height: 21px !important;
  padding: 6px 12px !important;
}

/* Các cột kế toán phụ: căn chỉnh vị trí đẹp mắt khi hàng cao lên */
.grid-cells.wrap-text .grid-cell.col-B,
.grid-cells.wrap-text .grid-cell.col-C {
  display: flex;
  align-items: center;
  justify-content: center;
}

.grid-cells.wrap-text .grid-cell.col-E,
.grid-cells.wrap-text .grid-cell.col-F,
.grid-cells.wrap-text .grid-cell.col-G {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* Nút công cụ trạng thái Active trên thanh Toolbar */
.tool-btn.active {
  background: #e8f0fe !important;
  color: var(--sheets-blue) !important;
}
.tool-btn.active svg {
  fill: var(--sheets-blue) !important;
}

/* Ô được chọn (Active Cell) với viền xanh 2px */
.grid-cell.selected {
  outline: 2px solid var(--sheets-blue);
  outline-offset: -2px;
  background: rgba(26, 115, 232, 0.04);
  z-index: 10;
}

/* Chấm vuông kéo công thức (Fill Handle) đặc trưng của Google Sheets / Excel */
.grid-cell.selected::after {
  content: "";
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 6px;
  height: 6px;
  background: var(--sheets-blue);
  border: 1px solid var(--white);
  cursor: crosshair;
  z-index: 20;
}

/* Kích thước & Căn chỉnh các cột ngụy trang */
.col-A { width: 850px; font-weight: 400; color: #1f1f1f; text-align: left !important; font-size: 13.5px; line-height: 1.55; padding: 6px 12px !important; } /* Nội dung truyện căn trái */
.col-B { width: 130px; text-align: center; font-size: 11px; }
.col-C { width: 130px; text-align: center; font-size: 11px; }
.col-D { width: 140px; text-align: center; font-size: 11px; color: var(--text-muted); }
.col-E { width: 130px; text-align: right; font-variant-numeric: tabular-nums; }
.col-F { width: 130px; text-align: right; font-variant-numeric: tabular-nums; }
.col-G { width: 130px; text-align: right; font-variant-numeric: tabular-nums; }

/* ==========================================================================
   5. THANH SHEET TABS Ở ĐÁY (Mỗi chương là 1 tab trang tính)
   ========================================================================== */
.sheets-bottom-bar {
  display: flex;
  align-items: center;
  background: #f8f9fa;
  border-top: 1px solid var(--sheet-border);
  height: 38px;
  padding: 0 8px;
  gap: 4px;
  user-select: none;
}

.add-sheet-btn, .all-sheets-btn, .sheet-nav-arrow {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.add-sheet-btn:hover, .all-sheets-btn:hover, .sheet-nav-arrow:hover:not(:disabled) {
  background: #e8eaed;
}

.sheet-nav-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.sheet-tabs-list {
  display: flex;
  align-items: flex-end;
  height: 100%;
  overflow-x: auto;
  gap: 2px;
  padding-bottom: 2px;
}

/* Từng Sheet Tab */
.sheet-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 14px 0 16px;
  background: #e9ecef;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  border: 1px solid var(--sheet-border);
  border-bottom: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  position: relative;
}

.sheet-tab:hover {
  background: #dee2e6;
  color: var(--text-main);
}

/* Tab đang kích hoạt (Active) */
.sheet-tab.active {
  background: var(--white);
  color: var(--green-primary);
  font-weight: 700;
  box-shadow: 0 -1px 3px rgba(0,0,0,0.06);
}

/* Đường vạch màu dưới đáy tab trang tính chuẩn Google Sheets */
.sheet-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--green-primary);
}

.sheet-tab-arrow {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 4px 3px 0 3px;
  border-color: #5f6368 transparent transparent transparent;
  margin-left: 2px;
}

/* Tab gợi ý chương tiếp theo */
.sheet-tab.next-preview-tab {
  color: var(--sheets-blue);
  font-style: italic;
  border-style: dashed;
  background: #f1f5fd;
}

.sheet-tab.next-preview-tab:hover {
  background: #e4edfd;
}

.bottom-bar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.calc-status {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.explore-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--white);
  border: 1px solid #dadce0;
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #1a73e8;
  cursor: pointer;
}

.explore-btn:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* ==========================================================================
   6. MODAL TÌM KIẾM TRUYỆN (VLOOKUP Assistant)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-dialog {
  background: var(--white);
  width: 720px;
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 8px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--sheet-border);
  background: #f8f9fa;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.search-input-group {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.search-input {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid #dadce0;
  border-radius: 6px;
  outline: none;
}

.search-input:focus {
  border-color: var(--green-primary);
  box-shadow: 0 0 0 2px rgba(15, 157, 88, 0.2);
}

.modal-btn {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

.primary-btn { background: var(--green-primary); color: #fff; }
.primary-btn:hover { background: var(--green-hover); }

.secondary-btn { background: #f1f3f4; color: var(--text-main); border: 1px solid #dadce0; }
.secondary-btn:hover { background: #e8eaed; }

.modal-status {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  min-height: 20px;
}

.section-heading {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.story-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
}

.story-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--sheet-border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.story-item:hover {
  border-color: var(--green-primary);
  background: #f6fdf8;
}

.story-name {
  font-size: 14px;
  font-weight: 600;
  color: #1a73e8;
  margin-bottom: 4px;
}

.story-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.story-tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.tag-full { background: #e6f4ea; color: #137333; }
.tag-hot { background: #fce8e6; color: #c5221f; }

.chapters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.selected-story-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.chapter-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  max-height: 380px;
  overflow-y: auto;
}

.chapter-item {
  padding: 8px 12px;
  border: 1px solid var(--sheet-border);
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #fff;
}

.chapter-item:hover {
  background: #e8f0fe;
  border-color: #1a73e8;
  color: #1a73e8;
}

/* Trạng thái khi vừa bấm sao chép liên kết chia sẻ */
.share-btn.copied {
  background: #e6f4ea !important;
  color: #137333 !important;
  border: 1px solid #ceead6 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}


/* --- Source Filter Tabs trong Modal Tìm kiếm --- */
.source-filter-group {
  display: flex;
  gap: 8px;
  margin: 10px 0 12px 0;
  flex-wrap: wrap;
}
.source-tab {
  background: #f1f3f4;
  border: 1px solid #dadce0;
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #3c4043;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}
.source-tab:hover {
  background: #e8eaed;
}
.source-tab.active {
  background: #0f9d58;
  border-color: #0f9d58;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 157, 88, 0.3);
}
.ws-search-overlay {
  background: rgba(32, 33, 36, 0.38);
  backdrop-filter: blur(4px);
  padding: 20px;
}

.ws-search-dialog {
  width: min(760px, 100%);
  max-width: 100%;
  max-height: min(88vh, 820px);
  border: 1px solid #e8eaed;
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(60, 64, 67, 0.24);
}

.ws-search-header {
  min-height: 64px;
  padding: 14px 22px;
  background: #ffffff;
}

.ws-search-header .modal-title {
  gap: 12px;
  color: #202124;
  font-size: 18px;
  letter-spacing: 0;
}

.ws-search-title-icon {
  flex: 0 0 auto;
  color: #1a73e8;
}

.ws-search-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.ws-search-close:hover {
  background: #f1f3f4;
  color: #202124;
}

.ws-search-body {
  padding: 20px 24px 24px;
}

.ws-search-description {
  margin: 0 0 14px;
  color: #5f6368;
  font-size: 13px;
  line-height: 1.5;
}

.ws-search-input-group {
  gap: 10px;
  margin-bottom: 12px;
}

.ws-search-input {
  min-width: 0;
  min-height: 46px;
  padding: 11px 16px;
  border-color: #dadce0;
  border-radius: 10px;
  color: #202124;
  background: #ffffff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.ws-search-input:focus {
  border-color: #1a73e8;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.14);
}

.ws-search-submit {
  min-width: 104px;
  border-radius: 10px;
  background: #1a73e8;
  font-weight: 600;
}

.ws-search-submit:hover {
  background: #1765cc;
}

#search-modal .source-filter-group {
  gap: 8px;
  margin: 0 0 14px;
}

#search-modal .source-tab {
  padding: 7px 13px;
  border-color: #dadce0;
  border-radius: 18px;
  color: #3c4043;
  background: #ffffff;
  font-size: 12px;
}

#search-modal .source-tab:hover {
  background: #f8f9fa;
  border-color: #c4c7c5;
}

#search-modal .source-tab.active {
  border-color: #d2e3fc;
  color: #1967d2;
  background: #e8f0fe;
  box-shadow: none;
}

.ws-search-status {
  min-height: 0;
  margin: 2px 0 12px;
  color: #5f6368;
  line-height: 1.5;
}

.ws-search-section-heading {
  margin: 8px 0 10px;
  color: #5f6368;
  font-size: 11px;
  letter-spacing: 0.06em;
}

#search-modal .story-list,
#search-modal .chapter-list {
  max-height: min(42vh, 380px);
  padding: 1px 3px 3px 1px;
}

#search-modal .story-item {
  gap: 14px;
  padding: 14px 16px;
  border-color: #e8eaed;
  border-radius: 12px;
  background: #ffffff;
}

#search-modal .story-item:hover {
  border-color: #c2dbff;
  background: #f8fbff;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.12);
}

#search-modal .story-name {
  color: #202124;
  line-height: 1.45;
}

#search-modal .story-meta {
  line-height: 1.5;
}

#search-modal .chapters-header {
  gap: 14px;
}

#search-modal .selected-story-title {
  overflow: hidden;
  color: #202124;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#search-modal .chapter-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

#search-modal .chapter-item {
  min-width: 0;
  padding: 10px 12px;
  border-color: #e8eaed;
  border-radius: 8px;
  background: #ffffff;
}

#search-modal .chapter-item:hover {
  border-color: #c2dbff;
  color: #1967d2;
  background: #f8fbff;
}

#search-modal .secondary-btn {
  border-radius: 8px;
  font-weight: 600;
}

@media (max-width: 600px) {
  .ws-search-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .ws-search-dialog {
    width: 100%;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
  }

  .ws-search-body {
    padding: 16px;
  }

  .ws-search-input-group {
    flex-direction: column;
  }

  .ws-search-submit {
    min-height: 44px;
  }

  #search-modal .story-item {
    align-items: flex-start;
    flex-direction: column;
  }

  #search-modal .chapter-list {
    grid-template-columns: minmax(0, 1fr);
  }
}
.story-tag.tag-s1 {
  background: #e8f0fe;
  color: #1a73e8;
  border: 1px solid #c8dafc;
}
.story-tag.tag-s2 {
  background: #e6f4ea;
  color: #137333;
  border: 1px solid #ceead6;
}
/* ==========================================================================
   HỆ THỐNG ĐA GIAO DIỆN NGỤY TRANG (MULTI-DISGUISE THEMES)
   1. Google Sheets (Mặc định)
   2. Gmail Web (Clone 100% Hộp thư Google)
   3. Zalo Web (Clone 100% Ứng dụng chat Zalo)
   ========================================================================== */

/* Ẩn hiện các view theo theme */
.theme-view {
  display: none !important;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.theme-view.active {
  display: flex !important;
  flex-direction: column;
}

/* Nút đổi giao diện trên Header (Disguised Template Switcher) */
.theme-switch-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f3f4;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 18px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.theme-switch-btn:hover {
  background: #e8eaed;
  border-color: #bdc1c6;
}

/* ==========================================================================
   A. GIAO DIỆN GMAIL WEB (CLONE 100%)
   ========================================================================== */
.gmail-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #f6f8fc;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #1f1f1f;
}

/* Header Gmail */
.gmail-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: #f6f8fc;
  border-bottom: 1px solid transparent;
}

.gmail-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 240px;
}

.gmail-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #444746;
  font-size: 22px;
  font-weight: 400;
}

.gmail-search-bar {
  flex: 1;
  max-width: 720px;
  height: 48px;
  background: #eaf1fb;
  border-radius: 24px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  transition: all 0.2s;
}

.gmail-search-bar:focus-within {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.gmail-search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 15px;
  color: #1f1f1f;
}

.gmail-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Thân Gmail (Sidebar + Content) */
.gmail-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Sidebar Gmail */
.gmail-sidebar {
  width: 256px;
  padding: 12px 12px 0 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gmail-compose-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #c2e7ff;
  color: #001d35;
  border: none;
  border-radius: 16px;
  padding: 0 24px;
  height: 56px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  width: fit-content;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  transition: box-shadow 0.2s;
}

.gmail-compose-btn:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.gmail-menu-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gmail-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 24px;
  height: 32px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
  color: #444746;
  cursor: pointer;
  transition: background 0.1s;
}

.gmail-menu-item:hover {
  background: #eaebef;
}

.gmail-menu-item.active {
  background: #d3e3fd;
  color: #001d35;
  font-weight: 700;
}

.gmail-menu-item-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Khung đọc thư Gmail (Email Reading View) */
.gmail-main {
  flex: 1;
  background: #ffffff;
  border-radius: 16px;
  margin: 0 16px 16px 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(60,64,67,0.1);
}

.gmail-toolbar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid #f1f3f4;
}

.gmail-email-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
}

.gmail-email-subject {
  font-size: 22px;
  font-weight: 400;
  color: #1f1f1f;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.gmail-tag-inbox {
  background: #ddf3e4;
  color: #0d652d;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.gmail-sender-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.gmail-sender-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gmail-sender-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #1a73e8;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.gmail-sender-name {
  font-size: 14px;
  font-weight: 700;
  color: #1f1f1f;
}

.gmail-sender-email {
  font-size: 12px;
  color: #5f6368;
}

.gmail-email-body {
  font-size: 14px;
  line-height: 1.7;
  color: #202124;
}

.gmail-email-body p {
  margin-bottom: 14px;
  text-align: justify;
}

.gmail-email-nav-footer {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==========================================================================
   B. GIAO DIỆN ZALO WEB (CLONE 100%)
   ========================================================================== */
.zalo-container {
  display: flex;
  width: 100%;
  height: 100%;
  background: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #081c36;
}

/* Cột Navigation Zalo bên trái nhất (64px) */
.zalo-nav {
  width: 64px;
  height: 100%;
  background: #0068ff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}

.zalo-nav-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.zalo-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  background: #004ecc;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}

.zalo-nav-item {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  opacity: 0.75;
  cursor: pointer;
  transition: all 0.15s;
}

.zalo-nav-item:hover, .zalo-nav-item.active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.18);
}

#btn-switch-theme-zalo > svg {
  display: none;
}

#btn-switch-theme-zalo::before {
  content: "";
  width: 24px;
  height: 24px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h4v4H4V4zm6 0h4v4h-4V4zm6 0h4v4h-4V4zM4 10h4v4H4v-4zm6 0h4v4h-4v-4zm6 0h4v4h-4v-4zM4 16h4v4H4v-4zm6 0h4v4h-4v-4zm6 0h4v4h-4v-4z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h4v4H4V4zm6 0h4v4h-4V4zm6 0h4v4h-4V4zM4 10h4v4H4v-4zm6 0h4v4h-4v-4zm6 0h4v4h-4v-4zM4 16h4v4H4v-4zm6 0h4v4h-4v-4zm6 0h4v4h-4v-4z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Cột danh sách hội thoại Zalo (340px) */
.zalo-conversations {
  width: 340px;
  height: 100%;
  border-right: 1px solid #e1e4ea;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.zalo-search-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #f0f2f5;
}

.zalo-search-input-wrapper {
  flex: 1;
  height: 32px;
  background: #eaedf0;
  border-radius: 16px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
}

.zalo-search-input-wrapper input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
}

.zalo-chat-list {
  flex: 1;
  overflow-y: auto;
}

.zalo-chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid #f6f7f9;
}

.zalo-chat-item:hover {
  background: #f3f5f8;
}

.zalo-chat-item.active {
  background: #e5efff;
}

.zalo-chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #129af6;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.zalo-chat-info {
  flex: 1;
  min-width: 0;
}

.zalo-chat-name {
  font-size: 14px;
  font-weight: 600;
  color: #081c36;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zalo-chat-preview {
  font-size: 12px;
  color: #72808e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
}

/* Khung Chat chính của Zalo */
.zalo-chat-panel {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #eef0f3;
}

.zalo-chat-header {
  height: 64px;
  background: #ffffff;
  border-bottom: 1px solid #e1e4ea;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.zalo-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.zalo-chat-messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.zalo-message-bubble {
  max-width: 75%;
  background: #ffffff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  color: #081c36;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  word-break: break-word;
}

.zalo-sender-label {
  font-size: 11px;
  font-weight: 700;
  color: #0068ff;
  margin-bottom: 4px;
}

.zalo-chat-footer {
  background: #ffffff;
  border-top: 1px solid #e1e4ea;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.zalo-chat-toolbar-icons {
  display: flex;
  align-items: center;
  gap: 16px;
  color: #72808e;
}

.zalo-input-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.zalo-input-box input {
  flex: 1;
  height: 38px;
  border: 1px solid #e1e4ea;
  border-radius: 8px;
  padding: 0 12px;
  outline: none;
  font-size: 14px;
}

/* ==========================================================================
   C. MODAL CHỌN GIAO DIỆN NGỤY TRANG (THEME SELECTOR MODAL)
   ========================================================================== */
.theme-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease-out;
}

.theme-modal-card {
  background: #ffffff;
  border-radius: 16px;
  width: 880px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px 28px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
}

.theme-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f3f4;
}

.theme-modal-title {
  font-size: 19px;
  font-weight: 700;
  color: #1f1f1f;
}

.theme-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.theme-option-item {
  border: 2px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #fbfbfb;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.theme-option-item:hover {
  border-color: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
  background: #ffffff;
}

.theme-option-item.selected {
  border-color: #0b8043;
  background: #f0fdf4;
  box-shadow: 0 0 0 1px #0b8043;
}

.theme-preview-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px auto;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.theme-option-details {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.theme-option-name {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

/* Huy hiệu Không quảng cáo nổi bật trong modal */
.theme-badge-noads {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  color: #047857;
  background: #d1fae5;
  border: 1px solid #6ee7b7;
  padding: 1px 7px;
  border-radius: 999px;
  letter-spacing: 0.2px;
  box-shadow: 0 1px 2px rgba(16, 185, 129, 0.15);
}

.theme-option-desc {
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.45;
}

/* ==========================================================================
   HOTKEY GUIDE MODAL (BẢNG TRA CỨU PHÍM TẮT NGỤY TRANG & THOÁT HIỂM)
   ========================================================================== */
.hotkey-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 10001;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease-out;
}

.hotkey-modal-card {
  background: #ffffff;
  border-radius: 16px;
  width: 780px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px 32px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.25);
  box-sizing: border-box;
}

.hotkey-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e0e0e0;
}

.hotkey-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a73e8;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hotkey-section {
  margin-bottom: 22px;
}

.hotkey-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #5f6368;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

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

.hotkey-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8f9fa;
  border: 1px solid #e8eaed;
  border-radius: 8px;
  padding: 10px 14px;
  transition: all 0.15s ease;
}

.hotkey-item:hover {
  background: #f1f3f4;
  border-color: #dadce0;
}

.hotkey-item.danger {
  background: #fef7f6;
  border-color: #fad2cf;
}
.hotkey-item.danger:hover {
  background: #fce8e6;
}

.hotkey-desc {
  font-size: 13px;
  color: #3c4043;
  font-weight: 500;
}

.hotkey-keys {
  display: flex;
  align-items: center;
  gap: 4px;
}

.hotkey-keys span {
  font-size: 11px;
  color: #70757a;
}

kbd {
  display: inline-block;
  padding: 4px 8px;
  font-size: 11px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
  font-weight: 700;
  line-height: 1;
  color: #3c4043;
  background-color: #ffffff;
  border: 1px solid #c6c9cc;
  border-radius: 5px;
  box-shadow: 0 2px 0 #c6c9cc;
  white-space: nowrap;
}

.hotkey-notice {
  background: #e8f0fe;
  border-left: 4px solid #1a73e8;
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 12.5px;
  color: #174ea6;
  line-height: 1.5;
  margin-top: 18px;
}

/* ==========================================================================
   RESPONSIVE DESIGN CHO GIAO DIỆN DI ĐỘNG (MOBILE & TABLET: <= 768px, <= 480px)
   Áp dụng đồng bộ cho cả 3 nền tảng: Google Sheets, Gmail Web, Zalo Web
   ========================================================================== */

/* ==========================================================================
   RESPONSIVE DESIGN CHO GIAO DIỆN DI ĐỘNG (MOBILE & TABLET: <= 768px, <= 480px)
   Áp dụng đồng bộ cho cả 3 nền tảng: Google Sheets, Gmail Web, Zalo Web
   ========================================================================== */

@media (max-width: 768px) {
  /* ------------------------------------------------------------------------
     1. TỔNG QUAN & BODY
     ------------------------------------------------------------------------ */
  body {
    overflow-x: hidden !important;
    -webkit-tap-highlight-color: transparent;
  }

  /* ------------------------------------------------------------------------
     2. GOOGLE SHEETS TRÊN MOBILE (KHẮC PHỤC TRIỆT ĐỂ ĐÈ HEADER & BỎ CỘT STT THỪA)
     ------------------------------------------------------------------------ */
  /* Ẩn hoàn toàn các phần tử rườm rà trên Mobile */
  #view-sheets .menu-bar,
  #view-sheets .sheets-toolbar,
  #view-sheets .star-btn,
  #view-sheets .move-btn,
  #view-sheets .save-status,
  #view-sheets .current-story-badge,
  #view-sheets .reading-hint-badge,
  #view-sheets .share-btn,
  #view-sheets .user-avatar,
  #view-sheets .circle-icon-btn[title="Lịch sử phiên bản"],
  #view-sheets .circle-icon-btn[title="Mở bảng lịch sử nhận xét"] {
    display: none !important;
  }

  /* Header Google Sheets: 1 hàng duy nhất cao 46px, không bao giờ đè nhau */
  #view-sheets .sheets-header {
    height: 46px !important;
    padding: 0 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: #ffffff !important;
    border-bottom: 1px solid #e0e2e6 !important;
    overflow: hidden !important;
    gap: 6px !important;
  }

  #view-sheets .header-main-info {
    flex: 1 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
  }

  #view-sheets .doc-title-row {
    height: auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 0 !important;
    flex: 1 !important;
    min-width: 0 !important;
  }

  #view-sheets .sheets-logo svg {
    width: 24px !important;
    height: 24px !important;
    flex-shrink: 0 !important;
  }

  #view-sheets .doc-title-input {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #1f1f1f !important;
    width: 100% !important;
    max-width: 150px !important;
    padding: 2px 4px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    border: none !important;
    background: transparent !important;
  }

  #view-sheets .header-right-actions {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
  }

  /* Các nút hành động trên Header: thu gọn thành icon tròn nhỏ */
  #view-sheets .theme-switch-btn span,
  #view-sheets .boss-key-btn span {
    display: none !important; /* Ẩn chữ */
  }

  #view-sheets .theme-switch-btn {
    padding: 6px !important;
    min-width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #view-sheets .boss-key-btn {
    padding: 6px !important;
    min-width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #view-sheets .circle-icon-btn {
    width: 32px !important;
    height: 32px !important;
  }

  /* Thanh công thức fx trên mobile */
  #view-sheets .formula-bar {
    height: 36px !important;
    padding: 0 6px !important;
    background: #ffffff !important;
    border-bottom: 1px solid #e0e2e6 !important;
    display: flex !important;
    align-items: center !important;
  }

  #view-sheets .name-box {
    width: 36px !important;
    font-size: 11px !important;
    padding: 2px 4px !important;
  }

  #view-sheets .formula-input {
    font-size: 13px !important;
    color: #444746 !important;
  }

  /* LƯỚI BẢNG TÍNH: BỎ CỘT STT THÊM VÀO, DÙNG TRỰC TIẾP ROW HEADER 1, 2, 3... CỦA GOOGLE SHEETS */
  #view-sheets .row-header {
    width: 36px !important;
    min-width: 36px !important;
    font-size: 11px !important;
    color: #5f6368 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Cột A chứa trực tiếp nội dung truyện: Chiếm trọn 100% bề ngang còn lại */
  #view-sheets .column-headers .col-header:nth-child(1) {
    width: calc(100vw - 38px) !important;
    min-width: calc(100vw - 38px) !important;
    font-size: 12px !important;
    text-align: left !important;
    padding-left: 10px !important;
  }

  #view-sheets .cell-item[data-col="A"] {
    width: calc(100vw - 38px) !important;
    min-width: calc(100vw - 38px) !important;
    font-size: 15px !important;
    line-height: 1.65 !important;
    padding: 10px 12px !important;
    color: #1f1f1f !important;
    word-break: break-word !important;
    white-space: pre-wrap !important;
  }

  /* ẨN TOÀN BỘ CÁC CỘT PHỤ B, C, D, E, F TRÊN MOBILE */
  #view-sheets .column-headers .col-header:nth-child(n+2),
  #view-sheets .cell-item[data-col="B"],
  #view-sheets .cell-item[data-col="C"],
  #view-sheets .cell-item[data-col="D"],
  #view-sheets .cell-item[data-col="E"],
  #view-sheets .cell-item[data-col="F"],
  #view-sheets .cell-item[data-col="G"] {
    display: none !important;
  }

  /* Thanh Tab dưới đáy */
  #view-sheets .sheets-bottom-bar {
    height: 42px !important;
    padding: 0 6px !important;
  }

  #view-sheets .sheet-tab {
    padding: 0 10px !important;
    font-size: 12px !important;
    max-width: 130px !important;
  }

  /* ------------------------------------------------------------------------
     3. GMAIL WEB TRÊN MOBILE
     ------------------------------------------------------------------------ */
  .gmail-sidebar {
    display: none !important;
  }

  .gmail-header {
    height: 52px !important;
    padding: 0 10px !important;
    gap: 8px !important;
  }

  .gmail-logo {
    min-width: auto !important;
  }

  .gmail-logo span {
    display: none !important;
  }

  .gmail-search-box {
    max-width: none !important;
    flex: 1 !important;
    height: 38px !important;
  }

  .gmail-search-box span {
    font-size: 12px !important;
  }

  .gmail-header-right {
    min-width: auto !important;
    gap: 4px !important;
  }

  .gmail-header-right .theme-switch-btn span {
    display: none !important;
  }

  .gmail-header-right .theme-switch-btn {
    padding: 6px 8px !important;
    border-radius: 50% !important;
    min-width: 32px !important;
    height: 32px !important;
    justify-content: center !important;
  }

  .gmail-content-area {
    padding: 12px 10px !important;
  }

  .gmail-email-subject {
    font-size: 17px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
    margin-bottom: 16px !important;
  }

  .gmail-sender-card {
    padding: 10px 0 !important;
  }

  .gmail-email-body {
    font-size: 15px !important;
    line-height: 1.65 !important;
  }

  .gmail-email-body p {
    margin-bottom: 14px !important;
  }

  .gmail-toolbar-right {
    display: none !important;
  }

  /* ------------------------------------------------------------------------
     4. ZALO WEB TRÊN MOBILE
     ------------------------------------------------------------------------ */
  .zalo-nav {
    display: none !important;
  }

  .zalo-conversations {
    display: none !important;
  }

  .zalo-chat-area {
    width: 100vw !important;
    height: 100vh !important;
  }

  .zalo-chat-header {
    height: 52px !important;
    padding: 0 10px !important;
  }

  #zalo-chat-header-title {
    font-size: 14px !important;
    max-width: 160px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .zalo-chat-header .theme-switch-btn span,
  .zalo-chat-header #btn-help-zalo span {
    display: none !important;
  }

  .zalo-chat-header .theme-switch-btn,
  .zalo-chat-header #btn-help-zalo {
    padding: 6px 8px !important;
    min-width: 32px !important;
    height: 32px !important;
    justify-content: center !important;
  }

  .zalo-messages {
    padding: 12px 8px !important;
  }

  .zalo-msg-bubble {
    max-width: 88% !important;
    padding: 10px 12px !important;
    font-size: 14.5px !important;
    line-height: 1.55 !important;
  }

  .zalo-input-area {
    height: 50px !important;
    padding: 6px 10px !important;
  }

  .zalo-input-toolbar {
    display: none !important;
  }

  /* ------------------------------------------------------------------------
     5. CÁC MODAL TRÊN MOBILE
     ------------------------------------------------------------------------ */
  .theme-modal-card,
  .hotkey-modal-card {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 16px 14px !important;
    border-radius: 14px !important;
  }

  .theme-options-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .theme-option-item {
    padding: 12px 14px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    text-align: left !important;
    border-radius: 12px !important;
    min-height: 58px !important;
  }

  .theme-preview-icon {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    margin: 0 !important;
    border-radius: 10px !important;
    flex-shrink: 0 !important;
  }

  .theme-preview-icon svg {
    width: 26px !important;
    height: 26px !important;
  }

  .theme-option-details {
    flex: 1 !important;
    min-width: 0 !important;
  }

  .theme-option-name {
    font-size: 14.5px !important;
    font-weight: 700 !important;
    margin-bottom: 2px !important;
  }

  .theme-option-desc {
    font-size: 11px !important;
    line-height: 1.35 !important;
    color: #64748b !important;
  }

  .theme-option-desc {
    font-size: 11.5px !important;
  }

  .search-modal-container {
    width: 96vw !important;
    max-width: 96vw !important;
    max-height: 92vh !important;
    padding: 16px 14px !important;
  }

  .search-input-group {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .search-input-group .search-input {
    width: 100% !important;
    font-size: 14px !important;
    padding: 10px 12px !important;
  }

  .search-input-group .modal-btn {
    width: 100% !important;
    height: 40px !important;
  }

  .chapter-list {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
    max-height: 50vh !important;
  }

  .chapter-item {
    padding: 10px 8px !important;
    font-size: 12.5px !important;
  }

  /* ------------------------------------------------------------------------
     6. THANH ĐIỀU KHIỂN CHẠM NHANH TRÊN DI ĐỘNG (MOBILE QUICK ACTION BAR)
     ------------------------------------------------------------------------ */
  .mobile-touch-bar {
    display: flex !important;
    position: fixed !important;
    bottom: 12px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: rgba(32, 33, 36, 0.92) !important;
    backdrop-filter: blur(8px) !important;
    border-radius: 28px !important;
    padding: 6px 12px !important;
    gap: 8px !important;
    z-index: 9999 !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    align-items: center !important;
  }

  .mobile-touch-btn {
    background: transparent !important;
    border: none !important;
    color: #ffffff !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 6px 8px !important;
    min-width: 44px !important;
    cursor: pointer !important;
    font-size: 10px !important;
    font-family: inherit !important;
    gap: 2px !important;
    border-radius: 12px !important;
    transition: background 0.15s ease !important;
  }

  .mobile-touch-btn:active {
    background: rgba(255, 255, 255, 0.2) !important;
  }

  .mobile-touch-btn svg {
    width: 20px !important;
    height: 20px !important;
    fill: currentColor !important;
  }

  .mobile-touch-btn.danger {
    color: #ff6b6b !important;
  }

  .mobile-touch-btn.primary {
    color: #8ab4f8 !important;
  }
}

/* Ẩn Mobile Touch Bar trên màn hình Desktop (> 768px) */
@media (min-width: 769px) {
  .mobile-touch-bar {
    display: none !important;
  }
}


.zalo-header-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f0f2f5;
  border: 1px solid #dcdfe4;
  border-radius: 16px;
  padding: 5px 12px;
  font-size: 12px;
  color: #081c36;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.zalo-header-action-btn:hover {
  background: #e4e7ec;
  color: #0068ff;
  border-color: #0068ff;
}



/* ==========================================================================
   FEEDBACK & SUGGESTION CARD (ĐÓNG GÓP Ý KIẾN & Ý TƯỞNG KHÁCH HÀNG)
   ========================================================================== */
.feedback-suggestion-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1.5px dashed #f59e0b;
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 22px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.08);
}

.feedback-suggestion-card:hover {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-color: #d97706;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.16);
  transform: translateY(-1px);
}

.feedback-card-icon {
  width: 46px;
  height: 46px;
  background: #ffffff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.feedback-card-content {
  flex: 1;
  min-width: 0;
}

.feedback-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 5px;
}

.feedback-badge-hot {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: #ef4444;
  color: #ffffff;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 3px rgba(239, 68, 68, 0.3);
}

.feedback-card-desc {
  font-size: 12.5px;
  color: #78350f;
  line-height: 1.5;
}

.feedback-card-desc b {
  color: #451a03;
}

.feedback-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #d97706;
  color: #ffffff !important;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(217, 119, 6, 0.3);
  transition: all 0.15s ease;
}

.feedback-cta-btn:hover {
  background: #b45309;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.45);
  transform: translateY(-1px);
}


/* ==========================================================================
   TTS CORE ENGINE - LOADING MODAL (INDEXEDDB PROGRESS) & FLOATING WIDGET
   ========================================================================== */

/* 1. Modal tiến trình tải Model vào IndexedDB */
.tts-loading-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease-out;
}

.tts-loading-card {
  background: #ffffff;
  border-radius: 16px;
  width: 520px;
  max-width: 92vw;
  padding: 24px 28px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  box-sizing: border-box;
}

.tts-loading-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.tts-loading-icon {
  width: 48px;
  height: 48px;
  background: #e8f0fe;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tts-loading-title {
  font-size: 16px;
  font-weight: 700;
  color: #1f1f1f;
  margin-bottom: 3px;
}

.tts-loading-subtitle {
  font-size: 12px;
  color: #5f6368;
}

.tts-progress-track {
  width: 100%;
  height: 8px;
  background: #e8eaed;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.tts-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #1a73e8, #4285f4);
  border-radius: 4px;
  transition: width 0.2s ease;
}

.tts-progress-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 16px;
}

.tts-loading-note {
  background: #f8f9fa;
  border-left: 3px solid #1a73e8;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 12px;
  color: #3c4043;
  line-height: 1.45;
}

/* 2. Floating TTS Control Widget */
.tts-floating-widget {
  position: fixed;
  bottom: 95px;
  right: 24px;
  z-index: 9990;
  touch-action: none;
  user-select: none;
  /* Hiệu ứng trượt lướt mượt mà khi tự căn chỉnh tránh mép màn hình */
  transition: left 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              top 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.3s ease;
}

.tts-floating-widget.dragging {
  cursor: grabbing !important;
  transition: none !important;
  opacity: 0.96;
}

/* Viên nang Morphing Capsule (Co giãn mượt mà 60fps) */
.tts-widget-inner {
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 40px;
  padding: 4px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: border-radius 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.3s ease,
              background 0.3s ease;
  overflow: hidden;
  box-sizing: border-box;
}

/* Icon Loa luôn hiện diện & có thể click mở rộng */
.tts-speaker-icon {
  width: 38px;
  height: 38px;
  background: #e8f0fe;
  color: #1a73e8;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 1px 4px rgba(26, 115, 232, 0.2);
}

.tts-speaker-icon:hover {
  background: #d2e3fc;
  transform: scale(1.06);
}

.tts-speaker-icon.pulse {
  animation: pulseAnim 1.6s infinite ease-in-out;
  background: #1a73e8;
  color: #ffffff;
}

@keyframes pulseAnim {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(26, 115, 232, 0.45); }
  70% { transform: scale(1.08); box-shadow: 0 0 0 9px rgba(26, 115, 232, 0); }
  100% { transform: scale(1); }
}

/* Vùng nội dung mở rộng (Morphing Expanded Content) */
.tts-expanded-content {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 620px;
  opacity: 1;
  padding-left: 10px;
  padding-right: 6px;
  transform: scale(1) translateX(0);
  transform-origin: left center;
  transition: max-width 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.28s ease 0.06s,
              transform 0.32s cubic-bezier(0.16, 1, 0.3, 1) 0.04s,
              padding 0.3s ease;
  white-space: nowrap;
  pointer-events: auto;
}

/* Khi thu nhỏ thành icon chiếc Loa nổi tròn xoe */
.tts-floating-widget.minimized .tts-widget-inner {
  padding: 3px;
  border-radius: 50%;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  background: #ffffff;
}

.tts-floating-widget.minimized .tts-speaker-icon {
  width: 44px;
  height: 44px;
  cursor: pointer;
}

.tts-floating-widget.minimized .tts-expanded-content {
  max-width: 0;
  opacity: 0;
  padding-left: 0;
  padding-right: 0;
  transform: scale(0.92) translateX(-8px);
  pointer-events: none;
  overflow: hidden;
  transition: max-width 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.2s ease,
              transform 0.25s ease,
              padding 0.3s ease;
}

.tts-status-col {
  display: flex;
  flex-direction: column;
  min-width: 85px;
  cursor: grab;
}

.tts-status-title {
  font-size: 11px;
  font-weight: 700;
  color: #1a73e8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tts-status-sub {
  font-size: 12px;
  color: #5f6368;
  font-weight: 500;
}

.tts-controls-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tts-btn-icon {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5f6368;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tts-btn-icon:hover {
  background: #f1f3f4;
  color: #1f1f1f;
}

.tts-btn-play {
  background: #1a73e8;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(26, 115, 232, 0.35);
  transition: all 0.15s ease;
}

.tts-btn-play:hover {
  background: #1557b0;
  transform: scale(1.05);
}

/* Voice Selector */
.tts-voice-wrapper {
  display: flex;
  align-items: center;
}

.tts-voice-select {
  border: 1px solid #dadce0;
  background: #f8f9fa;
  border-radius: 14px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #1a73e8;
  outline: none;
  cursor: pointer;
  max-width: 135px;
  transition: all 0.2s ease;
}

.tts-voice-select:hover, .tts-voice-select:focus {
  border-color: #1a73e8;
  background: #ffffff;
}

/* Speed Slider Range Bar */
.tts-speed-slider-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f3f4;
  border-radius: 16px;
  padding: 2px 8px 2px 6px;
  border: 1px solid #e0e0e0;
}

.tts-speed-icon {
  font-size: 12px;
  user-select: none;
}

.tts-speed-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 65px;
  height: 4px;
  border-radius: 2px;
  background: #dadce0;
  outline: none;
  cursor: pointer;
  margin: 0;
  padding: 0;
}

.tts-speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #1a73e8;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.tts-speed-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  background: #1557b0;
}

.tts-speed-slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #1a73e8;
  border: none;
  cursor: pointer;
}

.tts-speed-val {
  font-size: 11px;
  font-weight: 700;
  color: #1a73e8;
  min-width: 26px;
  text-align: right;
  user-select: none;
}

/* Nút thu nhỏ thủ công trên thanh điều khiển */
.tts-btn-minimize {
  background: transparent;
  border: none;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #70757a;
  cursor: pointer;
  border-radius: 50%;
  padding: 0;
  transition: all 0.15s ease;
}

.tts-btn-minimize:hover {
  background: #f1f3f4;
  color: #1a73e8;
}

.tts-btn-close {
  background: transparent;
  border: none;
  font-size: 18px;
  color: #70757a;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tts-btn-close:hover {
  color: #d93025;
}

/* 3. Hiệu ứng Highlight câu văn đang đọc trên giao diện */
/* Google Sheets Highlight */
.grid-row.tts-reading-row .cell-item[data-col="A"] {
  background: #e8f0fe !important;
  color: #174ea6 !important;
  font-weight: 500 !important;
  border-left: 3px solid #1a73e8 !important;
}

/* Zalo Chat Highlight */
.zalo-message-item.tts-reading-chat .zalo-msg-bubble {
  border: 2px solid #0068ff !important;
  box-shadow: 0 0 12px rgba(0, 104, 255, 0.25) !important;
}

/* Gmail Highlight */
.gmail-email-body p.tts-reading-email {
  background: #fef7e0;
  border-radius: 4px;
  padding: 2px 6px;
}

/* Tối ưu Mobile */
@media (max-width: 768px) {
  .tts-floating-widget:not([style*="top"]) {
    bottom: 120px !important; /* Đặt cao ráo ở mobile, tránh đè thanh touch bar */
    right: 16px !important;
    left: auto !important;
    transform: none !important;
  }
  .tts-floating-widget:not(.minimized) {
    max-width: calc(100vw - 24px) !important;
  }
  .tts-floating-widget:not(.minimized) .tts-widget-inner {
    padding: 6px 10px;
    gap: 6px;
    border-radius: 20px;
    flex-wrap: wrap;
    justify-content: center;
  }
}
/**
 * CSS Giao Diện Cổng Làm Việc Trung Tâm - Coogle Wordspeca
 * Thiết kế giao diện portal theo Material Design 3
 */

/* 1. KHUNG CHÍNH CỦA WORKSPACE HOMEPAGE */
#view-workspace-home {
  display: none;
  width: 100vw;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: #f8fafd;
  color: #1f1f1f;
  font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  box-sizing: border-box;
}

#view-workspace-home.active {
  display: flex;
  flex-direction: column;
}

/* Thanh điều khiển đọc truyện chỉ xuất hiện khi đã mở ứng dụng. */
#view-workspace-home.active ~ .mobile-touch-bar {
  display: none !important;
}

/* 2. HEADER WORKSPACE CỐ ĐỊNH */
.ws-header {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
  padding: 0 32px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e1e3e1;
}

.ws-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ws-logo-box {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
}

.ws-logo-icon {
  width: 44px;
  height: 44px;
}

.ws-logo-text {
  font-size: 24px;
  font-weight: 500;
  color: #444746;
  letter-spacing: -0.2px;
}

.ws-logo-badge {
  font-size: 13px;
  font-weight: 600;
  color: #0b57d0;
  background: #d3e3fd;
  padding: 2px 8px;
  border-radius: 12px;
}

/* Thanh tìm kiếm trung tâm */
.ws-header-center {
  flex: 1;
  max-width: 480px;
  margin: 0 32px;
}

.ws-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 16px;
  background: #edf2fc;
  border: 1px solid transparent;
  border-radius: 24px;
  transition: all 0.2s ease;
}

.ws-search-bar:focus-within {
  background: #ffffff;
  border-color: #0b57d0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06);
}

.ws-search-bar svg {
  color: #444746;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.ws-search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: #1f1f1f;
}

.ws-search-bar input::placeholder {
  color: #747775;
}

/* Các nút bên phải header */
.ws-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ws-icon-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #444746;
  cursor: pointer;
  transition: background 0.15s;
}

.ws-icon-btn:hover {
  background: #f0f4f9;
}

.ws-search-type-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 14px;
}

.ws-search-type-tab {
  padding: 8px 16px;
  border: 1px solid #dadce0;
  border-radius: 20px;
  color: #444746;
  background: #ffffff;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.ws-search-type-tab:hover {
  background: #f1f3f4;
}

.ws-search-type-tab.active {
  border-color: #d3e3fd;
  color: #0b57d0;
  background: #e8f0fe;
}

.ws-video-result-list {
  display: grid;
  gap: 10px;
}

.ws-video-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid #e1e3e1;
  border-radius: 10px;
  background: #ffffff;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ws-video-result:hover,
.ws-video-result:focus-visible {
  border-color: #a8c7fa;
  background: #f8fafd;
  outline: none;
}

.ws-video-result-thumb {
  flex: 0 0 112px;
  width: 112px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: cover;
  background: #e8eaed;
}

.ws-video-result-info {
  min-width: 0;
  text-align: left;
}

.ws-video-result-title {
  display: -webkit-box;
  overflow: hidden;
  color: #1f1f1f;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ws-video-result-meta {
  margin-top: 5px;
  color: #5f6368;
  font-size: 12px;
}

/* Phóng to icon bên trong nút header cho khớp nút 48px */
.ws-icon-btn svg {
  width: 26px;
  height: 26px;
}

.ws-icon-btn.ws-apps-btn svg {
  display: none;
}

.ws-icon-btn.ws-apps-btn::before {
  content: "";
  width: 26px;
  height: 26px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h4v4H4V4zm6 0h4v4h-4V4zm6 0h4v4h-4V4zM4 10h4v4H4v-4zm6 0h4v4h-4v-4zm6 0h4v4h-4v-4zM4 16h4v4H4v-4zm6 0h4v4h-4v-4zm6 0h4v4h-4v-4z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h4v4H4V4zm6 0h4v4h-4V4zm6 0h4v4h-4V4zM4 10h4v4H4v-4zm6 0h4v4h-4v-4zm6 0h4v4h-4v-4zM4 16h4v4H4v-4zm6 0h4v4h-4v-4zm6 0h4v4h-4v-4z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.ws-avatar-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0bd05a, #1ae8a3);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* 3. NỘI DUNG CHÍNH (MAIN BODY) */
.ws-main-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-content: start;
  align-items: start;
  column-gap: 32px;
  flex: 1 0 auto;
  width: 100%;
  max-width: 1280px;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 32px 24px 64px 24px;
}

/* Lời chào đầu trang */
.ws-greeting-banner {
  grid-column: 1 / -1;
  margin-bottom: 28px;
}

.ws-greeting-text {
  font-size: 24px;
  font-weight: 600;
  color: #1f1f1f;
  margin: 0 0 6px 0;
  letter-spacing: -0.3px;
}

.ws-greeting-sub {
  font-size: 14px;
  color: #5e5e5e;
  margin: 0;
}

/* Tiêu đề mục */
.ws-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.ws-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #444746;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* 4. KHỐI TIẾP TỤC CÔNG VIỆC DỞ (CONTINUE CARD) */
.ws-continue-section {
  grid-column: 1 / -1;
  margin-bottom: 36px;
}

.ws-continue-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: #ffffff;
  border: 1px solid #e1e3e1;
  border-radius: 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ws-continue-card:hover {
  border-color: #c2e7ff;
  box-shadow: 0 4px 14px rgba(11, 87, 208, 0.1);
  transform: translateY(-2px);
}

.ws-continue-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.ws-continue-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  border: 1px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.ws-continue-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ws-continue-info {
  flex: 1;
  min-width: 0;
}

.ws-continue-app-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}

.ws-app-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.ws-continue-title {
  font-size: 16px;
  font-weight: 600;
  color: #1f1f1f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.ws-continue-subtitle {
  font-size: 13px;
  color: #747775;
}

.ws-continue-right {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-left: 20px;
}

.ws-progress-box {
  width: 150px;
  text-align: right;
}

.ws-progress-text {
  font-size: 12px;
  color: #5e5e5e;
  margin-bottom: 6px;
}

.ws-progress-bar {
  width: 100%;
  height: 6px;
  background: #edf2fc;
  border-radius: 3px;
  overflow: hidden;
}

.ws-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.ws-btn-resume {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 20px;
  border: none;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  transition: opacity 0.15s, transform 0.15s;
}

.ws-btn-resume:hover {
  opacity: 0.92;
  transform: scale(1.03);
}

/* 5. LƯỚI ỨNG DỤNG (APP LAUNCHER GRID) */
.ws-app-section {
  min-width: 0;
}

.ws-app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.ws-app-card {
  display: flex;
  flex-direction: column;
  padding: 18px;
  background: #ffffff;
  border: 1px solid #e1e3e1;
  border-radius: 14px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ws-app-card:hover {
  border-color: #0b57d0;
  box-shadow: 0 4px 12px rgba(11, 87, 208, 0.08);
  transform: translateY(-2px);
}

.ws-app-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.ws-app-content {
  flex: 1;
}

.ws-app-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.ws-app-name {
  font-size: 15px;
  font-weight: 600;
  color: #1f1f1f;
}

.ws-app-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 8px;
}

.ws-app-desc {
  font-size: 12.5px;
  color: #5e5e5e;
  line-height: 1.45;
}

.ws-app-arrow {
  position: absolute;
  top: 18px;
  right: 14px;
  color: #c4c7c5;
  transition: transform 0.15s, color 0.15s;
}

.ws-app-card:hover .ws-app-arrow {
  color: #0b57d0;
  transform: translateX(3px);
}

/* 6. BẢNG TÀI LIỆU GẦN ĐÂY (RECENT ACTIVITIES) */
.ws-recent-section {
  min-width: 0;
}

.ws-recent-table {
  background: #ffffff;
  border: 1px solid #e1e3e1;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.ws-recent-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px 12px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #f0f2f5;
  cursor: pointer;
  transition: background 0.15s;
}

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

.ws-recent-row:hover {
  background: #f7f9fc;
}

.ws-recent-main {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.ws-recent-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
}

.ws-recent-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ws-recent-meta {
  flex: 1;
  min-width: 0;
}

.ws-recent-title {
  font-size: 14px;
  font-weight: 500;
  color: #1f1f1f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.ws-recent-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #747775;
}

.ws-recent-app-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #444746;
  text-align: left;
}

.ws-recent-time {
  font-size: 12px;
  color: #747775;
  text-align: right;
}

.ws-recent-actions {
  text-align: right;
}

.ws-btn-open-recent {
  padding: 5px 12px;
  border-radius: 14px;
  border: 1px solid #c2e7ff;
  background: #edf2fc;
  color: #0b57d0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.ws-recent-row:hover .ws-btn-open-recent {
  background: #0b57d0;
  color: #ffffff;
  border-color: #0b57d0;
}

/* Empty State */
.ws-empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  text-align: center;
  background: #ffffff;
  border: 1px dashed #c4c7c5;
  border-radius: 14px;
}

.ws-empty-icon {
  width: 48px;
  height: 48px;
  color: #c4c7c5;
  margin-bottom: 12px;
}

.ws-empty-text {
  font-size: 14px;
  color: #747775;
  line-height: 1.6;
}

/* Footer nằm cuối trang, không che nội dung khi danh sách dài. */
.ws-footer {
  flex-shrink: 0;
  border-top: 1px solid #e1e3e1;
  background: #ffffff;
}

.ws-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px 32px;
  color: #5e5e5e;
  font-size: 13px;
}

.ws-footer-brand {
  color: #444746;
  font-size: 20px;
  font-weight: 500;
  text-decoration: none;
}

.ws-footer-brand span {
  color: #747775;
  font-weight: 400;
}

.ws-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}

.ws-footer-links button,
.ws-footer-links a {
  border: 0;
  padding: 8px 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.ws-footer-links button:hover,
.ws-footer-links a:hover {
  color: #0b57d0;
}

.ws-footer a:focus-visible,
.ws-footer button:focus-visible {
  outline: 2px solid #0b57d0;
  outline-offset: 4px;
  border-radius: 4px;
}

.ws-footer-language {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* 7. RESPONSIVE BREAKPOINTS */
@media (max-width: 1000px) {
  .ws-main-body {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 28px;
  }
  .ws-greeting-banner,
  .ws-continue-section {
    margin-bottom: 0;
  }
  .ws-logo-badge {
    display: none;
  }
}

@media (max-width: 768px) {
  .ws-header {
    padding: 0 16px;
  }
  .ws-header-center {
    display: none;
  }
  .ws-main-body {
    padding: 20px 16px 48px 16px;
  }
  .ws-continue-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .ws-continue-right {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }
  .ws-progress-box {
    width: auto;
    flex: 1;
    text-align: left;
  }
  .ws-header-right {
    gap: 0;
  }
  .ws-logo-text {
    font-size: 18px;
  }
  .ws-logo-icon {
    width: 32px;
    height: 32px;
  }
  .ws-icon-btn {
    width: 36px;
    height: 40px;
  }
  .ws-footer-inner {
    padding: 20px 16px;
    gap: 12px 24px;
  }
}

@media (max-width: 480px) {
  .ws-header {
    height: auto;
    min-height: 72px;
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .ws-footer-brand {
    flex-basis: 100%;
  }
  .ws-video-result-thumb {
    flex-basis: 88px;
    width: 88px;
  }
  .ws-video-result-title {
    font-size: 13px;
  }
}
#view-calendar {
  display: none;
  width: 100vw;
  height: 100vh;
  overflow: auto;
  color: #202637;
  background:
    radial-gradient(circle at 12% 6%, rgba(221, 232, 255, 0.72), transparent 24rem),
    #f5f7fb;
  font-family: 'Google Sans', 'Segoe UI', Roboto, Arial, sans-serif;
  box-sizing: border-box;
}

#view-calendar.active {
  display: flex;
  flex-direction: column;
}

#view-calendar.active ~ .mobile-touch-bar {
  display: none !important;
}

#view-calendar *,
#view-calendar *::before,
#view-calendar *::after {
  box-sizing: border-box;
}

.caro-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 72px;
  padding: 0 clamp(16px, 4vw, 56px);
  border-bottom: 1px solid #e6eaf1;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.caro-back-home,
.caro-back-link {
  width: fit-content;
  color: #637087;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.caro-back-home:hover,
.caro-back-link:hover,
.caro-text-button:hover {
  color: #3157c8;
}

.caro-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.caro-brand-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, #6487f4, #5961d8);
  font-size: 22px;
}

.caro-brand strong,
.caro-brand span {
  display: block;
}

.caro-brand strong {
  font-size: 15px;
  letter-spacing: -0.2px;
}

.caro-brand div > span {
  margin-top: 2px;
  color: #8b94a6;
  font-size: 11px;
}

.caro-account {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.caro-guest-label,
.caro-history-note {
  color: #7d879b;
  font-size: 12px;
}

.caro-user-avatar,
.caro-player-avatar {
  display: grid;
  flex: 0 0 auto;
  overflow: hidden;
  place-items: center;
  border-radius: 50%;
  color: #455ed1;
  background: #e5eaff;
  font-weight: 700;
}

.caro-user-avatar {
  width: 34px;
  height: 34px;
}

.caro-user-avatar img,
.caro-player-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.caro-user-name {
  overflow: hidden;
  max-width: 180px;
  color: #525d72;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.caro-main {
  width: min(1120px, calc(100% - 40px));
  flex: 1 0 auto;
  margin: 0 auto;
  padding: 54px 0 72px;
}

.caro-page-heading,
.caro-room-heading,
.caro-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.caro-page-heading {
  margin-bottom: 30px;
}

.caro-eyebrow {
  color: #7785a1;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.35px;
}

.caro-page-heading h1,
.caro-room-heading h1,
.caro-gate-panel h1 {
  margin: 8px 0 7px;
  color: #222a3b;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 650;
  letter-spacing: -1.3px;
}

.caro-page-heading p,
.caro-room-heading p,
.caro-panel > p,
.caro-gate-panel p {
  margin: 0;
  color: #7a8499;
  font-size: 14px;
  line-height: 1.65;
}

.caro-calendar-date {
  display: flex;
  min-width: 170px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid #e7eaf1;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
}

.caro-calendar-date > span {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 11px;
  color: #455bcc;
  background: #edf0ff;
  font-size: 20px;
  font-weight: 700;
}

.caro-calendar-date small {
  color: #667187;
  font-size: 11px;
  text-transform: capitalize;
}

.caro-lobby-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.8fr);
  gap: 18px;
}

.caro-panel,
.caro-history-panel {
  border: 1px solid #e6eaf1;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 28px rgba(34, 45, 78, 0.045);
}

.caro-panel {
  padding: clamp(22px, 3vw, 34px);
}

.caro-online-panel {
  position: relative;
  overflow: hidden;
  min-height: 305px;
}

.caro-online-panel::after {
  position: absolute;
  right: -45px;
  bottom: -92px;
  width: 250px;
  height: 250px;
  border: 1px solid rgba(95, 120, 231, 0.1);
  border-radius: 50%;
  box-shadow: 0 0 0 25px rgba(95, 120, 231, 0.025), 0 0 0 50px rgba(95, 120, 231, 0.02);
  content: "";
  pointer-events: none;
}

.caro-panel-icon {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 21px;
  place-items: center;
  border-radius: 13px;
  color: #4f64db;
  background: #edf0ff;
  font-size: 20px;
}

.caro-panel h2,
.caro-history-heading h2,
.caro-room-sidebar h2 {
  margin: 7px 0 8px;
  color: #2c3446;
  font-size: 22px;
  letter-spacing: -0.5px;
}

.caro-panel > p {
  max-width: 480px;
}

.caro-lobby-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 20px;
  margin-top: 23px;
}

.caro-join-form {
  flex: 1 1 260px;
  max-width: 355px;
}

.caro-join-form label {
  display: block;
  margin-bottom: 7px;
  color: #69748a;
  font-size: 11px;
  font-weight: 650;
}

.caro-join-controls {
  display: flex;
  gap: 8px;
}

.caro-join-controls input {
  width: 0;
  min-width: 0;
  flex: 1;
  padding: 0 13px;
  border: 1px solid #e0e5ef;
  border-radius: 10px;
  outline: 0;
  color: #293348;
  background: #fbfcff;
  font: inherit;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.caro-join-controls input:focus {
  border-color: #7185ec;
  box-shadow: 0 0 0 3px rgba(93, 116, 224, 0.13);
}

.caro-local-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: linear-gradient(145deg, #fff, #fbf9f4);
}

.caro-local-symbol {
  display: flex;
  width: 54px;
  height: 54px;
  align-items: center;
  justify-content: center;
  margin-bottom: 19px;
  border: 1px solid #eee8da;
  border-radius: 16px;
  color: #d85158;
  background: #fff;
  font-size: 24px;
  font-weight: 750;
}

.caro-local-symbol span {
  margin: 11px 0 0 4px;
  color: #4c72cf;
}

.caro-local-panel .caro-button {
  margin-top: auto;
  padding-top: 22px;
}

.caro-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.caro-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.caro-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.caro-button-primary {
  color: #fff;
  background: linear-gradient(135deg, #5b78e8, #545bd4);
  box-shadow: 0 5px 12px rgba(83, 99, 211, 0.17);
}

.caro-button-primary:hover:not(:disabled) {
  box-shadow: 0 8px 17px rgba(83, 99, 211, 0.24);
}

.caro-button-light {
  border-color: #e0e5ef;
  color: #59657c;
  background: #fff;
}

.caro-button-dark {
  color: #fff;
  background: #30394e;
}

.caro-button-wide {
  width: 100%;
}

.caro-text-button {
  padding: 7px 3px;
  border: 0;
  color: #758097;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 650;
}

.caro-helper-text {
  margin: 10px 0 0;
  color: #8a93a5;
  font-size: 11px;
  line-height: 1.5;
}

.caro-history-panel {
  margin-top: 18px;
  padding: 23px 27px;
}

.caro-history-heading {
  align-items: flex-end;
  margin-bottom: 12px;
}

.caro-history-heading h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.caro-stat-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: #8790a2;
  font-size: 11px;
}

.caro-stat-strip b {
  color: #444f67;
  font-size: 15px;
}

.caro-match-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.caro-match-row {
  display: grid;
  grid-template-columns: 65px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 43px;
  border-top: 1px solid #f0f2f6;
  color: #68738a;
  font-size: 12px;
}

.caro-match-row time {
  color: #929aab;
  font-size: 11px;
}

.caro-match-result {
  font-size: 11px;
  font-weight: 750;
}

.caro-result-win {
  color: #2e9b72;
}

.caro-result-loss {
  color: #cf626b;
}

.caro-result-draw {
  color: #9a7a32;
}

.caro-history-empty {
  padding: 14px 0 3px;
  border-top: 1px solid #f0f2f6;
  color: #929aab;
  font-size: 12px;
}

.caro-room-heading {
  margin-bottom: 22px;
}

.caro-room-heading h1 {
  font-size: 32px;
}

.caro-room-heading h1 span {
  color: #586cde;
  letter-spacing: 2px;
}

.caro-room-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.caro-room-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: start;
  gap: 18px;
}

.caro-game-panel {
  padding: 21px;
}

.caro-player-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.caro-player-card {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #edf0f5;
  border-radius: 12px;
  background: #fbfcfe;
}

.caro-player-card.is-current {
  border-color: #bac5fa;
  background: #f6f7ff;
  box-shadow: 0 0 0 2px rgba(97, 117, 225, 0.08);
}

.caro-player-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: #fff;
  font-size: 19px;
  font-weight: 800;
}

.mark-x,
.caro-cell.mark-x {
  color: #d9575d;
}

.mark-o,
.caro-cell.mark-o {
  color: #4974d5;
}

.caro-player-info {
  display: block;
  min-width: 0;
}

.caro-player-info strong,
.caro-player-info small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.caro-player-info strong {
  color: #39445b;
  font-size: 11px;
}

.caro-player-info small {
  margin-top: 4px;
  color: #929aab;
  font-size: 10px;
}

.caro-player-avatar {
  width: 28px;
  height: 28px;
  margin-left: auto;
}

.caro-versus {
  color: #a0a7b5;
  font-size: 10px;
  font-weight: 800;
}

.caro-game-notice {
  margin: 17px 0 13px;
  padding: 10px 13px;
  border-radius: 10px;
  color: #626e84;
  background: #f6f7fa;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.caro-game-notice.is-your-turn {
  color: #475bc6;
  background: #eef0ff;
}

.caro-board-wrap {
  width: min(100%, 680px);
  margin: 0 auto;
}

.caro-board {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  grid-template-columns: repeat(15, minmax(0, 1fr));
  grid-template-rows: repeat(15, minmax(0, 1fr));
  gap: 2px;
  padding: 5px;
  border: 1px solid #dfd3b9;
  border-radius: 12px;
  background-color: #e9dfc9;
  background-image:
    linear-gradient(rgba(118, 102, 70, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(118, 102, 70, 0.09) 1px, transparent 1px);
  box-shadow: inset 0 0 18px rgba(121, 101, 57, 0.08);
}

.caro-cell {
  display: grid;
  min-width: 0;
  min-height: 0;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 4px;
  color: #273046;
  background: rgba(255, 255, 255, 0.58);
  cursor: pointer;
  font: inherit;
  font-size: clamp(10px, 2.3vw, 26px);
  font-weight: 800;
  line-height: 1;
}

.caro-cell:disabled {
  cursor: default;
}

.caro-cell:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: inset 0 0 0 1px rgba(81, 103, 214, 0.35);
}

.caro-cell span {
  transform: translateY(-1px);
}

.caro-game-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 15px;
  color: #9199a9;
  font-size: 11px;
}

.caro-room-sidebar {
  padding: 22px;
}

.caro-room-sidebar h2 {
  margin-top: 8px;
  font-size: 20px;
}

.caro-room-sidebar > p {
  margin-bottom: 16px;
  font-size: 12px;
}

.caro-room-code {
  margin: 18px 0 12px;
  padding: 14px 8px;
  border: 1px dashed #bdc7ee;
  border-radius: 12px;
  color: #4b5dca;
  background: #f6f7ff;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 4px;
  text-align: center;
}

.caro-room-role,
.caro-room-status {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  color: #8a93a5;
  font-size: 11px;
}

.caro-room-role strong,
.caro-room-status strong {
  color: #59657c;
  text-align: right;
}

.caro-local-game-panel {
  max-width: 750px;
  margin: 0 auto;
}

.caro-gate-panel {
  width: min(100%, 480px);
  margin: 8vh auto;
  padding: 38px;
  border: 1px solid #e6eaf1;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 16px 45px rgba(34, 45, 78, 0.08);
  text-align: center;
}

.caro-gate-panel .caro-panel-icon {
  margin: 0 auto 20px;
}

.caro-gate-panel .caro-button {
  margin: 23px auto 0;
}

.caro-gate-panel .caro-back-link {
  display: block;
  margin-top: 20px;
}

.caro-error-icon {
  color: #c5545e;
  background: #fff0f1;
  font-weight: 800;
}

.caro-loading {
  padding: 90px 10px;
  color: #808a9e;
  font-size: 13px;
  text-align: center;
}

.caro-error-message {
  margin: 12px 0 0;
  color: #c5545e;
  font-size: 12px;
}

.caro-toast {
  position: fixed;
  z-index: 50;
  right: 24px;
  bottom: 24px;
  max-width: min(380px, calc(100vw - 32px));
  padding: 12px 16px;
  transform: translateY(12px);
  border: 1px solid #e5e9f1;
  border-radius: 12px;
  color: #fff;
  background: #30394e;
  box-shadow: 0 8px 28px rgba(30, 39, 58, 0.2);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.caro-toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 760px) {
  .caro-header {
    grid-template-columns: auto 1fr auto;
    gap: 9px;
    min-height: 62px;
    padding: 0 14px;
  }

  .caro-back-home {
    overflow: hidden;
    max-width: 75px;
    font-size: 11px;
    white-space: nowrap;
  }

  .caro-brand {
    justify-self: center;
  }

  .caro-brand-icon {
    width: 32px;
    height: 32px;
  }

  .caro-brand strong {
    font-size: 13px;
  }

  .caro-brand div > span,
  .caro-user-name {
    display: none;
  }

  .caro-text-button {
    display: block;
    padding: 5px;
    font-size: 10px;
  }

  .caro-account {
    gap: 5px;
  }

  .caro-account .caro-button {
    min-height: 34px;
    padding: 0 9px;
    font-size: 10px;
  }

  .caro-main {
    width: min(100% - 26px, 600px);
    padding: 32px 0 48px;
  }

  .caro-calendar-date {
    min-width: 0;
    padding: 7px;
  }

  .caro-calendar-date small {
    display: none;
  }

  .caro-lobby-grid,
  .caro-room-layout {
    grid-template-columns: 1fr;
  }

  .caro-online-panel {
    min-height: 0;
  }

  .caro-local-panel {
    min-height: 255px;
  }

  .caro-room-sidebar {
    order: -1;
  }

  .caro-room-heading {
    align-items: flex-start;
  }

  .caro-room-actions {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }

  .caro-room-actions .caro-button {
    min-height: 36px;
    padding: 0 10px;
    white-space: nowrap;
  }

  .caro-game-panel {
    padding: 12px;
  }

  .caro-player-bar {
    gap: 5px;
  }

  .caro-player-card {
    gap: 6px;
    padding: 7px 5px;
  }

  .caro-player-mark {
    width: 27px;
    height: 27px;
    font-size: 16px;
  }

  .caro-player-info strong {
    font-size: 9px;
  }

  .caro-player-info small {
    font-size: 8px;
  }

  .caro-player-avatar {
    display: none;
  }

  .caro-history-panel {
    padding: 19px 17px;
  }
}

@media (max-width: 420px) {
  .caro-page-heading p {
    max-width: 220px;
    font-size: 12px;
  }

  .caro-lobby-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .caro-join-form {
    flex-basis: auto;
    max-width: none;
  }

  .caro-history-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .caro-match-row {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 7px;
    font-size: 10px;
  }

  .caro-match-row time {
    font-size: 9px;
  }
}

#view-calendar {
  color: #202124;
  background: #f8fafd;
}

.google-account-slot {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
}

.google-account-signin {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid #dadce0;
  border-radius: 18px;
  color: #1a73e8;
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.google-account-signin:hover:not(:disabled) {
  border-color: #d2e3fc;
  background: #f8fbff;
}

.google-account-signin:disabled {
  cursor: not-allowed;
}

.google-account-menu {
  position: relative;
}

.google-account-avatar {
  display: grid;
  width: 40px;
  height: 40px;
  overflow: hidden;
  padding: 0;
  place-items: center;
  border: 2px solid transparent;
  border-radius: 50%;
  color: #fff;
  background: #1a73e8;
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
}

.google-account-avatar:hover,
.google-account-avatar[aria-expanded="true"] {
  border-color: #d2e3fc;
  box-shadow: 0 0 0 2px #e8f0fe;
}

.google-account-avatar img,
.google-account-popover-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.google-account-popover {
  position: absolute;
  z-index: 100;
  top: calc(100% + 12px);
  right: 0;
  display: flex;
  width: 320px;
  align-items: center;
  flex-direction: column;
  padding: 22px 20px 16px;
  border: 1px solid #dadce0;
  border-radius: 20px;
  color: #202124;
  background: #fff;
  box-shadow: 0 4px 18px rgba(60, 64, 67, 0.25);
  text-align: center;
}

.google-account-popover[hidden] {
  display: none;
}

.google-account-popover-avatar {
  display: grid;
  width: 68px;
  height: 68px;
  overflow: hidden;
  margin-bottom: 12px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #1a73e8;
  font-size: 25px;
}

.google-account-popover > strong {
  max-width: 100%;
  overflow: hidden;
  font-size: 16px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.google-account-popover > span {
  max-width: 100%;
  overflow: hidden;
  margin-top: 4px;
  color: #5f6368;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.google-account-popover > button {
  min-height: 36px;
  margin-top: 18px;
  padding: 0 18px;
  border: 1px solid #dadce0;
  border-radius: 18px;
  color: #3c4043;
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
}

.google-account-popover > button:hover {
  background: #f8f9fa;
}

/* Nút vào trang quản trị (chỉ hiện với tài khoản admin) */
.google-account-popover > .google-account-admin-btn {
  border-color: #c2d5f7;
  color: #0b57d0;
}

.google-account-popover > .google-account-admin-btn:hover {
  background: #f0f4fc;
}

.google-account-popover > .google-account-admin-btn + button {
  margin-top: 8px;
}

.google-account-error {
  margin: 8px 0 0;
  color: #b3261e;
  font-size: 12px;
}

.google-account-slot[data-variant="workspace"] .google-account-avatar {
  width: 40px;
  height: 40px;
}

.google-account-slot[data-variant="workspace"] .google-account-signin {
  min-height: 36px;
}

#view-sheets .google-account-signin,
#view-email .google-account-signin {
  max-width: 102px;
  padding: 0 10px;
  font-size: 12px;
}

.zalo-google-account-slot {
  width: 44px;
  height: 44px;
}

.zalo-google-account-slot .google-account-avatar {
  width: 44px;
  height: 44px;
  border: 2px solid #fff;
  background: #004ecc;
  font-size: 16px;
  font-weight: 700;
}

.zalo-google-account-slot .google-account-signin {
  width: 44px;
  height: 44px;
  min-height: 44px;
  overflow: hidden;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: #004ecc;
  font-size: 0;
}

.zalo-google-account-slot .google-account-signin::before {
  content: "G";
  font-size: 17px;
  font-weight: 600;
}

.zalo-google-account-slot .google-account-popover {
  position: fixed;
  top: 72px;
  right: 16px;
}

.caro-header {
  grid-template-columns: auto 1fr auto;
  min-height: 64px;
  padding: 0 24px;
  border-bottom-color: #dadce0;
  background: #f8fafd;
  backdrop-filter: none;
}

.caro-brand {
  justify-self: start;
  margin-left: 28px;
}

.caro-brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #4285f4;
  font-size: 22px;
  font-weight: 500;
  text-align: center;
}

.caro-brand strong {
  color: #3c4043;
  font-size: 21px;
  font-weight: 400;
}

.caro-brand div > span {
  display: none;
}

.caro-back-home {
  color: #5f6368;
  font-size: 13px;
  font-weight: 500;
}

.caro-main.is-calendar-lobby {
  width: 100%;
  flex: 1 0 auto;
  margin: 0;
  padding: 0;
}

.caro-calendar-shell {
  display: grid;
  min-height: calc(100vh - 64px);
  grid-template-columns: 232px minmax(0, 1fr);
  background: #fff;
}

.caro-calendar-sidebar {
  position: sticky;
  top: 64px;
  align-self: start;
  min-height: calc(100vh - 64px);
  padding: 20px 16px;
  border-right: 1px solid #dadce0;
  background: #fff;
}

.caro-calendar-shell.is-room {
  grid-template-columns: 320px minmax(0, 1fr);
}

.caro-calendar-shell.is-room .caro-calendar-sidebar {
  padding-right: 18px;
  padding-left: 18px;
}

.caro-calendar-create {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding: 0 20px 0 16px;
  border: 1px solid #dadce0;
  border-radius: 16px;
  color: #3c4043;
  background: #fff;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.25), 0 1px 3px 1px rgba(60, 64, 67, 0.1);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
}

.caro-calendar-create span {
  color: #5f6368;
  font-size: 23px;
  line-height: 1;
}

.caro-calendar-create:disabled,
.caro-calendar-join:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.caro-calendar-side-section {
  margin: 0 -6px 22px;
  padding: 0 6px 18px;
  border-bottom: 1px solid #e8eaed;
}

.caro-calendar-side-title {
  margin-bottom: 12px;
  color: #3c4043;
  font-size: 14px;
  font-weight: 500;
}

.caro-calendar-sidebar .caro-join-form {
  max-width: none;
}

.caro-calendar-sidebar .caro-join-form label {
  margin-bottom: 8px;
  color: #5f6368;
  font-size: 12px;
  font-weight: 400;
}

.caro-calendar-sidebar .caro-join-controls {
  gap: 5px;
}

.caro-calendar-sidebar .caro-join-controls input {
  width: 0;
  min-height: 38px;
  padding: 0 8px;
  border-color: #dadce0;
  border-radius: 6px;
  color: #3c4043;
  background: #fff;
  font-size: 12px;
  letter-spacing: 1px;
}

.caro-calendar-join {
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  color: #1a73e8;
  background: #e8f0fe;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
}

.caro-calendar-sidebar .caro-helper-text,
.caro-calendar-record {
  margin: 9px 0 0;
  color: #70757a;
  font-size: 11px;
  line-height: 1.5;
}

.caro-calendar-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #3c4043;
  font-size: 13px;
}

.caro-calendar-check {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 3px;
  color: #fff;
  background: #1a73e8;
  font-size: 12px;
}

.caro-calendar-local {
  margin: 13px 0 0 28px;
  padding: 0;
  border: 0;
  color: #5f6368;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  text-align: left;
}

.caro-calendar-history .caro-match-list {
  margin-top: 10px;
}

.caro-calendar-history .caro-match-row {
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 5px;
  min-height: 34px;
  font-size: 10px;
}

.caro-calendar-history .caro-match-row time {
  display: none;
}

.caro-room-state-line,
.caro-room-role,
.caro-room-move-count {
  color: #70757a;
  font-size: 11px;
}

.caro-calendar-sidebar .caro-room-role {
  align-items: center;
  margin-top: 10px;
}

.caro-calendar-sidebar .caro-room-role strong {
  color: #3c4043;
  font-weight: 500;
}

.caro-room-message {
  margin-top: 12px;
  padding: 9px 10px;
  border-radius: 7px;
  color: #5f6368;
  background: #f1f3f4;
  font-size: 11px;
  line-height: 1.45;
}

.caro-room-message.is-your-turn {
  color: #174ea6;
  background: #e8f0fe;
}

.caro-room-players {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.caro-room-player {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border: 1px solid #e8eaed;
  border-radius: 8px;
  background: #fff;
}

.caro-room-player.is-current {
  border-color: #8ab4f8;
  background: #f8fbff;
}

.caro-room-player .caro-player-mark {
  width: 25px;
  height: 25px;
  border: 1px solid #e8eaed;
  border-radius: 50%;
  font-size: 14px;
}

.caro-room-player .caro-player-info strong {
  font-size: 10px;
}

.caro-room-player .caro-player-info small {
  margin-top: 2px;
  font-size: 9px;
}

.caro-room-versus {
  color: #9aa0a6;
  font-size: 9px;
  font-weight: 700;
  text-align: center;
}

.caro-room-controls {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.caro-room-controls .caro-calendar-local {
  margin: 2px 0 0;
}

.caro-room-board-section {
  padding-bottom: 12px;
}

.caro-room-board-section .caro-calendar-side-title {
  margin-bottom: 0;
}

.caro-room-board-section .caro-game-notice {
  margin: 8px 0;
  padding: 7px;
  font-size: 10px;
}

.caro-board-wrap.caro-room-board-wrap {
  width: 100%;
  max-width: none;
  margin: 0;
}

.caro-board.caro-room-board {
  gap: 1px;
  padding: 2px;
  border-radius: 7px;
}

.caro-room-board .caro-cell {
  border-radius: 1px;
  font-size: clamp(8px, 1vw, 14px);
}

.caro-room-move-count {
  margin-top: 6px;
  text-align: right;
}

.caro-calendar-main {
  min-width: 0;
  padding: 0 18px 30px;
  background: #fff;
}

.caro-calendar-toolbar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #fff;
}

.caro-calendar-navigation {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 16px;
}

.caro-calendar-today {
  min-height: 38px;
  padding: 0 17px;
  border: 1px solid #dadce0;
  border-radius: 5px;
  color: #3c4043;
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
}

.caro-calendar-arrows {
  display: flex;
  gap: 2px;
}

.caro-calendar-arrows button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: #5f6368;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 27px;
  line-height: 1;
}

.caro-calendar-arrows button:hover {
  background: #f1f3f4;
}

.caro-calendar-navigation h1 {
  overflow: hidden;
  margin: 0;
  color: #3c4043;
  font-size: 22px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.caro-calendar-view-label {
  padding: 9px 14px;
  border: 1px solid #dadce0;
  border-radius: 6px;
  color: #3c4043;
  font-size: 13px;
}

.caro-calendar-scroll {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #dadce0;
  border-radius: 10px;
}

.caro-time-grid {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: 46px repeat(var(--calendar-days), minmax(0, var(--calendar-cell-size)));
  grid-template-rows: 46px repeat(48, var(--calendar-cell-size));
  background: #fff;
}

.caro-time-corner,
.caro-day-heading {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #dadce0;
  background: #fff;
}

.caro-time-corner {
  z-index: 4;
  color: #5f6368;
  font-size: 10px;
}

.caro-day-heading {
  flex-direction: column;
  gap: 3px;
  border-left: 1px solid #e8eaed;
  color: #5f6368;
}

.caro-day-heading span {
  font-size: 9px;
  font-weight: 500;
}

.caro-day-heading strong {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  color: #3c4043;
  font-size: 13px;
  font-weight: 400;
}

.caro-day-heading.is-today span {
  color: #1a73e8;
}

.caro-day-heading.is-today strong {
  color: #fff;
  background: #1a73e8;
  font-weight: 600;
}

.caro-hour-label {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-right: 1px solid #dadce0;
  color: #70757a;
  background: #fff;
  font-size: 8px;
}

.caro-hour-label.is-half-hour {
  color: #9aa0a6;
  font-size: 7px;
}

.caro-hour-cell {
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid #e8eaed;
  border-bottom: 1px solid #e8eaed;
  background: #fff;
  cursor: pointer;
}

.caro-hour-cell:hover {
  background: #f1f6fe;
  box-shadow: inset 0 0 0 1px #8ab4f8;
}

.caro-hour-cell.is-today {
  background: #fbfdff;
}

.caro-hour-cell.is-today:hover {
  background: #e8f0fe;
}

.caro-room-grid-cell {
  position: relative;
  display: grid;
  place-items: center;
  background: #f5f9ff;
  font-size: clamp(7px, calc(var(--calendar-cell-size) * 0.65), 20px);
  font-weight: 700;
  line-height: 1;
}

.caro-room-grid-cell.mark-x {
  color: #d9575d;
}

.caro-room-grid-cell.mark-o {
  color: #4974d5;
}

.caro-room-grid-cell:disabled {
  cursor: default;
}

.caro-room-grid-cell:disabled:hover {
  background: #f5f9ff;
  box-shadow: none;
}

.caro-room-grid-cell.is-today:disabled:hover {
  background: #fbfdff;
}

.caro-room-grid-cell:not(:disabled):hover {
  background: #e8f0fe;
  box-shadow: inset 0 0 0 1px #8ab4f8;
}

.caro-room-grid-cell span {
  position: relative;
  z-index: 1;
  transform: translateY(-1px);
}

.caro-room-grid-cell.is-winning {
  z-index: 1;
  overflow: visible;
}

.caro-room-grid-cell.is-winning::after {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: -1px;
  width: calc(100% + 2px);
  height: max(2px, calc(var(--calendar-cell-size) * 0.1));
  background: var(--winning-line-color);
  content: "";
  pointer-events: none;
}

.caro-room-grid-cell.mark-x.is-winning {
  --winning-line-color: #c62828;
}

.caro-room-grid-cell.mark-o.is-winning {
  --winning-line-color: #174ea6;
}

.caro-room-grid-cell.is-winning-vertical::after {
  top: -1px;
  left: 50%;
  width: max(2px, calc(var(--calendar-cell-size) * 0.1));
  height: calc(100% + 2px);
}

.caro-room-grid-cell.is-winning-diagonal-down::after,
.caro-room-grid-cell.is-winning-diagonal-up::after {
  top: 50%;
  left: -21%;
  width: 142%;
  transform: rotate(45deg);
}

.caro-room-grid-cell.is-winning-diagonal-up::after {
  transform: rotate(-45deg);
}

.caro-calendar-main .caro-history-panel {
  display: none;
}

@media (max-width: 760px) {
  .caro-header {
    grid-template-columns: auto 1fr auto;
    padding: 0 12px;
  }

  .caro-brand {
    justify-self: center;
    margin-left: 0;
  }

  .caro-calendar-shell {
    grid-template-columns: 1fr;
  }

  .caro-calendar-shell.is-room {
    grid-template-columns: 1fr;
  }

  .caro-calendar-sidebar {
    position: static;
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    min-height: 0;
    gap: 0 14px;
    padding: 12px 16px 0;
    border-right: 0;
    border-bottom: 1px solid #dadce0;
  }

  .caro-calendar-create {
    width: fit-content;
    flex: 0 0 auto;
    margin-bottom: 12px;
  }

  .caro-calendar-side-section {
    flex: 1 1 225px;
    align-self: flex-start;
    margin-bottom: 12px;
    padding-bottom: 10px;
  }

  .caro-calendar-my {
    flex-basis: 160px;
  }

  .caro-calendar-shell.is-room .caro-calendar-sidebar {
    padding-right: 12px;
    padding-left: 12px;
  }

  .caro-room-board-section {
    flex-basis: 100%;
  }

  .caro-room-board-wrap {
    width: min(100%, 420px) !important;
    margin: 0 auto !important;
  }

  .caro-room-board .caro-cell {
    font-size: clamp(12px, 3vw, 20px);
  }

  .caro-calendar-history {
    display: none;
  }

  .caro-calendar-main {
    padding: 0 6px 20px;
  }

  .caro-calendar-toolbar {
    min-height: 52px;
  }

  .caro-calendar-navigation {
    gap: 7px;
  }

  .caro-calendar-navigation h1 {
    font-size: 17px;
  }

  .caro-calendar-today {
    min-height: 34px;
    padding: 0 10px;
    font-size: 11px;
  }

  .caro-calendar-view-label {
    padding: 7px 9px;
    font-size: 11px;
  }

  .caro-calendar-scroll {
    overflow: hidden;
  }

  .caro-time-grid {
    grid-template-columns: 34px repeat(var(--calendar-days), minmax(0, var(--calendar-cell-size)));
    grid-template-rows: 34px repeat(48, var(--calendar-cell-size));
  }

  .caro-time-corner {
    font-size: 7px;
  }

  .caro-day-heading {
    gap: 1px;
  }

  .caro-day-heading span {
    font-size: 6px;
  }

  .caro-day-heading strong {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }

  .caro-hour-label {
    font-size: 6px;
  }

  .caro-hour-label.is-half-hour {
    font-size: 5px;
  }

  .caro-calendar-history {
    display: none;
  }
}
