/* Kuupy 全局样式：浅色/深色主题通过 html[data-theme] 切换 CSS 变量 */
:root {
  --bg: #f5f7fa;
  --bg-card: #ffffff;
  --text: #1f2329;
  --text-secondary: #646a73;
  --border: #dee0e3;
  --primary: #3b6ef0;
  --primary-hover: #2f5cd0;
  --primary-soft: #e8eefc;
  --danger: #d83931;
  --success: #2ea121;
  --shadow: 0 2px 8px rgba(31, 35, 41, 0.08);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

html[data-theme="dark"] {
  --bg: #17191c;
  --bg-card: #22252a;
  --text: #e8eaed;
  --text-secondary: #9aa0a6;
  --border: #3c4043;
  --primary: #6e93f7;
  --primary-hover: #8aa9f9;
  --primary-soft: #2b3a5c;
  --danger: #f28b82;
  --success: #7ac74f;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.2s, color 0.2s;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* 顶部导航 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  height: 56px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.site-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.site-logo:hover {
  text-decoration: none;
  color: var(--primary);
}

.site-nav {
  display: flex;
  gap: 16px;
  flex: 1;
  overflow-x: auto;
}

.site-nav a {
  color: var(--text-secondary);
  white-space: nowrap;
  font-size: 14px;
}

.site-nav a.active,
.site-nav a:hover {
  color: var(--primary);
  text-decoration: none;
}

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

.lang-select,
.theme-toggle,
.fav-toggle {
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}

.lang-select {
  padding: 0 6px;
  max-width: 130px;
}

.theme-toggle,
.fav-toggle {
  width: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.fav-toggle.faved {
  color: #f5a623;
  border-color: #f5a623;
}

/* 主体布局 */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.hero {
  text-align: center;
  padding: 32px 0 16px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 32px;
}

.hero p {
  margin: 0;
  color: var(--text-secondary);
}

.section-title {
  margin: 32px 0 16px;
  font-size: 20px;
  border-left: 4px solid var(--primary);
  padding-left: 10px;
}

/* 工具卡片网格 */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.tool-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.15s, border-color 0.15s;
}

.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  text-decoration: none;
}

.tool-card .tool-icon {
  font-size: 28px;
}

.tool-card h3 {
  margin: 8px 0 4px;
  font-size: 16px;
}

.tool-card p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 工具页 */
.tool-page h1 {
  margin: 8px 0 4px;
  font-size: 26px;
}

