/* ============================================================
   zailiu-unified.css — 在留.com Unified Global Stylesheet
   基于首页 Warm Paper 风格，统一所有子页面的 UI 组件样式
   配合 zailiu-tokens.css 使用（token 定义在 tokens 文件中）
   版本: 1.0.0 — 2025-05
   ============================================================ */

/* ============================================================
   TABLE OF CONTENTS:
   1.  Reset & Base
   2.  Background Utilities (glow, shoji)
   3.  Layout (container, grid helpers)
   4.  Navigation
   5.  Buttons
   6.  Form Elements
   7.  Cards
   8.  Badges, Chips & Tags
   9.  Tabs
   10. Tables
   11. FAQ / Accordion
   12. Search Components
   13. Scoring Components
   14. Page Header & Breadcrumb
   15. Section Components
   16. Alerts, Hints & Status
   17. Footer
   18. Empty State
   19. CTA Banner
   20. Graph / Legend
   21. Modal / Dialog
   22. Animation Keyframes
   23. Utility Classes
   24. Responsive Breakpoints
   ============================================================ */

/* ============================================================
   1. RESET & BASE
   ============================================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--z-font-sans);
  background-color: var(--z-bg-base);
  color: var(--z-text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

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

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

ul, ol {
  list-style: none;
}

button {
  font-family: var(--z-font-sans);
  cursor: pointer;
}

/* ============================================================
   2. BACKGROUND UTILITIES (Glow + Shoji)
   ============================================================ */

/* Ambient glowing orbs — 统一使用两处渐变光晕 */
.ambient-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-glow::before {
  content: '';
  position: absolute;
  top: -30%;
  left: -15%;
  width: 50%;
  height: 60%;
  background: radial-gradient(
    ellipse at center,
    rgba(8, 145, 178, 0.08) 0%,
    rgba(8, 145, 178, 0.02) 40%,
    transparent 70%
  );
  transform: rotate(-15deg);
}

.ambient-glow::after {
  content: '';
  position: absolute;
  bottom: -20%;
  right: -10%;
  width: 45%;
  height: 55%;
  background: radial-gradient(
    ellipse at center,
    rgba(245, 158, 11, 0.06) 0%,
    rgba(245, 158, 11, 0.02) 40%,
    transparent 70%
  );
  transform: rotate(10deg);
}

/* 兼容旧版: .ambient-glow-2 (被 policy/hsp 页使用) 映射到同一效果 */
.ambient-glow-2 {
  display: none; /* 已统一到 .ambient-glow 的 ::after */
}

/* Shoji grid pattern — 统一的障子纹样背景 */
.shoji-pattern {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image:
    repeating-linear-gradient(
      to right,
      transparent,
      transparent 120px,
      var(--z-border-light) 120px,
      var(--z-border-light) 121px
    ),
    repeating-linear-gradient(
      to bottom,
      transparent,
      transparent 120px,
      var(--z-border-light) 120px,
      var(--z-border-light) 121px
    );
}

/* 兼容旧版: 部分页面通过 body::before 做 shoji，这里也支持但不强制 */
body.z-unified::before {
  display: none; /* 统一推荐使用 .shoji-pattern div */
}

/* ============================================================
   3. LAYOUT
   ============================================================ */

/* 统一容器 — 替代 .page-wrap / .nav-inner / .footer-inner */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--z-space-6);
  position: relative;
  z-index: 1;
}

/* 兼容别名 — 使旧代码无需改动 */
.page-wrap,
.nav-inner,
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--z-space-6);
  position: relative;
  z-index: 1;
}

/* Page content wrapper — 有 nav 的内页通用包裹 */
.page-content {
  padding-top: calc(var(--z-nav-height) + var(--z-space-8));
  padding-bottom: var(--z-space-16);
  position: relative;
  z-index: 1;
}

/* Grid helpers */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--z-space-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--z-space-6);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--z-space-6);
}

.grid-auto-fill {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--z-space-6);
}

/* Two-column layout (sidebar + main) */
.layout-sidebar {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--z-space-8);
}

/* Flex helpers */
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-1 { gap: var(--z-space-1); }
.gap-2 { gap: var(--z-space-2); }
.gap-3 { gap: var(--z-space-3); }
.gap-4 { gap: var(--z-space-4); }
.gap-5 { gap: var(--z-space-5); }
.gap-6 { gap: var(--z-space-6); }
.gap-8 { gap: var(--z-space-8); }
.gap-12 { gap: var(--z-space-12); }

/* ============================================================
   4. NAVIGATION — 首页固定导航 (position: fixed + underline hover)
   ============================================================ */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--z-nav-height);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--z-border-light);
  z-index: 100;
  display: flex;
  align-items: center;
}

.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--z-space-3);
  flex-shrink: 0;
}

.nav-logo svg {
  width: 32px;
  height: 32px;
}

.nav-logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--z-brand-primary);
  letter-spacing: 0.02em;
}

/* Navigation links — underline hover (首页风格) */
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--z-space-8);
  list-style: none;
}

.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--z-text-secondary);
  transition: color 0.2s ease;
  position: relative;
  padding: 0;
  background: none;
  border-radius: 0;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--z-brand-primary);
  border-radius: 1px;
  transition: width 0.25s ease;
}

.nav-links a:hover {
  color: var(--z-brand-primary);
  background: none;
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-links a.active {
  color: var(--z-brand-primary);
  font-weight: 600;
}

.nav-links a.active::after {
  width: 100%;
}

/* Nav actions (lang toggle + login) */
.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--z-space-3);
  flex-shrink: 0;
}

.lang-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--z-radius-full);
  border: 1px solid var(--z-border);
  background: var(--z-bg-surface);
  color: var(--z-text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.lang-toggle-btn:hover {
  background: var(--z-bg-hover);
}

.globe-icon {
  width: 15px;
  height: 15px;
}

/* Login button — 首页风格 (solid brand bg) */
.btn-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--z-space-2) var(--z-space-5);
  background: var(--z-brand-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--z-radius-sm);
  border: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  font-family: var(--z-font-sans);
  letter-spacing: 0.01em;
  flex-shrink: 0;
}

.btn-login:hover {
  background: var(--z-brand-dark);
  transform: translateY(-1px);
}

/* Nav left area (for pages that use .nav-left) */
.nav-left {
  display: flex;
  align-items: center;
  gap: var(--z-space-6);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: var(--z-space-3);
}

/* Hamburger menu trigger (mobile) */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--z-space-1);
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--z-text-primary);
  border-radius: 2px;
  transition: all 0.25s ease;
}

/* Page header with bottom padding for fixed nav */
.page-header-padded {
  padding-top: calc(var(--z-nav-height) + var(--z-space-6));
}

/* ============================================================
   5. BUTTONS
   ============================================================ */

/* Primary button */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--z-space-2);
  height: 48px;
  padding: 0 var(--z-space-8);
  background: var(--z-brand-primary);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--z-radius-md);
  border: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  font-family: var(--z-font-sans);
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--z-brand-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(8, 145, 178, 0.25);
}

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

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Full-width primary */
.btn-primary--block {
  width: 100%;
}

/* Small primary */
.btn-primary--sm {
  height: 36px;
  padding: 0 var(--z-space-4);
  font-size: 13px;
}

/* Secondary / outline button */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--z-space-2);
  height: 48px;
  padding: 0 var(--z-space-8);
  background: var(--z-bg-surface);
  color: var(--z-text-primary);
  font-size: 16px;
  font-weight: 500;
  border-radius: var(--z-radius-md);
  border: 1px solid var(--z-border);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--z-font-sans);
  white-space: nowrap;
}

