/*
 * Mangosteen Firmware
 *
 * Copyright (c) 2026 BD1AHN
 *
 * Licensed under the Apache License, Version 2.0
 *
 * Project:
 *     山竹 (Mangosteen)
 *
 * Maintainer:
 *     BD1AHN
 *
 * Official Website:
 *     https://ethanyan6.github.io/Mangosteen/
 *
 * The Mangosteen name, logo, and official project identity
 * are protected separately from the source code license.
 */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* Mangosteen cute light-first theme（果皮酒红 + 果肉奶白，避免通用紫渐变） */
:root {
  color-scheme: light;
  --bg-page: #fff6f2;
  --bg-elevated: #ffffff;
  --bg-input: #fffaf8;
  --bg-log: #fffaf8;
  --bg-muted: #f3e4ea;
  --border-default: #ebcfd9;
  --border-strong: #d9a8b8;
  --text-primary: #3a2433;
  --text-muted: #7a5a68;
  --text-subtle: #916f7d;
  --text-disabled: #b89aa6;
  --text-bright: #2a1524;
  --accent: #a33d6b;
  --accent-dot-glow: rgba(163, 61, 107, 0.35);
  --btn-primary: #6b2d52;
  --btn-primary-hover: #843a66;
  --btn-fetch: #c45c7a;
  --btn-fetch-hover: #a33d6b;
  --subtitle-gradient-end: #f7e8ee;
  --toast-1: #ffffff;
  --toast-2: #fff6f2;
  --toast-3: #f3e4ea;
  --shadow-kicker: rgba(74, 32, 64, 0.14);
  --toast-close-hover-bg: rgba(74, 32, 64, 0.06);
  --rind: #4a2040;
  --leaf: #3d7a5c;
  --blush: #f5c6ce;
  --font-display: "Baloo 2", "ZCOOL KuaiLe", "Segoe UI", sans-serif;
  --font-body: "Nunito", "Noto Sans SC", "PingFang SC", sans-serif;
}

html.theme-dark {
  color-scheme: dark;
  --bg-page: #1a1018;
  --bg-elevated: #261820;
  --bg-input: #1a1018;
  --bg-log: #1a1018;
  --bg-muted: #332028;
  --border-default: #4a3040;
  --border-strong: #6a4055;
  --text-primary: #f3e4ea;
  --text-muted: #c9a8b6;
  --text-subtle: #b0899a;
  --text-disabled: #7a5a68;
  --text-bright: #fff6f2;
  --accent: #e889ab;
  --accent-dot-glow: rgba(232, 137, 171, 0.4);
  --btn-primary: #a33d6b;
  --btn-primary-hover: #c45c7a;
  --btn-fetch: #843a66;
  --btn-fetch-hover: #a33d6b;
  --subtitle-gradient-end: #332028;
  --toast-1: #2a1822;
  --toast-2: #261820;
  --toast-3: #1a1018;
  --shadow-kicker: rgba(0, 0, 0, 0.55);
  --toast-close-hover-bg: rgba(255, 246, 242, 0.08);
}

body {
  font-family: var(--font-body);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(245, 198, 206, 0.55), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(163, 61, 107, 0.12), transparent 50%),
    var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
}

/* Brand hero */
.brand-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 8px 0 4px;
  animation: brandIn 0.7s ease-out both;
}
.brand-mango {
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  filter: drop-shadow(0 8px 16px rgba(74, 32, 64, 0.22));
  animation: mangoBob 2.8s ease-in-out infinite;
}
.brand-mango .leaf {
  transform-origin: 70% 20%;
  animation: leafWiggle 3.2s ease-in-out infinite;
}
.brand-copy h1 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  font-weight: 700;
  color: var(--rind);
  letter-spacing: 0.02em;
  line-height: 1.15;
}
.brand-copy .brand-tagline {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.95rem;
}
@keyframes mangoBob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-6px) rotate(2deg); }
}
@keyframes leafWiggle {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-8deg); }
}
@keyframes brandIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.loading-mango {
  width: 96px;
  height: 96px;
  margin: 0 auto 12px;
  animation: mangoBob 1.4s ease-in-out infinite;
}

.tabs .tab {
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 700;
}
.tabs .tab.active {
  background: var(--btn-primary);
  box-shadow: 0 6px 16px rgba(107, 45, 82, 0.28);
}

.h1, .header .h1 { display: none; }

