*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #667eea;
  --primary-dark: #764ba2;
  --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg: #f7f8fc;
  --card-bg: #ffffff;
  --text: #2d3748;
  --text-muted: #718096;
  --border: #b8c4d8;
  --success: #48bb78;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(102,126,234,0.10);
  --shadow-hover: 0 8px 32px rgba(102,126,234,0.18);
  --nav-w: 200px;
  --nav-w-collapsed: 60px;
  --nav-bg: #1a202c;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ===== APP LAYOUT ===== */
.app-body {
  display: flex;
  min-height: 100vh;
}

/* ===== LEFT NAV ===== */
.left-nav {
  width: var(--nav-w);
  background: var(--nav-bg);
  color: #cbd5e0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 50;
  flex-shrink: 0;
  transition: width 0.25s ease;
  overflow: hidden;
}
.left-nav.collapsed {
  width: var(--nav-w-collapsed);
}
.left-nav.collapsed .logo-text,
.left-nav.collapsed .lni-text,
.left-nav.collapsed .nav-collapse-text {
  display: none;
}
.left-nav.collapsed .left-nav-logo { justify-content: center; }
.left-nav.collapsed .left-nav-item { justify-content: center; padding: 11px 0; }
.left-nav.collapsed .nav-collapse-btn { justify-content: center; }
.left-nav.collapsed .language-toggle {
  margin: 8px auto;
  width: 42px;
  height: 34px;
  padding: 0;
  justify-content: center;
}

.left-nav-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.logo-icon { font-size: 1.2rem; }
.logo-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: white;
  white-space: nowrap;
}
.language-toggle {
  width: calc(100% - 28px);
  min-height: 36px;
  margin: 10px 14px 6px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  color: #edf2f7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.language-toggle:hover {
  background: rgba(102,126,234,0.28);
  border-color: rgba(255,255,255,0.24);
  transform: translateY(-1px);
}
.language-globe::before {
  content: "\1F310";
  display: block;
  font-size: 1rem;
  line-height: 1;
}
.language-current {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
}
.left-nav-items {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}
.left-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  border: none;
  background: none;
  color: #a0aec0;
  font-size: 0.92rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  border-radius: 0;
  white-space: nowrap;
}
.left-nav-item:hover { background: rgba(255,255,255,0.06); color: white; }
.left-nav-item.active {
  background: rgba(102,126,234,0.2);
  color: #a3b8f5;
  font-weight: 600;
  border-left: 3px solid var(--primary);
}
.lni-icon {
  width: 1.25em;
  font-size: 1.05rem;
  flex-shrink: 0;
  text-align: center;
}
.lni-text { white-space: nowrap; }

/* ===== 二级折叠菜单分组 ===== */
.nav-group { border-bottom: 1px solid rgba(255,255,255,0.04); }
.nav-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  color: #e2e8f0;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.nav-group-header:hover { background: rgba(255,255,255,0.05); color: white; }
.nav-group-arrow {
  margin-left: auto;
  font-size: 0.75rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  opacity: 0.6;
}
.nav-group-header.collapsed .nav-group-arrow { transform: rotate(-90deg); }
.nav-group-children {
  overflow: hidden;
  max-height: 500px;
  transition: max-height 0.25s ease;
}
.nav-group-children.collapsed { max-height: 0; }
.nav-group-children .left-nav-item {
  padding-left: 36px;
  font-size: 0.88rem;
  color: #90a0b7;
}
.nav-group-children .left-nav-item.active {
  background: rgba(102,126,234,0.18);
  color: #a3b8f5;
  border-left: 3px solid var(--primary);
  padding-left: 33px;
}

/* 折叠侧边栏时隐藏分组标题文字和箭头，只显示图标 */
.left-nav.collapsed .nav-group-header { justify-content: center; padding: 10px 0; }
.left-nav.collapsed .nav-group-arrow { display: none; }
.left-nav.collapsed .nav-group-children { max-height: 0 !important; }
.left-nav.collapsed .nav-group-header .lni-text { display: none; }

/* 折叠按钮 */
.nav-collapse-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: rgba(255,255,255,0.05);
  color: #a0aec0;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
  white-space: nowrap;
}
.nav-collapse-btn:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-collapse-icon {
  font-size: 1rem;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}
.left-nav.collapsed .nav-collapse-icon { transform: rotate(180deg); }

/* ===== RIGHT CONTENT ===== */
.right-content {
  margin-left: var(--nav-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  transition: margin-left 0.25s ease;
}
.right-content.nav-collapsed {
  margin-left: var(--nav-w-collapsed);
}

.content-section {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  overflow-x: hidden;
}

/* ===== HERO ===== */
.section-header { flex-shrink: 0; }
.hero {
  position: relative;
  background: var(--gradient);
  padding: 20px 24px 28px;
  text-align: center;
  color: white;
}
#section-cppide .hero,
#section-pyide .hero {
  padding: 14px 24px 16px;
}
/* C++ IDE hero 横向布局 */
.cpp-hero {
  position: relative;
  display: flex;
  align-items: center;
  padding: 12px 24px 14px;
  text-align: center;
}
.cpp-hero-title {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
}
.cpp-hero-title h1 { font-size: 1.5rem; }
.cpp-hero-title p { font-size: 0.88rem; opacity: 0.88; margin-top: 4px; }

/* C++ IDE 广告横幅（hero 内左侧） */
.cpp-ad-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: #29b8cc;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 10px;
  flex-shrink: 0;
  max-width: 220px;
}
.cpp-ad-logo {
  height: 48px;
  width: auto;
  border-radius: 6px;
  object-fit: contain;
  flex-shrink: 0;
  background: white;
  padding: 2px;
}
.cpp-ad-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cpp-ad-slogan {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}
.cpp-ad-sub {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.75);
}
.hero h1 {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}
.hero p {
  font-size: 0.95rem;
  opacity: 0.88;
  max-width: 480px;
  margin: 0 auto;
}