.btn-secondary:hover {
  background: var(--z-bg-hover);
  border-color: var(--z-brand-primary);
  color: var(--z-brand-primary);
}

.btn-secondary--block {
  width: 100%;
}

.btn-secondary--sm {
  height: 36px;
  padding: 0 var(--z-space-4);
  font-size: 13px;
}

/* Ghost / text-only button */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: var(--z-space-2);
  padding: var(--z-space-2) var(--z-space-4);
  background: none;
  border: none;
  color: var(--z-text-secondary);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--z-radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--z-font-sans);
}

.btn-ghost:hover {
  background: var(--z-bg-hover);
  color: var(--z-brand-primary);
}

/* Secondary link (text + arrow, for hero actions) */
.btn-secondary-link {
  display: inline-flex;
  align-items: center;
  gap: var(--z-space-2);
  font-size: 15px;
  font-weight: 500;
  color: var(--z-text-secondary);
  transition: color 0.2s ease;
  white-space: nowrap;
}

.btn-secondary-link:hover {
  color: var(--z-brand-primary);
}

.btn-secondary-link .arrow {
  transition: transform 0.2s ease;
}

.btn-secondary-link:hover .arrow {
  transform: translateX(4px);
}

/* Card action button */
.btn-card-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--z-radius-sm);
  border: 1px solid var(--z-border-light);
  background: var(--z-bg-surface);
  color: var(--z-text-secondary);
  cursor: pointer;
  font-family: var(--z-font-sans);
  transition: all var(--z-transition);
}

.btn-card-action:hover {
  border-color: var(--z-brand-primary);
  color: var(--z-brand-primary);
  background: var(--z-brand-bg);
}

.btn-card-action svg {
  width: 14px;
  height: 14px;
}

/* Step navigation buttons */
.btn-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: 1px solid var(--z-border);
  border-radius: var(--z-radius-md);
  background: var(--z-bg-surface);
  color: var(--z-text-primary);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-step:hover {
  background: var(--z-bg-hover);
  box-shadow: var(--z-shadow-hover);
}

.btn-step:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-step--next {
  background: var(--z-brand-primary);
  color: #fff;
  border-color: var(--z-brand-primary);
}

.btn-step--next:hover {
  background: var(--z-brand-dark);
}

/* Zoom / icon-only button */
.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--z-radius-sm);
  border: 1px solid var(--z-border);
  background: var(--z-bg-surface);
  color: var(--z-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all var(--z-transition);
}

.btn-icon:hover {
  border-color: var(--z-brand-primary);
  color: var(--z-brand-primary);
}

.btn-icon--sm {
  width: 28px;
  height: 28px;
  font-size: 13px;
}

/* CTA banner button */
.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  background: #fff;
  color: var(--z-brand-primary);
  border-radius: var(--z-radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--z-font-sans);
}

.btn-cta:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* ============================================================
   6. FORM ELEMENTS
   ============================================================ */

/* Text input */
.form-input {
  width: 100%;
  height: 48px;
  padding: 0 var(--z-space-4);
  font-size: 15px;
  font-family: var(--z-font-sans);
  background: var(--z-bg-surface);
  border: 1px solid var(--z-border);
  border-radius: var(--z-radius-md);
  color: var(--z-text-primary);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
  border-color: var(--z-brand-primary);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.12);
}

.form-input::placeholder {
  color: var(--z-text-dim);
}

.form-input--sm {
  height: 36px;
  font-size: 13px;
  padding: 0 var(--z-space-3);
}

.form-input--lg {
  height: 56px;
  font-size: 18px;
}

/* Select */
.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--z-border);
  border-radius: var(--z-radius-md);
  background: var(--z-bg-surface);
  color: var(--z-text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-select:focus {
  outline: none;
  border-color: var(--z-brand-primary);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.12);
}

.form-select--sm {
  font-size: 0.78rem;
  padding: 6px 10px;
}

/* Textarea */
.form-textarea {
  width: 100%;
  min-height: 100px;
  padding: var(--z-space-3) var(--z-space-4);
  font-size: 14px;
  font-family: var(--z-font-sans);
  background: var(--z-bg-surface);
  border: 1px solid var(--z-border);
  border-radius: var(--z-radius-md);
  color: var(--z-text-primary);
  outline: none;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-textarea:focus {
  border-color: var(--z-brand-primary);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.12);
}

/* Checkbox */
.form-checkbox {
  display: flex;
  align-items: center;
  gap: var(--z-space-2);
  cursor: pointer;
  font-size: 14px;
  color: var(--z-text-secondary);
  transition: color var(--z-transition);
}

.form-checkbox:hover {
  color: var(--z-text-primary);
}

.form-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--z-brand-primary);
  cursor: pointer;
}

/* Radio */
.form-radio {
  display: flex;
  align-items: center;
  gap: var(--z-space-2);
  cursor: pointer;
  font-size: 14px;
  color: var(--z-text-secondary);
}

.form-radio input[type="radio"] {
  accent-color: var(--z-brand-primary);
  cursor: pointer;
}

/* Form group */
.form-group {
  margin-bottom: var(--z-space-5);
}

.form-group:last-of-type {
  margin-bottom: 0;
}

/* Form label */
.form-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--z-text-primary);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--z-error);
  margin-left: 2px;
}

.form-label .optional {
  color: var(--z-text-dim);
  font-weight: 400;
  font-size: 0.75rem;
  margin-left: auto;
}

.form-subtitle {
  font-size: 0.85rem;
  color: var(--z-text-dim);
  margin-bottom: var(--z-space-5);
}

/* Form panel */
.form-panel {
  background: var(--z-bg-surface);
  border: 1px solid var(--z-border-light);
  border-radius: var(--z-radius-lg);
  padding: var(--z-space-8);
  box-shadow: var(--z-shadow-card);
}

.form-panel--sm {
  padding: var(--z-space-5);
}

/* Segmented control (radio button group) */
.segmented-control {
  display: flex;
  border: 1px solid var(--z-border);
  border-radius: var(--z-radius-md);
  overflow: hidden;
}

.segmented-control input[type="radio"] {
  display: none;
}

.segmented-label {
  flex: 1;
  text-align: center;
  padding: 9px 8px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--z-text-secondary);
  background: var(--z-bg-surface);
  cursor: pointer;
  transition: all 0.2s;
  border-right: 1px solid var(--z-border-light);
  user-select: none;
}

.segmented-label:last-child {
  border-right: none;
}

.segmented-label:hover {
  background: var(--z-bg-hover);
}

.segmented-control input[type="radio"]:checked + .segmented-label {
  background: var(--z-brand-primary);
  color: #fff;
}

/* Age / Career grid buttons */
.age-grid,
.career-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.age-btn,
.career-btn {
  padding: 10px 0;
  border: 1px solid var(--z-border);
  border-radius: var(--z-radius-md);
  background: var(--z-bg-surface);
  color: var(--z-text-primary);
  font-size: 0.88rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.age-btn:hover,
.career-btn:hover {
  background: var(--z-bg-hover);
}

.age-btn.active,
.career-btn.active {
  background: var(--z-brand-primary);
  color: #fff;
  border-color: var(--z-brand-primary);
}

/* Income input with currency symbol */
.income-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.income-wrap .currency-symbol {
  position: absolute;
  left: 14px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--z-text-secondary);
  pointer-events: none;
}