.top-marquee {
  background: linear-gradient(90deg, #6b2d52, #a33d6b, #c45c7a, #6b2d52);
  background-size: 200% 100%;
  animation: marqueeBg 12s linear infinite;
}
@keyframes marqueeBg {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

.coffee-btn {
  border-radius: 999px;
  background: linear-gradient(135deg, #f5c6ce, #e889ab);
  color: var(--rind);
  border: none;
  font-weight: 700;
}
.coffee-btn:hover {
  transform: translateY(-1px) scale(1.02);
}

.subtitle-call {
  color: var(--accent);
  font-family: var(--font-display);
}

/* Two-column layout: left version timeline (flush with page bg) + main column */
.page-layout { display: flex; min-height: 100vh; padding-top: 32px; }
.timeline-sidebar {
  flex: 0 0 340px;
  background: transparent;
  border: none;
  padding: 28px 18px 28px 24px;
  overflow-y: auto;
  position: sticky;
  top: 32px;
  height: calc(100vh - 32px);
}
/* 右侧主栏：内部 .container 为 720px 居中内容区；步骤条另按需定宽并居中 */
.main-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.container { min-width: 0; max-width: 720px; margin-left: auto; margin-right: auto; padding: 24px 32px; width: 100%; box-sizing: border-box; }
/* 仅「写频」标签激活时由 JS 为 body 添加 .writefreq-full，主栏占满右侧 */
body.writefreq-full .container { max-width: none; margin-left: 0; margin-right: 0; }
/* 写频表格较宽，隐藏右侧悬浮社交平台条以免遮挡 */
body.writefreq-full .subtitle-chips { display: none; }
.header { text-align: center; margin-bottom: 24px; max-width: 720px; margin-left: auto; margin-right: auto; }
.h1 { font-size: 1.6em; color: var(--accent); margin-bottom: 4px; }
.subtitle { font-size: 0.9em; color: var(--text-muted); text-align: center; margin-bottom: 20px; max-width: 720px; margin-left: auto; margin-right: auto; }
.subtitle-social {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  line-height: 1;
}
.subtitle-dev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 14px;
  background: linear-gradient(145deg, var(--bg-elevated) 0%, var(--subtitle-gradient-end) 100%);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.92em;
  color: var(--text-primary);
  line-height: 1;
}
.subtitle-call { color: var(--accent); font-weight: 600; letter-spacing: 0.02em; }
.subtitle-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.95;
}
.subtitle-icon--lg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}
/* 社交平台标签：视口右侧纵向悬浮（脱离文档流，不占副标题区高度） */
.subtitle-chips {
  position: fixed;
  right: calc(10px + env(safe-area-inset-right, 0px));
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 9980;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  gap: 8px;
  width: max-content;
  max-width: min(280px, calc(100vw - 24px));
  max-height: calc(100vh - 100px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 8px;
  margin: 0;
  box-sizing: border-box;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: 0 8px 28px var(--shadow-kicker);
}
.subtitle-chips::-webkit-scrollbar {
  width: 4px;
}
.subtitle-chips::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 2px;
}
.subtitle-chip {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-muted);
  border: 1px solid var(--border-default);
  border-radius: 999px;
  font-size: 0.82em;
  color: var(--text-primary);
  transition: border-color 0.2s, background 0.2s;
  box-sizing: border-box;
  text-align: left;
  min-width: 0;
}
.subtitle-chip:hover {
  background: var(--subtitle-gradient-end);
  border-color: var(--border-strong);
}
.subtitle-chips .subtitle-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.subtitle-chips .subtitle-chip-label {
  font-weight: 600;
  font-size: 0.92em;
  line-height: 1.2;
  flex-shrink: 0;
  white-space: nowrap;
}
.subtitle-chips .subtitle-chip-name {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9em;
  line-height: 1.25;
  min-width: 0;
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.subtitle-chip--douyin .subtitle-icon { color: #2dd4bf; }
.subtitle-chip--douyin .subtitle-chip-label { color: #5eead4; }
.subtitle-chip--bili .subtitle-icon { color: #fb7299; }
.subtitle-chip--bili .subtitle-chip-label { color: #f472b6; }
.subtitle-chip--redbook .subtitle-icon { color: #f87171; }
.subtitle-chip--redbook .subtitle-chip-label { color: #fca5a5; }
.subtitle-chip--weixin .subtitle-icon { color: #22c55e; }
.subtitle-chip--weixin .subtitle-chip-label { color: #4ade80; }
.subtitle-chip--fmo .subtitle-icon { color: #f97316; }
.subtitle-chip--fmo .subtitle-chip-label { color: #fb923c; }
.subtitle-chip--dondji .subtitle-icon { color: #fbbf24; }
.subtitle-chip--dondji .subtitle-chip-label { color: #fcd34d; }
a.subtitle-chip {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
a.subtitle-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.language-selector { position: absolute; top: 16px; right: 16px; }
.language-selector select { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border-strong); border-radius: 6px; padding: 4px 8px; font-size: 0.85em; }

/* 刷机步骤条：外壳不裁切（避免提示框被上边框挡住）；横向滚动仅作用在内层 .flash-steps-scroll */
.flash-steps-bar {
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  font-size: 0.85em;
  line-height: 1.45;
  overflow: visible;
}
.flash-steps-scroll {
  min-width: 0;
  overflow-x: hidden;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) var(--bg-muted);
}
/* 仅保留横向滚动条外观；纵向条宽压成 0，避免误出现纵向条 */
.flash-steps-scroll::-webkit-scrollbar {
  width: 0;
  height: 6px;
}
.flash-steps-scroll::-webkit-scrollbar-track {
  background: var(--bg-muted);
  border-radius: 3px;
}
.flash-steps-scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}
.flash-steps-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--text-subtle);
}
.flash-steps-inner {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px 14px;
  width: max-content;
}
.flash-steps-heading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.flash-steps-heading-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #f85149;
}
.flash-steps-label {
  font-weight: 700;
  color: #f85149;
}
.flash-step-index {
  font-weight: 700;
  color: #f85149;
  flex-shrink: 0;
}
.flash-steps-list {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}
.flash-step-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  position: relative;
  padding: 4px 2px;
  border-radius: 6px;
  outline: none;
}
.flash-step-item:not(:first-child)::before {
  content: '→';
  color: var(--text-subtle);
  font-size: 0.85em;
  margin-right: 6px;
  user-select: none;
}
.flash-step-item:focus-visible {
  box-shadow: 0 0 0 2px var(--accent-dot-glow);
}
.flash-step-name {
  color: var(--text-primary);
  white-space: nowrap;
}
.flash-step-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid var(--text-muted);
  font-size: 0.55rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-muted);
  cursor: help;
  flex-shrink: 0;
  box-sizing: border-box;
}
/* 默认移出排版流并收起：否则长文案 span 会在步骤里折行，整条被撑高并出现纵向滚动条 */
.flash-step-tooltip {
  position: absolute;
  left: -9999px;
  top: 0;
  box-sizing: border-box;
  min-width: 200px;
  max-width: min(340px, calc(100vw - 48px));
  padding: 9px 11px;
  background: var(--bg-muted);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: 0 8px 24px var(--shadow-kicker);
  font-size: 0.92em;
  line-height: 1.45;
  color: var(--text-primary);
  text-align: left;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 300;
}
.flash-step-tooltip.flash-step-tooltip--open {
  opacity: 1;
  visibility: visible;
}

/* Tabs */
.tabs {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-default);
  padding-bottom: 0;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  background: linear-gradient(180deg, transparent 0%, rgba(88, 166, 255, 0.03) 100%);
  padding-top: 8px;
}
.tab {
  background: linear-gradient(180deg, rgba(88, 166, 255, 0.08) 0%, rgba(88, 166, 255, 0.02) 100%);
  border: 1px solid rgba(88, 166, 255, 0.15);
  border-bottom: none;
  color: var(--text-muted);
  padding: 10px 20px;
  cursor: pointer;
  font-size: 0.88em;
  font-weight: 500;
  font-style: italic;
  border-radius: 0;
  transition: all 0.25s ease;
  width: auto;
  flex: 0 0 auto;
  margin-bottom: 0;
  position: relative;
  letter-spacing: 0.03em;
  transform: skewX(-15deg);
  transform-origin: bottom;
}
.tab span,
.tab {
  display: inline-block;
}
.tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(88, 166, 255, 0.4) 50%, transparent 100%);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.tab::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, rgba(88, 166, 255, 0.4) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.tab:hover {
  color: var(--accent);
  background: linear-gradient(180deg, rgba(88, 166, 255, 0.18) 0%, rgba(88, 166, 255, 0.06) 100%);
  border-color: rgba(88, 166, 255, 0.4);
  box-shadow: 
    0 4px 16px rgba(88, 166, 255, 0.2),
    inset 0 1px 0 rgba(88, 166, 255, 0.15);
}
.tab:hover::before,
.tab:hover::after {
  opacity: 1;
}
.tab.active {
  color: var(--accent);
  background: linear-gradient(180deg, rgba(88, 166, 255, 0.25) 0%, rgba(88, 166, 255, 0.08) 100%);
  border-color: var(--accent);
  border-bottom-color: var(--bg-page);
  font-weight: 600;
  box-shadow: 
    0 -3px 12px rgba(88, 166, 255, 0.25),
    0 4px 20px rgba(88, 166, 255, 0.15),
    inset 0 1px 0 rgba(88, 166, 255, 0.2);
}
.tab.active::before {
  opacity: 1;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, transparent 100%);
  box-shadow: 0 0 8px var(--accent);
}
.tab.active::after {
  opacity: 1;
  background: linear-gradient(180deg, var(--accent) 0%, rgba(88, 166, 255, 0.3) 100%);
  box-shadow: 0 0 6px var(--accent);
}
html.theme-light .tab {
  background: linear-gradient(180deg, rgba(9, 105, 218, 0.08) 0%, rgba(9, 105, 218, 0.02) 100%);
  border-color: rgba(9, 105, 218, 0.2);
}
html.theme-light .tab:hover {
  background: linear-gradient(180deg, rgba(9, 105, 218, 0.15) 0%, rgba(9, 105, 218, 0.05) 100%);
  border-color: rgba(9, 105, 218, 0.4);
  box-shadow: 
    0 4px 16px rgba(9, 105, 218, 0.15),
    inset 0 1px 0 rgba(9, 105, 218, 0.12);
}
html.theme-light .tab.active {
  background: linear-gradient(180deg, rgba(9, 105, 218, 0.2) 0%, rgba(9, 105, 218, 0.06) 100%);
  border-color: var(--accent);
  border-bottom-color: var(--bg-page);
}

/* Tab content */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Section */
.section { margin-bottom: 16px; }
.section label { display: block; font-size: 0.85em; color: var(--text-muted); margin-bottom: 6px; }

/* File input */
.file-input-wrapper { position: relative; }
/* 校准等：整块区域点击选择文件（input 为 wrapper 直接子元素） */
.file-input-wrapper > input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.file-input-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  padding: 12px 16px;
  transition: border-color 0.2s;
}
.file-input-wrapper--dual .file-input-label {
  flex-wrap: wrap;
}
.file-input-wrapper--dual .file-name {
  flex: 1 1 120px;
  min-width: 0;
}
.file-input-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.file-input-actions .file-action-remote {
  width: auto;
  min-width: unset;
  margin-bottom: 0;
  padding: 6px 12px;
  font-size: 0.8em;
}
.file-local-trigger {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}
.file-input-wrapper--dual .file-local-trigger input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.file-input-label:hover { border-color: var(--accent); }
.file-input-label.has-file { border-style: solid; border-color: var(--btn-primary); }
.file-name { color: var(--text-muted); font-size: 0.9em; }
.file-name.has-file { color: var(--text-primary); }
.file-button {
  position: relative;
  z-index: 1;
  display: inline-block;
  background: var(--bg-muted);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.8em;
  white-space: nowrap;
}

/* Buttons */
button { background: var(--btn-primary); color: #fff; border: 1px solid rgba(240,246,252,0.1); border-radius: 6px; padding: 12px 24px; font-size: 1em; cursor: pointer; width: 100%; transition: background 0.2s; margin-bottom: 8px; }
button:hover { background: var(--btn-primary-hover); }
button:disabled { background: var(--bg-muted); color: var(--text-disabled); cursor: not-allowed; border-color: var(--border-strong); }
.btn-secondary { background: var(--bg-muted); color: var(--text-primary); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--border-strong); }
.btn-fetch { background: var(--btn-fetch); }
.btn-fetch:hover { background: var(--btn-fetch-hover); }

/* Progress */
.progress-container { display: none; margin: 16px 0; }
.progress-bar { background: var(--bg-elevated); border-radius: 8px; height: 24px; overflow: hidden; position: relative; border: 1px solid var(--border-strong); }
.progress-fill { background: linear-gradient(90deg, var(--btn-primary), var(--btn-primary-hover)); height: 100%; width: 0; transition: width 0.3s; }
.progress-label { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 0.75em; color: #fff; font-weight: 600; }
html.theme-light .progress-label { color: var(--text-primary); }

/* Log */
.log-container { margin-top: 16px; }
.log-toggle { background: none; border: 1px solid var(--border-strong); color: var(--text-muted); padding: 6px 12px; font-size: 0.8em; width: auto; margin-bottom: 8px; }
.log {
  display: none;
  background: var(--bg-log);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 12px;
  max-height: 200px;
  overflow-y: auto;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 0.75em;
  line-height: 1.6;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.log.visible { display: block; }
.log::-webkit-scrollbar {
  width: 6px;
}
.log::-webkit-scrollbar-track {
  background: transparent;
}
.log::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}
.log::-webkit-scrollbar-thumb:hover {
  background: var(--text-disabled);
}
.log-entry { padding: 1px 0; }
.log-entry.success { color: #3fb950; }
.log-entry.error { color: #f85149; }
.log-entry.info { color: var(--text-muted); }
.log-entry.warning { color: #d29922; }

/* Info box — 与正文同宽居中（写频全宽时仍保持窄提示块） */
.info-box { background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: 8px; padding: 16px; margin-top: 20px; font-size: 0.85em; color: var(--text-muted); max-width: 720px; margin-left: auto; margin-right: auto; }
.info-box strong { color: var(--text-primary); }

/* Download link */
.download-link { display: none; margin: 12px 0; text-align: center; }
.download-link a { color: var(--accent); text-decoration: none; }
.download-link a:hover { text-decoration: underline; }

/* Firmware version info */
.fw-info { background: var(--bg-elevated); border: 1px solid var(--border-default); border-radius: 8px; padding: 12px; margin-bottom: 12px; font-size: 0.85em; }
.fw-info .fw-name { color: var(--accent); font-weight: 600; }
.fw-info .fw-size { color: var(--text-muted); }
.fw-info .fw-date { color: var(--text-muted); font-size: 0.85em; }

/* Write frequency (MR) tab */
.writefreq-lead {
  font-size: 0.95em;
  text-align: center;
  margin-bottom: 12px;
  line-height: 1.55;
}
.writefreq-lead .writefreq-scope-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
  color: #f85149;
  font-weight: 600;
}
.writefreq-lead-ico {
  width: 1.15em;
  height: 1.15em;
  flex-shrink: 0;
}
.writefreq-char-missing {
  color: var(--text-muted);
  font-weight: 500;
}
.writefreq-char-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.2s;
}
.writefreq-char-link:hover {
  color: #58a6ff;
}
.writefreq-log-dock { margin-top: 8px; }
.writefreq-log-dock .log-container { margin-top: 0; }
.writefreq-log-dock .progress-container {
  margin-top: 8px;
  margin-bottom: 12px;
}
.log-anchor-default { display: none; }
.writefreq-toolbar { margin-bottom: 12px; }
.writefreq-toolbar-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 12px;
}
.writefreq-range { display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.9em; color: var(--text-muted); align-items: center; }
.writefreq-range input { width: 72px; margin-left: 6px; background: var(--bg-elevated); border: 1px solid var(--border-strong); color: var(--text-primary); border-radius: 6px; padding: 6px 8px; }
.writefreq-actions-split {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 1;
  min-width: min(100%, 420px);
}
.writefreq-actions-left,
.writefreq-actions-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
button.btn-inline {
  width: auto;
  flex: 0 0 auto;
  min-width: unset;
  margin-bottom: 0;
  padding: 6px 12px;
  font-size: 0.875rem;
}
button.btn-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-ico {
  display: inline-flex;
  flex-shrink: 0;
}
.btn-ico svg {
  width: 16px;
  height: 16px;
  display: block;
  opacity: 0.95;
}
.wide-scroll {
  overflow-x: auto;
  margin-bottom: 16px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  width: 100%;
  box-sizing: border-box;
}
/* 写频横向滚动条：与左侧历史版本时间线 sidebar 同色，滚动条在表格下方（正常文档流） */
#writefreq-content .writefreq-table-scroll::-webkit-scrollbar {
  height: 6px;
}
#writefreq-content .writefreq-table-scroll::-webkit-scrollbar-track {
  background: transparent;
}
#writefreq-content .writefreq-table-scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}
#writefreq-content .writefreq-table-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--text-disabled);
}
#writefreq-content .writefreq-table-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.writefreq-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 0.9em;
  color: var(--text-muted);
}
.writefreq-page-info {
  min-width: 200px;
  text-align: center;
}
#writefreq-content { width: 100%; max-width: none; box-sizing: border-box; }
.writefreq-table { width: 100%; border-collapse: collapse; font-size: 0.82em; min-width: 1200px; }
.writefreq-table th, .writefreq-table td { border: 1px solid var(--border-default); padding: 6px 8px; text-align: left; }
.writefreq-table th { background: var(--bg-elevated); color: var(--text-muted); font-weight: 600; }
.writefreq-table .th-sub { font-weight: 400; font-size: 0.85em; color: var(--text-subtle); }
.writefreq-table input,
.writefreq-table select { width: 100%; min-width: 0; background: var(--bg-input); border: 1px solid var(--border-strong); color: var(--text-primary); border-radius: 4px; padding: 6px 8px; font-size: 0.95em; }
.writefreq-table select.wf-rx-dcs,
.writefreq-table select.wf-tx-dcs { min-width: 88px; max-width: 120px; font-size: 0.8em; }
.writefreq-table td.ch-num { color: var(--text-muted); text-align: center; width: 52px; }
/* 写频表：删除列固定在表格右侧，横向滚动时始终可见 */
.writefreq-table thead th.wf-delete-th,
.writefreq-table tbody td.wf-delete-cell {
  position: sticky;
  right: 0;
  width: 48px;
  min-width: 48px;
  max-width: 48px;
  text-align: center;
  vertical-align: middle;
  padding-left: 4px;
  padding-right: 4px;
  box-sizing: border-box;
}
.writefreq-table thead th.wf-delete-th {
  z-index: 4;
  background: var(--bg-elevated);
  box-shadow: -8px 0 12px -8px var(--shadow-kicker);
}
.writefreq-table tbody td.wf-delete-cell {
  z-index: 3;
  background: var(--bg-page);
  box-shadow: -8px 0 12px -8px var(--shadow-kicker);
}
.writefreq-table .wf-row-delete-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
}
.writefreq-table .wf-row-delete-btn:hover {
  color: #f85149;
  border-color: var(--border-strong);
  background: var(--bg-muted);
}
.writefreq-table .wf-row-delete-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.writefreq-table .wf-row-delete-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}
.writefreq-table th.wf-drag-th,
.writefreq-table td.wf-drag-handle {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  text-align: center;
  vertical-align: middle;
  color: var(--text-subtle);
  cursor: grab;
  user-select: none;
  padding-left: 4px;
  padding-right: 4px;
}
.writefreq-table td.wf-drag-handle:active {
  cursor: grabbing;
}
.writefreq-table select.wf-step {
  min-width: 70px;
  max-width: 90px;
  font-size: 0.85em;
}
.writefreq-table td.wf-scanlist-cell {
  text-align: center;
  min-width: 80px;
}
.writefreq-table select.wf-scanlist {
  min-width: 70px;
  max-width: 90px;
  font-size: 0.85em;
}
.writefreq-sortable-ghost {
  opacity: 0.45;
  background: var(--bg-muted) !important;
}
.writefreq-sortable-chosen {
  background: var(--bg-elevated) !important;
}
.writefreq-sortable-drag {
  opacity: 0.95;
}
.writefreq-validation { font-size: 0.85em; color: #f85149; white-space: pre-wrap; }

/* 顶部滚动公告栏 */
.top-marquee {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: linear-gradient(90deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%);
  border-bottom: 1px solid var(--border-strong);
  overflow: hidden;
  height: 32px;
  line-height: 32px;
}
html.theme-light .top-marquee {
  background: linear-gradient(90deg, #f0f4f8 0%, #e8f0fe 50%, #f0f4f8 100%);
}
.top-marquee-inner {
  display: flex;
  animation: marquee-scroll 25s linear infinite;
  white-space: nowrap;
}
.top-marquee-inner:hover {
  animation-play-state: paused;
}
.marquee-text {
  display: inline-block;
  padding: 0 50px;
  color: #58a6ff;
  font-size: 0.85em;
  font-weight: 500;
}
html.theme-light .marquee-text {
  color: #0969da;
}
.marquee-text span {
  color: #3fb950;
  font-weight: 700;
}
html.theme-light .marquee-text span {
  color: #1a7f37;
}
@keyframes marquee-scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* 加载中转圈动画 */
.loading-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(63, 185, 80, 0.3);
  border-top-color: #3fb950;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin: 0 2px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 右上角主题切换（Toast 叠在其下方） */
.theme-toggle {
  position: fixed;
  top: calc(44px + env(safe-area-inset-top, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  z-index: 9998;
  width: 42px;
  height: 42px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px var(--shadow-kicker);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button.theme-toggle {
  width: 42px;
  margin-bottom: 0;
}
.theme-toggle__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: block;
}
html:not(.theme-light) .theme-toggle__icon--sun {
  display: block;
}
html:not(.theme-light) .theme-toggle__icon--moon {
  display: none;
}
html.theme-light .theme-toggle__icon--sun {
  display: none;
}
html.theme-light .theme-toggle__icon--moon {
  display: block;
}

.top-right-buttons {
  position: fixed;
  top: calc(44px + env(safe-area-inset-top, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 8px;
}

.help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  box-shadow: 0 4px 18px var(--shadow-kicker);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  text-decoration: none;
  font-size: 0.9em;
  font-weight: 500;
  font-family: inherit;
  line-height: 1;
  box-sizing: border-box;
  width: auto;
  margin: 0;
  flex-shrink: 0;
  vertical-align: middle;
}

/* Override global `button { width:100%; margin-bottom; padding… }` */
button.help-btn {
  width: auto;
  margin: 0;
  padding: 0 14px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
}

button.help-btn:hover {
  background: var(--bg-elevated);
  color: var(--accent);
  border-color: var(--accent);
}

button.help-btn:disabled {
  background: var(--bg-elevated);
  color: var(--text-disabled);
  cursor: not-allowed;
}

.help-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

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

.help-btn__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
}

.help-btn__text {
  white-space: nowrap;
}

.top-right-buttons .theme-toggle {
  position: static;
}

/* Language switcher button */
.lang-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  height: 42px;
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  box-shadow: 0 4px 18px var(--shadow-kicker);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  font-size: 0.9em;
  font-weight: 500;
  font-family: inherit;
  line-height: 1;
  box-sizing: border-box;
  width: auto;
  flex-shrink: 0;
  vertical-align: middle;
}

button.lang-switch:hover {
  background: var(--bg-elevated);
  color: var(--accent);
  border-color: var(--accent);
}

.lang-switch:hover {
  color: var(--accent);
  border-color: var(--accent);
}

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

.lang-switch__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
}

.lang-switch__text {
  white-space: nowrap;
}

/* 全局轻提示（替代 alert），固定在右上角 */
.app-toast-root {
  position: fixed;
  top: calc(94px + env(safe-area-inset-top, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  left: auto;
  bottom: auto;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
  width: min(92vw, 440px);
  max-width: calc(100vw - 24px);
}
.app-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 12px 14px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(155deg, var(--toast-1) 0%, var(--toast-2) 55%, var(--toast-3) 100%);
  box-shadow:
    0 16px 48px var(--shadow-kicker),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  opacity: 0;
  transform: translateX(18px) scale(0.98);
  transition: opacity 0.3s ease, transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.app-toast.app-toast-visible {
  opacity: 1;
  transform: translateX(0) scale(1);
}
.app-toast--warning {
  border-color: rgba(210, 153, 34, 0.55);
  box-shadow:
    0 16px 48px var(--shadow-kicker),
    0 0 0 1px rgba(210, 153, 34, 0.12) inset,
    0 0 32px rgba(158, 106, 3, 0.12);
}
.app-toast--info {
  border-color: rgba(88, 166, 255, 0.45);
  box-shadow:
    0 16px 48px var(--shadow-kicker),
    0 0 0 1px rgba(88, 166, 255, 0.1) inset,
    0 0 28px rgba(88, 166, 255, 0.1);
}
.app-toast--info .app-toast-icon {
  color: var(--accent);
}
.app-toast--success {
  border-color: rgba(63, 185, 80, 0.5);
  box-shadow:
    0 16px 48px var(--shadow-kicker),
    0 0 0 1px rgba(63, 185, 80, 0.12) inset,
    0 0 28px rgba(63, 185, 80, 0.12);
}
.app-toast--success .app-toast-icon {
  color: #3fb950;
}
.app-toast-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  color: #e3b341;
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-toast-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}
.app-toast-body {
  flex: 1;
  min-width: 0;
}
.app-toast-msg {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-bright);
  letter-spacing: 0.01em;
  white-space: pre-wrap;
}
.app-toast-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin: -6px -4px -6px 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.app-toast-close:hover {
  color: var(--text-bright);
  background: var(--toast-close-hover-bg);
}

/* 刷固件标签：设备型号安全提示弹窗 */
.flash-device-warning-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  box-sizing: border-box;
}
.flash-device-warning-modal[hidden] {
  display: none;
}
.flash-device-warning-modal__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(1, 4, 9, 0.72);
  backdrop-filter: blur(4px);
}
html.theme-light .flash-device-warning-modal__backdrop {
  background: rgba(31, 35, 40, 0.45);
}
.flash-device-warning-modal__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 440px);
  max-height: min(90vh, 520px);
  overflow: auto;
  padding: 22px 22px 20px;
  border-radius: 14px;
  border: 1px solid rgba(210, 153, 34, 0.55);
  background: linear-gradient(155deg, var(--toast-1) 0%, var(--toast-2) 55%, var(--toast-3) 100%);
  box-shadow:
    0 24px 64px var(--shadow-kicker),
    0 0 0 1px rgba(210, 153, 34, 0.15) inset,
    0 0 40px rgba(158, 106, 3, 0.14);
}
.flash-device-warning-modal__title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-bright);
  margin: 0 0 14px;
  line-height: 1.35;
}
.flash-device-warning-modal__text {
  margin: 0 0 20px;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-primary);
}
.flash-device-warning-modal__text strong {
  color: #e3b341;
  font-weight: 600;
}
.flash-device-warning-modal__btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--btn-primary);
  color: #fff;
  transition: background 0.15s ease;
}
.flash-device-warning-modal__btn:hover {
  background: var(--btn-primary-hover);
}
.flash-device-warning-modal__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 校准检查弹窗 */
.calib-check-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
  box-sizing: border-box;
}
.calib-check-modal[hidden] { display: none; }
.calib-check-modal__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(1, 4, 9, 0.72);
  backdrop-filter: blur(4px);
}
html.theme-light .calib-check-modal__backdrop {
  background: rgba(31, 35, 40, 0.45);
}
.calib-check-modal__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 960px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 20px;
  border-radius: 14px;
  border: 1px solid rgba(210, 153, 34, 0.55);
  background: linear-gradient(155deg, var(--toast-1) 0%, var(--toast-2) 55%, var(--toast-3) 100%);
  box-shadow: 0 24px 64px var(--shadow-kicker), 0 0 0 1px rgba(210, 153, 34, 0.15) inset;
}
.calib-check-modal__title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-bright);
  margin: 0;
}
.calib-check-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.calib-check-modal__close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  margin-bottom: 0;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  width: auto;
  min-width: unset;
}
.calib-check-modal__close:hover {
  color: var(--text-bright);
  background: var(--toast-close-hover-bg);
}
.calib-check-modal__toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.calib-check-modal__toolbar button {
  width: auto;
  margin-bottom: 0;
  padding: 8px 14px;
  font-size: 0.8em;
}
.calib-check-modal__table-wrap {
  flex: 1;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  min-height: 0;
}
.calib-check-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8em;
}
.calib-check-table th,
.calib-check-table td {
  border: 1px solid var(--border-default);
  padding: 6px 8px;
  vertical-align: middle;
}
.calib-check-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  color: var(--text-bright);
  font-weight: 600;
  z-index: 1;
}
.calib-check-table__col-desc {
  width: 200px;
  min-width: 160px;
  text-align: left;
  color: var(--text-primary);
  font-weight: 500;
}
.calib-check-table__col-data {
  min-width: 160px;
  text-align: center;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 0.9em;
}
.calib-check-table__col-backup {
  min-width: 160px;
  text-align: center;
}
.calib-check-table td.calib-desc {
  background: var(--bg-muted);
  color: var(--text-primary);
  font-weight: 500;
}
.calib-check-table td.calib-val {
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  text-align: center;
  color: var(--text-muted);
}
.calib-check-table td.calib-val.calib-val--empty {
  color: var(--text-disabled);
}
.calib-check-table td.calib-val.calib-val--invalid {
  background: #f85149;
  color: #000;
  font-weight: 700;
}
.calib-check-table td.calib-backup-cell {
  padding: 2px 4px;
}
.calib-check-table td.calib-backup-cell input {
  width: 100%;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  padding: 4px 6px;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 0.95em;
  text-align: center;
  box-sizing: border-box;
}
.calib-check-table td.calib-backup-cell input:focus {
  outline: none;
  border-color: var(--accent);
}
.calib-check-table tr:hover td {
  background: rgba(88, 166, 255, 0.04);
}
.calib-check-modal__actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.calib-check-modal__actions button {
  width: auto;
  margin-bottom: 0;
  padding: 10px 24px;
  font-size: 0.9em;
}

