/* ==================== CSS RESET & VARIABLES ==================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

:root {
  --primary-color: #1d50f6;
  --primary-dark: #1e40af;
  --primary-light: #eef2ff;
  --bg-color: #f8f9fa;
  --card-bg: #ffffff;
  --text-main: #1a1a1a;
  --text-sub: #666666;
  --text-light: #999999;
  --border-color: #f0f0f0;
  
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background-color: #eaecef;
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
}

/* ==================== DEVICE MOCKUP CONTAINER ==================== */
.device-container {
  width: 420px;
  height: 860px;
  background-color: #000000;
  border-radius: 44px;
  border: 12px solid #1f1f1f;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.4);
  position: relative;
  display: flex;
  overflow: hidden;
}

.screen-frame {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-color);
  border-radius: 32px;
  overflow: hidden;
}

/* Status Bar Mockup */
.status-bar {
  height: 44px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 32px;
  background-color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  color: #000000;
  z-index: 100;
  position: relative;
  flex-shrink: 0;
}

.notch {
  width: 130px;
  height: 26px;
  background-color: #000000;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 0;
}

.status-icons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.signal-icon {
  width: 16px;
  height: 10px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23000"><path d="M2 22h20V2z"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
}

.wifi-icon {
  width: 14px;
  height: 10px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23000"><path d="M12 21l-12-12c5.07-5.07 13.93-5.07 19 0z"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
}

.battery-icon {
  width: 20px;
  height: 10px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23000" stroke-width="2"><rect x="1" y="6" width="18" height="12" rx="2"/><line x1="22" y1="10" x2="22" y2="14"/><rect x="3" y="8" width="10" height="8" rx="1" fill="%23000"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
}

/* Home Indicator Bar */
.home-indicator {
  width: 130px;
  height: 5px;
  background-color: #000000;
  border-radius: 3px;
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
}

/* Responsive query: make full screen on real mobile phones */
@media (max-width: 480px) {
  body {
    background-color: var(--bg-color);
  }
  .device-container {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
  .screen-frame {
    border-radius: 0;
  }
  .status-bar {
    padding: 0 16px;
    height: 38px;
  }
  .notch {
    display: none; /* Hide mockup notch on real notch phones */
  }
  .home-indicator {
    bottom: 4px;
    background-color: rgba(0,0,0,0.5);
  }
}

/* ==================== APP SHELL & NAVIGATION ==================== */
.app-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow: hidden;
  position: relative;
}

/* Header */
.app-header {
  height: 60px;
  background-color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-color);
  z-index: 90;
  flex-shrink: 0;
}

.app-header h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.sort-selector {
  background-color: var(--primary-light);
  padding: 6px 12px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.sort-selector span {
  font-size: 13px;
  color: var(--primary-color);
  font-weight: 600;
}

.chevron-down-icon {
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
  transform: rotate(45deg);
  margin-bottom: 2px;
}

/* Header sort dropdown menu */
.header-sort-menu {
  position: absolute;
  top: 55px;
  right: 20px;
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  padding: 6px 0;
  width: 120px;
  z-index: 150;
  display: none;
  border: 1px solid var(--border-color);
}

.header-sort-menu.active {
  display: block;
}

.sort-menu-item {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-sub);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.sort-menu-item.active {
  color: var(--primary-color);
  font-weight: bold;
  background-color: var(--primary-light);
}

/* Content Area */
.app-content {
  flex: 1;
  width: 100%;
  overflow: hidden;
  position: relative;
}

.view-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  display: none;
  flex-direction: column;
  padding-bottom: 30px; /* Space for smooth scroll */
}

.view-panel.active {
  display: flex;
}

/* Bottom Tabbar */
.app-tabbar {
  height: 64px;
  background-color: #ffffff;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 90;
  flex-shrink: 0;
  padding-bottom: var(--safe-bottom);
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-sub);
  cursor: pointer;
  flex: 1;
  height: 100%;
  justify-content: center;
  transition: all 0.2s ease;
}

.tab-icon {
  width: 24px;
  height: 24px;
  opacity: 0.8;
  object-fit: contain;
}

.tab-item span {
  font-size: 10px;
  font-weight: 500;
}

.tab-item.active {
  color: var(--primary-color);
}

.tab-item.active span {
  font-weight: 700;
}

