/**
 * style.css — YINUNU 纯端侧 OCR 文字识别工作台
 * 严格遵循系统默认字体栈（严禁任何外部字体）
 * 沉浸式暗色科技感精密工坊设计，全尺寸响应式适配 (100dvh)
 */

:root {
  --bg-app: #090d16;
  --bg-surface: #101726;
  --bg-card: #172134;
  --bg-card-hover: #1e2b44;
  --bg-input: #0b111e;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(56, 189, 248, 0.5);
  
  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --primary-glow: rgba(56, 189, 248, 0.25);
  
  --accent-green: #34d399;
  --accent-amber: #fbbf24;
  --accent-red: #f87171;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 亮色模式色彩变量 (Light Theme Variables) */
body.theme-light, html.theme-light body {
  --bg-app: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-card: #f8fafc;
  --bg-card-hover: #f1f5f9;
  --bg-input: #ffffff;
  
  --border-subtle: #cbd5e1;
  --border-focus: rgba(2, 132, 199, 0.6);
  
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-glow: rgba(2, 132, 199, 0.2);
  
  --accent-green: #059669;
  --accent-amber: #d97706;
  --accent-red: #dc2626;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.5;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* 顶部导航栏 */
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background-color: rgba(16, 23, 38, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* YINUNU 品牌 Logo 门户规范 */
.brand-portal-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
  flex-shrink: 0;
}

.brand-portal-link:hover {
  transform: scale(1.06);
  opacity: 0.95;
}

.brand-portal-logo {
  height: 28px;
  width: 112px;
  aspect-ratio: 4 / 1;
  border-radius: var(--radius-sm);
  object-fit: contain;
  display: block;
}

.app-heading {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.badge-privacy {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(52, 211, 153, 0.12);
  color: var(--accent-green);
  border: 1px solid rgba(52, 211, 153, 0.25);
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

/* 主题切换按钮规范 */
.theme-toggle {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-focus);
}

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

body.theme-dark .sun-icon { display: block; }
body.theme-dark .moon-icon { display: none; }
body.theme-light .sun-icon { display: none; }
body.theme-light .moon-icon { display: block; }

.btn-history-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  min-height: 38px;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-history-toggle:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.history-badge {
  background: var(--primary);
  color: #0b111e;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
}

/* 主工作台布局 */
.main-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(360px, 1.15fr) minmax(360px, 1fr);
  gap: 1.5rem;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
}

/* 通用卡片容器 */
.card-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* 视觉工作区：图像投递与预览 */
.dropzone-container {
  border: 2px dashed rgba(56, 189, 248, 0.35);
  background: rgba(11, 17, 30, 0.6);
  border-radius: var(--radius-md);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}

.dropzone-container:hover,
.dropzone-container.dragover {
  border-color: var(--primary);
  background: rgba(56, 189, 248, 0.08);
  box-shadow: 0 0 20px var(--primary-glow);
}

.dropzone-icon {
  width: 48px;
  height: 48px;
  color: var(--primary);
  margin-bottom: 0.75rem;
  opacity: 0.9;
}

.dropzone-text-primary {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.dropzone-text-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.file-input-hidden {
  display: none;
}

/* 图像预览视口 */
.preview-stage {
  position: relative;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  max-height: 380px;
  border: 1px solid var(--border-subtle);
}

.preview-canvas-wrapper {
  position: relative;
  max-width: 100%;
  max-height: 100%;
}

.preview-canvas {
  max-width: 100%;
  max-height: 380px;
  object-fit: contain;
  display: block;
}

.preview-overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* 识别处理中视口遮罩蒙版 */
.processing-mask {
  position: absolute;
  inset: 0;
  background: rgba(11, 17, 30, 0.78);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  z-index: 20;
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  text-align: center;
  user-select: none;
  animation: maskFadeIn 0.25s ease-out;
}

@keyframes maskFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.processing-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(56, 189, 248, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: maskSpin 0.75s linear infinite;
  box-shadow: 0 0 16px var(--primary-glow);
}

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

.processing-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
}

.processing-sub {
  font-size: 0.8rem;
  color: #7dd3fc;
  font-family: var(--font-mono);
  max-width: 90%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.6rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-mini-change {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--primary);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.75rem;
  transition: var(--transition);
}

.btn-mini-change:hover {
  background: rgba(56, 189, 248, 0.15);
}

/* 选项配置卡 */
.options-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.option-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.option-label {
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* 单选分段控件 Segmented Control */
.segmented-control {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-input);
  padding: 0.3rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.segmented-option {
  flex: 1;
  position: relative;
}

.segmented-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.segmented-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  min-height: 44px; /* 触控热区保证 */
  text-align: center;
}

.segmented-option input[type="radio"]:checked + .segmented-label {
  background: var(--bg-card-hover);
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.segmented-desc {
  font-size: 0.68rem;
  color: var(--text-dim);
  font-weight: normal;
}

.segmented-option input[type="radio"]:checked + .segmented-label .segmented-desc {
  color: #7dd3fc;
}

.segmented-option input[type="radio"]:disabled {
  cursor: not-allowed;
}

.segmented-option input[type="radio"]:disabled + .segmented-label {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.4);
}

.segmented-option input[type="radio"]:disabled + .segmented-label .segmented-desc {
  color: var(--text-dim);
}

/* 复选框开关 */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.825rem;
  color: var(--text-muted);
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* 开始识别主操作按钮 */
.btn-run-ocr {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.85rem 1.25rem;
  background: linear-gradient(135deg, var(--primary), #0284c7);
  color: #0b111e;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 14px var(--primary-glow);
  min-height: 48px;
}

.btn-run-ocr:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-run-ocr:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* 进度条与状态展示 */
.progress-box {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent-green));
  transition: width 0.25s ease;
}

.progress-status-text {
  font-size: 0.775rem;
  color: var(--primary);
  display: flex;
  justify-content: space-between;
}

/* 右侧控制台：结果文本区域 */
.console-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.result-stats-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stat-chip {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-dim);
}

