:root {
  --text: #6b6375;
  --text-h: #08060d;
  --bg: #fff;
  --border: #e5e4e7;
  --code-bg: #f4f3ec;
  --accent: #aa3bff;
  --accent-bg: rgba(170, 59, 255, 0.1);
  --accent-border: rgba(170, 59, 255, 0.5);
  --social-bg: rgba(244, 243, 236, 0.5);
  --shadow:
    rgba(0, 0, 0, 0.1) 0 10px 15px -3px, rgba(0, 0, 0, 0.05) 0 4px 6px -2px;

  --sans: system-ui, 'Segoe UI', Roboto, sans-serif;
  --heading: system-ui, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, Consolas, monospace;

  font: 18px/145% var(--sans);
  letter-spacing: 0.18px;
  color-scheme: light dark;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  @media (max-width: 1024px) {
    font-size: 16px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #9ca3af;
    --text-h: #f3f4f6;
    --bg: #16171d;
    --border: #2e303a;
    --code-bg: #1f2028;
    --accent: #c084fc;
    --accent-bg: rgba(192, 132, 252, 0.15);
    --accent-border: rgba(192, 132, 252, 0.5);
    --social-bg: rgba(47, 48, 58, 0.5);
    --shadow:
      rgba(0, 0, 0, 0.4) 0 10px 15px -3px, rgba(0, 0, 0, 0.25) 0 4px 6px -2px;
  }

  #social .button-icon {
    filter: invert(1) brightness(2);
  }
}

#root {
  width: 1126px;
  max-width: 100%;
  margin: 0 auto;
  text-align: center;
  border-inline: 1px solid var(--border);
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

body {
  margin: 0;
}

h1,
h2 {
  font-family: var(--heading);
  font-weight: 500;
  color: var(--text-h);
}

h1 {
  font-size: 56px;
  letter-spacing: -1.68px;
  margin: 32px 0;
  @media (max-width: 1024px) {
    font-size: 36px;
    margin: 20px 0;
  }
}
h2 {
  font-size: 24px;
  line-height: 118%;
  letter-spacing: -0.24px;
  margin: 0 0 8px;
  @media (max-width: 1024px) {
    font-size: 20px;
  }
}
p {
  margin: 0;
}

code,
.counter {
  font-family: var(--mono);
  display: inline-flex;
  border-radius: 4px;
  color: var(--text-h);
}

code {
  font-size: 15px;
  line-height: 135%;
  padding: 4px 8px;
  background: var(--code-bg);
}
/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI Symbol', 'Apple Symbols', 'Noto Sans Symbols 2', 'Segoe UI', Roboto, sans-serif; background: transparent; min-height: 100vh; color: #222; }

/* ── Layout ── */
.app { display: flex; justify-content: center; padding: 24px 16px 60px; min-height: 100vh; }
.page { width: 100%; max-width: 420px; position: relative; }

