/* Magic 计算器官网样式：一套变量，深色 / 浅色两套取值。 */

:root {
  --bg: #0a0e14;
  --bg-soft: #0e141d;
  --surface: #121821;
  --surface-2: #171f2b;
  --border: #253044;
  --border-strong: #33415a;
  --text: #e9f0fa;
  --muted: #93a4bb;
  --accent: #4f9cff;
  --accent-2: #22d3ee;
  --accent-soft: rgba(79, 156, 255, 0.14);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.28);
  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  color-scheme: dark;
}

:root[data-theme='light'] {
  --bg: #f4f6fa;
  --bg-soft: #eef2f8;
  --surface: #ffffff;
  --surface-2: #f2f5fa;
  --border: #d8e0ec;
  --border-strong: #bcc8d9;
  --text: #0f1b2d;
  --muted: #56657e;
  --accent: #1f6feb;
  --accent-2: #0e9db8;
  --accent-soft: rgba(31, 111, 235, 0.1);
  --shadow: 0 24px 60px rgba(21, 42, 74, 0.16);
  --shadow-soft: 0 10px 26px rgba(21, 42, 74, 0.1);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    'PingFang SC',
    'Hiragino Sans GB',
    'Microsoft YaHei',
    'Noto Sans SC',
    'Noto Sans TC',
    'Noto Sans JP',
    'Noto Sans',
    'Helvetica Neue',
    Arial,
    sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body.is-locked {
  overflow: hidden;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

h1 {
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  font-weight: 800;
}

h2 {
  font-size: clamp(1.5rem, 2.6vw, 2.15rem);
  font-weight: 750;
}

h3 {
  font-size: 1.05rem;
  font-weight: 650;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}

.skip-link:focus {
  left: 16px;
}

/* ── 顶栏 ─────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.topbar.is-scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.brand-logo {
  border-radius: 9px;
  box-shadow: var(--shadow-soft);
}

.nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nav a {
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.92rem;
  color: var(--muted);
  transition: color 0.16s ease, background 0.16s ease;
}

.nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* 顶栏语言下拉：不用原生 <select>，深色下系统下拉面板的白底 / 深底不受控，
   容易变成浅底浅字，这里自己画按钮与列表，配色全部走 CSS 变量 */
.lang-picker {
  position: relative;
  display: inline-flex;
}

.lang-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.lang-button:hover,
.lang-button[aria-expanded='true'] {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

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

.lang-button .icon {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--muted);
}

.lang-button .chevron {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--muted);
  transition: transform 0.18s ease;
}

.lang-button[aria-expanded='true'] .chevron {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  min-width: 190px;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.lang-menu[hidden] {
  display: none;
}

.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.lang-option:hover,
.lang-option:focus-visible {
  background: var(--surface-2);
  outline: none;
}

.lang-option .check {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--accent);
  opacity: 0;
}

.lang-option.is-current {
  color: var(--accent);
  font-weight: 600;
}

.lang-option.is-current .check {
  opacity: 1;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease;
}

.icon-button:hover {
  border-color: var(--border-strong);
  color: var(--accent);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

/* ── 首屏 ─────────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: 64px 0 40px;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: -20% 40% 40% -10%;
  background: radial-gradient(
    circle at 30% 40%,
    color-mix(in srgb, var(--accent) 26%, transparent),
    transparent 62%
  );
  filter: blur(10px);
  pointer-events: none;
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  gap: 48px;
  align-items: center;
}

.badge {
  display: inline-block;
  margin-bottom: 18px;
  padding: 5px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--border));
  border-radius: 999px;
  background: var(--accent-soft);
  color: color-mix(in srgb, var(--accent) 78%, var(--text));
  font-size: 0.8rem;
  letter-spacing: 0.01em;
}

.hero h1 {
  margin-bottom: 18px;
}

.grad {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  color: var(--muted);
  font-size: 1.03rem;
  max-width: 54ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 0 30px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.button.primary {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 12px 26px color-mix(in srgb, var(--accent) 34%, transparent);
}

.button.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px color-mix(in srgb, var(--accent) 42%, transparent);
}

.button.ghost {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.button.ghost:hover {
  border-color: var(--border-strong);
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hero-stats li {
  display: flex;
  flex-direction: column;
  padding-right: 22px;
  border-right: 1px solid var(--border);
}

.hero-stats li:last-child {
  border-right: 0;
  padding-right: 0;
}

.hero-stats strong {
  font-size: 1.5rem;
  font-weight: 750;
  line-height: 1.2;
}

.hero-stats span {
  color: var(--muted);
  font-size: 0.82rem;
}

.hero-figure {
  position: relative;
}

/* 手机外壳：官网全部用手机截图，所以统一套这个壳 */
.device {
  position: relative;
  margin: 0;
  padding: 9px;
  border: 1px solid var(--border-strong);
  border-radius: 38px;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  box-shadow: var(--shadow);
}

/* 屏幕边缘的一道高光，让外壳不至于太平 */
.device::after {
  content: '';
  position: absolute;
  inset: 9px;
  border-radius: 30px;
  box-shadow: inset 0 0 0 1px rgba(127, 160, 200, 0.16);
  pointer-events: none;
}

.device img {
  width: 100%;
  height: auto;
  border-radius: 30px;
  background: var(--bg-soft);
}

/* 浅色下外壳与页面底色太接近，靠更深的描边 + 投影把手机框出来 */
[data-theme='light'] .device {
  background: linear-gradient(160deg, var(--surface), var(--surface-2));
  border-color: var(--border-strong);
}

.device-hero {
  width: min(320px, 100%);
  margin: 0 auto;
}

.device-hero img {
  cursor: zoom-in;
}

/* 屏幕区域：底部导航热区按这张图的百分比定位，所以要包一层贴着图片的容器 */
.device-screen {
  position: relative;
  display: block;
}

/* 手机图底部是 App 自己的导航条（计算器 / 绘图 / 工具 / 设置，62 / 844 高）：
   盖一层四等分的透明热区，点哪一格就换哪一页的截图。 */
.hero-hotspots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 7.346%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 3px;
  border-radius: 0 0 30px 30px;
  pointer-events: none;
}

.hero-hotspot {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  border-radius: 12px;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.hero-hotspot:hover,
.hero-hotspot:focus-visible {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 60%, transparent);
}

.hero-hotspot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.hero-hotspot[aria-current='true'] {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.hero-hint {
  margin: 16px auto 0;
  max-width: 320px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: center;
}

.hero-glow {
  position: absolute;
  inset: 12% -6% -8% 6%;
  background: radial-gradient(
    circle at 60% 50%,
    color-mix(in srgb, var(--accent) 30%, transparent),
    transparent 68%
  );
  filter: blur(40px);
  z-index: -1;
}

/* ── 通用区块 ─────────────────────────────────────────────── */
.section {
  padding: 84px 0;
}

.section:nth-of-type(even) {
  background: var(--bg-soft);
}

.section-head {
  max-width: 720px;
  margin-bottom: 40px;
}

.eyebrow {
  margin-bottom: 10px;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.section-head h2 {
  margin-bottom: 12px;
}

.hint {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ── 特性 ─────────────────────────────────────────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.feature-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.feature-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--shadow-soft);
}

.feature-badge {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.feature-icon {
  width: 21px;
  height: 21px;
}

.feature-card h3 {
  margin-bottom: 6px;
}

.feature-card p {
  color: var(--muted);
  font-size: 0.92rem;
}

/* ── 截图 ─────────────────────────────────────────────────── */
/* 六张手机截图排成 3 列，卡片里的手机限宽，免得整块太高 */
.shot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px 20px;
}

.shot-card {
  margin: 0;
  transition: transform 0.18s ease;
}

/* 入场动画的 .reveal.is-in 会把 transform 写回 none，这里用更高权重盖住它 */
.shot-card:hover,
.shot-card.is-in:hover {
  transform: translateY(-3px);
}

.shot-card .device {
  width: min(240px, 100%);
  margin: 0 auto;
  padding: 7px;
  border-radius: 30px;
}

.shot-card .device::after {
  inset: 7px;
  border-radius: 24px;
}

.shot-card .device img {
  border-radius: 24px;
  cursor: zoom-in;
  transition: transform 0.35s ease;
}

.shot-card:hover .device img {
  transform: scale(1.015);
}

figcaption {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 4px 0;
  font-size: 0.86rem;
  text-align: center;
}

.shot-name {
  font-weight: 650;
  white-space: nowrap;
}

.shot-desc {
  color: var(--muted);
}

/* 「手机上也好用」一句话说明，放在截图网格下面 */
.shots-note {
  margin: 30px auto 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.shots-note strong {
  color: var(--text);
  font-weight: 650;
  margin-right: 6px;
}

.theme-pair {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 40px;
}

.theme-card {
  flex: 0 1 268px;
  margin: 0;
}

.theme-card .device img {
  cursor: zoom-in;
}

.theme-card figcaption {
  gap: 8px;
  font-weight: 600;
}

.theme-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
}

.theme-dot-dark {
  background: #0a0e14;
}

.theme-dot-light {
  background: #f4f6fa;
}

/* ── 工具 ─────────────────────────────────────────────────── */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 16px;
}

.tool-card {
  --accent: var(--accent-dark);
  margin: 0;
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

[data-theme='light'] .tool-card {
  --accent: var(--accent-light);
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-soft);
}

/* 工具卡片放手机截图的「上半屏」：标题 + 输入区，点开看全长图 */
.tool-shot {
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  cursor: zoom-in;
}

.tool-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.35s ease;
}