.stat-chip strong {
  color: var(--text-main);
  margin-left: 0.2rem;
}

.console-actions-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  min-height: 40px;
}

.btn-action-primary {
  background: var(--primary);
  color: #0b111e;
  border: none;
}

.btn-action-primary:hover {
  background: var(--primary-hover);
}

.btn-action-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-action-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.btn-action-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid transparent;
}

.btn-action-ghost:hover {
  color: var(--accent-red);
}

.textarea-wrapper {
  flex: 1;
  display: flex;
  min-height: 320px;
}

.result-textarea {
  width: 100%;
  height: 100%;
  min-height: 320px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: var(--transition);
}

.result-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 12px var(--primary-glow);
}

/* 历史抽屉面板 */
.history-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  max-width: 90vw;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.7);
  z-index: 60;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  visibility: hidden;
}

.history-drawer.open {
  transform: translateX(0);
  visibility: visible;
}

.history-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.history-drawer-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.history-drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  gap: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.history-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.history-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #000;
  flex-shrink: 0;
}

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

.history-text-snippet {
  font-size: 0.8rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-meta-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  color: var(--text-dim);
}

.history-btn-del {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.history-btn-del:hover {
  color: var(--accent-red);
}

.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.history-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
  text-align: center;
  font-size: 0.85rem;
  gap: 0.5rem;
}

/* Toast 提示浮层 */
.toast-notice {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translate(-50%, 20px);
  background: rgba(16, 23, 38, 0.95);
  color: var(--text-main);
  border: 1px solid var(--border-focus);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  padding: 0.6rem 1.25rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.toast-notice.show {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

/* 品牌通用页脚规范 (YINUNU Footer) */
.yinunu-footer {
  margin-top: auto;
  padding: 2.5rem 1.5rem 2rem;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted, #94a3b8);
  line-height: 1.8;
}

.yinunu-footer-brand {
  font-weight: 600;
  color: var(--text-main, #f8fafc);
  margin-bottom: 0.35rem;
}

.yinunu-footer-links {
  margin-bottom: 0.45rem;
}

.yinunu-footer-links a {
  color: var(--text-muted, #94a3b8);
  text-decoration: none;
  transition: color 0.2s ease;
}

.yinunu-footer-links a:hover {
  color: var(--primary, #38bdf8);
  text-decoration: underline;
}

.yinunu-footer-sep {
  margin: 0 0.5rem;
  opacity: 0.4;
}

.yinunu-footer-copy {
  font-size: 0.75rem;
  color: var(--text-dim, #64748b);
}

/* ---------- YINUNU 通用模态弹窗（产品矩阵 & 隐私条款） ---------- */
.yinunu-products-modal[hidden] {
  display: none !important;
}

.yinunu-products-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.yinunu-products-modal * {
  box-sizing: border-box;
}

.yinunu-products-modal a {
  text-decoration: none;
}

.yinunu-products-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.yinunu-products-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  background: #181c2a !important;
  color: #f1f5f9 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: yinunuFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.yinunu-products-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: transparent !important;
}

.yinunu-products-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.yinunu-products-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: #f8fafc !important;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.yinunu-products-subtitle {
  margin: 0;
  font-size: 0.78rem;
  color: #94a3b8 !important;
  line-height: 1.4;
}

.yinunu-products-close {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  font-size: 1.5rem;
  line-height: 1;
  color: #94a3b8 !important;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

.yinunu-products-close:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.08) !important;
}

.yinunu-products-body {
  padding: 1.25rem 1.5rem 1.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: transparent !important;
  color: #f1f5f9 !important;
}

.yinunu-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.yinunu-product-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 8px;
  text-decoration: none !important;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.yinunu-product-item:hover {
  transform: translateY(-2px);
  border-color: #38bdf8 !important;
  background: rgba(56, 189, 248, 0.06) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.yinunu-product-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #f1f5f9 !important;
  margin-bottom: 0.35rem;
  transition: color 0.15s ease;
}

.yinunu-product-url {
  font-size: 0.75rem;
  color: #94a3b8 !important;
  word-break: break-all;
  transition: color 0.15s ease;
}

.yinunu-product-item:hover .yinunu-product-name {
  color: #38bdf8 !important;
}

.yinunu-product-item:hover .yinunu-product-url {
  color: #cbd5e1 !important;
}

/* ---------- 隐私条款专属样式 ---------- */
.yinunu-privacy-body {
  font-size: 0.85rem;
  line-height: 1.75;
  color: #cbd5e1 !important;
}

.yinunu-privacy-lead {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1) !important;
  color: #f1f5f9 !important;
}

.yinunu-privacy-body h4 {
  margin: 1.1rem 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #38bdf8 !important;
}

.yinunu-privacy-body p {
  margin: 0.4rem 0;
  color: #cbd5e1 !important;
}

.yinunu-privacy-body strong {
  color: #f8fafc !important;
  font-weight: 600;
}

.yinunu-privacy-bullet {
  padding-left: 0.8rem;
  position: relative;
}

.yinunu-privacy-bullet::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #38bdf8 !important;
}

.yinunu-privacy-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0.85rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: rgba(0, 0, 0, 0.18) !important;
}