.header-date-badge {
  position: absolute;
  top: 50%;
  right: 24px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 148px;
  padding: 11px 13px;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 10px;
  background: rgba(255,255,255,0.16);
  box-shadow: 0 10px 26px rgba(26,32,44,0.12);
  color: #fff;
  line-height: 1.25;
  text-align: right;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.dev-hero-meta-row {
  display: contents;
}
.dev-dino-stage {
  --dino-stage-center: -50%;
  position: absolute;
  top: 50%;
  right: 188px;
  width: 96px;
  height: 84px;
  transform: translateY(-50%);
  cursor: grab;
  touch-action: none;
  animation: dino-stage-float 3.2s ease-in-out infinite;
}
.dev-dino-stage:active { cursor: grabbing; }
.dev-dino-canvas {
  display: block;
  width: 96px;
  height: 84px;
  filter: drop-shadow(0 12px 18px rgba(26,32,44,0.22));
  opacity: 1;
  transition: opacity 0.22s ease;
}
.dev-dino-loader {
  position: absolute;
  inset: 8px 6px;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  border: 1px solid rgba(255,255,255,0.32);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,0.22), rgba(255,255,255,0.08));
  box-shadow: 0 12px 24px rgba(26,32,44,0.12);
  color: rgba(255,255,255,0.92);
  pointer-events: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.dev-dino-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,0.32);
  border-top-color: #fff;
  border-radius: 50%;
  animation: dino-loader-spin 0.82s linear infinite;
}
.dev-dino-loader-text {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.dev-dino-stage.is-loading .dev-dino-canvas {
  opacity: 0;
}
.dev-dino-stage.is-loading .dev-dino-loader {
  display: flex;
}
.header-date-day {
  font-size: 0.86rem;
  font-weight: 700;
}
.header-date-week {
  margin-top: 6px;
  font-size: 0.78rem;
  opacity: 0.86;
}
.header-date-lunar {
  margin-top: 6px;
  font-size: 0.78rem;
  opacity: 0.86;
}

/* ===== SECTION FOOTER ===== */
.section-footer {
  text-align: center;
  padding: 14px 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.section-footer p { font-size: 0.85rem; }
.section-footer p a { font-size: 0.85rem; }
.section-footer a { color: var(--text-muted); text-decoration: none; }
.section-footer a:hover { color: var(--primary); }

/* ===== SECTION MAIN ===== */
.section-main { flex: 1; min-width: 0; }

/* ===== MAIN CARD ===== */
.main-container {
  max-width: 860px;
  margin: 20px auto 0;
  padding: 0 24px 24px;
  width: 100%;
}
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
}

/* ===== TEXTAREA ===== */
.section-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  min-height: 76px;
  color: var(--text);
  transition: border-color 0.2s;
  background: #fafbff;
}
textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

/* ===== ALGO TABS ===== */
.algo-section { margin-top: 16px; }
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.tab-btn {
  padding: 7px 16px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
}
.tab-btn:hover { border-color: var(--primary); color: var(--primary); }
.tab-btn.active {
  background: var(--gradient);
  border-color: transparent;
  color: white;
  box-shadow: 0 2px 10px rgba(102,126,234,0.30);
}

/* ===== HMAC KEY ===== */
.hmac-key-row { display: none; margin-bottom: 16px; }
.hmac-key-row.visible { display: flex; gap: 12px; align-items: center; }
.hmac-key-row label { font-size: 0.88rem; color: var(--text-muted); white-space: nowrap; }
.hmac-key-row input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}
.hmac-key-row input:focus { outline: none; border-color: var(--primary); }

/* ===== BASE64 MODE ===== */
.base64-mode-row { display: none; margin-bottom: 16px; gap: 8px; }
.base64-mode-row.visible { display: flex; }
.mode-btn {
  padding: 6px 18px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: transparent;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.18s;
}
.mode-btn.active { background: var(--gradient); color: white; border-color: transparent; }

/* ===== OUTPUT ===== */
.output-row {
  position: relative;
}
.output-area {
  display: block;
  width: 100%;
  min-height: 68px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 80px 10px 16px;
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 0.95rem;
  background: #f8faff;
  color: var(--text);
  resize: vertical;
  word-break: break-all;
}
.copy-btn {
  position: absolute;
  top: 8px;
  right: 20px;
  padding: 5px 12px;
  background: var(--gradient);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  z-index: 1;
}
.copy-btn.success { background: var(--success); }
.copy-btn:hover { opacity: 0.88; transform: translateY(-1px); }

/* ===== IMAGE TOOLS HEADER ===== */
.image-header {
  position: relative;
  background: var(--gradient);
  padding: 28px 24px 0;
  color: white;
}
.image-title-row { text-align: center; padding-bottom: 20px; }
.image-title-row h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: 6px; }
.image-title-row p { font-size: 0.95rem; opacity: 0.88; max-width: 560px; margin: 0 auto; word-break: break-word; }

.image-sub-tabs {
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
  padding-bottom: 0;
}
.image-tab {
  padding: 10px 20px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: all 0.18s;
  white-space: nowrap;
}
.image-tab:hover { background: rgba(255,255,255,0.25); color: white; }
.image-tab.active { background: var(--bg); color: var(--primary); font-weight: 700; }

/* ===== IMAGE MAIN ===== */
.image-main { background: var(--bg); }
.image-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 24px 24px;
  width: 100%;
}

/* ===== UPLOAD ZONE ===== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
  background: #fafbff;
  margin-bottom: 16px;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: #f0f2ff;
}
.upload-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.upload-icon { font-size: 2rem; display: block; margin-bottom: 8px; }
.upload-placeholder p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 4px; }
.upload-hint { font-size: 0.82rem !important; color: #a0aec0 !important; }

/* ===== PREVIEW AREA ===== */
.preview-area {
  position: relative;
  margin-bottom: 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: #fafbff;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.preview-img {
  max-width: 120px;
  max-height: 90px;
  border-radius: 6px;
  object-fit: contain;
  flex-shrink: 0;
}
.preview-info {
  flex: 1;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.7;
}
.remove-btn {
  flex-shrink: 0;
  padding: 4px 10px;
  border: 1.5px solid #fc8181;
  border-radius: 6px;
  background: #fff5f5;
  color: #c53030;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.remove-btn:hover { background: #fc8181; color: white; }

/* ===== TOOL OPTIONS ===== */
.tool-options { margin-bottom: 16px; }
.option-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* quality / opacity slider */
.quality-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  outline: none;
  cursor: pointer;
  margin-bottom: 4px;
}
.quality-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(102,126,234,0.35);
}
.quality-hints {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #a0aec0;
}

/* format buttons */
.format-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.fmt-btn {
  padding: 6px 16px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
}
.fmt-btn:hover { border-color: var(--primary); color: var(--primary); }
.fmt-btn.active { background: var(--gradient); border-color: transparent; color: white; }

/* crop inputs */
.crop-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
}
.crop-input-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.crop-input-group input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 0.9rem;
  font-family: inherit;
}
.crop-input-group input:focus { outline: none; border-color: var(--primary); }
.crop-size-hint { font-size: 0.8rem; color: #a0aec0; }

/* watermark */
.wm-input-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.wm-input-row .option-label { margin-bottom: 0; white-space: nowrap; }
.wm-input-row input[type="text"] {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}
.wm-input-row input[type="text"]:focus { outline: none; border-color: var(--primary); }
.wm-input-row .quality-slider { flex: 1; margin-bottom: 0; }
.position-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-width: 300px;
}
.pos-btn {
  padding: 8px 4px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.18s;
  text-align: center;
}
.pos-btn:hover { border-color: var(--primary); color: var(--primary); }
.pos-btn.active { background: var(--gradient); border-color: transparent; color: white; }

/* pdf file list */
.pdf-file-list {
  margin-bottom: 12px;
}
.pdf-file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  margin-bottom: 6px;
  background: #fafbff;
  font-size: 0.88rem;
}
.pdf-file-item .file-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.pdf-file-item .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-file-item .file-size { color: var(--text-muted); white-space: nowrap; }
.pdf-file-item .remove-item {
  color: #fc8181;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s;
}
.pdf-file-item .remove-item:hover { background: #fff5f5; }

/* ===== ACTION ROW ===== */
.action-row { margin-bottom: 12px; text-align: center; }
.btn-action {
  padding: 11px 32px;
  background: var(--gradient);
  color: white;
  border: none;
  border-radius: 9px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.18s, transform 0.15s;
  box-shadow: 0 3px 12px rgba(102,126,234,0.30);
}
.btn-action:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); }
.btn-action:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ===== STATUS MSG ===== */
.status-msg {
  min-height: 22px;
  font-size: 0.9rem;
  border-radius: 7px;
  padding: 0;
  transition: all 0.2s;
}
.status-msg.loading { color: var(--primary); }
.status-msg.success { color: var(--success); font-weight: 600; }
.status-msg.error { color: #e53e3e; font-weight: 500; }

.lang-en #reward-fab,
.lang-en #thanks-fab {
  display: none !important;
}