/* ==================== SEARCH BAR ==================== */
.search-container {
  padding: 16px 20px 12px 20px;
  background-color: #ffffff;
}

.search-box {
  background-color: #f1f3f5;
  height: 38px;
  border-radius: 19px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  position: relative;
}

.search-icon {
  width: 15px;
  height: 15px;
  margin-right: 8px;
  opacity: 0.4;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23333" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  flex-shrink: 0;
}

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

.search-box input::placeholder {
  color: var(--text-light);
}

.search-clear-btn {
  font-size: 18px;
  color: var(--text-light);
  cursor: pointer;
  padding: 0 4px;
  display: none;
}

.search-clear-btn.active {
  display: inline;
}

/* ==================== RECOMMEND VIEW ==================== */
.category-carousel {
  width: 100%;
  overflow-x: auto;
  padding: 4px 0 16px 0;
  background-color: #ffffff;
  flex-shrink: 0;
}

.category-carousel::-webkit-scrollbar {
  display: none;
}

.category-list {
  display: inline-flex;
  padding: 0 20px;
  gap: 8px;
}

.category-item {
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  background-color: #f1f3f5;
  border-radius: 20px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-item:active {
  transform: scale(0.95);
}

.category-item.active {
  background-color: var(--primary-color);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(29, 80, 246, 0.2);
}

/* Video cards list */
.video-list-container {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.video-card {
  background-color: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.video-card:active {
  transform: scale(0.98);
}

.cover-wrapper {
  position: relative;
  width: 100%;
  height: 210px;
  background-color: #e5e7eb;
}

.cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tag-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background-color: var(--primary-color);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
}

.duration-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background-color: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
}

.video-info {
  padding: 16px;
}

.video-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-desc {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.6;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-meta {
  border-top: 1px solid #f8f9fa;
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-light);
}

.meta-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta-icon {
  width: 12px;
  height: 12px;
  opacity: 0.5;
  background-size: contain;
  background-repeat: no-repeat;
}

.clock-icon {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23333" stroke-width="2.5"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>');
}

.eye-icon {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23333" stroke-width="2.5"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>');
}

.heart-icon {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23333" stroke-width="2.5"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/></svg>');
}

.meta-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ==================== SQUARE VIEW ==================== */
.video-row {
  background-color: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  padding: 12px;
  display: flex;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.video-row:active {
  transform: scale(0.98);
}

.row-cover-wrapper {
  position: relative;
  width: 110px;
  height: 70px;
  border-radius: 6px;
  overflow: hidden;
  background-color: #e5e7eb;
  flex-shrink: 0;
}

.row-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.row-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0; /* Important for ellipsis */
}

.row-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-desc {
  font-size: 11px;
  color: var(--text-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.row-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.row-tag {
  background-color: var(--primary-light);
  color: var(--primary-color);
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.row-meta {
  display: flex;
  align-items: center;
  font-size: 9px;
  color: var(--text-light);
}

.row-meta-item {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
}

/* ==================== COMPARE VIEW ==================== */
.compare-chips-container {
  padding: 10px 0 16px 0;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  width: 100%;
  overflow-x: auto;
  flex-shrink: 0;
}

.compare-chips-container::-webkit-scrollbar {
  display: none;
}

.chip-list {
  display: inline-flex;
  padding: 0 20px;
  gap: 8px;
  align-items: center;
}

.compare-chip {
  background-color: var(--primary-light);
  color: var(--primary-color);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.compare-chip-close {
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  font-weight: 300;
}

.add-chip-btn {
  background-color: transparent;
  border: 1px dashed var(--primary-color);
  color: var(--primary-color);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  flex-shrink: 0;
}

.field-filter-trigger {
  background-color: #f8f9fa;
  border-bottom: 1px solid var(--border-color);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.field-filter-label {
  font-size: 13px;
  color: var(--text-sub);
  font-weight: 600;
}

/* Comparison Table */
.comparison-table-wrapper {
  flex: 1;
  overflow: auto;
  background-color: #ffffff;
  -webkit-overflow-scrolling: touch;
  border-top: 1px solid #eaeaea;
  position: relative;
}

.modern-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  color: var(--text-main);
  table-layout: fixed;
}

.modern-compare-table th,
.modern-compare-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #f0f0f0;
  text-align: left;
  vertical-align: top;
  word-break: break-all;
  white-space: normal;
  box-sizing: border-box;
  line-height: 1.4;
}

/* Sticky first column (字段) */
.modern-compare-table th:first-child,
.modern-compare-table td:first-child {
  position: -webkit-sticky;
  position: sticky;
  left: 0;
  z-index: 10;
  font-weight: 600;
  color: #555555;
  border-right: 2px solid #eaeaea;
  box-shadow: 4px 0 10px rgba(0,0,0,0.02);
  width: 90px;
  min-width: 90px;
}

/* Sticky headers at the top */
.modern-compare-table th {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 9;
  background-color: #f8f9fa;
  color: var(--primary-color);
  font-weight: 700;
  font-size: 12px;
  text-align: left;
  border-bottom: 2px solid #eaeaea;
  padding: 12px 10px;
  width: 130px;
  min-width: 130px;
}

/* Sticky left + top corner header */
.modern-compare-table th:first-child {
  z-index: 11;
  color: var(--text-sub);
  font-weight: 700;
  background-color: #f8f9fa;
}

/* Row backgrounds to prevent transparent bleed-through when scrolling sticky left column */
.modern-compare-table tr:nth-child(even) td {
  background-color: #fcfdfe;
}
.modern-compare-table tr:nth-child(odd) td {
  background-color: #ffffff;
}
.modern-compare-table tr:nth-child(even) td:first-child {
  background-color: #fcfdfe;
}
.modern-compare-table tr:nth-child(odd) td:first-child {
  background-color: #ffffff;
}

.modern-compare-table th .header-name {
  font-weight: 700;
  font-size: 12px;
  line-height: 1.2;
  color: var(--primary-color);
}

.modern-compare-table th .header-desc {
  font-size: 9px;
  color: var(--text-light);
  font-weight: 400;
  margin-top: 4px;
  line-height: 1.1;
}

.compare-empty-state {
  text-align: center;
  padding: 40px 0;
  color: var(--text-light);
  font-size: 13px;
}

/* ==================== MINE VIEW ==================== */
.profile-card {
  background-image: linear-gradient(to bottom, var(--primary-color), var(--primary-dark));
  padding: 24px 20px 30px 20px;
  color: #ffffff;
  flex-shrink: 0;
}

.profile-info {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.avatar-img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  object-fit: cover;
  background-color: #ffffff;
}

.user-name {
  font-size: 18px;
  font-weight: 700;
}

.user-role {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 4px;
}

.stats-row {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stats-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stats-num {
  font-size: 18px;
  font-weight: 700;
}

.stats-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 2px;
}

.stats-divider {
  width: 1px;
  height: 24px;
  background-color: rgba(255, 255, 255, 0.15);
}

.history-container {
  padding: 20px;
  flex: 1;
  background-color: var(--bg-color);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  margin-top: -12px;
  min-height: 400px;
}

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

.history-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.clear-history-btn {
  font-size: 12px;
  color: var(--primary-color);
  font-weight: 600;
  cursor: pointer;
}

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

.history-card {
  background-color: #ffffff;
  border-radius: 10px;
  padding: 10px;
  display: flex;
  gap: 12px;
  border: 1px solid var(--border-color);
}

.history-cover-wrapper {
  position: relative;
  width: 90px;
  height: 56px;
  border-radius: 4px;
  overflow: hidden;
  background-color: #eaeaea;
  flex-shrink: 0;
}

.history-cover-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.finished-badge {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 10px;
  font-weight: bold;
}

.history-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.history-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-time {
  font-size: 10px;
  color: var(--text-light);
  margin-top: 2px;
}

.history-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  gap: 8px;
}

.history-progress-track {
  flex: 1;
  height: 4px;
  background-color: #f1f3f5;
  border-radius: 2px;
  overflow: hidden;
}

.history-progress-fill {
  height: 100%;
  background-color: var(--primary-color);
  border-radius: 2px;
}

.history-progress-percent {
  font-size: 10px;
  color: var(--text-light);
  width: 30px;
  text-align: right;
  flex-shrink: 0;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
}

.empty-icon {
  width: 80px;
  height: 80px;
  opacity: 0.2;
  margin-bottom: 12px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23333" stroke-width="1.5"><circle cx="12" cy="12" r="10"/><line x1="8" y1="12" x2="16" y2="12"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
}

.empty-text {
  font-size: 13px;
  color: var(--text-light);
}

/* ==================== MODALS & DRAWERS (OVERLAYS) ==================== */
.modal-overlay {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background-color: rgba(0, 0, 0, 0.6) !important;
  z-index: 1000 !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* Drawer slips from bottom */
  border-radius: 32px;
  overflow: hidden;
}

.modal-overlay.active {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.drawer-content, .player-modal-content {
  background-color: #ffffff;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  width: 100% !important;
  max-width: 100% !important;
  max-height: 80%;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
  padding: 20px 20px calc(20px + var(--safe-bottom)) 20px;
  box-sizing: border-box;
}

.modal-overlay.active .drawer-content,
.modal-overlay.active .player-modal-content {
  transform: translateY(0) !important;
}

/* Drawer Header */
.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.drawer-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.drawer-close {
  font-size: 28px;
  color: var(--text-light);
  cursor: pointer;
  line-height: 1;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  min-height: 0;
}

/* Add Channel Item styling */
.add-channel-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f9f9f9;
  cursor: pointer;
}

.add-channel-item:active {
  background-color: #fdfdfd;
}

.add-item-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.add-item-desc {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

.add-item-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--primary-light);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
}

/* Fields Checkboxes List */
.drawer-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.drawer-action-link {
  font-size: 13px;
  color: var(--text-sub);
  cursor: pointer;
  font-weight: 500;
}

.drawer-confirm-btn {
  background-color: var(--primary-color);
  color: #ffffff;
  border: none;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 16px;
  cursor: pointer;
}

.field-checkbox-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 4px;
  border-bottom: 1px solid #f9f9f9;
  cursor: pointer;
}

.field-checkbox-label {
  font-size: 14px;
  color: var(--text-main);
}

.custom-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid #ccc;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.field-checkbox-item.checked .custom-checkbox {
  border-color: var(--primary-color);
}