.tool-page .tool-desc {
  color: var(--text-secondary);
  margin-top: 0;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-top: 16px;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin-top: 0;
  font-size: 17px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

label {
  font-size: 14px;
  color: var(--text-secondary);
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="time"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

textarea {
  font-family: var(--mono);
  min-height: 140px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-row input,
.form-row select {
  width: auto;
  flex: 1;
  min-width: 120px;
}

.btn {
  display: inline-block;
  padding: 8px 18px;
  border: none;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}

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

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

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

.btn-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

.result-box {
  font-family: var(--mono);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  word-break: break-all;
  white-space: pre-wrap;
  min-height: 24px;
  font-size: 14px;
}

.msg {
  margin-top: 8px;
  font-size: 13px;
  min-height: 20px;
}

.msg.error {
  color: var(--danger);
}

.msg.ok {
  color: var(--success);
}

/* 计算器按键 */
.calc-display {
  width: 100%;
  font-family: var(--mono);
  font-size: 26px;
  text-align: right;
  padding: 14px;
  margin-bottom: 12px;
}

.calc-keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.calc-keys.cols-5 {
  grid-template-columns: repeat(5, 1fr);
}

.calc-keys button {
  padding: 14px 0;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
}

.calc-keys button:hover {
  background: var(--primary-soft);
}

.calc-keys button.op {
  color: var(--primary);
  font-weight: 600;
}

.calc-keys button.eq {
  background: var(--primary);
  color: #fff;
  grid-row: span 2;
}

/* 图标生成结果 */
.icon-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.icon-preview-item {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
}

.icon-preview-item img {
  width: 100%;
  max-width: 96px;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: block;
  margin: 0 auto 4px;
}

/* 页脚 */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  background: var(--bg-card);
}

.site-footer nav {
  margin-bottom: 8px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
}

.empty-tip {
  color: var(--text-secondary);
  font-size: 14px;
  padding: 12px 0;
}

@media (max-width: 640px) {
  .site-header {
    padding: 0 12px;
    gap: 10px;
  }

  .hero h1 {
    font-size: 24px;
  }

  .container {
    padding: 16px 12px 40px;
  }
}

/* 房贷计算器（mortgage.html）：汇总结果与还款计划表 */
.mortgage-summary {
  border-top: 1px solid var(--border);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.summary-row .summary-value {
  font-family: var(--mono);
  font-weight: 600;
  text-align: right;
}

.table-scroll {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.mortgage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.mortgage-table th,
.mortgage-table td {
  padding: 6px 12px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.mortgage-table th {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}

.mortgage-table th:first-child,
.mortgage-table td:first-child {
  text-align: center;
}

.mortgage-table td {
  font-family: var(--mono);
}

/* 睡眠计算器（sleep-calculator.html） */
.sleep-hidden {
  display: none !important;
}

.sleep-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sleep-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.sleep-item.recommended {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.sleep-time {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
  min-width: 72px;
}

.sleep-meta {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
}

.sleep-badge {
  padding: 2px 10px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
}

.sleep-note {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

/* 星座计算器（zodiac-calculator.html）：结果面板与 12 星座对照表 */
.zodiac-hidden {
  display: none !important;
}

.zodiac-result {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.zodiac-symbol {
  font-size: 48px;
  line-height: 1.2;
}

.zodiac-name {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.zodiac-dates {
  margin: 2px 0 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.zodiac-traits {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.zodiac-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.zodiac-table th,
.zodiac-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.zodiac-table th {
  color: var(--text-secondary);
  white-space: nowrap;
}

.zodiac-note {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

/* ===== 健康计算器（bmi/bmr/bodyfat/duedate/ovulation/dosage） ===== */
/* 结果面板显隐与各工具通用小字说明 */
.bmi-hidden,
.bodyfat-hidden,
.duedate-hidden,
.ovulation-hidden,
.dosage-hidden,
.workday-hidden,
.countdown-hidden,
.sql2gorm-hidden,
.dataformat-hidden,
.timestamp-hidden,
.cron-hidden,
.qrcode-hidden {
  display: none !important;
}

.bmi-note,
.bmr-note,
.bodyfat-note,
.duedate-note,
.ovulation-note,
.dosage-note,
.dosage-result-note,
.workday-note,
.sql2gorm-note,
.dataformat-note,
.timestamp-note,
.cron-note,
.qrcode-note,
.color-note {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

/* 各工具静态对照表共用同一表格样式（DRY） */
.bmi-table,
.bmr-table,
.bodyfat-table,
.duedate-table,
.ovulation-table,
.dosage-table,
.dataformat-table,
.timestamp-table,
.cron-table,
.qrcode-table,
.color-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.bmi-table th,
.bmi-table td,
.bmr-table th,
.bmr-table td,
.bodyfat-table th,
.bodyfat-table td,
.duedate-table th,
.duedate-table td,
.ovulation-table th,
.ovulation-table td,
.dosage-table th,
.dosage-table td,
.dataformat-table th,
.dataformat-table td,
.timestamp-table th,
.timestamp-table td,
.cron-table th,
.cron-table td,
.qrcode-table th,
.qrcode-table td,
.color-table th,
.color-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.bmi-table th,
.bmr-table th,
.bodyfat-table th,
.duedate-table th,
.ovulation-table th,
.dosage-table th,
.dataformat-table th,
.timestamp-table th,
.cron-table th,
.qrcode-table th,
.color-table th {
  color: var(--text-secondary);
  white-space: nowrap;
}

/* BMI 计算器：居中大字结果 */
.bmi-result {
  text-align: center;
}

.bmi-value {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
}

.bmi-category {
  margin: 4px 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.bmi-range {
  margin: 4px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.bmi-note {
  font-size: 0.85rem;
}

.bmi-text {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* BMR/TDEE 计算器：汇总区与建议列表 */
.bmr-summary {
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* 各工具说明/建议列表共用同一样式（DRY） */
.bmr-tips,
.bodyfat-guide,
.countdown-list,
.dataformat-list {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* 体脂率计算器：大字百分比结果 */
.bodyfat-result {
  text-align: center;
}

.bodyfat-value {
  margin: 0;
  font-family: var(--mono);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
}

.bodyfat-cat {
  margin: 4px 0;
  font-size: 1.1rem;
  font-weight: 600;
}

/* 预产期计算器：三孕期小标题与当前孕期高亮 */
.duedate-tri-title {
  margin: 16px 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.summary-row.duedate-current {
  color: var(--primary);
  font-weight: 600;
}

/* 排卵期计算器：周期卡片列表 */
.ovulation-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

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

.ovulation-cycle {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.ovulation-line {
  margin: 2px 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.ovulation-best {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 10px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  vertical-align: middle;
}

/* 服药剂量计算器：醒目免责框与结果行 */
.dosage-disclaimer {
  border-left: 4px solid var(--danger);
  background: var(--primary-soft);
}

.dosage-disclaimer h2 {
  color: var(--danger);
}

.dosage-line {
  margin: 4px 0;
  font-size: 15px;
}

.dosage-total {
  font-weight: 600;
}

.dosage-result-note {
  margin-top: 8px;
}

/* ===== 倒计时计算器（countdown-calculator.html）：复选框行、大字天数结果与场景列表 ===== */
.countdown-check {
  gap: 8px;
}

/* 复选框不拉伸：覆盖 .form-row input 的 flex:1，避免撑满整行 */
.countdown-check input[type="checkbox"] {
  flex: none;
  width: auto;
  min-width: 0;
  margin: 0;
}

.countdown-result {
  text-align: center;
}

.countdown-event {
  margin: 0;
  font-size: 15px;
  color: var(--text-secondary);
}

.countdown-days {
  margin: 4px 0;
}

.countdown-days-num {
  font-family: var(--mono);
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary);
}

.countdown-days-unit {
  margin-left: 6px;
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.countdown-status {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 600;
}

.countdown-result .summary-row {
  text-align: left;
}

.countdown-note {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ===== SQL 转 GORM（sql-to-gorm.html）：转换选项、代码输出区与类型映射表 ===== */
.sql2gorm-options {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 8px 0 4px;
}

.sql2gorm-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  cursor: pointer;
}

.sql2gorm-opt input[type="checkbox"] {
  width: auto;
}

.sql2gorm-code,
.dataformat-code {
  font-family: var(--mono);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  margin: 0 0 12px;
}

.sql2gorm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-bottom: 8px;
}

.sql2gorm-table th,
.sql2gorm-table td {
  font-family: var(--mono);
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

.sql2gorm-table th {
  color: var(--text-secondary);
  font-weight: 600;
}

.sql2gorm-note {
  line-height: 1.8;
}

/* ===== 数据格式转换（data-format-converter.html）：格式选择与互换按钮 ===== */
.dataformat-formats select {
  flex: 1;
  min-width: 100px;
}

.dataformat-swap {
  flex: none;
  padding: 8px 12px;
}

/* ===== 时间戳转换（timestamp-converter.html）：实时当前时间戳区 ===== */
.timestamp-now {
  margin-bottom: 10px;
}

.timestamp-now-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  flex-wrap: wrap;
}

.timestamp-now-label {
  color: var(--text-secondary);
  min-width: 150px;
}

.timestamp-value {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  word-break: break-all;
}

.timestamp-code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
}

/* ===== Cron 解析（cron-parser.html）：字段行、表达式输出与解析/执行时间列表 ===== */
.cron-field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.cron-field-row label {
  min-width: 90px;
}

.cron-field-row select {
  width: auto;
}

.cron-step-input {
  width: 80px;
}

.cron-specific-input {
  flex: 1;
  min-width: 140px;
}

.cron-unit {
  font-size: 13px;
  color: var(--text-secondary);
}

.cron-expr-out {
  font-family: var(--mono);
  font-size: 15px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  word-break: break-all;
}

.cron-desc-list,
.cron-next-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cron-desc-list li,
.cron-next-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.cron-table td:first-child {
  font-family: var(--mono);
  white-space: nowrap;
}

/* ===== 二维码（qr-code.html）：预览画布与文件选择 ===== */
.qrcode-preview {
  margin-top: 12px;
  text-align: center;
}

/* 画布底色固定为白色：二维码扫描依赖浅色底，不随暗色主题变化 */
.qrcode-preview canvas {
  width: 256px;
  height: 256px;
  image-rendering: pixelated;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.qrcode-file {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ===== 颜色转换（color-converter.html）：预览、取色器、滑杆与和谐色板 ===== */
.color-preview {
  height: 120px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.color-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.color-picker-row input[type="color"] {
  width: 64px;
  height: 36px;
  padding: 2px;
}

.color-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.color-field label {
  min-width: 48px;
  flex: none;
}

.color-field input {
  flex: 1;
}

.color-invalid {
  border-color: var(--danger) !important;
}

.color-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.color-slider-row label {
  min-width: 160px;
  flex: none;
}

.color-slider-row input[type="range"] {
  flex: 1;
}

.color-slider-val {
  min-width: 48px;
  text-align: right;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-secondary);
}

.color-harmony {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.color-harmony-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.color-harmony-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-swatch-item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text);
  transition: transform 0.15s;
}

.color-swatch-item:hover {
  transform: translateY(-2px);
}

.color-chip {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--border);
  vertical-align: middle;
  margin-right: 6px;
}

.color-swatch-hex {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.color-sub {
  margin: 12px 0 6px;
  font-size: 14px;
  font-weight: 600;
}



/* App 图标制作工具（tools/app-logo.html）：上传拖拽区与原图预览 */
.applogo-dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 36px 16px;
  text-align: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.applogo-dropzone:hover,
.applogo-dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.applogo-preview {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.applogo-preview img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
}

.applogo-preview-info {
  color: var(--text-secondary);
  font-size: 13px;
}

/* 基础计算器 basic-calculator：算式历史行与不跨行的等号键 */
.calc-history {
  min-height: 20px;
  margin-bottom: 4px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-secondary);
  text-align: right;
  word-break: break-all;
}

.calc-keys button.eq-basic {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.calc-keys button.eq-basic:hover {
  background: var(--primary);
  opacity: 0.9;
}

/* ===== 程序员计算器（programmer-calculator.html） ===== */
.prog-expr {
  min-height: 20px;
  text-align: right;
  font-family: var(--mono);
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.prog-rows {
  display: grid;
  gap: 6px;
}

.prog-row {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.prog-row.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.prog-label {
  width: 40px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.prog-value {
  font-family: var(--mono);
  font-size: 15px;
  word-break: break-all;
}

/* 位宽/符号/进制切换按钮组 */
.seg-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.seg-bar .btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* 当前进制下不可用的数字按键置灰 */
.calc-keys button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.calc-keys button:disabled:hover {
  background: var(--bg-card);
}

/* 5 列布局下 = 键不跨行，避免按键区出现空缺 */
.prog-keys button.eq {
  grid-row: auto;
}

/* ===== 数学计算器（scientific-calculator.html）：跨列按键与历史记录 ===== */
.calc-keys button.key-span2 {
  grid-column: span 2;
}

.sci-history {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.sci-history-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.sci-history-item:last-child {
  border-bottom: none;
}

.sci-history-item:hover {
  background: var(--primary-soft);
}

.sci-history-item .h-expr {
  color: var(--text-secondary);
  word-break: break-all;
}

.sci-history-item .h-result {
  font-weight: 600;
  flex-shrink: 0;
}

/* 语言切换菜单（静态链接，显示各语言本名） */
.lang-menu {
  position: relative;
}

.lang-menu summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 6px;
  height: 32px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 13px;
  color: var(--text);
  user-select: none;
  white-space: nowrap;
}

.lang-menu summary::-webkit-details-marker {
  display: none;
}

.lang-menu[open] summary {
  border-color: var(--primary);
}

.lang-list {
  position: absolute;
  right: 0;
  top: 38px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 120px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  z-index: 200;
}

.lang-list a {
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
}

.lang-list a:hover {
  background: var(--primary-soft);
  text-decoration: none;
}

.lang-list a.current {
  color: var(--primary);
  font-weight: 600;
}