/* ===== FAB MODAL ===== */
.fab-group {
  position: fixed;
  bottom: 28px;
  right: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}
.feedback-fab {
  background: var(--gradient);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 12px 22px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(102,126,234,0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
.feedback-fab:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(102,126,234,0.40); }
.reward-fab { background: linear-gradient(135deg, #f6a623 0%, #e8821a 100%); box-shadow: 0 4px 18px rgba(246,166,35,0.35); }
.reward-fab:hover { box-shadow: 0 8px 24px rgba(246,166,35,0.45); }
.thanks-fab { background: linear-gradient(135deg, #38a169 0%, #2f855a 100%); box-shadow: 0 4px 18px rgba(56,161,105,0.32); }
.thanks-fab:hover { box-shadow: 0 8px 24px rgba(56,161,105,0.42); }
.reward-modal { max-width: 360px; text-align: center; }
.reward-qr { width: 100%; max-width: 260px; border-radius: 12px; display: block; margin: 0 auto; }
.reward-tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; }
.reward-tab {
  padding: 7px 24px; border-radius: 20px; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; border: 1.5px solid var(--border); background: transparent; color: var(--text-muted);
  transition: all 0.18s;
}
.reward-tab.active { background: var(--gradient); color: white; border-color: transparent; }
.reward-panel { display: none; }
.reward-panel.active { display: block; }
.modal.thanks-modal {
  max-width: 520px;
  padding: 0;
  overflow: hidden;
}
.thanks-header {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 22px 24px;
  background: linear-gradient(135deg, #f7fafc 0%, #edf7f1 100%);
  border-bottom: 1px solid #d9eadf;
  text-align: left;
}
.thanks-medal {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(135deg, #f6ad55 0%, #ed8936 100%);
  box-shadow: 0 8px 18px rgba(237,137,54,0.22);
  font-size: 1.25rem;
  flex: 0 0 auto;
}
.thanks-header h2 {
  margin: 0 0 4px;
  font-size: 1.16rem;
}
.thanks-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.84rem;
  white-space: nowrap;
}
.thanks-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 18px 24px 10px;
}
.thanks-summary > div {
  border: 1px solid #d9eadf;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fbfffd;
}
.thanks-summary span {
  display: block;
  color: var(--text-muted);
  font-size: 0.76rem;
  margin-bottom: 4px;
}
.thanks-summary strong {
  color: #2f855a;
  font-size: 1.18rem;
}
.thanks-list {
  max-height: min(56vh, 480px);
  overflow-y: auto;
  padding: 12px 24px 8px;
}
.thanks-modal .modal-actions {
  padding-bottom: 30px;
}
.thanks-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
}
.thanks-item:last-child { border-bottom: none; }
.thanks-person {
  min-width: 0;
}
.thanks-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--text);
}
.thanks-name::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #38a169;
  box-shadow: 0 0 0 4px rgba(56,161,105,0.12);
}
.thanks-note {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.45;
}
.thanks-meta {
  text-align: right;
  white-space: nowrap;
}
.thanks-amount {
  display: block;
  color: #dd6b20;
  font-weight: 800;
  font-size: 1.05rem;
}
.thanks-time {
  display: block;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 5px;
}
.thanks-empty {
  padding: 28px 8px;
  color: var(--text-muted);
  text-align: center;
  background: #f8fafc;
  border-radius: 12px;
}
@media (max-width: 640px) {
  .modal.thanks-modal {
    max-width: calc(100vw - 28px);
  }
  .thanks-header {
    padding: 20px 20px;
  }
  .thanks-header p {
    white-space: normal;
  }
  .thanks-summary {
    grid-template-columns: 1fr;
    padding: 14px 20px 8px;
  }
  .thanks-list {
    padding: 10px 20px 8px;
  }
  .thanks-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .thanks-meta {
    text-align: left;
  }
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white;
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.18);
  animation: slideUp 0.22s ease;
}
@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.modal h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.87rem; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }
.form-group select,
.form-group input,
.form-group textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}
.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus { outline: none; border-color: var(--primary); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.btn-cancel {
  padding: 9px 20px; border: 1.5px solid var(--border);
  border-radius: 8px; background: transparent; cursor: pointer; font-size: 0.92rem;
}
.btn-submit {
  padding: 9px 24px; background: var(--gradient); color: white;
  border: none; border-radius: 8px; font-size: 0.92rem; font-weight: 600;
  cursor: pointer; transition: opacity 0.18s;
}
.btn-submit:hover { opacity: 0.88; }
.success-msg { text-align: center; padding: 20px 0; color: var(--success); font-size: 1.05rem; font-weight: 600; }

/* ===== 手机端菜单遮罩 ===== */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 49;
}
.nav-overlay.open { display: block; }

/* 手机端汉堡按钮 */
.nav-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 60;
  width: 38px;
  height: 38px;
  background: var(--nav-bg);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: #cbd5e0;
  border-radius: 2px;
  transition: all 0.2s;
}

/* ===== RANDOM TOOL STYLES ===== */
.rand-options { margin-bottom: 20px; }
.rand-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}
.rand-full-row { grid-column: 1 / -1; }
.rand-option-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.rand-option-row .option-label {
  min-width: 120px;
  margin-bottom: 0;
  flex-shrink: 0;
}
.rand-select {
  width: 100px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s;
  background: #fff;
  cursor: pointer;
}
.rand-select:focus { outline: none; border-color: var(--primary); }

.rand-input {
  width: 120px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color 0.2s;
}
.rand-input:focus { outline: none; border-color: var(--primary); }
.rand-input-text {
  flex: 1;
  min-width: 180px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color 0.2s;
}
.rand-input-text:focus { outline: none; border-color: var(--primary); }

/* toggle switch */
.rand-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.rand-switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; inset: 0;
  background: #cbd5e0; border-radius: 24px; cursor: pointer;
  transition: background 0.2s;
}
.switch-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: white; border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.rand-switch input:checked + .switch-slider { background: var(--primary); }
.rand-switch input:checked + .switch-slider::before { transform: translateX(20px); }

.rand-fmt-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.rand-fmt-btn {
  padding: 6px 16px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
}
.rand-fmt-btn:hover { border-color: var(--primary); color: var(--primary); }
.rand-fmt-btn.active { background: var(--gradient); border-color: transparent; color: white; }

.rand-action-row { text-align: center; margin-bottom: 16px; }