.checkbox-dot {
  width: 10px;
  height: 10px;
  background-color: var(--primary-color);
  border-radius: 50%;
  display: none;
}

.field-checkbox-item.checked .checkbox-dot {
  display: block;
}

/* ==================== MOCK PLAYER MODAL ==================== */
.video-player-box {
  width: 100%;
  background-color: #000000;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

.video-player-screen {
  position: relative;
  width: 100%;
  height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.video-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

.player-overlay-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: rgba(29, 80, 246, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  box-shadow: 0 4px 15px rgba(29, 80, 246, 0.4);
  cursor: pointer;
}

.play-icon {
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-left: 14px solid white;
  border-bottom: 8px solid transparent;
  margin-left: 4px;
}

.play-icon.playing {
  width: 12px;
  height: 16px;
  border: none;
  border-left: 4px solid white;
  border-right: 4px solid white;
  margin-left: 0;
}

.player-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40px;
  background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0));
  z-index: 10;
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: #ffffff;
  font-size: 11px;
}

.progress-bar-container {
  flex: 1;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.3);
  margin: 0 12px;
  border-radius: 2px;
  position: relative;
  cursor: pointer;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--primary-color);
  border-radius: 2px;
  position: relative;
}

.progress-handle {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #ffffff;
  position: absolute;
  right: -5px;
  top: -3px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.video-details-box {
  padding: 16px 4px;
  flex: 1;
  overflow-y: auto;
}

.video-details-box h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.video-details-box p {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.6;
}

.author-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.author-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-image: linear-gradient(135deg, #a5b4fc, #818cf8);
}

.author-info {
  display: flex;
  flex-direction: column;
}

.author-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}