.yinunu-privacy-agree-btn {
  background: #0284c7 !important;
  color: #ffffff !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  border-radius: 6px;
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.yinunu-privacy-agree-btn:hover {
  background: #0369a1 !important;
  opacity: 0.95;
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   亮色主题专项视觉适配 (Light Theme Specific Overrides)
   -------------------------------------------------------------------------- */
body.theme-light .header-bar {
  background-color: rgba(255, 255, 255, 0.88);
  border-bottom-color: var(--border-subtle);
}

body.theme-light .card-panel {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

body.theme-light .badge-privacy {
  background: rgba(5, 150, 105, 0.1);
  border-color: rgba(5, 150, 105, 0.25);
  color: #059669;
}

body.theme-light .history-badge {
  color: #ffffff;
}

body.theme-light .dropzone-container {
  border-color: rgba(2, 132, 199, 0.35);
  background: #f8fafc;
}

body.theme-light .dropzone-container:hover,
body.theme-light .dropzone-container.dragover {
  border-color: var(--primary);
  background: rgba(2, 132, 199, 0.06);
}

body.theme-light .preview-stage {
  background: #0f172a; /* 保持深色视口衬底以突出原图文本与识别框 */
  border-color: var(--border-subtle);
}

body.theme-light .segmented-control {
  background: #f1f5f9;
  border-color: var(--border-subtle);
}

body.theme-light .segmented-option input[type="radio"]:checked + .segmented-label {
  background: #ffffff;
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body.theme-light .segmented-option input[type="radio"]:checked + .segmented-label .segmented-desc {
  color: var(--primary);
}

body.theme-light .btn-run-ocr {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.25);
}

body.theme-light .btn-action-primary {
  background: var(--primary);
  color: #ffffff;
}

body.theme-light .stat-chip {
  background: #f1f5f9;
  color: var(--text-muted);
}

body.theme-light .stat-chip strong {
  color: var(--text-main);
}

body.theme-light .result-textarea {
  background: #ffffff;
  border-color: var(--border-subtle);
  color: var(--text-main);
}

body.theme-light .history-drawer {
  background: #ffffff;
  border-left-color: var(--border-subtle);
  box-shadow: -6px 0 25px rgba(0, 0, 0, 0.1);
}

body.theme-light .history-drawer-header {
  border-bottom-color: var(--border-subtle);
}

body.theme-light .history-card {
  background: #f8fafc;
  border-color: var(--border-subtle);
}

body.theme-light .history-card:hover {
  background: #f1f5f9;
  border-color: var(--border-focus);
}

body.theme-light .toast-notice {
  background: rgba(255, 255, 255, 0.98);
  color: var(--text-main);
  border-color: var(--border-subtle);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

body.theme-light .yinunu-footer {
  border-top-color: var(--border-subtle);
}

body.theme-light .yinunu-footer-brand {
  color: var(--text-main);
}

body.theme-light .yinunu-footer-links a:hover {
  color: var(--primary);
}

/* 响应式断点适配 */
@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: 1fr;
    padding: 1rem;
    gap: 1rem;
  }

  .app-heading {
    font-size: 0.95rem;
  }

  .badge-privacy {
    display: none;
  }
}

@media (max-width: 640px) {
  /* 小尺寸设备隐藏应用文本标题，杜绝顶栏挤压换行，完整保留 YINUNU 品牌 Logo 门户 */
  .app-heading {
    display: none;
  }
}

@media (max-width: 480px) {
  .header-bar {
    padding: 0.6rem 1rem;
  }

  .brand-portal-logo {
    height: 24px;
    width: 96px;
  }

  .theme-toggle {
    width: 34px;
    height: 34px;
  }

  .theme-icon {
    width: 16px;
    height: 16px;
  }

  .card-panel {
    padding: 1rem;
  }

  .segmented-control {
    flex-direction: column;
  }

  .segmented-label {
    flex-direction: row;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
  }

  /* 移动端模态弹窗适配 */
  .yinunu-products-card { max-height: 90vh; }
  .yinunu-products-grid { grid-template-columns: 1fr; }
  .yinunu-privacy-footer { justify-content: stretch; }
  .yinunu-privacy-agree-btn { width: 100%; text-align: center; }
}