.rand-result-wrap { position: relative; }
.rand-result {
  display: block;
  width: 100%;
  min-height: 120px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 80px 10px 14px;
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 0.9rem;
  background: #f8faff;
  color: var(--text);
  resize: vertical;
  word-break: break-all;
}
.rand-count-info { font-size: 0.82rem; color: var(--text-muted); margin-top: 6px; display: block; }
.rand-copy-btn {
  position: absolute;
  top: 8px;
  right: 20px;
  padding: 5px 12px;
  background: var(--gradient);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  z-index: 1;
}
.rand-copy-btn:hover { opacity: 0.88; }
.rand-copy-btn.success { background: var(--success); }

/* color swatches */
.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.color-swatch {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid rgba(0,0,0,0.06);
  transition: transform 0.15s;
  title: attr(title);
}
.color-swatch:hover { transform: scale(1.12); }

/* ===== INLINE FAB (mobile footer) ===== */
.fab-inline {
  display: none;
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
}
.fab-inline-btn {
  padding: 10px 20px;
  font-size: 0.88rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  :root { --nav-w: 200px; }

  /* 汉堡按钮可见 */
  .nav-toggle { display: flex; }

  /* 手机端隐藏左侧折叠按钮（手机已有左上角汉堡按钮） */
  .nav-collapse-btn { display: none; }

  /* 导航默认收起到屏幕外 */
  .left-nav {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 51;
  }
  .left-nav.open { transform: translateX(0); }

  /* 右侧内容占满宽度，顶部留出汉堡按钮空间 */
  .right-content { margin-left: 0; }

  /* hero 手机端减小高度，顶部留出汉堡按钮空间 */
  .hero { padding: 48px 16px 32px; }
  #section-cppide .hero,
  #section-pyide .hero { padding: 48px 16px 20px; }
  .image-header { padding: 48px 16px 0; }
  .header-date-badge {
    position: static;
    transform: none;
    align-items: center;
    width: fit-content;
    min-width: 0;
    max-width: 100%;
    margin: 14px auto 0;
    padding: 8px 12px;
    border-radius: 10px;
    text-align: center;
    white-space: normal;
  }
  .dev-dino-stage {
    --dino-stage-center: 0;
    position: static;
    width: 96px;
    height: 84px;
    margin: 0;
    transform: none;
    flex: 0 0 auto;
  }
  .dev-dino-canvas {
    width: 96px;
    height: 84px;
  }
  .header-date-day,
  .header-date-week,
  .header-date-lunar {
    font-size: 0.78rem;
  }
  .header-date-week,
  .header-date-lunar { margin-top: 5px; }
  .cpp-hero {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: unset;
    text-align: center;
  }
  .cpp-hero-title {
    position: static;
    max-width: 100%;
    pointer-events: auto;
  }
  .cpp-hero-title h1 { font-size: 1.35rem; }
  .cpp-hero-title p {
    max-width: 320px;
    font-size: 0.82rem;
    line-height: 1.45;
  }
  .cpp-ad-banner {
    max-width: min(100%, 320px);
    justify-content: center;
    padding: 7px 12px;
  }
  .cpp-ad-logo { height: 38px; }
  .cpp-ad-slogan { font-size: 0.78rem; }
  .cpp-ad-sub { font-size: 0.66rem; }
  .dev-hero-meta-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    max-width: 100%;
    margin-top: 2px;
  }
  .dev-hero-meta-row .header-date-badge {
    margin: 0;
    flex: 0 1 auto;
  }
  .image-title-row { padding-bottom: 12px; }
  .image-title-row h1 { font-size: 1.4rem; margin-bottom: 4px; }
  .image-title-row p { font-size: 0.85rem; }

  /* 手机端 footer：显示 inline FAB，隐藏 fixed FAB */
  .section-footer { padding-bottom: 16px; }
  .fab-group { display: none; }
  .fab-inline { display: flex; }

  /* 手机端：结果框缩小，复制按钮保持 absolute 定位在框内 */
  .output-area { min-height: 60px; resize: none; padding-right: 80px; }
  .rand-result { resize: none; padding-right: 80px; }
}

@media (max-width: 600px) {
  html,
  body,
  .app-body,
  .right-content,
  .content-section,
  .section-main {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
  .main-container,
  .image-container,
  .section-faq {
    width: 100%;
    max-width: 100%;
    padding-left: 16px;
    padding-right: 16px;
  }
  .card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .tabs,
  .format-btns,
  .base64-mode-row.visible,
  .json-options,
  .modal-actions {
    min-width: 0;
  }
  .tab-btn,
  .fmt-btn,
  .mode-btn,
  .json-indent-btn {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
  }
  .output-row,
  .case-output-wrap {
    min-width: 0;
    max-width: 100%;
  }
  .copy-btn {
    right: 8px;
    max-width: 72px;
    padding-left: 10px;
    padding-right: 10px;
  }
  .output-area,
  .case-output-wrap .case-output {
    padding-right: 74px;
  }
  .hero h1 { font-size: 1.4rem; }
  .hero p { font-size: 0.85rem; word-break: break-word; }
  .card { padding: 14px 12px; }
  .tabs { gap: 6px; }
  .tab-btn { padding: 6px 12px; font-size: 0.82rem; }
  .crop-inputs { grid-template-columns: 1fr 1fr; }
  .image-sub-tabs { gap: 2px; }
  .image-tab { padding: 8px 10px; font-size: 0.8rem; }

  /* 随机数手机端：单列布局，防溢出 */
  .rand-grid { grid-template-columns: 1fr; }
  .rand-full-row { grid-column: auto; }
  .rand-option-row { gap: 8px; flex-wrap: nowrap; justify-content: space-between; }
  .rand-option-row .option-label { min-width: 0; flex: 1; }
  .rand-input-text { width: 100%; min-width: 0; }
}

/* ===== 时间戳工具 ===== */

/* 当前时间展示行 */
.ts-now-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.ts-now-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  flex: 1 1 0;
  min-width: 160px;
}

.ts-now-block--wide {
  flex: 1 1 0;
}

.ts-now-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.ts-now-val {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ts-now-val-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ts-copy-inline {
  font-size: 0.78rem;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.ts-copy-inline:hover { border-color: var(--primary); color: var(--primary); }
.ts-copy-inline.success { border-color: var(--success); color: var(--success); }

/* 转换输入行 */
.ts-convert-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
}

.ts-input {
  width: 220px;
  flex: 0 0 220px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
}
.ts-input:focus { border-color: var(--primary); }

.ts-date-input {
  width: 210px;
  flex: 0 0 210px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
}
.ts-date-input:focus { border-color: var(--primary); }

.ts-tz-select-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ts-tz-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.ts-tz-select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--text);
  background: #fff;
  cursor: pointer;
  outline: none;
}
.ts-tz-select:focus { border-color: var(--primary); }

.ts-btn {
  white-space: nowrap;
  padding: 10px 24px;
}

/* 转换结果区 */
.ts-result-block {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.ts-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ts-result-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.ts-collapse-btn {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}
.ts-collapse-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.ts-result-content {
  transition: max-height 0.3s ease, opacity 0.3s ease;
  overflow: hidden;
}
.ts-result-block.collapsed .ts-result-content {
  max-height: 0;
  opacity: 0;
}


.ts-result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.ts-result-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}

.ts-result-label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.ts-result-val {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
  font-variant-numeric: tabular-nums;
  flex: 1;
}