/* Version Timeline Sidebar */
.timeline-sidebar::-webkit-scrollbar { width: 6px; }
.timeline-sidebar::-webkit-scrollbar-track { background: transparent; }
.timeline-sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.timeline-sidebar::-webkit-scrollbar-thumb:hover { background: var(--text-disabled); }

.timeline-title { font-size: 1em; color: var(--text-primary); margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid transparent; }
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--border-strong); opacity: 0.7; }
.timeline-loading { color: var(--text-disabled); font-size: 0.8em; padding: 8px 0; }
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: -21px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); border: 2px solid var(--bg-page); z-index: 1; }
.timeline-item:first-child .timeline-dot { background: var(--accent); box-shadow: 0 0 6px var(--accent-dot-glow); }
.timeline-header { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin-bottom: 2px; }
.timeline-tag { color: var(--accent); font-weight: 600; font-size: 0.85em; text-decoration: none; }
.timeline-tag:hover { text-decoration: underline; }
.timeline-name { color: var(--text-primary); font-size: 0.8em; }
.timeline-date { color: var(--text-disabled); font-size: 0.7em; }
.timeline-body { color: var(--text-muted); font-size: 0.75em; line-height: 1.5; margin-top: 6px; word-break: break-word; overflow-x: auto; }
.timeline-body p { margin: 0 0 8px; }
.timeline-body p:last-child { margin-bottom: 0; }
.timeline-body h1, .timeline-body h2, .timeline-body h3, .timeline-body h4 { font-size: 1.05em; margin: 10px 0 6px; color: var(--text-primary); font-weight: 600; }
.timeline-body ul, .timeline-body ol { margin: 6px 0 8px; padding-left: 1.2em; }
.timeline-body li { margin-bottom: 4px; }
.timeline-body pre { background: var(--bg-muted); border: 1px solid var(--border-default); border-radius: 6px; padding: 8px 10px; overflow-x: auto; font-size: 0.95em; margin: 8px 0; }
.timeline-body code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.95em; }
.timeline-body :not(pre) > code { background: var(--bg-muted); padding: 2px 5px; border-radius: 4px; }
.timeline-body blockquote { margin: 8px 0; padding: 4px 0 4px 10px; border-left: 3px solid var(--border-strong); color: var(--text-subtle); }
.timeline-body a { color: var(--accent); text-decoration: none; word-break: break-all; }
.timeline-body a:hover { text-decoration: underline; }
.timeline-body img { max-width: 100%; height: auto; border-radius: 4px; display: block; margin: 8px 0; }
.timeline-body table { border-collapse: collapse; width: 100%; font-size: 0.95em; margin: 8px 0; }
.timeline-body th, .timeline-body td { border: 1px solid var(--border-default); padding: 4px 6px; text-align: left; }
.timeline-body hr { border: none; border-top: 1px solid var(--border-default); margin: 10px 0; }
.timeline-prerelease { display: inline-block; background: #9e6a03; color: #fff; font-size: 0.6em; padding: 1px 5px; border-radius: 10px; vertical-align: middle; }

/* Footer */
.footer { text-align: center; margin-top: 24px; font-size: 0.8em; color: var(--text-disabled); max-width: 720px; margin-left: auto; margin-right: auto; }
.footer a { color: var(--accent); text-decoration: none; }

/* Status badge */
.status { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 0.75em; font-weight: 600; }
.status.ok { background: var(--btn-primary); color: #fff; }
.status.warn { background: #9e6a03; color: #fff; }
.status.err { background: #f85149; color: #fff; }

/* Responsive */
@media (max-width: 768px) {
  .page-layout { flex-direction: column; }
  .main-column { order: 1; flex: none; width: 100%; max-width: 100%; }
  .container { max-width: 100%; padding: 16px 12px; }
  .timeline-sidebar { order: 2; flex: none; width: 100%; height: auto; position: static; border-right: none; border-top: 1px dashed var(--border-default); border-bottom: none; padding: 20px; max-height: none; background: transparent; }
  .h1 { font-size: 1.3em; }
  .tabs { flex-wrap: wrap; }
  .tab { padding: 8px 12px; font-size: 0.8em; }
  .flash-steps-bar { padding: 10px 12px; font-size: 0.8em; }
  .flash-step-tooltip {
    max-width: calc(100vw - 32px);
  }
  /* 窄屏：右侧悬浮条改贴底，避免挡住中部表单区 */
  .subtitle-chips {
    top: auto;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    transform: none;
    max-height: min(42vh, 300px);
    max-width: min(260px, calc(100vw - 20px));
    right: calc(8px + env(safe-area-inset-right, 0px));
    padding: 8px 6px;
  }
  .subtitle-chip {
    font-size: 0.78em;
    padding: 5px 8px;
  }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(145deg, #fff6f2 0%, #f5c6ce 45%, #6b2d52 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 1;
  transition: opacity 0.5s ease-out;
}

.loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-content {
  text-align: center;
  animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.loading-chicken {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 30px;
  animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-15px);
  }
}

.chicken-body {
  position: absolute;
  width: 100px;
  height: 80px;
  background: linear-gradient(135deg, #ffd93d 0%, #f9c74f 100%);
  border-radius: 50px 50px 40px 40px;
  top: 20px;
  left: 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.chicken-head {
  position: absolute;
  width: 60px;
  height: 50px;
  background: linear-gradient(135deg, #ffd93d 0%, #f9c74f 100%);
  border-radius: 50%;
  top: -10px;
  left: 20px;
  z-index: 2;
}

.chicken-eye {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #2d3436;
  border-radius: 50%;
  top: 18px;
  animation: blink 3s infinite;
}

.chicken-eye::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  background: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
}

.chicken-eye--left {
  left: 12px;
}

.chicken-eye--right {
  right: 12px;
}

@keyframes blink {
  0%, 90%, 100% {
    transform: scaleY(1);
  }
  95% {
    transform: scaleY(0.1);
  }
}

.chicken-beak {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 12px solid #ff6b35;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
}

.chicken-comb {
  position: absolute;
  width: 30px;
  height: 20px;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
}

.chicken-comb::before,
.chicken-comb::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  background: #ff6b35;
  border-radius: 50% 50% 50% 50%;
}

.chicken-comb::before {
  left: 0;
  top: 8px;
}

.chicken-comb::after {
  right: 0;
  top: 8px;
}

.chicken-wing {
  position: absolute;
  width: 35px;
  height: 25px;
  background: linear-gradient(135deg, #f9c74f 0%, #f4a460 100%);
  border-radius: 50%;
  top: 35px;
  animation: flap 0.3s ease-in-out infinite alternate;
}

.chicken-wing--left {
  left: -5px;
  transform-origin: right center;
}

.chicken-wing--right {
  right: -5px;
  transform-origin: left center;
}

@keyframes flap {
  0% {
    transform: rotate(-15deg);
  }
  100% {
    transform: rotate(15deg);
  }
}

.chicken-tail {
  position: absolute;
  width: 20px;
  height: 35px;
  background: linear-gradient(135deg, #f9c74f 0%, #f4a460 100%);
  border-radius: 50% 50% 50% 50%;
  top: 10px;
  right: -15px;
  transform: rotate(45deg);
  z-index: -1;
}

.chicken-feet {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 20px;
}

.chicken-foot {
  position: absolute;
  width: 20px;
  height: 15px;
  bottom: 0;
}

.chicken-foot::before,
.chicken-foot::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 12px;
  background: #ff6b35;
  border-radius: 2px;
  bottom: 0;
}

.chicken-foot::before {
  left: 0;
  transform: rotate(-15deg);
}

.chicken-foot::after {
  right: 0;
  transform: rotate(15deg);
}

.chicken-foot--left {
  left: 5px;
}

.chicken-foot--right {
  right: 5px;
}

.loading-text {
  color: white;
  font-size: 1.3em;
  font-weight: bold;
  margin-bottom: 25px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.loading-progress {
  width: 280px;
  margin: 0 auto 20px;
}

.loading-progress-bar {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.loading-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
  border-radius: 10px;
  width: 0%;
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.loading-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.loading-progress-text {
  color: white;
  font-size: 0.9em;
  margin-top: 10px;
  font-weight: 600;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.loading-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.loading-dots span {
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
  animation: dotBounce 1.4s ease-in-out infinite;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.loading-dots span:nth-child(1) {
  animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotBounce {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

.chicken-speech-bubble {
  position: absolute;
  top: -80px;
  right: -120px;
  background: white;
  border-radius: 20px;
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: scale(0) translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 10;
  min-width: 140px;
}

.chicken-speech-bubble.show {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.speech-bubble-content {
  color: #333;
  font-size: 0.9em;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.speech-bubble-arrow {
  position: absolute;
  bottom: -8px;
  left: 20px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 10px solid white;
}

@keyframes bubbleBounce {
  0%, 100% {
    transform: scale(1) translateY(0);
  }
  50% {
    transform: scale(1.05) translateY(-5px);
  }
}

.chicken-speech-bubble.show {
  animation: bubbleBounce 2s ease-in-out infinite;
}

.coffee-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 14px;
  background: linear-gradient(135deg, #6f4e37 0%, #8b5a2b 100%);
  border: 1px solid rgba(139, 90, 43, 0.6);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(111, 78, 55, 0.3);
  flex-shrink: 0;
  width: auto;
  font-size: 0.92em;
  color: #fff;
  line-height: 1;
  transform: translateY(2px);
}

.coffee-icon {
  width: 20px;
  height: 20px;
  color: #fff;
  flex-shrink: 0;
}

.coffee-btn:hover {
  background: linear-gradient(135deg, #8b5a2b 0%, #a0522d 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(111, 78, 55, 0.4);
}

.coffee-text {
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
}

.coffee-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.coffee-modal[hidden] {
  display: none;
}

.coffee-modal__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.coffee-modal__panel {
  position: relative;
  z-index: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: coffeeModalIn 0.3s ease;
}

.coffee-modal--wide .coffee-modal__panel {
  max-width: 680px;
}

@keyframes coffeeModalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.coffee-modal__title {
  font-size: 1.3em;
  color: var(--text-primary);
  margin-bottom: 16px;
  text-align: center;
}

.coffee-modal__content {
  margin-bottom: 20px;
}

.coffee-modal__text {
  font-size: 0.95em;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
}

.coffee-modal__text strong {
  color: var(--accent);
}

.coffee-modal__qrcodes {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.coffee-modal__qrcode-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.coffee-modal__qrcode-img {
  width: 130px;
  height: 130px;
  object-fit: contain;
  border-radius: 8px;
  border: 2px solid var(--border-default);
  background: #fff;
  padding: 6px;
}

.coffee-modal__qrcode-label {
  font-size: 0.85em;
  font-weight: 600;
  color: var(--text-primary);
}

.coffee-modal__btn {
  display: block;
  width: 100%;
  padding: 12px 24px;
  background: var(--btn-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

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

.coffee-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: var(--btn-primary);
  color: #fff;
  border-radius: 8px;
  font-size: 0.95em;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  animation: coffeeToastIn 0.3s ease;
}

.coffee-toast--center {
  bottom: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.1em;
  padding: 16px 32px;
  animation: coffeeToastIn--center 0.3s ease;
}

.coffee-toast--center.coffee-toast--fadeout {
  animation: coffeeToastOut--center 0.3s ease forwards;
}

.coffee-toast--fadeout {
  animation: coffeeToastOut 0.3s ease forwards;
}

@keyframes coffeeToastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes coffeeToastIn--center {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes coffeeToastOut {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
}

@keyframes coffeeToastOut--center {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
}

/* Toolbox Grid */
.toolbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.toolbox-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.2s ease;
  cursor: pointer;
}

.toolbox-card:hover {
  border-color: var(--accent);
  background: var(--bg-muted);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toolbox-card-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  color: var(--accent);
}

.toolbox-card-icon svg {
  width: 100%;
  height: 100%;
}

.toolbox-card-title {
  font-size: 1.1em;
  font-weight: 600;
  margin-bottom: 8px;
  text-align: center;
}

.toolbox-card-filename {
  font-size: 0.75em;
  color: var(--text-muted);
  text-align: center;
  word-break: break-all;
  padding: 4px 8px;
  background: var(--bg-muted);
  border-radius: 4px;
  max-width: 100%;
}

.downgrade-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-muted);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9em;
  font-weight: 500;
  transition: all 0.2s ease;
}

.downgrade-file-btn:hover {
  border-color: var(--accent);
  background: var(--bg-elevated);
  color: var(--accent);
  transform: translateY(-1px);
}

.coffee-modal--donation .coffee-modal__panel {
  max-width: 920px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.coffee-modal__body {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
  flex: 1;
  min-height: 0;
}

.coffee-modal__left {
  flex: 0 0 auto;
  width: 320px;
}

.coffee-modal__right {
  flex: 1;
  min-width: 0;
}

.donation-board {
  background: var(--bg-muted);
  border-radius: 8px;
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.donation-board__header {
  padding: 10px 12px;
  font-size: 0.85em;
  font-weight: 600;
  color: var(--text-primary);
  background: transparent;
  text-align: center;
}

.donation-board__scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 280px;
  position: relative;
}

.donation-board__scroll::-webkit-scrollbar {
  width: 4px;
}

.donation-board__scroll::-webkit-scrollbar-track {
  background: transparent;
}

.donation-board__scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 2px;
}

.donation-board__scroll::-webkit-scrollbar-thumb:hover {
  background: var(--text-subtle);
}

.donation-board__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.65em;
  table-layout: fixed;
}

.donation-board__table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-muted);
}

.donation-board__table th {
  padding: 4px 3px;
  text-align: left;
  font-weight: 500;
  color: var(--text-subtle);
  font-size: 0.9em;
}

.donation-board__table th:nth-child(1) {
  width: 34%;
}

.donation-board__table th:nth-child(2) {
  width: 14%;
}

.donation-board__table th:nth-child(3) {
  width: 10%;
}

.donation-board__table th:nth-child(4) {
  width: 28%;
}

.donation-board__table th:nth-child(5) {
  width: 14%;
}

.donation-board__table td {
  padding: 4px 3px;
  color: var(--text-muted);
}

.donation-board__table td:nth-child(1) {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.donation-board__table td:nth-child(4) {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.donation-board__table td:nth-child(4) .scroll-text {
  display: inline-block;
}

.donation-board__table tr:hover td:nth-child(4) .scroll-text {
  animation: textScroll 3s linear infinite alternate;
}

@keyframes textScroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

.donation-board__table tbody tr {
  transition: background 0.2s ease;
}

.donation-board__table tbody tr:hover {
  background: rgba(88, 166, 255, 0.05);
}

.donation-board__table td:nth-child(3) {
  color: var(--accent);
  font-weight: 500;
}

.donation-board__table td:nth-child(5) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.donation-loading {
  text-align: center;
  padding: 20px;
  color: var(--text-subtle);
}

.coffee-modal__footer {
  border-top: 1px solid var(--border-default);
  padding-top: 16px;
  margin-top: 8px;
  flex-shrink: 0;
}

.coffee-modal__notice {
  font-size: 0.8em;
  color: var(--text-subtle);
  text-align: center;
  margin-bottom: 12px;
  line-height: 1.5;
}

@keyframes donationScroll {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-50%);
  }
}

.donation-board__scroll--auto {
  animation: donationScroll 20s linear infinite;
}

.donation-board__scroll--auto:hover {
  animation-play-state: paused;
}

/* Boot logo tab */
.logo-desc { font-size: 0.9em; color: var(--text-muted); margin-bottom: 10px; line-height: 1.5; }
.logo-warning { font-size: 0.9em; color: var(--accent); margin-bottom: 12px; line-height: 1.5; }
.logo-controls-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.logo-controls-row label { display: block; margin-bottom: 4px; color: var(--text-muted); font-size: 0.9em; }
.logo-controls-row input[type="range"] { width: 160px; vertical-align: middle; }
#logoThresholdValue { margin-left: 8px; color: var(--text-primary); }
.logo-invert-label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; margin-top: 4px; }
.logo-preview-frame {
  background: #1a1220;
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 10px;
  display: inline-block;
}
#logoPreviewCanvas {
  width: 256px;
  height: 128px;
  image-rendering: pixelated;
  display: block;
}
.logo-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }


/* ========== User manual page ========== */
body.help-page {
  padding-bottom: 48px;
}

.help-top-actions {
  top: calc(12px + env(safe-area-inset-top, 0px));
  align-items: center;
}

.help-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1100px;
  margin: 18px auto 8px;
  padding: 8px 20px 4px;
  animation: brandIn 0.6s ease-out both;
}

.help-hero__mango {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  filter: drop-shadow(0 6px 12px rgba(74, 32, 64, 0.2));
  animation: mangoBob 2.8s ease-in-out infinite;
}

.help-hero__eyebrow {
  font-size: 0.85rem;
  color: var(--text-subtle);
  margin-bottom: 2px;
}

.help-hero__title {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.5vw, 2.1rem);
  font-weight: 700;
  color: var(--rind);
  line-height: 1.2;
}

.help-hero__desc {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.help-layout {
  display: grid;
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 20px 40px;
  align-items: start;
}

.help-toc {
  position: sticky;
  top: calc(64px + env(safe-area-inset-top, 0px));
  max-height: calc(100vh - 80px);
  overflow: auto;
  padding: 14px 12px;
  border: 1px solid var(--border-default);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px var(--shadow-kicker);
}

.help-toc__title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--rind);
  margin-bottom: 10px;
  padding: 0 6px;
}

.help-toc__loading,
.help-toc__empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 8px 6px;
}

.help-toc__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.help-toc__link {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.35;
  border-left: 3px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.help-toc__item--h1 .help-toc__link {
  font-weight: 700;
  color: var(--text-primary);
}

.help-toc__item--h3 .help-toc__link {
  padding-left: 22px;
  font-size: 0.84rem;
}

.help-toc__item--h2 .help-toc__link {
  padding-left: 12px;
}

.help-toc__link:hover {
  color: var(--accent);
  background: var(--bg-muted);
}

.help-toc__link.is-active {
  color: var(--accent);
  background: var(--bg-muted);
  border-left-color: var(--accent);
  font-weight: 600;
}

.help-main {
  min-width: 0;
}

.help-article {
  padding: 22px 26px 32px;
  border: 1px solid var(--border-default);
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  box-shadow: 0 10px 28px var(--shadow-kicker);
  animation: brandIn 0.7s ease-out both;
}

.help-article h1,
.help-article h2,
.help-article h3 {
  font-family: var(--font-display);
  color: var(--rind);
  scroll-margin-top: 84px;
  line-height: 1.3;
}

.help-article h1 {
  font-size: 1.7rem;
  margin-bottom: 14px;
}

.help-article h2 {
  font-size: 1.25rem;
  margin: 28px 0 10px;
  padding-top: 6px;
  border-top: 1px solid var(--border-default);
}

.help-article h2:first-of-type {
  border-top: none;
  margin-top: 18px;
}

.help-article h3 {
  font-size: 1.05rem;
  margin: 18px 0 8px;
  color: var(--btn-primary);
}

.help-article p,
.help-article li {
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 0.98rem;
}

.help-article p {
  margin: 0 0 12px;
}

.help-article ul,
.help-article ol {
  margin: 0 0 14px 1.25em;
}

.help-article li {
  margin-bottom: 6px;
}

.help-article strong {
  color: var(--text-bright);
}

.help-article blockquote {
  margin: 14px 0;
  padding: 10px 14px;
  border-left: 4px solid var(--accent);
  background: var(--bg-muted);
  border-radius: 0 10px 10px 0;
  color: var(--text-muted);
}

.help-article code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.88em;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--bg-muted);
  color: var(--btn-primary);
}

.help-content-loading,
.help-error {
  color: var(--text-muted);
  padding: 24px 8px;
}

.help-error__title {
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}

@media (max-width: 860px) {
  .help-layout {
    grid-template-columns: 1fr;
    padding-top: 8px;
  }

  .help-toc {
    position: static;
    max-height: none;
  }

  .help-toc__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 4px;
  }

  .help-hero {
    padding-top: 56px;
  }

  .help-top-actions .help-btn__text {
    display: none;
  }

  .help-top-actions .help-btn {
    padding: 0 10px;
  }
}

@media print {
  body.help-page {
    background: #fff !important;
    color: #000 !important;
  }

  .help-top-actions,
  .help-toc,
  .help-hero__mango,
  .lang-switch {
    display: none !important;
  }

  .help-hero,
  .help-layout,
  .help-main,
  .help-article {
    max-width: none;
    margin: 0;
    padding: 0;
    border: none;
    box-shadow: none;
    background: transparent;
  }

  .help-article h2 {
    break-after: avoid;
  }

  .help-article p,
  .help-article li {
    orphans: 3;
    widows: 3;
  }
}