.income-wrap input {
  width: 100%;
  padding: 10px 14px 10px 32px;
  border: 1px solid var(--z-border);
  border-radius: var(--z-radius-md);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--z-text-primary);
  background: var(--z-bg-surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.income-wrap input:focus {
  outline: none;
  border-color: var(--z-brand-primary);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.12);
}

/* Bonus items checklist */
.bonus-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bonus-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--z-border-light);
  border-radius: var(--z-radius-md);
  background: var(--z-bg-surface);
  font-size: 0.85rem;
  color: var(--z-text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.bonus-item:hover {
  border-color: var(--z-border);
  box-shadow: var(--z-shadow-card);
}

.bonus-item.checked,
.bonus-item.is-checked {
  background: var(--z-brand-bg);
  border-color: var(--z-brand-primary);
  color: var(--z-brand-primary);
}

.bonus-item input[type="checkbox"] {
  display: none;
}

.bonus-chk {
  width: 18px;
  height: 18px;
  border: 2px solid var(--z-border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.bonus-item.checked .bonus-chk,
.bonus-item.is-checked .bonus-chk {
  background: var(--z-brand-primary);
  border-color: var(--z-brand-primary);
}

.bonus-chk::after {
  content: '✓';
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.2s;
}

.bonus-item.checked .bonus-chk::after,
.bonus-item.is-checked .bonus-chk::after {
  opacity: 1;
}

.bonus-points {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--z-text-dim);
  white-space: nowrap;
}

.bonus-item.checked .bonus-points,
.bonus-item.is-checked .bonus-points {
  color: var(--z-brand-primary);
}

/* Language switch (segmented toggle) */
.lang-switch {
  display: flex;
  gap: 2px;
  background: var(--z-bg-surface-alt);
  border-radius: var(--z-radius-sm);
  padding: 2px;
}

.lang-switch button {
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--z-text-dim);
  border-radius: 5px;
  cursor: pointer;
  font-family: var(--z-font-sans);
  transition: all var(--z-transition);
}

.lang-switch button.active {
  background: var(--z-bg-surface);
  color: var(--z-text-primary);
  box-shadow: var(--z-shadow-sm);
}

/* Bilingual toggle */
.bilingual-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--z-space-2);
  padding: 4px;
  background: var(--z-bg-surface-alt);
  border-radius: var(--z-radius-sm);
  margin-bottom: var(--z-space-4);
}

.bilingual-toggle button {
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--z-font-sans);
  background: transparent;
  color: var(--z-text-dim);
  transition: all var(--z-transition);
}

.bilingual-toggle button.active {
  background: var(--z-bg-surface);
  color: var(--z-text-primary);
  box-shadow: var(--z-shadow-sm);
}

/* Step buttons row */
.step-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--z-space-7);
  padding-top: var(--z-space-5);
  border-top: 1px solid var(--z-border-light);
}

/* ============================================================
   7. CARDS
   ============================================================ */

/* Generic card */
.card {
  background: var(--z-bg-surface);
  border: 1px solid var(--z-border-light);
  border-radius: var(--z-radius-lg);
  padding: var(--z-space-8);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--z-shadow-hover);
  border-color: var(--z-border);
}

.card--sm {
  padding: var(--z-space-5);
}

.card--flat {
  box-shadow: none;
}

.card--flat:hover {
  transform: none;
  box-shadow: none;
}

/* Entrance card (首页三大入口) */
.entrance-card {
  background: var(--z-bg-surface);
  border: 1px solid var(--z-border-light);
  border-radius: var(--z-radius-lg);
  padding: var(--z-space-8);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: var(--z-space-4);
}

.entrance-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--z-shadow-hover);
  border-color: var(--z-border);
}

.entrance-card h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--z-text-primary);
}

.entrance-card p {
  font-size: 14px;
  color: var(--z-text-secondary);
  line-height: 1.7;
  flex: 1;
}

/* Entrance icon */
.entrance-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--z-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.entrance-icon--map { background: var(--z-brand-bg); color: var(--z-brand-primary); }
.entrance-icon--calc { background: rgba(13, 148, 136, 0.1); color: var(--z-secondary); }
.entrance-icon--report { background: rgba(245, 158, 11, 0.1); color: var(--z-accent); }

/* Entrance CTA link */
.entrance-cta {
  display: inline-flex;
  align-items: center;
  gap: var(--z-space-2);
  font-size: 14px;
  font-weight: 600;
  color: var(--z-brand-primary);
  padding-top: var(--z-space-2);
  transition: gap 0.2s ease;
}

.entrance-cta:hover {
  gap: var(--z-space-3);
}

/* Scenario card */
.scenario-card {
  background: var(--z-bg-surface);
  border: 1px solid var(--z-border-light);
  border-radius: var(--z-radius-lg);
  padding: var(--z-space-8);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: var(--z-space-4);
}

.scenario-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--z-shadow-hover);
}

.scenario-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--z-text-primary);
}

.scenario-card p {
  font-size: 14px;
  color: var(--z-text-secondary);
  line-height: 1.7;
  flex: 1;
}

/* Scenario icon */
.scenario-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--z-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
}

.scenario-icon--work { background: var(--z-brand-bg); }
.scenario-icon--study { background: rgba(13, 148, 136, 0.1); }
.scenario-icon--family { background: rgba(245, 158, 11, 0.1); }

/* Scenario links */
.scenario-links {
  display: flex;
  flex-direction: column;
  gap: var(--z-space-2);
  padding-top: var(--z-space-2);
}

.scenario-link {
  display: flex;
  align-items: center;
  gap: var(--z-space-2);
  font-size: 13px;
  font-weight: 500;
  color: var(--z-text-secondary);
  transition: color 0.2s ease;
}

.scenario-link:hover {
  color: var(--z-brand-primary);
}

.scenario-link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--z-text-dim);
}

.scenario-link:hover svg {
  color: var(--z-brand-primary);
}

/* Testimonial card */
.testimonial-card {
  background: var(--z-bg-surface);
  border: 1px solid var(--z-border-light);
  border-radius: var(--z-radius-lg);
  padding: var(--z-space-6);
  display: flex;
  flex-direction: column;
  gap: var(--z-space-4);
}

.testimonial-stars {
  display: flex;
  gap: 2px;
}

.testimonial-stars svg {
  width: 16px;
  height: 16px;
}

.testimonial-stars .star-filled { color: var(--z-accent); }
.testimonial-stars .star-empty { color: var(--z-border); }

.testimonial-text {
  font-size: 14px;
  color: var(--z-text-secondary);
  line-height: 1.7;
  flex: 1;
  font-style: italic;
}

.testimonial-author {
  display: flex;
  align-items: center;
  gap: var(--z-space-3);
  padding-top: var(--z-space-1);
}

.testimonial-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--z-radius-full);
  background: var(--z-border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--z-text-secondary);
  flex-shrink: 0;
}

.testimonial-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--z-text-primary);
}

.testimonial-role {
  font-size: 12px;
  color: var(--z-text-dim);
}

/* Policy card (with left accent bar) */
.policy-card {
  background: var(--z-bg-surface);
  border: 1px solid var(--z-border-light);
  border-radius: var(--z-radius-lg);
  padding: var(--z-space-8);
  margin-bottom: var(--z-space-6);
  transition: all var(--z-transition);
  position: relative;
  overflow: hidden;
}

.policy-card:hover {
  border-color: var(--z-border);
  box-shadow: var(--z-shadow-hover);
}

.policy-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  border-radius: 4px 0 0 4px;
}