.ts-result-val-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .ts-now-block { min-width: 100%; }
  .ts-now-block--wide { flex: 1 1 0; }
  .ts-convert-row { flex-direction: column; align-items: stretch; }
  .ts-date-row { flex-direction: column; align-items: stretch; }
  .ts-input, .ts-date-input { width: 100%; flex: 1 1 auto; }
  .ts-tz-select-wrap { justify-content: flex-start; }
  .ts-result-grid { grid-template-columns: 1fr 1fr; }
  .ts-btn { width: 100%; }
}

@media (max-width: 480px) {
  .ts-result-grid { grid-template-columns: 1fr; }
}

/* ===== JSON TOOLS ===== */
.json-input {
  width: 100%;
  min-height: 180px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  resize: vertical;
  background: var(--card-bg);
  color: var(--text);
  line-height: 1.5;
}
.json-input:focus {
  outline: none;
  border-color: var(--primary);
}

.json-output {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  min-height: 180px;
}

.json-options {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  margin-bottom: 16px;
}

.json-indent-btns {
  display: flex;
  gap: 6px;
}

.json-indent-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}
.json-indent-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.json-indent-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.json-validate-result {
  margin-top: 16px;
  padding: 16px;
  border-radius: 8px;
  background: var(--bg);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.json-validate-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.json-validate-icon.valid { color: var(--success); }
.json-validate-icon.invalid { color: #e53e3e; }
.json-validate-icon.warn { color: #ed8936; }

.json-validate-msg {
  font-size: 0.9rem;
  line-height: 1.5;
}

.json-validate-msg.valid { color: var(--success); }
.json-validate-msg.invalid { color: #e53e3e; }
.json-validate-msg.warn { color: #ed8936; }

.json-validate-msg strong {
  display: block;
  margin-bottom: 4px;
}

/* ===== 二维码工具 ===== */
.qr-type-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.qr-type-btn {
  flex: 0 0 auto;
  padding: 6px 8px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.qr-type-btn:hover { border-color: var(--primary); color: var(--primary); }
.qr-type-btn.active { background: var(--gradient); border-color: transparent; color: white; }

@media (max-width: 600px) {
  .qr-type-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    overflow-x: visible;
  }
  .qr-type-btn {
    min-width: 0;
    text-align: center;
    padding: 7px 4px;
    font-size: 0.78rem;
    border-radius: 8px;
    white-space: normal;
  }
}

.qr-input-panel { display: none; }
.qr-input-panel.active { display: block; }

.qr-text-field {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
  background: #fafbff;
  color: var(--text);
}
.qr-text-field:focus { outline: none; border-color: var(--primary); background: #fff; }

.qr-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.qr-form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.qr-form-row label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}
.qr-form-full { grid-column: 1 / -1; }

.qr-select {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  background: #fafbff;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s;
}
.qr-select:focus { outline: none; border-color: var(--primary); }

.qr-color-input {
  width: 100%;
  height: 38px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  cursor: pointer;
  background: #fafbff;
}

/* 二维码生成卡片：左右布局 */
.qr-generate-card {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.qr-left-col {
  flex: 1;
  min-width: 0;
}

.qr-right-col {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-top: 4px;
  position: sticky;
  top: 20px;
}

.qr-options { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.qr-options-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  align-items: flex-end;
}
.qr-option-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.qr-result-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.qr-result-inner {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: inline-flex;
  box-shadow: var(--shadow);
}
.qr-result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.qr-result-actions .btn-action {
  width: 100%;
  text-align: center;
}

@media (max-width: 700px) {
  .qr-generate-card { flex-direction: column; }
  .qr-generate-row { margin-bottom: 0 !important; }
  .qr-left-col { width: 100%; }
  .qr-right-col { position: static; width: 100%; align-items: center; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 2px; }
  .qr-result-actions { flex-direction: row; }
  .qr-result-actions .btn-action { width: auto; }
  .qr-form-grid { grid-template-columns: 1fr; }
  .qr-form-full { grid-column: auto; }
  .qr-options-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .qr-result-inner { padding: 10px; }
}

/* ===== ICP 备案查询 ===== */
.icp-input-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.icp-domain-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.2s;
  outline: none;
}
.icp-domain-input:focus {
  border-color: var(--primary);
  background: #fff;
}
.icp-query-btn {
  padding: 10px 24px;
  background: var(--gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
}
.icp-query-btn:hover { opacity: 0.88; }
.icp-examples {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.icp-examples a {
  color: var(--primary);
  text-decoration: none;
  margin: 0 4px;
}
.icp-examples a:hover { text-decoration: underline; }
.icp-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 8px;
}
.icp-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: icp-spin 0.7s linear infinite;
}
@keyframes icp-spin { to { transform: rotate(360deg); } }
.icp-error {
  color: #e53e3e;
  background: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.93rem;
  margin-top: 8px;
}
.icp-result-card { margin-top: 20px; }
.icp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin-bottom: 12px;
}
.icp-table th {
  width: 110px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.icp-table td {
  padding: 10px 0 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  word-break: break-all;
}
.icp-table tr:last-child th,
.icp-table tr:last-child td { border-bottom: none; }
.icp-highlight {
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 1.05em;
}
.icp-disclaimer {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.icp-disclaimer a { color: var(--primary); text-decoration: none; }
.icp-disclaimer a:hover { text-decoration: underline; }
.icp-miit-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
}
.icp-miit-link:hover { text-decoration: underline; }
.icp-captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.icp-captcha-img {
  height: 44px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  display: block;
  background: #f0f0f0;
}
.icp-captcha-img:hover { opacity: 0.85; }
.icp-captcha-input {
  width: 110px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  letter-spacing: 3px;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.2s;
  outline: none;
}
.icp-captcha-input:focus {
  border-color: var(--primary);
  background: #fff;
}
.icp-official-tip {
  margin-top: 10px;
  font-size: 0.84rem;
  color: var(--text-muted);
}
.icp-official-tip a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.icp-official-tip a:hover { text-decoration: underline; }

.ip-self-btn {
  background: none;
  border: 1.5px solid var(--primary);
  color: var(--primary);
  border-radius: var(--radius);
  padding: 3px 10px;
  font-size: 0.84rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin-top: 10px;
  display: inline-block;
}
.ip-self-btn:hover {
  background: var(--primary);
  color: #fff;
}
.ip-map-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.93rem;
}
.ip-map-link:hover { text-decoration: underline; }

.whois-contact-card {
  margin-top: 16px;
}
.whois-contact-list {
  display: grid;
  gap: 10px;
}
.whois-contact-item {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8faff;
}
.whois-contact-role {
  color: var(--primary-dark);
  font-size: 0.86rem;
  font-weight: 700;
  word-break: break-word;
}
.whois-contact-meta {
  display: grid;
  gap: 4px;
  color: var(--text);
  font-size: 0.9rem;
  word-break: break-all;
}

@media (max-width: 600px) {
  .icp-input-row { flex-direction: column; }
  .icp-query-btn { width: 100%; }
  .icp-table th { width: 90px; }
  .whois-contact-item { grid-template-columns: 1fr; }
}

/* ===== 在线计时 ===== */
.stopwatch-card {
  text-align: center;
  padding: 28px 24px;
}
.stopwatch-display {
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: clamp(2.2rem, 6.5vw, 4.2rem);
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  margin: 8px 0 10px;
}
.stopwatch-state {
  min-height: 22px;
  color: var(--text-muted);
  font-size: 0.94rem;
  margin-bottom: 22px;
}
.stopwatch-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.stopwatch-primary,
.stopwatch-btn {
  min-width: 88px;
  min-height: 42px;
}
.stopwatch-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.stopwatch-laps-card {
  margin-top: 18px;
}
.stopwatch-laps-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.stopwatch-lap-summary {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 2px;
}
.stopwatch-laps {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fafbff;
}
.stopwatch-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 18px 12px;
  font-size: 0.9rem;
}
.stopwatch-lap-row {
  display: grid;
  grid-template-columns: 72px 1fr 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.stopwatch-lap-row:last-child { border-bottom: none; }
.stopwatch-lap-index {
  color: var(--text-muted);
  font-weight: 600;
}
.stopwatch-lap-time,
.stopwatch-lap-total {
  font-family: 'Courier New', 'Consolas', monospace;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.stopwatch-lap-time {
  color: var(--primary);
  font-weight: 700;
}
@media (max-width: 600px) {
  .stopwatch-card { padding: 24px 16px; }
  .stopwatch-controls { gap: 8px; }
  .stopwatch-primary,
  .stopwatch-btn {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
  }
  .stopwatch-laps-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .stopwatch-lap-row {
    grid-template-columns: 52px 1fr 1fr;
    padding: 9px 10px;
    font-size: 0.84rem;
  }
}

/* ===== 万年历 ===== */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.cal-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}
.cal-nav-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  color: var(--text);
  font-size: 1rem;
  transition: background 0.15s;
}
.cal-nav-btn:hover { background: var(--bg); }
.cal-today-btn {
  background: var(--gradient);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 14px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: opacity 0.15s;
}
.cal-today-btn:hover { opacity: 0.88; }
.cal-grid {
  width: 100%;
  border-collapse: collapse;
}
.cal-grid th {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  padding: 6px 0 10px;
}
.cal-grid th:first-child { color: #e53e3e; }
.cal-grid th:last-child  { color: #667eea; }
.cal-cell {
  text-align: center;
  padding: 4px 2px;
  border-radius: 8px;
  cursor: default;
  position: relative;
  height: 56px;
  vertical-align: top;
}
.cal-cell:hover { background: var(--bg); }
.cal-cell.other-month { opacity: 0.3; }
.cal-cell.selected .cal-solar {
  background: #e9edff;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  line-height: 28px;
  margin: 0 auto;
  color: var(--primary);
  font-weight: 700;
}
.cal-cell.today .cal-solar {
  background: var(--gradient);
  color: #fff;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  line-height: 28px;
  margin: 0 auto;
}
.cal-solar {
  font-size: 1rem;
  font-weight: 500;
  line-height: 28px;
}
.cal-lunar {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-cell.has-term .cal-lunar  { color: #38a169; font-weight: 600; }
.cal-cell.is-holiday .cal-solar { color: #e53e3e; }
.cal-badge {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.6rem;
  border-radius: 3px;
  padding: 0 3px;
  line-height: 1.4;
  font-weight: 700;
}
.cal-badge.holiday { background: #fff5f5; color: #e53e3e; }
.cal-badge.workday { background: #fffaf0; color: #dd6b20; }
.cal-today-info {
  margin-top: 20px;
  background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.cal-today-info-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--primary-dark);
}
.cal-today-info-row {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.cal-today-info-row b { color: var(--text); }
.cal-yiji {
  margin-top: 8px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.cal-yi-block, .cal-ji-block {
  font-size: 0.88rem;
}
.cal-yi-block span { color: #38a169; font-weight: 600; }
.cal-ji-block span { color: #e53e3e; font-weight: 600; }
.cal-yi-block b, .cal-ji-block b { color: var(--text-muted); }

/* 年份选择器 */
.cal-year-select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--card-bg);
  cursor: pointer;
}
.cal-year-select:focus { outline: none; border-color: var(--primary); }

@media (max-width: 600px) {
  .cal-cell { height: 44px; }
  .cal-solar { font-size: 0.88rem; }
  .cal-lunar { font-size: 0.62rem; }
  .cal-today-info { padding: 10px 12px; margin-top: 12px; }
  .cal-today-info-title { font-size: 0.92rem; margin-bottom: 6px; }
  .cal-today-info-row { font-size: 0.82rem; }
  .cal-yiji { gap: 10px; margin-top: 6px; }
  .cal-yi-block, .cal-ji-block { font-size: 0.82rem; }
}

/* ===== 生肖星座 ===== */
.zodiac-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.zodiac-field {
  width: 90px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--card-bg);
  transition: border-color 0.18s;
}
.zodiac-field:focus { outline: none; border-color: var(--primary); }
.zodiac-field--sm { width: 72px; }
.zodiac-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 26px;
  cursor: pointer;
}
.zodiac-sep { color: var(--text-muted); font-size: 0.95rem; }
.zodiac-query-btn {
  padding: 10px 24px;
  background: var(--gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
}
.zodiac-query-btn:hover { opacity: 0.88; }
.zodiac-quick-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.zodiac-quick-label { font-size: 0.85rem; color: var(--text-muted); }
.zodiac-quick {
  font-size: 0.85rem;
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px dashed var(--primary);
}
.zodiac-quick:hover { opacity: 0.75; }
.zodiac-error {
  margin-top: 12px;
  color: #e53e3e;
  font-size: 0.92rem;
}

/* 结果卡片 */
.zodiac-result-card { margin-top: 20px; }
.zodiac-cards-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 16px 0 20px;
}
.zodiac-result-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px;
  text-align: center;
}
.zodiac-result-divider {
  width: 1px;
  background: var(--border);
  margin: 8px 0;
}
.zodiac-result-emoji {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 10px;
}
.zodiac-result-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.zodiac-result-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.zodiac-result-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.zodiac-detail-row {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.zodiac-detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.92rem;
}
.zodiac-detail-key { color: var(--text-muted); }
.zodiac-detail-val { font-weight: 600; color: var(--text); }

@media (max-width: 600px) {
  .zodiac-input-row { gap: 4px; flex-wrap: nowrap; }
  .zodiac-field { width: 64px; padding: 9px 6px; font-size: 0.9rem; }
  .zodiac-field--sm { width: 58px; }
  .zodiac-query-btn { padding: 9px 14px; font-size: 0.9rem; }
  .zodiac-result-emoji { font-size: 2.4rem; }
  .zodiac-result-name { font-size: 1.25rem; }
}

/* ===== 大写金额 ===== */
.amount-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.amount-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--card-bg);
  transition: border-color 0.18s;
  min-width: 0;
}
.amount-input:focus { outline: none; border-color: var(--primary); }
.amount-examples {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.amount-example {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px dashed var(--primary);
  margin: 0 5px;
}
.amount-example:hover { opacity: 0.75; }
.amount-error {
  margin-top: 10px;
  color: #e53e3e;
  font-size: 0.92rem;
}
.amount-result-card { margin-top: 16px; }
.amount-result-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.amount-result-row .copy-btn {
  position: static;
  transform: none;
  flex-shrink: 0;
}
.amount-result-text {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.5;
  word-break: break-all;
}
.amount-ref-card { margin-top: 16px; }
.amount-ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  table-layout: fixed;
}
.amount-ref-col-label { width: 88px; }
.amount-ref-table th,
.amount-ref-table td {
  border: 1px solid var(--border);
  padding: 7px 4px;
  text-align: center;
}
.amount-ref-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text-muted);
}
.amount-ref-table td {
  color: var(--text);
  font-weight: 600;
}
.amount-ref-spacer td {
  padding: 3px 0;
  background: var(--bg);
  border-left: none;
  border-right: none;
}
@media (max-width: 600px) {
  .amount-input-row { gap: 8px; }
  .amount-input-row .icp-query-btn { width: auto; padding: 10px 14px; white-space: nowrap; flex-shrink: 0; }
  .amount-result-text { font-size: 1.1rem; }
  .amount-ref-table { font-size: 0.75rem; }
  .amount-ref-col-label { width: 60px; }
  .amount-ref-table th, .amount-ref-table td { padding: 5px 2px; }
}

/* ===== Section 内 FAQ ===== */
.section-faq {
  margin: 8px 0 0;
  border-top: 1px solid var(--border);
  padding: 20px 24px 0;
  max-width: 860px;
  width: 100%;
  box-sizing: border-box;
  align-self: center;
}
.section-faq h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}
.section-faq details {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--card-bg);
}
.section-faq details[open] { border-color: var(--primary); }
.section-faq summary {
  padding: 13px 16px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.section-faq summary::-webkit-details-marker { display: none; }
.section-faq summary::after { content: "+"; font-size: 1.1rem; color: var(--primary); }
.section-faq details[open] summary::after { content: "−"; }
.section-faq details p {
  padding: 0 16px 13px;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.75;
}

/* ========== 大小写转换 ========== */
.case-card { display: flex; flex-direction: column; gap: 10px; }
.case-textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.7;
  resize: vertical;
  box-sizing: border-box;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s;
}

@keyframes dino-stage-float {
  0%, 100% { transform: translateY(var(--dino-stage-center)) translateY(0); }
  50% { transform: translateY(var(--dino-stage-center)) translateY(-4px); }
}

@keyframes dino-loader-spin {
  to { transform: rotate(360deg); }
}
.case-textarea:focus { outline: none; border-color: var(--primary); }
.case-output { background: #f8faff; }
.case-output-wrap {
  position: relative;
}
.case-output-wrap .case-output {
  padding-right: 82px;
}
.case-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 4px 0 8px;
}
.case-actions .btn-action {
  min-width: 150px;
  padding: 10px 24px;
}
.case-result-label { margin-top: 4px; }
.base-convert-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.base-convert-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.base-convert-head > div {
  min-width: 0;
}
.base-convert-head p {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.base-clear-btn {
  position: static;
  transform: none;
  flex-shrink: 0;
}
.base-clear-btn:hover { transform: none; }
.base-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.base-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.base-field span {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
}
.base-field input {
  width: 100%;
  min-height: 48px;
  padding: 11px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: Consolas, Monaco, 'Courier New', monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.base-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}
.base-field input.is-invalid {
  border-color: #e53e3e;
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
}
.base-error {
  min-height: 20px;
  color: #e53e3e;
  font-size: 0.88rem;
}
.chinese-convert-actions .btn-secondary {
  min-width: 120px;
  padding: 10px 18px;
}
.utility-tool-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.utility-tool-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.utility-tool-head p {
  margin: 6px 0 0;
  color: var(--text-light);
  line-height: 1.6;
  font-size: 0.94rem;
}
.utility-clear-btn {
  position: static;
  transform: none;
  flex-shrink: 0;
}
.utility-clear-btn:hover {
  transform: none;
}
.utility-textarea,
.utility-input {
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: Consolas, Monaco, 'Courier New', monospace;
  font-size: 0.95rem;
  line-height: 1.65;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.utility-textarea {
  min-height: 128px;
  resize: vertical;
}
.utility-input {
  min-height: 48px;
}
.utility-textarea:focus,
.utility-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}
.utility-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.utility-actions .btn-action,
.utility-actions .btn-secondary {
  min-width: 118px;
  padding: 10px 18px;
}
.utility-error {
  min-height: 20px;
  color: #e53e3e;
  font-size: 0.88rem;
}
.utility-result-label {
  margin-top: 4px;
}
.regex-pattern-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.regex-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.regex-flags label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary, #f7f8fa);
  color: var(--text);
  font-weight: 700;
}
.regex-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.regex-summary-grid div {
  padding: 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f7f8ff, #f2fbf8);
  border: 1px solid #e1e8f5;
}
.regex-summary-grid span {
  display: block;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--primary);
}
.regex-summary-grid small {
  color: var(--text-light);
}
.regex-result-list {
  display: grid;
  gap: 10px;
  min-height: 72px;
  max-height: 320px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-light);
}
.regex-result-item {
  display: grid;
  grid-template-columns: 56px 82px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  background: var(--bg-secondary, #f7f8fa);
  color: var(--text);
}
.regex-result-item code {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #2f855a;
}

/* ========== 世界坐标范围计算 ========== */
.coord-container {
  max-width: 1320px;
}
.coord-layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}
.coord-control-card,
.coord-stage-card,
.coord-result-card {
  border-radius: 8px;
}
.coord-control-card {
  display: grid;
  gap: 12px;
}
.coord-fieldset {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary, #f7f8fa);
}
.coord-fieldset h3 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 0.95rem;
}
.coord-field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.coord-field-grid label {
  display: grid;
  gap: 5px;
  color: var(--text-light);
  font-weight: 700;
  font-size: 0.82rem;
}
.coord-field-grid input {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: 0.94rem Consolas, Monaco, 'Courier New', monospace;
}
.coord-field-grid input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}
.coord-density-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(135deg, #f7f8ff, #f2fbf8);
  color: var(--text-light);
  font-weight: 700;
}
.coord-density-row input {
  accent-color: var(--primary);
}
.coord-density-row output {
  color: var(--primary);
  font-weight: 800;
  text-align: right;
}
.coord-stage-card {
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr);
  gap: 12px;
  min-height: 520px;
}
.coord-stage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.coord-stage-head p {
  margin: 6px 0 0;
  color: var(--text-light);
  line-height: 1.6;
}
.coord-stage-head span {
  flex-shrink: 0;
  padding: 6px 10px;
  border-radius: 999px;
  color: #2f855a;
  background: #eefaf3;
  font-size: 0.82rem;
  font-weight: 800;
}
#coord-canvas {
  width: 100%;
  height: 100%;
  min-height: 360px;
  border-radius: 8px;
  background: #111827;
}
.coord-results-grid {
  display: grid;
  grid-template-columns: 1fr 1.35fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.coord-result-card {
  display: grid;
  gap: 12px;
}
.coord-value-grid,
.coord-bounds-grid {
  display: grid;
  gap: 8px;
}
.coord-value-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.coord-bounds-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.coord-single-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.coord-value-grid span,
.coord-bounds-grid span {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary, #f7f8fa);
  color: var(--text-light);
  font-size: 0.78rem;
  font-weight: 800;
}
.coord-value-grid strong,
.coord-bounds-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font: 700 1rem Consolas, Monaco, 'Courier New', monospace;
}
@media (max-width: 600px) {
  .case-actions { flex-direction: column; }
  .case-actions .btn-action { width: 100%; }
  .base-convert-head {
    flex-direction: column;
    align-items: stretch;
  }
  .base-clear-btn { width: 100%; }
  .base-grid { grid-template-columns: 1fr; gap: 12px; }
  #section-baseconvert .base-convert-card {
    width: calc(100vw - 48px);
  }
  .base-field input {
    min-width: 0;
    font-size: 0.9rem;
  }
  .chinese-convert-actions .btn-secondary { width: 100%; }
  .utility-tool-head {
    flex-direction: column;
    align-items: stretch;
  }
  .utility-clear-btn,
  .utility-actions .btn-action,
  .utility-actions .btn-secondary {
    width: 100%;
  }
  .regex-pattern-row,
  .regex-summary-grid {
    grid-template-columns: 1fr;
  }
  .regex-result-item {
    grid-template-columns: 1fr;
  }
  .coord-layout,
  .coord-results-grid {
    grid-template-columns: 1fr;
  }
  .coord-container {
    width: calc(100vw - 48px);
  }
  .coord-field-grid,
  .coord-value-grid,
  .coord-bounds-grid,
  .coord-single-grid {
    grid-template-columns: 1fr;
  }
  .coord-density-row {
    grid-template-columns: 1fr;
  }
  .coord-density-row output {
    text-align: left;
  }
  .coord-stage-card {
    min-height: auto;
    grid-template-rows: auto auto;
  }
  #coord-canvas {
    min-height: 300px;
  }
}

