:root {
  --bg: #f5f4f1;
  --surface: #ffffff;
  --ink: #1c2430;
  --muted: #5c6673;
  --line: rgba(28, 36, 48, 0.1);
  --teal: #2f6f7a;
  --teal-soft: #e8f2f3;
  --green: #5f7a5c;
  --green-soft: #f3f7f0;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(28, 36, 48, 0.06);
  --font: "Noto Sans SC", "DM Sans", system-ui, sans-serif;
  --display: "DM Sans", "Noto Sans SC", system-ui, sans-serif;
  --header-h: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(47, 111, 122, 0.08), transparent 55%),
    radial-gradient(900px 420px at 90% 0%, rgba(95, 122, 92, 0.08), transparent 50%),
    var(--bg);
  line-height: 1.6;
  padding-bottom: var(--safe-bottom);
}

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

.shell {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: rgba(245, 244, 241, 0.92);
  border-bottom: 1px solid var(--line);
  padding-top: var(--safe-top);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  flex-shrink: 0;
}

.brand-logo {
  display: block;
  height: 40px;
  width: auto;
  max-width: min(200px, 46vw);
  object-fit: contain;
  background: transparent;
}

.hero-brand {
  margin: 0 0 10px;
  line-height: 0;
}

.hero-logo {
  display: block;
  height: clamp(52px, 10vw, 72px);
  width: auto;
  max-width: min(360px, 88vw);
  object-fit: contain;
  background: transparent;
}

.nav {
  display: flex;
  gap: 22px;
  margin-left: 12px;
}

.nav a,
.mobile-nav a:not(.btn) {
  color: var(--muted);
  font-size: 0.95rem;
}

.nav a:hover,
.mobile-nav a:not(.btn):hover {
  color: var(--ink);
}

.header-actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--teal);
  color: #fff;
}

.btn-primary:hover {
  background: #275f68;
}

.btn-ghost {
  background: transparent;
  border-color: rgba(28, 36, 48, 0.22);
  color: var(--ink);
}

.btn-write {
  background: var(--green);
  color: #fff;
}

.btn-write:hover {
  background: #516849;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 11px;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
  transform-origin: center;
}

.nav-toggle[aria-expanded='true'] span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.nav-toggle[aria-expanded='true'] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded='true'] span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

.mobile-nav {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 4px 20px calc(16px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: rgba(245, 244, 241, 0.98);
}

.mobile-nav[hidden] {
  display: none !important;
}

.mobile-nav a:not(.btn) {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 4px;
  font-size: 1.05rem;
  border-bottom: 1px solid rgba(28, 36, 48, 0.06);
}

.mobile-nav .btn {
  margin-top: 10px;
  width: 100%;
  min-height: 48px;
}

.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 40px;
  align-items: center;
  padding: 64px 0 40px;
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  font-weight: 650;
  letter-spacing: -0.02em;
}