.policy-card.type-visa::before { background: var(--z-brand-primary); }
.policy-card.type-tax::before { background: var(--z-secondary); }
.policy-card.type-pension::before { background: var(--z-accent); }
.policy-card.type-insurance::before { background: var(--z-success); }
.policy-card.type-residence::before { background: #8b5cf6; }
.policy-card.type-work::before { background: var(--z-warning); }
.policy-card.type-family::before { background: #ec4899; }

/* Policy card header */
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--z-space-4);
  gap: var(--z-space-4);
}

.card-title-row {
  display: flex;
  align-items: baseline;
  gap: var(--z-space-3);
  margin-bottom: var(--z-space-2);
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--z-text-primary);
  letter-spacing: -0.01em;
}

.card-title-jp {
  font-size: 15px;
  font-weight: 500;
  color: var(--z-text-dim);
}

.card-summary {
  font-size: 14px;
  color: var(--z-text-secondary);
  line-height: 1.7;
  margin-bottom: var(--z-space-5);
}

.card-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--z-space-4);
  margin-bottom: var(--z-space-5);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--z-space-4);
  border-top: 1px solid var(--z-border-light);
  flex-wrap: wrap;
  gap: var(--z-space-3);
}

.card-source {
  display: flex;
  align-items: center;
  gap: var(--z-space-2);
  font-size: 12px;
  color: var(--z-text-dim);
}

.card-source .source-icon {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}

.card-actions {
  display: flex;
  gap: var(--z-space-2);
}

/* Detail item (inside cards) */
.detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--z-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-value {
  font-size: 13px;
  color: var(--z-text-primary);
  font-weight: 500;
}

.detail-value .jp {
  font-size: 12px;
  color: var(--z-text-dim);
  display: block;
}

/* Related card */
.related-card {
  background: var(--z-bg-surface);
  border: 1px solid var(--z-border-light);
  border-radius: var(--z-radius-md);
  padding: var(--z-space-5);
  transition: all var(--z-transition);
  cursor: pointer;
}

.related-card:hover {
  border-color: var(--z-border);
  box-shadow: var(--z-shadow-card);
}

.related-card .rel-type {
  font-size: 11px;
  font-weight: 600;
  color: var(--z-text-dim);
  text-transform: uppercase;
  margin-bottom: var(--z-space-1);
}

.related-card .rel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--z-text-primary);
  margin-bottom: var(--z-space-1);
}

.related-card .rel-meta {
  font-size: 12px;
  color: var(--z-text-dim);
}

/* Strategy card */
.strategy-card {
  background: var(--z-bg-surface);
  border: 1px solid var(--z-border-light);
  border-radius: var(--z-radius-lg);
  padding: 28px 24px;
  transition: all 0.25s;
  box-shadow: var(--z-shadow-card);
}

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

.strategy-icon {
  font-size: 2rem;
  margin-bottom: 16px;
}

.strategy-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--z-text-primary);
  margin-bottom: 8px;
}

.strategy-card p {
  font-size: 0.85rem;
  color: var(--z-text-secondary);
  line-height: 1.65;
}

.strategy-score {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: var(--z-brand-bg);
  border-radius: var(--z-radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--z-brand-primary);
  margin-top: 12px;
}

/* Route card */
.route-card {
  background: var(--z-bg-surface);
  border: 1px solid var(--z-border-light);
  border-radius: var(--z-radius-lg);
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: var(--z-shadow-card);
}

.route-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--z-brand-primary);
  margin-bottom: 12px;
}

.route-card ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.route-card li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--z-text-secondary);
}

.route-card li::before {
  content: '✓';
  color: var(--z-success);
  font-weight: 700;
  flex-shrink: 0;
}

/* ============================================================
   8. BADGES, CHIPS & TAGS
   ============================================================ */

/* Hero badge */
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--z-space-2);
  padding: var(--z-space-1) var(--z-space-4);
  background: var(--z-brand-bg);
  border: 1px solid rgba(8, 145, 178, 0.15);
  border-radius: var(--z-radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--z-brand-primary);
  width: fit-content;
}

.hero-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--z-brand-primary);
  animation: pulse-dot 2s ease-in-out infinite;
}