/* ── Language Switcher ── */
.lang-switch { position: absolute; top: 8px; right: 0; background: #fff !important; border: 2px solid #a855f7 !important; border-radius: 20px; padding: 5px 14px; font-size: 12px; cursor: pointer; color: #81D8D0; font-weight: 700; z-index: 9999; }
.lang-switch:hover { background: #ede9fe; border-color: #c084fc !important; box-shadow: 0 0 12px rgba(168,85,247,0.4); }

/* ── Typography ── */
.title { font-size: 26px; font-weight: 800; color: #fff; margin-bottom: 2px; letter-spacing: -0.5px; text-shadow: 0 2px 10px rgba(0,0,0,0.3); }
.subtitle { font-size: 14px; color: #a855f7; font-weight: 600; margin-bottom: 14px; }
.desc { font-size: 13px; color: #a855f7; line-height: 1.6; margin-bottom: 18px; }

/* ── Input Page ── */
.input-page {
  padding-top: 56px; position: relative; z-index: 2; min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  background: transparent; overflow: hidden;
}
/* Prevent iOS Safari zoom-on-input */
@media screen and (max-width: 500px) {
  .date-part { font-size: 16px !important; }
}

/* ── Background Video ── */
.bg-video {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}

/* Starfield fallback (shown when video fails to load) */
.starfield-fallback {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1.8px 1.8px at 35% 52%, rgba(255,255,255,0.7) 50%, transparent 50%),
    radial-gradient(1.8px 1.8px at 70% 58%, rgba(255,255,255,0.6) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 18% 42%, rgba(255,255,255,0.65) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 55% 85%, rgba(129,216,208,0.6) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 82% 25%, rgba(255,255,255,0.55) 50%, transparent 50%),
    radial-gradient(1.2px 1.2px at 38% 22%, rgba(255,255,255,0.5) 50%, transparent 50%),
    radial-gradient(1.2px 1.2px at 68% 8%, rgba(255,255,255,0.5) 50%, transparent 50%),
    radial-gradient(1.2px 1.2px at 48% 65%, rgba(255,255,255,0.45) 50%, transparent 50%),
    radial-gradient(1.2px 1.2px at 5% 92%, rgba(212,175,55,0.4) 50%, transparent 50%),
    radial-gradient(1px 1px at 22% 72%, rgba(129,216,208,0.4) 50%, transparent 50%),
    radial-gradient(1px 1px at 95% 65%, rgba(255,255,255,0.35) 50%, transparent 50%),
    #0a0a18;
  background-size: 100% 100%;
  animation: twinkle 4s ease-in-out infinite alternate;
}


/* Dark overlay for text readability */
.video-overlay {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: transparent;
}
/* Cinematic typography over video */
.input-page .title {
  color: #81D8D0; text-shadow: 0 2px 20px rgba(129,216,208,0.4), 0 0 40px rgba(129,216,208,0.15);
  position: relative; z-index: 5; letter-spacing: -0.8px;
}
.input-page .subtitle {
  color: #7c3aed; text-shadow: 0 1px 16px rgba(124,58,237,0.35);
  position: relative; z-index: 5;
}
.input-page .desc {
  color: #6d28d9; position: relative; z-index: 5;
  font-weight: 500;
}
.input-page .date-label { color: #0891b2; font-size: 12px; margin-bottom: 2px; font-weight: 700; }
/* ── Form Card — compact & bright glass ── */
.form {
  display: flex; flex-direction: column; gap: 12px;
  width: 100%;
  padding: 14px 14px 12px;
  background: transparent;
  border: 2px solid #0891b2;
  border-radius: 16px;
  box-shadow:
    0 4px 24px rgba(8,145,178,0.15),
    inset 0 1px 0 rgba(255,255,255,0.4);
}
.input { width: 100%; height: 50px; border: 1.5px solid #e0e0e0; border-radius: 12px; padding: 0 16px; font-size: 15px; color: #222; background: #fff; outline: none; transition: border-color 0.2s; }
.input:focus { border-color: #81D8D0; box-shadow: 0 0 0 3px rgba(129,216,208,0.15); }
.input::placeholder { color: #bbb; }

/* ── Manual Date Input — equal-width fields ── */
.date-manual {
  display: flex; align-items: center; gap: 3px;
  width: 100%;
}
.date-part {
  flex: 1; height: 52px; border: 2px solid #0891b2; border-radius: 12px;
  padding: 0 14px; font-size: 16px; font-weight: 600;
  color: #a855f7 !important; background: #fff !important;
  outline: none; text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none; appearance: none;
  font-family: inherit;
  min-width: 0;
}
.date-part:focus {
  border-color: #81D8D0; box-shadow: 0 0 0 3px rgba(129,216,208,0.2);
}
.date-part::placeholder { color: #c4b5fd; }
.date-slash {
  color: rgba(46,203,247,0.5); font-size: 18px; font-weight: 200;
  user-select: none; flex-shrink: 0;
}

.btn { width: 100%; height: 46px; border: none; border-radius: 12px; font-size: 15px; font-weight: 700; cursor: pointer; transition: all 0.2s; letter-spacing: 0.3px; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(0.98); }
/* Brand Blue — no glow, pure & flat */
.btn-primary {
  background: #2ECBF7;
  color: #fff;
  border: none;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.btn-primary:hover, .btn-primary:active {
  background: #4AD8FF;
  box-shadow: 0 3px 12px rgba(0,0,0,0.3);
}
.btn-secondary { background: #fff; color: #81D8D0; border: 2px solid #81D8D0; margin-top: 20px; }
.btn-secondary:hover { background: rgba(129,216,208,0.06); }

/* ── Loading ── */
.loading-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; }
.spinner { width: 44px; height: 44px; border: 3px solid #eee; border-top-color: #81D8D0; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin-top: 18px; color: #999; font-size: 14px; }

/* ── Result Page ── */
.result-page { padding-top: 20px; }

/* Score Ring */
.score-ring { width: 130px; height: 130px; margin: 20px auto 8px; }
.score-ring svg { width: 100%; height: 100%; }

/* Engine Cards */
.engine-cards { display: flex; flex-direction: column; gap: 0; margin: 24px 0; }
.engine-info { display: flex; flex-direction: column; gap: 3px; text-align: left; flex: 1; }
.engine-name { font-size: 13px; font-weight: 600; color: #1A1F4B; }
.engine-summary { font-size: 12px; color: #888; line-height: 1.4; }
.engine-score { font-size: 20px; font-weight: 800; color: #1A1F4B; }

/* AI Insight */
.ai-insight { background: linear-gradient(135deg, #f0f7ff, #faf5ff); border-radius: 14px; padding: 18px; text-align: left; margin-bottom: 18px; border: 1px solid rgba(129,216,208,0.2); }
.ai-insight h3 { font-size: 14px; color: #1A1F4B; margin-bottom: 8px; }
.ai-insight p { font-size: 13px; color: #555; line-height: 1.65; }

/* Aspects Tags */
.aspects { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.aspect-group { text-align: left; }
.aspect-group h4 { font-size: 13px; color: #555; margin-bottom: 8px; }
.tag { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; margin: 0 6px 6px 0; }
.tag-good { background: rgba(129,216,208,0.15); color: #2a8a7a; }
.tag-warn { background: rgba(212,175,55,0.15); color: #b8860b; }

/* Error */
.error-msg { color: #e74c3c; font-size: 13px; marginTop: 12px; }

/* ── Back Button ── */
.back-btn { background: none; border: none; cursor: pointer; color: #81D8D0; font-size: 14px; font-weight: 600; padding: 0; margin-bottom: 16px; }
.back-btn:hover { opacity: 0.7; }

/* ── Score Label ── */
.score-label { text-align: center; font-size: 13px; color: #888; font-weight: 500; margin-bottom: 20px; letter-spacing: 0.5px; }

/* ── Four Dimensions ── */
.dim-section { background: #fff; border-radius: 14px; padding: 16px; margin-bottom: 16px; border: 1px solid #eee; }
.section-title { font-size: 13px; font-weight: 700; color: #1A1F4B; margin-bottom: 14px; }
.dim-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.dim-row:last-child { margin-bottom: 0; }
.dim-label { font-size: 12px; color: #1a1a1a; width: 110px; flex-shrink: 0; text-align: left; font-family: 'SimHei', 'Heiti SC', sans-serif; font-weight: 900; }
.dim-bar-bg { flex: 1; height: 6px; background: #f0f0f0; border-radius: 3px; overflow: hidden; }
.dim-bar-fill { height: 100%; background: linear-gradient(90deg, #81D8D0, #5cc5bb); border-radius: 3px; transition: width 1s cubic-bezier(.4,0,.2,1); }
.dim-val { font-size: 13px; font-weight: 700; color: #1A1F4B; width: 26px; text-align: right; }

/* ── Engine Cards (interactive) ── */
.engine-card { background: #fff; border-radius: 14px; border: 1px solid #eee; margin-bottom: 10px; overflow: hidden; }
.engine-card-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; cursor: pointer; user-select: none; }
.engine-card-header:active { background: #fafafa; }
.engine-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.engine-icon { font-size: 20px; flex-shrink: 0; }
.engine-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.chevron { font-size: 20px; color: #ccc; transition: transform 0.2s; display: inline-block; }
.chevron.open { transform: rotate(90deg); color: #81D8D0; }
.engine-detail { padding: 0 16px 16px; border-top: 1px solid #f0f0f0; animation: slideDown 0.2s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.detail-heading { font-size: 12px; font-weight: 700; color: #1A1F4B; margin-top: 12px; margin-bottom: 4px; }
.detail-line { font-size: 12px; color: #555; line-height: 1.65; margin-bottom: 2px; }

/* ── Date Field ── */
.date-field { position: relative; }
.date-label { display: block; font-size: 12px; color: #888; font-weight: 500; margin-bottom: 6px; margin-left: 4px; }

/* ── Date inputs (year/month/day text fields) ── */
.date-selects {
  display: flex; align-items: center; gap: 6px;
}
.date-sep {
  color: rgba(46,203,247,0.5); font-size: 18px; font-weight: 300;
  user-select: none; flex-shrink: 0;
}
.date-sel {
  flex: 1; height: 52px; border: 2px solid #0891b2; border-radius: 12px;
  padding: 0 14px; font-size: 16px; color: #a855f7 !important; background: #fff;
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none; appearance: none;
  font-family: inherit; text-align: center; font-weight: 600;
}
.date-sel:focus { border-color: #81D8D0; box-shadow: 0 0 0 3px rgba(129,216,208,0.2); }
.date-sel::placeholder { color: #c4b5fd; }
.date-sel-year { flex: 1.4; min-width: 0; }
.date-sel-month { flex: 0.9; min-width: 0; }
.date-sel-day { flex: 0.9; min-width: 0; }

/* Keep original date-input for any fallback usage */


/* Hide native date picker "Today" / "Clear" buttons (WebKit shadow-DOM hack) */
.date-input::-webkit-datetime-edit-seconds-field,
.date-input::-webkit-datetime-edit-millisecond-field,
.date-input::-webkit-datetime-edit-meridiem-field { display: none; }

/* ── Custom Date Picker (minimalist) ── */
.date-picker-wrapper { position: relative; width: 100%; }
.date-display {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; height: 52px; border: 1.5px solid rgba(255,255,255,0.25); border-radius: 12px;
  padding: 0 16px; background: rgba(255,255,255,0.12); backdrop-filter: blur(10px);
  cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s;
}
.date-display:hover { border-color: rgba(255,255,255,0.4); }
.date-value { font-size: 15px; color: #fff; letter-spacing: 0.5px; }
.date-placeholder { font-size: 15px; color: rgba(255,255,255,0.45); }
.date-icon { font-size: 18px; opacity: 0.7; }
.date-panel {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 100;
  background: rgba(13,13,26,0.95); backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.15); border-radius: 16px; padding: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.date-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.date-title { font-size: 15px; font-weight: 600; color: #fff; }
.date-nav {
  width: 32px; height: 32px; border: none; border-radius: 8px; background: rgba(255,255,255,0.1);
  color: #fff; font-size: 18px; cursor: pointer; transition: background 0.2s;
}
.date-nav:hover { background: rgba(129,216,208,0.3); }
.date-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 8px; }
.date-wd { text-align: center; font-size: 11px; color: rgba(255,255,255,0.5); padding: 4px 0; }
.date-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.date-cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: rgba(255,255,255,0.8); border-radius: 8px; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.date-cell:hover:not(.empty) { background: rgba(129,216,208,0.25); color: #fff; }
.date-cell.empty { cursor: default; }
.date-cell.selected { background: #81D8D0; color: #1A1F4B; font-weight: 600; }

/* ── AI Insight Loading Skeleton ── */
.insight-skeleton { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.skeleton-line {
  height: 14px; border-radius: 7px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
.w60 { width: 60%; }
.w80 { width: 80%; }
.w90 { width: 90%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.insight-error { font-size: 12px; color: #aaa; font-style: italic; }
/* v2 */

@keyframes twinkle {
  0% { opacity: 1; }
  50% { opacity: 0.75; }
  100% { opacity: 1; }
}
