/* CalcStory 网页版增强（2026-11-03）：首屏演示、上手引导、长按功能标注、连接符提示、
   电脑端布局、浅色主题。只是附加层，不改混淆的 app-*.js。配合 cs-enhance.js。 */

/* ---------- 1. 首屏：一句话卖点 + 演示，其余说明折叠 ---------- */
#seoIntro:not(.cs-open) > :not(h1):not(.cs-demo):not(.cs-more):not(.seo-links) { display: none; }
#seoIntro:not(.cs-open) > .seo-links ~ .seo-links { display: none; }
#seoIntro h1 { margin-bottom: 10px; }

.cs-demo { margin: 0 0 12px; }
.cs-demo-tag { margin: 0 0 10px; font-size: 16px; font-weight: 650; line-height: 1.4; color: var(--text-strong); }
.cs-demo-box {
  background: var(--card-bg); border: 1px solid var(--divider-soft); border-radius: 12px;
  padding: 10px 14px; font-variant-numeric: tabular-nums; max-width: 420px;
}
.cs-demo-row {
  display: grid; grid-template-columns: 1.4em 1fr auto; align-items: baseline; column-gap: 8px;
  padding: 5px 0; border-bottom: 1px solid var(--divider-faint);
}
.cs-demo-row .op { color: var(--primary); font-weight: 700; text-align: center; }
.cs-demo-row .ex { font-size: 17px; color: var(--text); }
.cs-demo-row .val { font-size: 15px; color: var(--text-muted); }
.cs-demo-row .note { grid-column: 2 / 4; font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.cs-demo-row.total { border-bottom: 0; }
.cs-demo-row.total .ex { font-weight: 700; color: var(--text-strong); }
.cs-demo-row.total .val { font-size: 19px; font-weight: 700; color: var(--primary); }

.cs-more {
  background: none; border: 0; padding: 4px 0; margin: 0 0 8px; font: inherit; font-size: 13px;
  color: var(--primary); cursor: pointer;
}
.cs-more:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

/* ---------- 2. 上手引导气泡 ---------- */
#csCoach {
  position: fixed; z-index: 2000; max-width: min(340px, calc(100vw - 24px));
  background: var(--primary); color: var(--primary-contrast);
  border-radius: 12px; padding: 12px 14px 10px; box-shadow: 0 10px 30px rgba(0,0,0,.35);
  font-size: 14.5px; line-height: 1.45;
}
#csCoach[hidden] { display: none; }
#csCoach .cs-step { font-size: 12px; opacity: .75; margin-bottom: 3px; }
#csCoach .cs-pc { margin-top: 6px; font-size: 13px; opacity: .85; }
#csCoach .cs-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
#csCoach button {
  font: inherit; font-size: 14px; border-radius: 8px; padding: 6px 12px; cursor: pointer; border: 0;
}
#csCoach .cs-skip { background: transparent; color: inherit; opacity: .8; }
#csCoach .cs-next { background: var(--primary-contrast); color: var(--primary); font-weight: 650; }
#csCoach .cs-arrow {
  position: absolute; width: 14px; height: 14px; background: var(--primary); transform: rotate(45deg);
}
.cs-coach-target { box-shadow: 0 0 0 3px var(--primary) !important; border-radius: 6px; z-index: 1999; }

/* ---------- 3. 长按功能标注（键角小字） ---------- */
#custom-keyboard .key[data-cs-hint]::after {
  content: attr(data-cs-hint);
  position: absolute; left: 3px; right: 3px; bottom: 2px;
  font-size: 9.5px; line-height: 1.1; font-weight: 500; font-family: system-ui, sans-serif;
  color: var(--text-muted); opacity: .9; pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center;
}
body.cs-no-hints #custom-keyboard .key[data-cs-hint]::after { display: none; }
/* 运算符：只在当前连接符上标“连接符”，跟蓝色一起说明它的意思 */
#custom-keyboard .op-key[data-cs-hint]::after { content: none; }
#custom-keyboard .op-key.active[data-cs-hint]::after { content: attr(data-cs-hint); color: var(--primary); opacity: 1; }
body.cs-no-hints #custom-keyboard .op-key.active[data-cs-hint]::after { display: block; }

.cs-setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cs-setting-row input { width: 20px; height: 20px; accent-color: var(--primary); }

/* ---------- 4. 轻提示（从左到右计算） ---------- */
#csTip {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 2001;
  max-width: min(420px, calc(100vw - 24px)); padding: 10px 14px; border-radius: 10px;
  background: var(--toast-bg); color: #fff; font-size: 14px; line-height: 1.45; text-align: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.3); cursor: pointer;
}
#csTip[hidden] { display: none; }

/* ---------- 5. 电脑端：键盘填满右侧卡片，按键更大 ---------- */
@media (hover: hover) and (pointer: fine) and (orientation: landscape) and (min-width: 900px) and (min-height: 600px) {
  #custom-keyboard.visible, #custom-keyboard {
    grid-template-rows: repeat(5, minmax(56px, 1fr)) !important;
    flex: 1 1 auto !important; max-height: 440px !important; min-height: 300px;
  }
  #custom-keyboard .key { height: auto !important; font-size: 1.35rem; border-radius: 10px; }
  #custom-keyboard .op-key { font-size: 2.2rem; }
  #custom-keyboard .key[data-cs-hint]::after { font-size: 11px; bottom: 5px; }
  .card { justify-content: flex-end; }
}

/* ---------- 6. 浅色主题：跟随系统 ---------- */
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --primary: #0a64c8; --primary-hover: #0952a6; --primary-contrast: #ffffff; --focus-ring-dim: #b7d3f2;
    --danger: #c8243a; --danger-hover: #a51d30;
    --bg-color: #f2f2f5; --card-bg: #ffffff; --input-bg: #e6e6eb; --surface-sunken: #ececf0;
    --overlay-scrim: rgba(0, 0, 0, 0.35); --overlay-scrim-strong: rgba(0, 0, 0, 0.55);
    --toast-bg: rgba(28, 28, 30, 0.92); --overlay-scrim-max: rgba(0, 0, 0, 0.7);
    --border: #c7c7cc; --divider-soft: rgba(0, 0, 0, 0.1); --divider-faint: rgba(0, 0, 0, 0.07);
    --text: #1c1c1e; --text-strong: #000000; --text-secondary: #3a3a3c; --timestamp: #6c6c70;
    --text-muted: #6c6c70; --text-disabled: #8e8e93;
    --key-active-bg: #c9c9d0; --key-hold-bg: #d8d8de; --key-longpress-bg: #bdbdc6;
    --control-neutral: #8e8e93; --control-neutral-strong: #7c7c82; --control-disabled-bg: #d1d1d6;
    --checkbox-bg: #ffffff; --checkbox-border: #8e8e93; --checkbox-bg-checked: #6c6c70;
    --checkbox-border-checked: #48484a; --checkbox-tick: #ffffff;
    --scrollbar-thumb: #b4b4ba; --shadow-card-color: rgba(0, 0, 0, 0.1);
    --shadow-modal: 0 18px 60px rgba(0, 0, 0, 0.22);
  }
  .op-key { color: var(--text); }
  .store-link { background: #ffffff; color: var(--text); border: 1px solid var(--border); }
  .op-key.active { color: var(--primary); }
  #csCoach { box-shadow: 0 10px 30px rgba(0,0,0,.18); }
}