.tool-card:hover .tool-shot img {
  transform: scale(1.03);
}

.tool-card figcaption {
  display: block;
  padding: 14px 16px 16px;
}

.tool-card h3 {
  margin-bottom: 3px;
  color: var(--accent);
}

.tool-tagline {
  color: var(--muted);
  font-size: 0.86rem;
}

/* ── 语言 ─────────────────────────────────────────────────── */
.language-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.language-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.language-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.language-card.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.language-label {
  font-weight: 650;
}

.language-sample {
  color: var(--muted);
  font-size: 0.85rem;
}

.language-current {
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ── 页脚 ─────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 36px 0;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
}

.footer-brand img {
  border-radius: 8px;
}

.footer-note {
  color: var(--muted);
  font-size: 0.88rem;
}

.footer-links {
  display: flex;
  gap: 18px;
  margin-left: auto;
  font-size: 0.88rem;
}

.footer-links a {
  color: var(--muted);
  transition: color 0.16s ease;
}

.footer-links a:hover {
  color: var(--accent);
}

/* ── 灯箱 ─────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 32px;
  background: rgba(4, 8, 14, 0.86);
  backdrop-filter: blur(6px);
  cursor: zoom-out;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-figure {
  margin: 0;
  max-width: min(1240px, 94vw);
}

.lightbox-figure img {
  width: 100%;
  max-height: 84vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.55);
  background: var(--surface);
}

.lightbox-figure figcaption {
  justify-content: center;
  padding-top: 14px;
  color: #dbe6f5;
  font-size: 0.9rem;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
}

.lightbox-close svg {
  width: 20px;
  height: 20px;
}

/* ── 入场动画 ─────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.is-in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  * {
    transition-duration: 0.01ms !important;
  }
}

/* ── 响应式 ───────────────────────────────────────────────── */
@media (max-width: 960px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .nav {
    display: none;
  }

  .topbar-actions {
    margin-left: auto;
  }

  .theme-pair {
    gap: 26px;
  }
}

@media (max-width: 640px) {
  .container,
  .topbar-inner {
    padding-left: 18px;
    padding-right: 18px;
  }

  .hero {
    padding-top: 36px;
  }

  .section {
    padding: 56px 0;
  }

  .brand-name {
    display: none;
  }

  .hero-stats {
    gap: 16px;
  }

  .hero-stats li {
    padding-right: 16px;
  }

  .hero-stats strong {
    font-size: 1.25rem;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-links {
    margin-left: 0;
  }

  .lightbox {
    padding: 12px;
  }

  .shot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}