.hero-lead {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.hero-art {
  display: flex;
  justify-content: center;
}

.hero-svg {
  width: min(100%, 420px);
  height: auto;
  filter: drop-shadow(0 18px 40px rgba(47, 111, 122, 0.12));
}

.entries {
  padding: 28px 0 56px;
}

.entries h2,
.about h2,
.login-guide h2 {
  margin: 0 0 22px;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.entry-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 22px 20px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 248px;
}

.entry-card--counselor,
.entry-card--org {
  background: linear-gradient(180deg, #f7fbfb 0%, #fff 48%);
}

.entry-card--write {
  background: linear-gradient(180deg, #f7faf5 0%, #fff 48%);
}

.entry-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--teal);
  color: #fff;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.entry-icon--write {
  background: var(--green);
}

.entry-card h3 {
  margin: 0 0 6px;
  font-size: 1.2rem;
}

.entry-desc {
  margin: 0;
  color: var(--muted);
}

.entry-host {
  margin: 10px 0 0;
  font-family: var(--display);
  font-size: 0.86rem;
  color: #7a8594;
}

.entry-actions {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.entry-open,
.entry-install {
  align-self: flex-start;
  min-width: 96px;
}

.entry-install { cursor: pointer; }

.install-dialog {
  margin: auto; padding: 0; border: none;
  border-radius: calc(var(--radius) + 4px);
  background: transparent;
  max-width: min(420px, calc(100vw - 32px));
  width: 100%; box-shadow: none;
}
.install-dialog::backdrop {
  background: rgba(28, 36, 48, 0.45);
  backdrop-filter: blur(2px);
}
.install-dialog-panel {
  position: relative; background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow); padding: 22px 20px 20px;
}
.install-dialog-close {
  position: absolute; top: 10px; right: 10px;
  width: 36px; height: 36px; border: none; border-radius: 10px;
  background: transparent; color: var(--muted);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.install-dialog-close:hover { background: var(--teal-soft); color: var(--ink); }
.install-dialog-panel h2 {
  margin: 0 28px 10px 0; font-size: 1.2rem; letter-spacing: -0.02em;
}
.install-dialog-lead, .install-dialog-desktop-hint {
  margin: 0 0 14px; color: var(--muted); font-size: 0.95rem;
}
.install-dialog-desktop-hint {
  padding: 10px 12px; border-radius: 10px;
  background: var(--teal-soft); color: var(--teal);
}
.install-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.install-tabs [role="tab"] {
  flex: 1; border: 1px solid var(--line); border-radius: 10px;
  background: transparent; color: var(--muted); font: inherit;
  font-size: 0.9rem; font-weight: 600; padding: 10px 8px; cursor: pointer;
}
.install-tabs [role="tab"][aria-selected="true"] {
  background: var(--teal-soft);
  border-color: rgba(47, 111, 122, 0.35); color: var(--teal);
}
.install-dialog-panel ol { margin: 0 0 18px; padding-left: 1.2rem; color: var(--muted); }
.install-dialog-panel li + li { margin-top: 8px; }
.install-open { display: inline-flex; width: 100%; justify-content: center; }

.about,
.login-guide {
  padding: 8px 0 40px;
}

.about p,
.login-guide li {
  color: var(--muted);
  max-width: 68ch;
}

.login-guide ol {
  margin: 0;
  padding-left: 1.2rem;
}

.login-guide li + li {
  margin-top: 8px;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 calc(36px + var(--safe-bottom));
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-inner {
  text-align: center;
}

.footer-inner p {
  margin: 0;
}

.footer-inner p + p {
  margin-top: 8px;
}

.footer-sep {
  margin: 0 8px;
  opacity: 0.5;
}

.beian:hover,
.footer-inner a:hover {
  color: var(--teal);
}

.legal-page {
  padding: 48px 0 72px;
}

.legal-page h1 {
  margin: 0 0 16px;
  font-size: 1.8rem;
}

.legal-page p {
  color: var(--muted);
  max-width: 68ch;
}

/* —— 平板：顶栏收纳、双列收束 —— */
@media (max-width: 900px) {
  .nav,
  .header-actions {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .mobile-nav:not([hidden]) {
    display: flex;
  }

  .hero {
    grid-template-columns: 1fr;
    padding-top: 36px;
    gap: 28px;
  }

  .hero-art {
    order: 2;
  }

  .hero-copy {
    order: 1;
  }

  .entry-grid {
    grid-template-columns: 1fr;
  }
}

/* —— 手机：触控优先、竖排入口 —— */
@media (max-width: 640px) {
  :root {
    --header-h: 56px;
  }

  .shell {
    width: calc(100% - 32px);
  }

  .brand-logo {
    height: 34px;
  }

  .hero-brand {
    margin-bottom: 8px;
  }

  .hero-logo {
    height: clamp(44px, 12vw, 60px);
  }

  .hero {
    padding: 28px 0 24px;
    gap: 20px;
  }

  .hero h1 {
    font-size: 1.28rem;
    line-height: 1.35;
    margin-bottom: 10px;
  }

  .hero-lead {
    font-size: 0.98rem;
    line-height: 1.55;
  }

  .hero-cta {
    flex-direction: column;
    margin-top: 22px;
    gap: 10px;
  }

  .hero-cta .btn {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
  }

  .hero-svg {
    width: min(100%, 300px);
    filter: drop-shadow(0 12px 28px rgba(47, 111, 122, 0.1));
  }

  .entries {
    padding: 12px 0 40px;
  }

  .entries h2,
  .about h2,
  .login-guide h2 {
    font-size: 1.28rem;
    margin-bottom: 16px;
  }

  .entry-grid {
    gap: 14px;
  }

  .entry-card {
    min-height: 0;
    padding: 18px 16px 16px;
    border-radius: 16px;
  }

  .entry-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
  }

  .entry-card h3 {
    font-size: 1.12rem;
  }

  .entry-desc {
    font-size: 0.95rem;
  }

  .entry-host {
    margin-top: 8px;
    font-size: 0.82rem;
    word-break: break-all;
  }

  .entry-actions {
    align-self: stretch; width: 100%; margin-top: 18px; flex-direction: column;
  }
  .entry-open, .entry-install {
    align-self: stretch; width: 100%; min-height: 48px; margin-top: 0; font-size: 1rem;
  }

  .about,
  .login-guide {
    padding: 4px 0 32px;
  }

  .about p,
  .login-guide li {
    font-size: 0.95rem;
  }

  .login-guide ol {
    padding-left: 1.1rem;
  }

  .login-guide li + li {
    margin-top: 12px;
  }

  .site-footer {
    padding: 22px 0 calc(28px + var(--safe-bottom));
    font-size: 0.82rem;
  }

  .footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 0;
    line-height: 1.8;
  }

  .footer-sep {
    margin: 0 6px;
  }

  .legal-page {
    padding: 32px 0 56px;
  }

  .legal-page h1 {
    font-size: 1.45rem;
  }
}

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

  .btn,
  .nav-toggle span {
    transition: none;
  }

  .btn:hover {
    transform: none;
  }
}
