:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #697386;
  --line: #e4e8f0;
  --primary: #315bea;
  --primary-dark: #2348cb;
  --shadow: 0 18px 55px rgba(32, 48, 82, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: 260px;
  flex-direction: column;
  padding: 30px 22px 24px;
  background: rgba(255, 255, 255, 0.94);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.brand, .mobile-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  background: linear-gradient(145deg, #5479ff, #284fd8);
  border-radius: 13px;
  box-shadow: 0 9px 20px rgba(49, 91, 234, 0.25);
  color: white;
  font-size: 21px;
  font-weight: 800;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: .02em; }
.brand small { margin-top: 3px; color: #9098a8; font-size: 11px; }
.nav { display: grid; gap: 6px; margin-top: 42px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: 0;
  border-radius: 12px;
  color: #5f687a;
  cursor: pointer;
  text-align: left;
  transition: .18s ease;
}
.nav-item span { width: 22px; color: #8790a3; font-size: 20px; text-align: center; }
.nav-item:hover { background: #f3f5fa; color: var(--ink); }
.nav-item.active { background: #edf2ff; color: #244bd2; font-weight: 650; }
.nav-item.active span { color: #315bea; }
.privacy-badge {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding: 11px 12px;
  background: #f1faf6;
  border-radius: 11px;
  color: #39805d;
  font-size: 11px;
}
.status-dot { width: 7px; height: 7px; background: #2ab773; border-radius: 50%; box-shadow: 0 0 0 4px rgba(42,183,115,.12); }
.main { min-height: 100vh; margin-left: 260px; padding: 54px clamp(28px, 5vw, 76px) 72px; }
.mobile-header { display: none; }
.view { display: none; width: 100%; max-width: 1100px; margin: 0 auto; animation: viewIn .3s ease; }
.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.home-hero { padding: clamp(38px, 7vh, 78px) 0 48px; text-align: center; }
.eyebrow { color: #315bea; font-size: 11px; font-weight: 750; letter-spacing: .19em; }
.home-hero h1 { margin: 12px 0 12px; font-size: clamp(38px, 5vw, 60px); line-height: 1.12; letter-spacing: -.045em; }
.home-hero p { margin: 0; color: var(--muted); font-size: 17px; }
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.tool-card {
  position: relative;
  display: flex;
  min-height: 152px;
  align-items: flex-start;
  gap: 16px;
  padding: 25px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 8px 28px rgba(32,48,82,.045);
  cursor: pointer;
  text-align: left;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.tool-card:hover { transform: translateY(-4px); border-color: #d7ddec; box-shadow: var(--shadow); }
.tool-icon, .page-icon { display: inline-grid; place-items: center; border-radius: 14px; font-weight: 700; }
.tool-icon { width: 48px; height: 48px; flex: 0 0 48px; font-size: 24px; }
.tool-card strong, .tool-card small { display: block; }
.tool-card strong { margin: 4px 0 8px; font-size: 16px; }
.tool-card small { color: #828b9c; font-size: 12px; line-height: 1.5; }
.tool-card i { position: absolute; right: 20px; bottom: 18px; color: #a6adbb; font-style: normal; }
.blue .tool-icon, .page-icon.blue { background: #eaf0ff; color: #315bea; }
.cyan .tool-icon, .page-icon.cyan { background: #e7f8fa; color: #1596a7; }
.green .tool-icon, .page-icon.green { background: #e9f8f0; color: #17945a; }
.orange .tool-icon, .page-icon.orange { background: #fff1e4; color: #de761d; }
.violet .tool-icon, .page-icon.violet { background: #f1eafd; color: #8051cc; }
.rose .tool-icon, .page-icon.rose { background: #ffebf1; color: #c94a73; }

.page-heading { display: flex; align-items: center; gap: 17px; margin-bottom: 34px; }
.page-icon { width: 58px; height: 58px; flex: 0 0 58px; font-size: 28px; }
.page-heading h1 { margin: 0 0 6px; font-size: clamp(28px, 3vw, 38px); letter-spacing: -.025em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.workspace { display: grid; gap: 22px; align-items: stretch; }
.two-column { grid-template-columns: minmax(0, 1.05fr) minmax(300px, .95fr); }
.single-column { grid-template-columns: minmax(0, 1fr); }
.narrow { max-width: 720px; }
.panel { padding: clamp(24px, 3vw, 34px); background: var(--panel); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 12px 40px rgba(32,48,82,.055); }
.panel h2 { margin: 0 0 24px; font-size: 18px; }
label { display: block; margin: 0 0 9px; color: #4f596c; font-size: 13px; font-weight: 600; }
input:not([type="checkbox"]):not([type="range"]), select, textarea {
  width: 100%;
  padding: 13px 14px;
  background: #f7f8fb;
  border: 1px solid #e3e7ef;
  border-radius: 11px;
  outline: none;
  color: var(--ink);
  transition: border-color .18s ease, box-shadow .18s ease;
}
input:focus, select:focus, textarea:focus { border-color: #7e9af6 !important; box-shadow: 0 0 0 4px rgba(49,91,234,.09); }
textarea { min-height: 158px; resize: vertical; line-height: 1.6; }
.field-meta { display: flex; justify-content: space-between; margin: 7px 2px 22px; color: #9098a7; font-size: 11px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.primary-button, .secondary-button, .text-button, .swap-button, .icon-button { border: 0; cursor: pointer; }
.primary-button { width: 100%; margin-top: 24px; padding: 14px 20px; background: var(--primary); border-radius: 12px; color: white; font-weight: 650; box-shadow: 0 9px 22px rgba(49,91,234,.2); transition: .18s ease; }
.primary-button:hover { background: var(--primary-dark); transform: translateY(-1px); }
.secondary-button { padding: 12px 20px; background: #edf2ff; border-radius: 11px; color: #294dce; font-weight: 600; }
.result-panel { min-height: 360px; }
.qr-panel, .placeholder, .qr-result { display: grid; place-items: center; }
.placeholder { height: 100%; align-content: center; color: #a0a8b7; text-align: center; }
.placeholder span { font-size: 68px; color: #d4d9e3; }
.placeholder p { margin: 14px 0 0; font-size: 13px; }
.qr-result { gap: 22px; }
.qr-result canvas { max-width: 100%; height: auto; padding: 12px; background: white; border: 1px solid var(--line); border-radius: 12px; }
.hidden { display: none !important; }

.tabs, .segmented { display: flex; gap: 6px; padding: 5px; background: #f0f2f7; border-radius: 12px; }
.tabs { margin-bottom: 30px; overflow-x: auto; }
.tabs button, .segmented button { flex: 1; min-width: max-content; padding: 10px 16px; background: transparent; border: 0; border-radius: 9px; color: #737d8e; cursor: pointer; font-size: 13px; }
.tabs button.active, .segmented button.active { background: white; color: #274ed4; font-weight: 650; box-shadow: 0 3px 10px rgba(32,48,82,.08); }
.conversion-boxes { display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: end; }
.conversion-box { padding: 22px; background: #f8f9fc; border: 1px solid var(--line); border-radius: 16px; }
.conversion-box input, .conversion-box output { display: block; height: 62px; margin-bottom: 15px; padding: 0 !important; background: transparent !important; border: 0 !important; box-shadow: none !important; font-size: 32px; font-weight: 700; line-height: 62px; }
.conversion-box output { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversion-box.result { background: #f0f4ff; border-color: #dce4ff; }
.conversion-box.result output { color: #274ed4; }
.swap-button { width: 42px; height: 42px; margin-bottom: 47px; background: #315bea; border-radius: 50%; color: white; font-size: 19px; }
.formula { min-height: 20px; margin: 22px 4px 0; color: #7d8696; font-size: 12px; text-align: center; }

.segmented { margin-bottom: 26px; }
.mortgage-layout input { margin-bottom: 20px; }
.mortgage-result { background: linear-gradient(145deg, #284fd8, #3e6bf1); border: 0; color: white; }
.result-kicker { display: block; color: rgba(255,255,255,.72); font-size: 13px; }
.big-number { display: block; margin: 10px 0 32px; font-size: clamp(34px, 4vw, 49px); letter-spacing: -.035em; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat-grid div { padding: 17px; background: rgba(255,255,255,.105); border: 1px solid rgba(255,255,255,.12); border-radius: 13px; }
.stat-grid span, .stat-grid strong { display: block; }
.stat-grid span { margin-bottom: 7px; color: rgba(255,255,255,.67); font-size: 11px; }
.stat-grid strong { font-size: 15px; }
.fine-print { margin: 16px 0 0; color: #8a93a2; font-size: 11px; line-height: 1.55; }
.inline-result { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; padding: 19px 20px; background: #f1f4fc; border-radius: 13px; }
.inline-result span { color: #6b7588; font-size: 13px; }
.inline-result strong { color: #294fd4; font-size: 20px; }
.panel > input + label { margin-top: 18px; }

.money-input { display: flex; align-items: center; padding: 0 18px; background: #f7f8fb; border: 1px solid var(--line); border-radius: 13px; }
.money-input span { color: #5a6578; font-size: 24px; }
.money-input input { height: 68px; background: transparent !important; border: 0 !important; box-shadow: none !important; font-size: 28px; }
.money-output { position: relative; margin-top: 24px; padding: 24px; background: #f1f4ff; border-radius: 15px; }
.money-output span, .money-output strong { display: block; }
.money-output span { margin-bottom: 10px; color: #77829b; font-size: 12px; }
.money-output strong { padding-right: 74px; color: #274bc9; font-size: 21px; line-height: 1.5; word-break: break-all; }
.text-button { position: absolute; top: 17px; right: 16px; padding: 7px 10px; background: white; border-radius: 8px; color: #315bea; font-size: 11px; }
.password-output { display: flex; align-items: center; min-height: 76px; margin-bottom: 26px; padding: 18px 20px; background: #171f31; border-radius: 14px; color: #eef2ff; }
.password-output code { flex: 1; overflow-wrap: anywhere; font-family: "SFMono-Regular", Consolas, monospace; font-size: 16px; letter-spacing: .035em; }
.icon-button { display: inline-grid; width: 38px; height: 38px; place-items: center; background: transparent; border-radius: 9px; }
.password-output .icon-button { color: #b9c5e5; }
input[type="range"] { width: 100%; accent-color: #315bea; }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 24px; }
.check-grid label { display: flex; align-items: center; gap: 9px; padding: 13px; background: #f7f8fb; border-radius: 10px; cursor: pointer; font-weight: 500; }
.check-grid input { width: 16px; height: 16px; accent-color: #315bea; }
.toast { position: fixed; left: 50%; bottom: 30px; z-index: 100; padding: 11px 18px; background: #182033; border-radius: 10px; box-shadow: 0 12px 35px rgba(0,0,0,.2); color: white; font-size: 13px; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: .22s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 920px) {
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column { grid-template-columns: 1fr; }
  .result-panel { min-height: 330px; }
}
@media (max-width: 700px) {
  .sidebar { width: min(82vw, 280px); transform: translateX(-105%); box-shadow: 15px 0 40px rgba(21,31,53,.14); transition: transform .24s ease; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 86px 18px 50px; }
  .mobile-header { position: fixed; inset: 0 0 auto; z-index: 15; display: flex; height: 66px; align-items: center; justify-content: space-between; padding: 0 18px; background: rgba(255,255,255,.9); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); }
  .mobile-brand { font-size: 15px; font-weight: 700; }
  .mobile-brand .brand-mark { width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px; font-size: 17px; }
  .mobile-header .icon-button { background: #f1f3f7; }
  .home-hero { padding: 28px 0 36px; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-card { min-height: 125px; }
  .page-heading { align-items: flex-start; }
  .conversion-boxes { grid-template-columns: 1fr; }
  .swap-button { margin: -6px auto; transform: rotate(90deg); }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .stat-grid { grid-template-columns: 1fr; }
  .check-grid { grid-template-columns: 1fr; }
}

/* 手机专用布局：无论屏幕宽度如何，始终以手机界面呈现 */
html { background: #e9edf4; }
body {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  overflow-x: hidden;
  box-shadow: 0 0 60px rgba(28, 39, 65, .14);
}
.app-shell { width: 100%; max-width: 430px; }
.sidebar {
  left: max(0px, calc(50% - 215px));
  right: auto;
  width: min(82vw, 280px);
  padding: 26px 20px 22px;
  transform: translateX(-105%);
  box-shadow: 15px 0 40px rgba(21, 31, 53, .14);
  transition: transform .24s ease;
}
.sidebar.open { transform: translateX(0); }
.main {
  width: 100%;
  min-height: 100vh;
  margin-left: 0;
  padding: 84px 16px 54px;
}
.mobile-header {
  position: fixed;
  inset: 0 auto auto 50%;
  z-index: 15;
  display: flex;
  width: min(100%, 430px);
  height: 66px;
  align-items: center;
  justify-content: space-between;
  padding: 0 17px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
  transform: translateX(-50%);
}
.mobile-brand { font-size: 15px; font-weight: 700; }
.mobile-brand .brand-mark { width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px; font-size: 17px; }
.mobile-header .icon-button { background: #f1f3f7; }
.view { max-width: none; }
.home-hero { padding: 28px 4px 32px; }
.home-hero h1 { font-size: 38px; }
.home-hero p { font-size: 14px; line-height: 1.6; }
.tool-grid { grid-template-columns: 1fr; gap: 14px; }
.tool-card { min-height: 118px; padding: 22px; }
.tool-card:hover { transform: none; }
.page-heading { align-items: flex-start; gap: 14px; margin-bottom: 24px; }
.page-icon { width: 50px; height: 50px; flex-basis: 50px; font-size: 24px; }
.page-heading h1 { font-size: 27px; }
.page-heading p { font-size: 12px; line-height: 1.5; }
.workspace, .two-column, .single-column { grid-template-columns: 1fr; gap: 16px; }
.narrow { max-width: none; }
.panel { padding: 22px 18px; border-radius: 18px; }
.field-row { grid-template-columns: 1fr; gap: 0; }
.result-panel { min-height: 300px; }
.conversion-boxes { grid-template-columns: 1fr; }
.swap-button { margin: -5px auto; transform: rotate(90deg); }
.stat-grid { grid-template-columns: 1fr; }
.check-grid { grid-template-columns: 1fr; }
.toast { bottom: 22px; max-width: calc(100% - 40px); text-align: center; }

.qr-mode-tabs { margin-bottom: 16px; }
.qr-workspace { grid-template-columns: 1fr; }
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0 !important;
}
.upload-zone {
  display: grid;
  min-height: 210px;
  place-items: center;
  align-content: center;
  padding: 24px;
  background: #f5f7fc;
  border: 2px dashed #cdd6ea;
  border-radius: 16px;
  color: #59677d;
  cursor: pointer;
  text-align: center;
}
.upload-zone:active { background: #edf2ff; border-color: #7895ef; }
.upload-zone strong, .upload-zone small { display: block; }
.upload-zone strong { margin: 13px 0 7px; color: #28364d; font-size: 16px; }
.upload-zone small { color: #8a94a5; font-size: 12px; line-height: 1.55; }
.upload-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  background: #e7edff;
  border-radius: 16px;
  color: #315bea;
  font-size: 27px;
}
.decode-preview { margin-top: 18px; text-align: center; }
.decode-preview img { display: block; max-width: 100%; max-height: 320px; margin: 0 auto; border-radius: 13px; }
.decode-result { margin-top: 18px; padding: 18px; background: #eff3ff; border: 1px solid #dce4ff; border-radius: 14px; }
.decode-result > span { color: #6d7891; font-size: 12px; }
.decode-result p { margin: 9px 0 16px; color: #203b9f; line-height: 1.6; overflow-wrap: anywhere; white-space: pre-wrap; }
.decode-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.decode-actions .secondary-button { width: 100%; padding: 11px 8px; }
.center-text { text-align: center; }