/* Generic badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--z-radius-full);
  white-space: nowrap;
}

.badge--primary { background: var(--z-brand-bg); color: var(--z-brand-primary); }
.badge--secondary { background: #f0fdfa; color: var(--z-secondary); }
.badge--accent { background: #fffbeb; color: var(--z-accent); }
.badge--success { background: #dcfce7; color: #166534; }
.badge--danger { background: #fef2f2; color: #dc2626; }
.badge--warning { background: #fffbeb; color: #d97706; }
.badge--neutral { background: var(--z-bg-surface-alt); color: var(--z-text-dim); }
.badge--purple { background: #f5f3ff; color: #7c3aed; }
.badge--pink { background: #fdf2f8; color: #db2777; }

/* Result badge (search results) */
.result-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--z-radius-full);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.result-badge.identity { background: var(--z-brand-bg); color: var(--z-brand-primary); }
.result-badge.event { background: #f0fdfa; color: var(--z-secondary); }
.result-badge.field { background: #f5f3ff; color: #7c3aed; }
.result-badge.level-official { background: #dcfce7; color: #166534; }
.result-badge.level-expert { background: var(--z-brand-bg); color: var(--z-brand-primary); }
.result-badge.level-user { background: var(--z-bg-surface-alt); color: var(--z-text-dim); }

/* Card badge */
.card-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--z-radius-full);
  background: var(--z-bg-surface-alt);
  color: var(--z-text-dim);
}

.card-badge.new { background: #dcfce7; color: #166534; }
.card-badge.important { background: #fef2f2; color: #dc2626; }

/* Card category tag */
.card-category {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--z-radius-full);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.card-category.visa { background: var(--z-brand-bg); color: var(--z-brand-primary); }
.card-category.tax { background: #f0fdfa; color: var(--z-secondary); }
.card-category.pension { background: #fffbeb; color: var(--z-accent); }
.card-category.insurance { background: #ecfdf5; color: var(--z-success); }
.card-category.residence { background: #f5f3ff; color: #7c3aed; }
.card-category.work { background: #fffbeb; color: #d97706; }
.card-category.family { background: #fdf2f8; color: #db2777; }

/* Meta tag */
.meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--z-radius-full);
}

.meta-tag.source-official { background: #dcfce7; color: #166534; }
.meta-tag.source-expert { background: var(--z-brand-bg); color: var(--z-brand-primary); }
.meta-tag.updated { background: var(--z-bg-surface-alt); color: var(--z-text-secondary); }
.meta-tag.level { background: #fef3c7; color: #92400e; }

/* Source pill */
.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  border-radius: var(--z-radius-full);
}

.source-pill.gov { background: #dcfce7; color: #166534; }
.source-pill.exp { background: var(--z-brand-bg); color: var(--z-brand-primary); }
.source-pill.comm { background: var(--z-bg-surface-alt); color: var(--z-text-dim); }

/* Risk pill */
.risk-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--z-radius-full);
}

.risk-pill.high { background: #fef2f2; color: #dc2626; }
.risk-pill.medium { background: #fffbeb; color: #d97706; }
.risk-pill.low { background: #ecfdf5; color: #059669; }

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: var(--z-radius-full);
  font-size: 0.82rem;
  font-weight: 600;
}

.status-badge--pending {
  background: #FFF7ED;
  color: var(--z-warning);
  border: 1px solid rgba(249, 115, 22, 0.2);
}

.status-badge--pass {
  background: #ECFDF5;
  color: var(--z-success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge--fail {
  background: #FEF2F2;
  color: var(--z-error);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-badge--js {
  background: rgba(245, 158, 11, 0.1);
  color: #B45309;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Filter chip (active filter) */
.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--z-radius-full);
  cursor: pointer;
  border: none;
  font-family: var(--z-font-sans);
  transition: all var(--z-transition);
}

.active-filter-chip:hover {
  opacity: 0.8;
}

.active-filter-chip .remove {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.1);
}

/* ============================================================
   9. TABS
   ============================================================ */

.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--z-border-light);
  margin-bottom: var(--z-space-8);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-nav::-webkit-scrollbar { height: 3px; }
.tab-nav::-webkit-scrollbar-track { background: transparent; }
.tab-nav::-webkit-scrollbar-thumb { background: var(--z-border); border-radius: 2px; }

.tab-btn {
  display: flex;
  align-items: center;
  gap: var(--z-space-2);
  padding: var(--z-space-3) var(--z-space-5);
  font-size: 14px;
  font-weight: 500;
  color: var(--z-text-dim);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--z-font-sans);
  transition: all var(--z-transition);
  margin-bottom: -2px;
}

.tab-btn:hover {
  color: var(--z-text-secondary);
}

.tab-btn.active {
  color: var(--z-brand-primary);
  border-bottom-color: var(--z-brand-primary);
  font-weight: 600;
}

.tab-btn .tab-icon {
  width: 16px;
  height: 16px;
}

.tab-count {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--z-radius-full);
  background: var(--z-bg-surface-alt);
  color: var(--z-text-dim);
}

.tab-btn.active .tab-count {
  background: var(--z-brand-bg);
  color: var(--z-brand-primary);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s var(--z-ease);
}

.tab-content.active {
  display: block;
}

/* ============================================================
   10. TABLES
   ============================================================ */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--z-border-light);
}

.table th {
  background: var(--z-bg-hover);
  font-weight: 600;
  color: var(--z-text-primary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table td {
  color: var(--z-text-secondary);
}

.table tr:hover td {
  background: var(--z-bg-hover);
}

.table .cell-highlight {
  color: var(--z-brand-primary);
  font-weight: 700;
}

.table--sm th,
.table--sm td {
  padding: 8px 12px;
  font-size: 0.78rem;
}

/* Points table alias */
.points-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
}

.points-table th,
.points-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--z-border-light);
  font-size: 0.85rem;
}

.points-table th {
  background: var(--z-bg-hover);
  font-weight: 600;
  color: var(--z-text-primary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.points-table td {
  color: var(--z-text-secondary);
}

.points-table .pts-highlight {
  color: var(--z-brand-primary);
  font-weight: 700;
}

.points-table tr:hover td {
  background: var(--z-bg-hover);
}

/* ============================================================
   11. FAQ / ACCORDION
   ============================================================ */

/* Checkbox-driven accordion (首页风格) */
.faq-list {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--z-space-3);
}

.faq-item {
  background: var(--z-bg-surface);
  border: 1px solid var(--z-border-light);
  border-radius: var(--z-radius-md);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.faq-item:hover {
  border-color: var(--z-border);
}

.faq-toggle {
  display: none;
}

.faq-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--z-space-5) var(--z-space-6);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
  gap: var(--z-space-4);
}

.faq-label:hover {
  background: rgba(0, 0, 0, 0.015);
}

.faq-question {
  font-size: 15px;
  font-weight: 600;
  color: var(--z-text-primary);
  line-height: 1.5;
}

.faq-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--z-text-dim);
  transition: transform 0.3s ease;
}

.faq-toggle:checked + .faq-label .faq-icon {
  transform: rotate(45deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.3s ease;
}

.faq-toggle:checked ~ .faq-answer {
  max-height: 300px;
  padding: 0 var(--z-space-6) var(--z-space-5);
}

.faq-answer p {
  font-size: 14px;
  color: var(--z-text-secondary);
  line-height: 1.8;
}

/* Inline FAQ (JS-driven, simpler) */
.faq-inline {
  margin-top: var(--z-space-8);
}

.faq-inline-item {
  border: 1px solid var(--z-border-light);
  border-radius: var(--z-radius-md);
  overflow: hidden;
  margin-bottom: var(--z-space-2);
  background: var(--z-bg-surface);
}

.faq-inline-q {
  padding: 14px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--z-text-primary);
  background: var(--z-bg-hover);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.faq-inline-q:hover {
  color: var(--z-brand-primary);
}

.faq-inline-a {
  padding: 0 18px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s, padding 0.3s;
}

.faq-inline-item.open .faq-inline-a {
  max-height: 400px;
  padding: 14px 18px;
}

.faq-inline-a p {
  font-size: 0.82rem;
  color: var(--z-text-secondary);
  line-height: 1.7;
}

/* ============================================================
   12. SEARCH COMPONENTS
   ============================================================ */

/* Search layout */
.search-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--z-space-8);
  margin-bottom: var(--z-space-10);
}

/* Search sidebar */
.search-sidebar {
  position: sticky;
  top: calc(var(--z-nav-height) + 16px);
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: var(--z-space-6);
  max-height: calc(100vh - var(--z-nav-height) - 36px);
  overflow-y: auto;
}

/* Filter section */
.filter-section {
  display: flex;
  flex-direction: column;
  gap: var(--z-space-3);
}

.filter-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--z-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--z-space-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.filter-section-title .reset {
  font-size: 11px;
  font-weight: 400;
  color: var(--z-brand-primary);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}

.filter-section-title .reset:hover {
  text-decoration: underline;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: var(--z-space-2);
  padding: var(--z-space-1) 0;
  font-size: 13px;
  color: var(--z-text-secondary);
  cursor: pointer;
  transition: color var(--z-transition);
}

.filter-option:hover {
  color: var(--z-text-primary);
}

.filter-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--z-brand-primary);
  cursor: pointer;
}

.filter-option .opt-count {
  font-size: 11px;
  color: var(--z-text-dim);
  margin-left: auto;
}

/* Level dot */
.level-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.level-dot.official { background: var(--z-success); }
.level-dot.expert { background: var(--z-brand-primary); }
.level-dot.user { background: var(--z-text-dim); }

/* Search hero / search bar */
.search-hero {
  display: flex;
  flex-direction: column;
  gap: var(--z-space-5);
  margin-bottom: var(--z-space-6);
}

.search-input-wrap {
  display: flex;
  gap: var(--z-space-3);
  flex-wrap: wrap;
}

.search-main {
  flex: 1;
  min-width: 280px;
  position: relative;
}

.search-main input {
  width: 100%;
  height: 48px;
  padding: 0 var(--z-space-4) 0 44px;
  font-size: 15px;
  font-family: var(--z-font-sans);
  background: var(--z-bg-surface);
  border: 1px solid var(--z-border-light);
  border-radius: var(--z-radius-md);
  color: var(--z-text-primary);
  outline: none;
  transition: all var(--z-transition);
}

.search-main input:focus {
  border-color: var(--z-brand-primary);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.12);
}

.search-main input::placeholder {
  color: var(--z-text-dim);
}

.search-main .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--z-text-dim);
}

.search-btn {
  padding: 0 var(--z-space-6);
  height: 48px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--z-font-sans);
  background: var(--z-brand-primary);
  color: #fff;
  border: none;
  border-radius: var(--z-radius-md);
  cursor: pointer;
  transition: all var(--z-transition);
  white-space: nowrap;
}

.search-btn:hover {
  background: var(--z-brand-dark);
  box-shadow: 0 4px 14px rgba(8, 145, 178, 0.25);
}

