/* ============================================
 * 智和工具箱 — 全局样式
 * Soft mesh + IT-Tools card grid
 * ============================================ */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --maxw: 1080px;
  --r-card: 18px;
  --r-sm: 12px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --dur: 220ms;

  /* Dark default */
  --bg: #0b0d14;
  --bg-elevated: rgba(22, 26, 38, 0.72);
  --surface: rgba(30, 34, 50, 0.58);
  --surface-hover: rgba(40, 46, 66, 0.72);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text-1: #f4f6fb;
  --text-2: rgba(232, 236, 248, 0.68);
  --text-3: rgba(232, 236, 248, 0.42);
  --accent: #6aa8ff;
  --accent-2: #7dd3c0;
  --accent-soft: rgba(106, 168, 255, 0.16);
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.38);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.28);
  --mesh-a: rgba(80, 120, 255, 0.28);
  --mesh-b: rgba(64, 190, 170, 0.18);
  --mesh-c: rgba(150, 110, 255, 0.16);
  --badge-bg: #ff5a5f;
  --badge-text: #fff;
  --disabled-filter: grayscale(0.25) saturate(0.75);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #eef1f7;
  --bg-elevated: rgba(255, 255, 255, 0.78);
  --surface: rgba(255, 255, 255, 0.72);
  --surface-hover: rgba(255, 255, 255, 0.92);
  --border: rgba(20, 28, 48, 0.08);
  --border-strong: rgba(20, 28, 48, 0.12);
  --text-1: #141a28;
  --text-2: rgba(20, 26, 40, 0.68);
  --text-3: rgba(20, 26, 40, 0.42);
  --accent: #2f6fed;
  --accent-2: #1f9b84;
  --accent-soft: rgba(47, 111, 237, 0.12);
  --shadow: 0 14px 36px rgba(28, 40, 72, 0.12);
  --shadow-sm: 0 6px 16px rgba(28, 40, 72, 0.08);
  --mesh-a: rgba(110, 150, 255, 0.28);
  --mesh-b: rgba(90, 210, 185, 0.2);
  --mesh-c: rgba(180, 140, 255, 0.18);
  --badge-bg: #e5484d;
  --badge-text: #fff;
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  html:not([data-theme]) {
    --bg: #eef1f7;
    --bg-elevated: rgba(255, 255, 255, 0.78);
    --surface: rgba(255, 255, 255, 0.72);
    --surface-hover: rgba(255, 255, 255, 0.92);
    --border: rgba(20, 28, 48, 0.08);
    --border-strong: rgba(20, 28, 48, 0.12);
    --text-1: #141a28;
    --text-2: rgba(20, 26, 40, 0.68);
    --text-3: rgba(20, 26, 40, 0.42);
    --accent: #2f6fed;
    --accent-2: #1f9b84;
    --accent-soft: rgba(47, 111, 237, 0.12);
    --shadow: 0 14px 36px rgba(28, 40, 72, 0.12);
    --shadow-sm: 0 6px 16px rgba(28, 40, 72, 0.08);
    --mesh-a: rgba(110, 150, 255, 0.28);
    --mesh-b: rgba(90, 210, 185, 0.2);
    --mesh-c: rgba(180, 140, 255, 0.18);
    --badge-bg: #e5484d;
    --badge-text: #fff;
    color-scheme: light;
  }
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

img, svg {
  display: block;
}

/* ── Mesh background ── */
.mesh-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(1200px 700px at 12% -10%, var(--mesh-a), transparent 60%),
    radial-gradient(900px 600px at 92% 8%, var(--mesh-b), transparent 58%),
    radial-gradient(800px 700px at 50% 100%, var(--mesh-c), transparent 55%),
    var(--bg);
}

.mesh-bg .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  will-change: transform;
}

.mesh-bg .blob-a {
  width: 380px;
  height: 380px;
  left: -80px;
  top: 8%;
  background: var(--mesh-a);
}

.mesh-bg .blob-b {
  width: 320px;
  height: 320px;
  right: -60px;
  top: 18%;
  background: var(--mesh-b);
}

.mesh-bg .blob-c {
  width: 420px;
  height: 420px;
  left: 30%;
  bottom: -120px;
  background: var(--mesh-c);
}

/* ── Shell ── */
.site {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding:
    calc(14px + var(--safe-t))
    calc(14px + var(--safe-r))
    calc(22px + var(--safe-b))
    calc(14px + var(--safe-l));
}

.site-inner {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ── Top bar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
  padding: 4px 2px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.18), transparent 55%),
    linear-gradient(160deg, #5b8cff, #3ec9b0 70%);
  box-shadow: 0 8px 22px rgba(59, 130, 246, 0.28);
  color: #fff;
  flex-shrink: 0;
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-text {
  min-width: 0;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
}

.brand-sub {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  color: var(--text-1);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}

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

.theme-btn:active {
  transform: scale(0.96);
}

.theme-btn svg {
  width: 18px;
  height: 18px;
}

.theme-btn .icon-sun { display: none; }
.theme-btn .icon-moon { display: block; }

html[data-theme="light"] .theme-btn .icon-sun { display: block; }
html[data-theme="light"] .theme-btn .icon-moon { display: none; }

@media (prefers-color-scheme: light) {
  html:not([data-theme]) .theme-btn .icon-sun { display: block; }
  html:not([data-theme]) .theme-btn .icon-moon { display: none; }
}

/* ── Hero ── */
.hero {
  margin-bottom: 24px;
  padding: 4px 2px 0;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 14px;
}

.hero-title {
  margin: 0 0 10px;
  font-size: clamp(26px, 5vw, 36px);
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.15;
}

.hero-desc {
  margin: 0;
  max-width: 36em;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.6;
}

/* ── Section ── */
.section-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 2px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: none;
  letter-spacing: 0;
}