.author-title {
  font-size: 10px;
  color: var(--text-light);
  margin-top: 2px;
}

.modal-footer {
  display: flex;
  gap: 12px;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  flex-shrink: 0;
}

.modal-btn {
  flex: 1;
  height: 44px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cancel-btn {
  background-color: #f1f3f5;
  color: var(--text-sub);
}

.confirm-btn {
  background-color: var(--primary-color);
  color: #ffffff;
}

.confirm-btn:active {
  background-color: var(--primary-dark);
}

/* ==================== MOCK PLAYER FULLSCREEN & QUIZ EXTENSIONS ==================== */

/* Fullscreen player simulator mode */
.video-player-box.fullscreen {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 2500 !important;
  border-radius: 0 !important;
  background-color: #000000 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
}

.video-player-box.fullscreen .video-player-screen {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 16 / 9 !important;
  position: relative !important;
}

/* Disable transform containing block context on modal content during fullscreen mode */
.modal-overlay.fullscreen-mode .player-modal-content {
  transform: none !important;
  position: static !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

/* Fullscreen toggle button icon */
.player-fullscreen-btn {
  width: 18px;
  height: 18px;
  margin-left: 14px;
  opacity: 0.8;
  cursor: pointer;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23ffffff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

.player-fullscreen-btn:hover {
  opacity: 1;
}

/* Close fullscreen button (visible only in fullscreen mode) */
.player-exit-fullscreen {
  display: none;
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 28px;
  color: #ffffff;
  cursor: pointer;
  z-index: 2600;
  font-weight: bold;
  background-color: rgba(0, 0, 0, 0.5);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  text-align: center;
  line-height: 32px;
  box-sizing: border-box;
}

.video-player-box.fullscreen .player-exit-fullscreen {
  display: block;
}

.video-player-box.fullscreen .player-fullscreen-btn {
  display: none;
}

/* Quiz modal button tweaks */
.modal-footer .favorite-btn {
  background-color: #f1f3f5;
  color: var(--text-sub);
}

.modal-footer .confirm-btn {
  background-color: var(--primary-color);
  color: #ffffff;
}

/* ==================== QUIZ PAGE VIEW ==================== */
.quiz-header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 12px 20px;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  gap: 6px;
}

.quiz-back-btn {
  font-size: 13px;
  color: var(--primary-color);
  font-weight: 700;
  cursor: pointer;
}

.quiz-header-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.4;
}

.quiz-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.quiz-progress-box {
  margin-bottom: 20px;
}

.quiz-progress-text {
  display: flex;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-sub);
}