/* Active filters row */
.active-filters {
  display: flex;
  align-items: center;
  gap: var(--z-space-2);
  flex-wrap: wrap;
  margin-bottom: var(--z-space-6);
}

.active-filters .label {
  font-size: 12px;
  color: var(--z-text-dim);
  font-weight: 500;
}

.clear-all {
  font-size: 11px;
  color: var(--z-error);
  cursor: pointer;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
}

.clear-all:hover {
  background: #fef2f2;
}

/* Results header */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--z-space-5);
  flex-wrap: wrap;
  gap: var(--z-space-3);
}

.result-count {
  font-size: 14px;
  color: var(--z-text-secondary);
}

.result-count strong {
  color: var(--z-text-primary);
}

.sort-select {
  font-size: 12px;
  color: var(--z-text-secondary);
  padding: 4px 8px;
  border: 1px solid var(--z-border-light);
  border-radius: var(--z-radius-sm);
  background: var(--z-bg-surface);
  font-family: var(--z-font-sans);
  cursor: pointer;
}

/* Result list */
.result-list {
  display: flex;
  flex-direction: column;
  gap: var(--z-space-4);
  margin-bottom: var(--z-space-8);
}

/* Result item */
.result-item {
  background: var(--z-bg-surface);
  border: 1px solid var(--z-border-light);
  border-radius: var(--z-radius-lg);
  padding: var(--z-space-5) var(--z-space-6);
  transition: all var(--z-transition);
  cursor: pointer;
  display: flex;
  gap: var(--z-space-5);
}

.result-item:hover {
  border-color: var(--z-border);
  box-shadow: var(--z-shadow-card);
}

.result-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--z-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.result-icon.visa { background: var(--z-brand-bg); }
.result-icon.tax { background: #f0fdfa; }
.result-icon.pension { background: #fffbeb; }
.result-icon.insurance { background: #ecfdf5; }
.result-icon.residence { background: #f5f3ff; }

.result-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--z-space-2);
}

.result-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--z-space-3);
}

.result-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--z-text-primary);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.result-title .jp {
  font-size: 13px;
  font-weight: 400;
  color: var(--z-text-dim);
  display: block;
}

.result-badges {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.result-excerpt {
  font-size: 13px;
  color: var(--z-text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: var(--z-space-4);
  font-size: 11px;
  color: var(--z-text-dim);
  flex-wrap: wrap;
}

.result-meta-item {
  display: flex;
  align-items: center;
  gap: 3px;
}

.result-arrow {
  display: flex;
  align-items: center;
  color: var(--z-text-dim);
  flex-shrink: 0;
  opacity: 0;
  transition: all var(--z-transition);
}

.result-item:hover .result-arrow {
  opacity: 1;
  color: var(--z-brand-primary);
}

/* ============================================================
   13. SCORING COMPONENTS (HSP / 打分器)
   ============================================================ */

/* Stepper */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 28px;
  padding: 0;
  flex-wrap: wrap;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--z-text-dim);
  cursor: pointer;
  transition: color 0.2s;
  padding: 8px 12px;
  border-radius: var(--z-radius-sm);
}

.step:hover {
  color: var(--z-brand-primary);
  background: var(--z-bg-hover);
}

.step.active {
  color: var(--z-brand-primary);
  font-weight: 600;
}

.step.completed {
  color: var(--z-success);
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  border: 2px solid var(--z-border);
  transition: all 0.2s;
  flex-shrink: 0;
}

.step.active .step-num,
.step.completed .step-num {
  background: var(--z-brand-primary);
  border-color: var(--z-brand-primary);
  color: #fff;
}

.step.completed .step-num {
  background: var(--z-success);
  border-color: var(--z-success);
}

.step-line {
  flex: 0 0 32px;
  height: 2px;
  background: var(--z-border-light);
  margin: 0 4px;
}

.step.completed + .step-line {
  background: var(--z-success);
}

/* Score panel */
.score-panel {
  position: sticky;
  top: calc(var(--z-nav-height) + 24px);
}

.score-card {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafd 100%);
  border: 1px solid var(--z-border-light);
  border-radius: var(--z-radius-xl);
  padding: 28px 24px;
  box-shadow: var(--z-shadow-card);
  text-align: center;
  margin-bottom: var(--z-space-5);
}

.score-number {
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--z-brand-primary);
  line-height: 1;
  transition: transform 0.3s ease;
  position: relative;
  display: inline-block;
}

.score-number.pulse {
  animation: scorePulse 0.5s ease;
}

.score-number .score-denom {
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--z-text-dim);
}

.score-label {
  font-size: 0.8rem;
  color: var(--z-text-secondary);
  margin-bottom: 14px;
}

/* Progress bar */
.progress-wrap {
  background: var(--z-bg-surface-alt);
  border-radius: var(--z-radius-full);
  height: 10px;
  overflow: hidden;
  margin-bottom: 14px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--z-brand-primary), var(--z-secondary));
  border-radius: var(--z-radius-full);
  width: 0%;
  transition: width 0.5s ease;
}

.progress-fill--80 {
  background: linear-gradient(90deg, var(--z-brand-primary), var(--z-accent));
}

/* Threshold buttons */
.threshold-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.threshold-btn {
  flex: 1;
  padding: 8px 0;
  border: 1px solid var(--z-border);
  border-radius: var(--z-radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  background: var(--z-bg-surface);
  color: var(--z-text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.threshold-btn:hover {
  background: var(--z-bg-hover);
}

.threshold-btn--70.active {
  background: var(--z-brand-bg);
  border-color: var(--z-brand-primary);
  color: var(--z-brand-primary);
}

.threshold-btn--80.active {
  background: rgba(245, 158, 11, 0.1);
  border-color: var(--z-accent);
  color: #B45309;
}

/* Mini checklist in score panel */
.mini-list {
  list-style: none;
  text-align: left;
  margin-bottom: 18px;
}

.mini-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--z-text-secondary);
  padding: 5px 0;
  border-bottom: 1px solid var(--z-border-light);
}

.mini-list li:last-child {
  border-bottom: none;
}

.mini-list .mini-check { color: var(--z-success); flex-shrink: 0; font-weight: 700; }
.mini-list .mini-warn { color: var(--z-warning); flex-shrink: 0; font-weight: 700; }
.mini-list .mini-dash { color: var(--z-text-dim); flex-shrink: 0; }

/* Breakdown preview */
.breakdown-preview {
  background: var(--z-bg-surface);
  border: 1px solid var(--z-border-light);
  border-radius: var(--z-radius-lg);
  padding: 24px;
  margin-top: 28px;
}

.breakdown-preview h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--z-text-primary);
  margin-bottom: 16px;
}

.bp-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.bp-item {
  text-align: center;
  padding: 14px 8px;
  background: var(--z-bg-base);
  border-radius: var(--z-radius-md);
  border: 1px solid var(--z-border-light);
}

.bp-item .bp-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--z-brand-primary);
  margin-bottom: 4px;
}

.bp-item .bp-label {
  font-size: 0.7rem;
  color: var(--z-text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Scoring grid (form + sidebar) */
.scoring-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 28px;
  align-items: start;
}

.scoring-section {
  padding: 32px 0 72px;
  position: relative;
  z-index: 1;
}

/* Form step visibility */
.form-step {
  display: none;
}

.form-step.active {
  display: block;
}

.form-step h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--z-text-primary);
  margin-bottom: 4px;
}

/* ============================================================
   14. PAGE HEADER & BREADCRUMB
   ============================================================ */