/* ========== 字数统计 ========== */
.wc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.wc-toolbar-btns {
  display: flex;
  gap: 8px;
}
.wc-toolbar-btns .copy-btn {
  position: static;
  transform: none;
  flex-shrink: 0;
}
.wc-toolbar-btns .copy-btn:hover {
  transform: none;
}
.wc-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.7;
  resize: vertical;
  box-sizing: border-box;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s;
}
.wc-textarea:focus { outline: none; border-color: var(--primary); }
.wc-stats-card { margin-top: 16px; }
.wc-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 4px;
}
.wc-stat-item {
  background: var(--bg-secondary, #f7f8fa);
  border-radius: 10px;
  padding: 16px 12px;
  text-align: center;
}
.wc-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
  letter-spacing: -0.5px;
}
.wc-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}
@media (max-width: 600px) {
  .wc-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }
  .wc-toolbar-btns {
    width: 100%;
  }
  .wc-toolbar-btns .copy-btn {
    flex: 1 1 0;
    max-width: none;
    text-align: center;
  }
  .wc-stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .wc-stat-value { font-size: 1.3rem; }
  .wc-stat-item { padding: 12px 8px; }
}

/* ===== C++ IDE ===== */
.cpp-ide-layout {
  display: flex;
  gap: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: calc(100vh - 160px);
  min-height: 500px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #ffffff;
}