.q-type-badge {
  font-size: 10px;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 4px;
  background-color: var(--primary-light);
  color: var(--primary-color);
}

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

.quiz-progress-fill {
  height: 100%;
  background-color: var(--primary-color);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.question-card {
  background-color: #ffffff;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
}

.question-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 20px;
  line-height: 1.5;
}

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

.option-item {
  padding: 12px 16px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: #ffffff;
}

.option-item:active {
  transform: scale(0.98);
}

.option-item.selected {
  border-color: var(--primary-color);
  background-color: var(--primary-light);
}

.option-indicator {
  width: 18px;
  height: 18px;
  border: 2px solid #cccccc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  flex-shrink: 0;
}

/* Single choice is circle, multi is square */
.option-item.single .option-indicator,
.option-item.judgment .option-indicator {
  border-radius: 50%;
}

.option-item.multiple .option-indicator {
  border-radius: 4px;
}

.option-item.selected .option-indicator {
  border-color: var(--primary-color);
  background-color: var(--primary-color);
}

/* Inner dot/check symbol */
.option-item.selected .option-indicator::after {
  content: "";
  display: block;
}

.option-item.selected.single .option-indicator::after,
.option-item.selected.judgment .option-indicator::after {
  width: 6px;
  height: 6px;
  background-color: #ffffff;
  border-radius: 50%;
}

.option-item.selected.multiple .option-indicator::after {
  content: "✓";
  color: #ffffff;
  font-size: 10px;
  line-height: 1;
}

.option-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.4;
}

.quiz-nav-row {
  display: flex;
  gap: 12px;
  margin-top: auto;
  padding-top: 10px;
  flex-shrink: 0;
}