.page-header {
  padding: var(--z-space-10) 0 var(--z-space-6);
  border-bottom: 1px solid var(--z-border-light);
  margin-bottom: var(--z-space-6);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--z-space-2);
  font-size: 13px;
  color: var(--z-text-dim);
  margin-bottom: var(--z-space-4);
}

.breadcrumb a {
  color: var(--z-text-dim);
  transition: color var(--z-transition);
}

.breadcrumb a:hover {
  color: var(--z-brand-primary);
}

.breadcrumb span {
  color: var(--z-text-secondary);
}

.page-title h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--z-text-primary);
  margin-bottom: var(--z-space-2);
}

.page-title .subtitle {
  font-size: 14px;
  color: var(--z-text-secondary);
  line-height: 1.6;
  max-width: 600px;
}

.page-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--z-space-6);
  flex-wrap: wrap;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: var(--z-space-4);
  flex-wrap: wrap;
}

/* ============================================================
   15. SECTION COMPONENTS
   ============================================================ */

.section-divider {
  height: 1px;
  background: linear-gradient(
    to right,
    transparent 0%,
    var(--z-border) 20%,
    var(--z-border) 80%,
    transparent 100%
  );
  border: none;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Gradient divider variant */
.gradient-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--z-brand-primary), transparent);
  margin: 0 auto;
  max-width: 1200px;
  border: none;
}

.gradient-divider--tall {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--z-brand-primary), var(--z-secondary), transparent);
  position: relative;
  z-index: 1;
}

.section-label {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--z-brand-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--z-space-2);
}

.section-title {
  text-align: center;
  font-size: 32px;
  font-weight: 700;
  color: var(--z-text-primary);
  margin-bottom: var(--z-space-12);
  letter-spacing: -0.01em;
}

/* Content section */
.content-section {
  padding: 48px 0;
  position: relative;
  z-index: 1;
}

.content-section h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--z-text-primary);
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}

.content-section h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--z-text-primary);
  margin-bottom: 8px;
}

/* Related section */
.related-section {
  margin-top: var(--z-space-8);
}

.related-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--z-text-primary);
  margin-bottom: var(--z-space-4);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--z-space-4);
}

/* ============================================================
   16. ALERTS, HINTS & STATUS
   ============================================================ */

/* Hint bar */
.hint-bar {
  padding: 12px 16px;
  border-radius: var(--z-radius-md);
  font-size: 0.8rem;
  font-weight: 500;
  text-align: left;
  margin-bottom: 12px;
  display: none;
}

.hint-bar--70 {
  display: block;
  background: var(--z-brand-bg);
  color: var(--z-brand-primary);
  border: 1px solid rgba(8, 145, 178, 0.15);
}

.hint-bar--80 {
  display: block;
  background: rgba(245, 158, 11, 0.08);
  color: #B45309;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.hint-bar--js {
  display: block;
  background: rgba(13, 148, 136, 0.06);
  color: var(--z-secondary);
  border: 1px solid rgba(13, 148, 136, 0.2);
}

/* Generic alert */
.alert {
  padding: 12px 16px;
  border-radius: var(--z-radius-md);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: var(--z-space-4);
}

.alert--info {
  background: var(--z-brand-bg);
  color: var(--z-brand-primary);
  border: 1px solid rgba(8, 145, 178, 0.15);
}

.alert--success {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert--warning {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert--error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ============================================================
   17. FOOTER
   ============================================================ */

.footer {
  padding: var(--z-space-16) 0 var(--z-space-8);
  border-top: 1px solid var(--z-border-light);
  position: relative;
  z-index: 1;
  background: var(--z-bg-surface);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: var(--z-space-12);
  margin-bottom: var(--z-space-12);
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: var(--z-space-4);
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: var(--z-space-2);
}

.footer-logo svg {
  width: 28px;
  height: 28px;
}

.footer-logo-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--z-text-primary);
}

.footer-desc,
.footer-brand .desc {
  font-size: 13px;
  color: var(--z-text-dim);
  line-height: 1.7;
  max-width: 260px;
}

.footer-social {
  display: flex;
  gap: var(--z-space-3);
}

.footer-social a {
  width: 36px;
  height: 36px;
  border-radius: var(--z-radius-full);
  border: 1px solid var(--z-border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--z-text-dim);
  transition: all 0.2s ease;
}

.footer-social a:hover {
  border-color: var(--z-brand-primary);
  color: var(--z-brand-primary);
  background: var(--z-brand-bg);
}

.footer-col h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--z-text-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--z-space-4);
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--z-space-3);
}

.footer-col ul a {
  font-size: 13px;
  color: var(--z-text-secondary);
  transition: color 0.2s ease;
}

.footer-col ul a:hover {
  color: var(--z-brand-primary);
}

.footer-bottom {
  padding-top: var(--z-space-6);
  border-top: 1px solid var(--z-border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--z-space-4);
}

.footer-copy {
  font-size: 12px;
  color: var(--z-text-dim);
}

.footer-lang {
  display: flex;
  align-items: center;
  gap: var(--z-space-2);
  font-size: 12px;
  color: var(--z-text-dim);
}

.footer-lang select {
  background: var(--z-bg-base);
  border: 1px solid var(--z-border-light);
  border-radius: var(--z-radius-sm);
  padding: var(--z-space-1) var(--z-space-2);
  font-size: 12px;
  color: var(--z-text-secondary);
  font-family: var(--z-font-sans);
  cursor: pointer;
}

/* ============================================================
   18. EMPTY STATE
   ============================================================ */

.empty-state {
  text-align: center;
  padding: var(--z-space-16) var(--z-space-6);
  color: var(--z-text-dim);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  opacity: 0.3;
  margin: 0 auto var(--z-space-4);
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--z-text-secondary);
  margin-bottom: var(--z-space-1);
}

.empty-state p {
  font-size: 13px;
}

/* No results (search-specific empty state) */
.no-results {
  text-align: center;
  padding: var(--z-space-16);
  color: var(--z-text-dim);
}

.no-results svg {
  width: 64px;
  height: 64px;
  opacity: 0.25;
  margin-bottom: var(--z-space-4);
}

.no-results h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--z-text-secondary);
  margin-bottom: var(--z-space-1);
}

.no-results p {
  font-size: 13px;
}

/* ============================================================
   19. CTA BANNER
   ============================================================ */

.cta-banner {
  background: linear-gradient(135deg, var(--z-brand-primary), #0e7490);
  border-radius: var(--z-radius-lg);
  padding: 36px 40px;
  text-align: center;
  color: #fff;
  margin: 32px 0;
  position: relative;
  overflow: hidden;
}

.cta-banner::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -20%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.cta-banner h2 {
  color: #fff;
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.cta-banner p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

/* ============================================================
   20. GRAPH / LEGEND
   ============================================================ */

.graph-section {
  padding: 32px 0 48px;
  position: relative;
  z-index: 1;
}

.graph-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.graph-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--z-text-primary);
}

.graph-controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.graph-container {
  background: var(--z-bg-surface);
  border: 1px solid var(--z-border-light);
  border-radius: var(--z-radius-lg);
  overflow: hidden;
}

/* Legend bar */
.legend-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--z-bg-surface);
  border: 1px solid var(--z-border-light);
  border-radius: var(--z-radius-md);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--z-text-secondary);
  white-space: nowrap;
}