/* ── Tool grid ── */
.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 36px;
}

@media (min-width: 640px) {
  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (min-width: 960px) {
  .tool-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
  }
}

.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 168px;
  padding: 18px;
  border-radius: var(--r-card);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  overflow: hidden;
  transition:
    transform var(--dur) var(--ease),
    background var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.tool-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(155deg, rgba(255,255,255,0.08), transparent 42%);
  opacity: 0.9;
  pointer-events: none;
}

.tool-card > * {
  position: relative;
  z-index: 1;
}

a.tool-card:hover,
a.tool-card:focus-visible {
  transform: translateY(-2px) scale(1.01);
  background: var(--surface-hover);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  outline: none;
}

a.tool-card:active {
  transform: scale(0.985);
}

.tool-card.is-disabled,
.tool-card[aria-disabled="true"] {
  cursor: default;
  filter: var(--disabled-filter);
  opacity: 0.86;
}

.tool-card.is-disabled:hover,
.tool-card[aria-disabled="true"]:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
  background: var(--surface);
  border-color: var(--border);
}

.tool-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.tool-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.tool-icon svg {
  width: 24px;
  height: 24px;
}

.tool-icon.express {
  background: linear-gradient(145deg, #5b8cff, #3b6af0);
}

.tool-icon.fuel {
  background: linear-gradient(145deg, #34c4a0, #1f9b84);
}

.tool-icon.more {
  background: linear-gradient(145deg, #8b95a8, #6b7385);
}

.tool-badge {
  display: none;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(229, 72, 77, 0.35);
}

.tool-badge.is-visible {
  display: inline-block;
}

.tool-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  background: rgba(127, 140, 160, 0.16);
  color: var(--text-2);
  border: 1px solid var(--border);
}

.tool-chip.soon {
  background: rgba(52, 196, 160, 0.14);
  color: var(--accent-2);
  border-color: rgba(52, 196, 160, 0.22);
}

.tool-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.25;
}

.tool-desc {
  margin: 0;
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.55;
  flex: 1;
}

.tool-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
}

.tool-meta .go {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-weight: 600;
}

.tool-meta .go svg {
  width: 14px;
  height: 14px;
}

/* ── Footer ── */
.site-footer {
  margin-top: auto;
  padding-top: 8px;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.6;
}

.site-footer a {
  color: var(--text-2);
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ── Focus ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


/* ── Topbar actions ── */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.logout-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  color: var(--text-2);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.logout-btn:hover {
  background: var(--surface-hover);
  color: var(--text-1);
}

.logout-btn:active {
  transform: scale(0.96);
}

.logout-btn svg {
  width: 18px;
  height: 18px;
}

/* ── iOS list-style tool cards ── */
.topbar {
  margin-bottom: 16px;
}

.section-label {
  margin: 0 4px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.tool-grid {
  gap: 12px;
}

.tool-card {
  min-height: 0;
  padding: 14px 14px 12px;
  border-radius: 16px;
  background: var(--bg-elevated);
}

.tool-card-top {
  margin-bottom: 12px;
}

.tool-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.tool-title {
  font-size: 16px;
  margin-bottom: 4px;
}

.tool-desc {
  font-size: 12px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tool-meta {
  margin-top: 12px;
}

/* ── Login ── */
.login-body {
  min-height: 100dvh;
}

.login-shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(24px + var(--safe-t))
    calc(20px + var(--safe-r))
    calc(24px + var(--safe-b))
    calc(20px + var(--safe-l));
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 28px 22px 24px;
  border-radius: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  margin-bottom: 6px;
}

.login-brand .brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
}

.login-brand .brand-mark svg {
  width: 28px;
  height: 28px;
}

.login-title {
  margin: 4px 0 0;
  font-size: 22px;
  font-weight: 720;
  letter-spacing: 0;
  line-height: 1.2;
}

.login-sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-3);
}

.login-error {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(229, 72, 77, 0.12);
  color: #e5484d;
  font-size: 13px;
  font-weight: 560;
  text-align: center;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  padding-left: 2px;
}

.login-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-1);
  font-size: 16px;
  outline: none;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.login-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface-hover);
}

.login-submit {
  margin-top: 4px;
  height: 48px;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(160deg, #5b8cff, #3b6af0);
  color: #fff;
  font-size: 16px;
  font-weight: 680;
  box-shadow: 0 10px 24px rgba(59, 106, 240, 0.28);
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}

.login-submit:hover {
  opacity: 0.96;
}

.login-submit:active {
  transform: scale(0.985);
}