.quiz-nav-btn {
  flex: 1;
  height: 44px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background-color: #ffffff;
  color: var(--text-sub);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.quiz-nav-btn.next {
  background-color: var(--primary-color);
  color: #ffffff;
  border: none;
}

.quiz-nav-btn.next:active {
  background-color: var(--primary-dark);
}

.quiz-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==================== QUIZ RESULT PANEL ==================== */
.quiz-result-view {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.score-card {
  background-color: #ffffff;
  border-radius: 14px;
  padding: 24px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 5px solid var(--primary-color);
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-num {
  font-size: 26px;
  font-weight: 900;
  color: var(--primary-color);
}

.score-unit {
  font-size: 11px;
  color: var(--primary-color);
  font-weight: 700;
  margin-top: -2px;
}

.score-evaluation {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.score-stats {
  font-size: 12px;
  color: var(--text-light);
}

.analysis-section {
  margin-bottom: 24px;
}

.analysis-section h3 {
  font-size: 14px;
  font-weight: bold;
  color: var(--text-sub);
  margin-bottom: 12px;
}

.analysis-card {
  background-color: #ffffff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0,0,0,0.01);
}

.analysis-q-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
  margin-bottom: 8px;
}

.analysis-stat-row {
  font-size: 11px;
  font-weight: bold;
  margin-bottom: 8px;
}

.analysis-stat-row.correct {
  color: #10b981;
}

.analysis-stat-row.incorrect {
  color: #ef4444;
}

.analysis-explanation {
  background-color: #f9fafb;
  border-left: 3px solid #d1d5db;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text-sub);
  line-height: 1.5;
  border-radius: 0 4px 4px 0;
  word-break: break-all;
}

.quiz-result-actions {
  display: flex;
  gap: 12px;
  margin-top: auto;
  padding-top: 10px;
  flex-shrink: 0;
}

.quiz-action-btn {
  flex: 1;
  height: 44px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.quiz-action-btn.retry {
  background-color: #f1f3f5;
  color: var(--text-sub);
}

.quiz-action-btn.retry:active {
  background-color: #e5e7eb;
}

.quiz-action-btn.back {
  background-color: var(--primary-color);
  color: #ffffff;
}

.quiz-action-btn.back:active {
  background-color: var(--primary-dark);
}

/* ==================== DATA COMPARE CONFIG SELECTION ==================== */
.compare-type-selector {
  margin-bottom: 16px;
}

.section-sub-title {
  display: block;
  font-size: 13px;
  color: var(--text-light);
  font-weight: 700;
  margin-bottom: 8px;
}

.segment-control {
  display: flex;
  background-color: var(--primary-light);
  border-radius: 10px;
  padding: 4px;
  margin-top: 4px;
}

.segment-item {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-color);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.segment-item.active {
  background-color: var(--primary-color);
  color: #ffffff;
}

.compare-items-checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px 4px 4px 0;
  box-sizing: border-box;
}

.compare-item-checkbox {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background-color: #f8f9fa;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.compare-item-checkbox:hover {
  background-color: #f1f3f5;
}

.compare-item-checkbox.checked {
  background-color: var(--primary-light);
  border-color: rgba(29, 80, 246, 0.2);
}

.compare-item-checkbox-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  transition: color 0.2s ease;
}

.compare-item-checkbox.checked .compare-item-checkbox-name {
  color: var(--primary-color);
}

.compare-item-checkbox.checked .custom-checkbox {
  border-color: var(--primary-color);
}

.compare-item-checkbox.checked .checkbox-dot {
  display: block;
}

.compare-item-checkbox .custom-checkbox {
  flex-shrink: 0;
  margin-left: 10px;
}

/* Compare controls row and iOS-style toggle switch */
.compare-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #f8f9fa;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.hide-same-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px 12px 14px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.toggle-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
}

.toggle-switch {
  width: 36px;
  height: 20px;
  background-color: #e5e7eb;
  border-radius: 10px;
  position: relative;
  transition: background-color 0.2s ease;
}

.toggle-knob {
  width: 16px;
  height: 16px;
  background-color: #ffffff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.hide-same-toggle.active .toggle-switch {
  background-color: var(--primary-color);
}

.hide-same-toggle.active .toggle-knob {
  transform: translateX(16px);
}

/* Video Filter Drawer Styles */
.filter-section {
  display: flex;
  flex-direction: column;
  padding: 0 16px;
}

.filter-tags-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.filter-tag-item {
  padding: 6px 12px;
  background-color: #f2f3f5;
  border-radius: 6px;
  font-size: 11px;
  color: #4e5969;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-align: center;
  user-select: none;
}

.filter-tag-item:active {
  background-color: #e5e6eb;
}

.filter-tag-item.active {
  background-color: var(--primary-light);
  color: var(--primary-color);
  border-color: var(--primary-color);
  font-weight: 600;
}

.filter-drawer-actions {
  padding: 0 16px;
}

.filter-reset-btn {
  flex: 1;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #e5e6eb;
  background-color: #ffffff;
  font-size: 13px;
  color: #4e5969;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.filter-reset-btn:active {
  background-color: #f2f3f5;
}

.filter-apply-btn {
  flex: 2;
  height: 40px;
  border-radius: 8px;
  border: none;
  background-color: var(--primary-color);
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  cursor: pointer;
  transition: background-color 0.2s;
}

.filter-apply-btn:active {
  background-color: var(--primary-dark);
}