.legend-swatch {
  width: 16px;
  height: 4px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-swatch.upgrade { background: var(--rel-upgrade, var(--z-brand-primary)); }
.legend-swatch.prereq { background: var(--rel-prereq, var(--z-secondary)); }
.legend-swatch.parallel { background: var(--rel-parallel, var(--z-success)); }
.legend-swatch.risk { background: var(--rel-risk, var(--z-error)); }
.legend-swatch.convert { background: var(--rel-convert, var(--z-accent)); }
.legend-swatch.restrict { background: var(--rel-restrict, var(--z-text-dim)); }

/* ============================================================
   21. MODAL / DIALOG
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--z-space-6);
}

.modal {
  background: var(--z-bg-surface);
  border-radius: var(--z-radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}

.modal-header {
  padding: var(--z-space-6) var(--z-space-6) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--z-text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--z-radius-full);
  border: none;
  background: var(--z-bg-hover);
  color: var(--z-text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 18px;
}

.modal-close:hover {
  background: var(--z-bg-surface-alt);
  color: var(--z-text-primary);
}

.modal-body {
  padding: var(--z-space-6);
  font-size: 14px;
  color: var(--z-text-secondary);
  line-height: 1.7;
}

.modal-footer {
  padding: 0 var(--z-space-6) var(--z-space-6);
  display: flex;
  justify-content: flex-end;
  gap: var(--z-space-3);
}

/* ============================================================
   22. ANIMATION KEYFRAMES
   ============================================================ */

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scorePulse {
  0% { transform: scale(1); }
  30% { transform: scale(1.18); }
  60% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   23. UTILITY CLASSES
   ============================================================ */

/* Text */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--z-text-primary); }
.text-secondary { color: var(--z-text-secondary); }
.text-dim { color: var(--z-text-dim); }
.text-brand { color: var(--z-brand-primary); }
.text-success { color: var(--z-success); }
.text-warning { color: var(--z-warning); }
.text-error { color: var(--z-error); }

.text-xs { font-size: 11px; }
.text-sm { font-size: 13px; }
.text-base { font-size: 15px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 24px; }
.text-2xl { font-size: 32px; }
.text-3xl { font-size: 40px; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.italic { font-style: italic; }
.uppercase { text-transform: uppercase; letter-spacing: 0.06em; }

/* Spacing */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--z-space-2); }
.mt-4 { margin-top: var(--z-space-4); }
.mt-6 { margin-top: var(--z-space-6); }
.mt-8 { margin-top: var(--z-space-8); }
.mt-12 { margin-top: var(--z-space-12); }
.mt-16 { margin-top: var(--z-space-16); }

.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--z-space-2); }
.mb-4 { margin-bottom: var(--z-space-4); }
.mb-6 { margin-bottom: var(--z-space-6); }
.mb-8 { margin-bottom: var(--z-space-8); }
.mb-12 { margin-bottom: var(--z-space-12); }
.mb-16 { margin-bottom: var(--z-space-16); }

.p-4 { padding: var(--z-space-4); }
.p-6 { padding: var(--z-space-6); }
.p-8 { padding: var(--z-space-8); }

/* Display */
.hidden { display: none; }
.block { display: block; }
.inline { display: inline; }
.inline-flex { display: inline-flex; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Width */
.w-full { width: 100%; }
.max-w-sm { max-width: 480px; }
.max-w-md { max-width: 640px; }
.max-w-lg { max-width: 800px; }
.max-w-xl { max-width: 1200px; }

/* Truncation */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Rounded */
.rounded-sm { border-radius: var(--z-radius-sm); }
.rounded-md { border-radius: var(--z-radius-md); }
.rounded-lg { border-radius: var(--z-radius-lg); }
.rounded-xl { border-radius: var(--z-radius-xl); }
.rounded-full { border-radius: var(--z-radius-full); }

/* Shadow */
.shadow-sm { box-shadow: var(--z-shadow-sm); }
.shadow-card { box-shadow: var(--z-shadow-card); }
.shadow-hover { box-shadow: var(--z-shadow-hover); }

/* Transitions */
.transition { transition: all var(--z-transition); }

/* Z-index helpers */
.z-0 { z-index: 0; }
.z-1 { z-index: 1; }
.z-10 { z-index: 10; }
.z-100 { z-index: 100; }
.z-200 { z-index: 200; }

/* ============================================================
   24. RESPONSIVE BREAKPOINTS
   ============================================================ */

/* Tablet: ≤ 1024px */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .bp-grid { grid-template-columns: repeat(2, 1fr); }
  .scoring-grid { grid-template-columns: 1fr; }
  .score-panel { position: static; }
  .layout-sidebar { grid-template-columns: 1fr; }
  .search-sidebar { position: static; max-height: none; overflow-y: visible; }
}

/* Mobile: ≤ 768px */
@media (max-width: 768px) {
  /* Navigation */
  .nav-links {
    display: none;
  }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--z-nav-height);
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    padding: var(--z-space-6);
    border-bottom: 1px solid var(--z-border-light);
    gap: var(--z-space-5);
    align-items: center;
  }

  .nav-links.open a {
    font-size: 16px;
  }

  .nav-toggle {
    display: flex;
  }

  /* Layout */
  .container,
  .page-wrap,
  .nav-inner,
  .footer-inner {
    padding: 0 var(--z-space-5);
  }

  .page-content {
    padding-top: calc(var(--z-nav-height) + var(--z-space-6));
  }

  /* Grids */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .search-layout {
    grid-template-columns: 1fr;
  }

  .search-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--z-space-4);
  }

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

  .score-panel {
    position: static;
  }

  .bp-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .age-grid,
  .career-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Typography */
  .page-title h1 {
    font-size: 22px;
  }

  .section-title {
    font-size: 26px;
  }

  /* Cards */
  .card-details {
    grid-template-columns: 1fr;
  }

  .card-header {
    flex-direction: column;
  }

  .result-item {
    flex-direction: column;
  }

  .result-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--z-space-1);
  }

  /* Policy card */
  .policy-card {
    padding: var(--z-space-5);
  }

  /* Strategy */
  .strategy-grid {
    grid-template-columns: 1fr;
  }

  /* Tabs */
  .tab-btn {
    font-size: 12px;
    padding: var(--z-space-2) var(--z-space-3);
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--z-space-8);
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  /* Search */
  .search-input-wrap {
    flex-direction: column;
  }
}

/* Small mobile: ≤ 480px */
@media (max-width: 480px) {
  .container,
  .page-wrap,
  .nav-inner,
  .footer-inner {
    padding: 0 var(--z-space-4);
  }

  .hero {
    padding-top: calc(var(--z-nav-height) + var(--z-space-12));
    padding-bottom: var(--z-space-12);
  }

  .hero h1 {
    font-size: 28px;
  }

  .hero-subtitle {
    font-size: 15px;
  }

  .btn-primary {
    height: 44px;
    font-size: 14px;
    padding: 0 var(--z-space-6);
  }

  .section-title {
    font-size: 24px;
  }

  .entrance-card,
  .scenario-card {
    padding: var(--z-space-6);
  }

  .stat-number {
    font-size: 28px;
  }

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

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

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

/* Between 769px and 1024px — specific adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
  .entrance-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .testimonials {
    grid-template-columns: repeat(2, 1fr);
  }

  .testimonials .testimonial-card:last-child {
    grid-column: 1 / -1;
    max-width: 50%;
    justify-self: center;
  }

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

  .footer-brand {
    grid-column: 1 / -1;
  }
}

/* Print styles */
@media print {
  .nav,
  .footer,
  .ambient-glow,
  .shoji-pattern,
  .section-divider {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  .card,
  .policy-card,
  .entrance-card,
  .scenario-card {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }
}