/* 模板下拉 */
.cpp-tpl-dropdown-wrap { margin-left: auto; }
.cpp-tpl-select {
  height: 32px;
  padding: 0 28px 0 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f0f2fa;
  color: var(--text);
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23718096'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.15s;
}
.cpp-tpl-select:hover, .cpp-tpl-select:focus { border-color: var(--primary); }

.cpp-empty { color: var(--text-muted); font-size: 12px; padding: 8px 0; }

/* 我的保存面板 */
.cpp-saves-panel { border-left: 1px solid var(--border); flex: 0.7; }
.cpp-saves-grid {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
}
.cpp-save-chip {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 6px 4px 10px;
  border-radius: 6px;
  background: #f0f2fa;
  border: 1px solid #dde3f5;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
  max-width: 140px;
}
.cpp-save-chip:hover { background: #e4e8f8; border-color: var(--primary); box-shadow: 0 1px 4px rgba(102,126,234,0.15); }
.cpp-save-chip-name {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  max-width: 100px;
}
.cpp-save-chip-name:hover { color: var(--primary); }
.cpp-save-del {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #a0aec0;
  font-size: 13px;
  line-height: 1;
  padding: 1px 2px;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}
.cpp-save-del:hover { background: #fee2e2; color: #e53e3e; }

.cpp-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.cpp-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cpp-btn-run { padding: 6px 18px; font-size: 13px; }
.btn-secondary {
  background: #f0f2fa;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-secondary:hover { background: #e2e6f7; color: var(--primary); }

.cpp-editor-container {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #ffffff;
}
.cpp-editor-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  background: #ffffff;
  gap: 8px;
}
.cpp-editor-loading::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: cpp-spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes cpp-spin {
  to { transform: rotate(360deg); }
}

.cpp-console {
  height: 200px;
  flex-shrink: 0;
  min-width: 0;
  border-top: 1px solid var(--border);
  background: #ffffff;
}
.cpp-console-panels { display: flex; height: 100%; min-width: 0; }
.cpp-console-panel { display: flex; flex-direction: column; flex: 0.6; overflow: hidden; min-width: 0; }
.cpp-output-panel { border-left: 1px solid var(--border); flex: 1.4; }
.cpp-panel-title {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  background: #f7f8fc;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.cpp-timing { font-size: 10px; color: var(--text-muted); text-transform: none; letter-spacing: 0; font-weight: normal; }
.cpp-stdin {
  flex: 1;
  background: #ffffff;
  color: var(--text);
  border: none;
  padding: 8px 10px;
  font-family: 'Consolas', monospace;
  font-size: 12px;
  resize: none;
  outline: none;
}
.cpp-stdin::placeholder { color: var(--text-muted); }
.cpp-output {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  font-family: 'Consolas', monospace;
  font-size: 12px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  line-height: 1.5;
  background: #ffffff;
}
.cpp-output.cpp-error { color: #e53e3e; }
.cpp-output.cpp-success { color: #276749; }

.cpp-status-toast {
  margin-left: 8px;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 4px;
  background: #0e639c;
  color: #fff;
}
.cpp-status-toast.error { background: #f44747; }
.cpp-status-toast.success { background: #48bb78; color: #1a202c; }

/* Monaco error decorations */
.cpp-error-line { background: rgba(255,0,0,0.12) !important; }

@media (max-width: 768px) {
  .cpp-ide-layout { flex-direction: column; height: auto; min-height: unset; }
  .cpp-editor-container { height: 280px; flex: none; }
  .cpp-console { height: auto; }
  .cpp-console-panels { flex-direction: column; }
  .cpp-console-panel { flex: unset; }
  .cpp-output-panel { border-left: none; border-top: 1px solid var(--border); flex: unset; }
  .cpp-saves-panel { border-left: none; border-top: 1px solid var(--border); flex: unset; }
  .cpp-stdin { height: 70px; }
  .cpp-output { height: 140px; }
  .cpp-saves-grid { max-height: 120px; }
  .cpp-tpl-select { font-size: 12px; }
  .cpp-save-chip { max-width: 120px; }
  .cpp-save-chip-name { max-width: 80px; }
}

