:root {
  color-scheme: light;
  --theme-control: #edf1f6;
  --theme-selected: #ffffff;
  --theme-border: #bdcadd;
}

/* Fixed icon boxes keep the label baseline identical across all five tabs. */
.tab .nav-symbol {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  margin: 0 auto 5px;
  color: inherit;
  line-height: 1;
}

.tab .nav-fortune {
  font-family: "Batang", "Songti SC", "Noto Serif CJK KR", serif;
  font-size: 27px;
  font-weight: 600;
}

.nav-lotto {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1.8px solid currentColor;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.tab {
  height: 62px;
  font-size: 14px;
}

html[data-theme="light"] .tab:not(.active) {
  color: #59677a;
}

.tab > svg {
  width: 24px;
  height: 26px;
  margin-bottom: 5px;
}

.ai-action-icon .nav-lotto {
  width: 29px;
  height: 29px;
  font-size: 14px;
}

.settings-section h2 {
  margin: 0 0 24px;
  font-size: 22px;
  line-height: 1.4;
  font-weight: 600;
}

.settings-group + .settings-group {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.settings-label {
  display: block;
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  font-weight: 500;
}

.settings-section .segmented {
  border-radius: 8px;
  gap: 4px;
  padding: 4px;
}

.settings-section .segment {
  min-height: 48px;
  border-radius: 6px;
  font-size: 16px;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--theme-control);
}

.theme-option {
  display: flex;
  min-width: 0;
  min-height: 74px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 10px 4px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}

.theme-option svg {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}

.theme-option[aria-pressed="true"] {
  background: var(--theme-selected);
  border-color: var(--theme-border);
  box-shadow: 0 2px 5px rgba(24, 32, 44, 0.05);
  color: var(--blue-deep);
  font-weight: 600;
}

.theme-option:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.phone :is(.copy, .strong, .flow-step span, .dream-card p, .value-card span, .trust-brief p) {
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.phone :is(.h1, .h2, .h3, .dream-card h4, .btn) {
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.panel.blue::before,
.panel.gold::before,
.eyebrow::before {
  display: none;
}

.eyebrow {
  font-size: 14px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14171a;
  --surface: #1e2227;
  --surface-subtle: #24292f;
  --surface-strong: #2b3139;
  --ink: #f2f4f7;
  --text: #f2f4f7;
  --text-soft: #d0d6de;
  --ink-soft: #d0d6de;
  --muted: #b3bdc9;
  --line: #373f49;
  --line-strong: #566272;
  --glass-edge: rgba(240, 247, 255, 0.14);
  --blue: #9ebfff;
  --blue-deep: #afcaff;
  --blue-soft: #27364b;
  --soft: #27364b;
  --green: #8ed1b0;
  --gold: #e3c479;
  --gold-soft: #373126;
  --red: #f2a7b0;
  --navy: #161b22;
  --card: #1e2227;
  --theme-control: #14191f;
  --theme-selected: #2e3c50;
  --theme-border: #809cc0;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 8px 24px rgba(0, 0, 0, 0.12);
  background: #101215;
}

html[data-theme="dark"] body {
  background: #101215;
  color: var(--ink);
}

html[data-theme="dark"] .phone {
  background: var(--bg);
  box-shadow: 0 0 0 1px var(--line), 0 24px 60px rgba(0, 0, 0, 0.24);
}

html[data-theme="dark"] header {
  background: rgba(26, 30, 35, 0.87);
  border-color: var(--glass-edge);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] nav {
  background: rgba(31, 36, 43, 0.88);
  border-color: rgba(239, 246, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 14px 34px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .tab {
  color: #b8c1cd;
}

html[data-theme="dark"] .tab.active {
  background: #334156;
  color: #d1e1ff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] :is(.panel, .panel.blue, .panel.gold) {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.026), transparent 68%), var(--surface);
  border-color: var(--glass-edge);
  box-shadow: var(--shadow);
}

html[data-theme="dark"] :is(.hero, .panel.dark, .number-maker) {
  background: #202834;
  border-color: #465267;
  box-shadow: var(--shadow);
}

html[data-theme="dark"] :is(.hero, .number-maker)::before {
  opacity: 0.4;
}

html[data-theme="dark"] :is(.input, textarea, select, .round-select, .choice-card, .metric-card) {
  background-color: #181d23;
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

html[data-theme="dark"] :is(input, textarea)::placeholder {
  color: #a6b1c0;
  opacity: 1;
}

html[data-theme="dark"] :is(.choice-card.selected, .metric-card.active, .value-card.current) {
  background: var(--blue-soft);
  border-color: #819ac0;
}

html[data-theme="dark"] .choice-card.selected::after {
  background: #c4d9ff;
  box-shadow: inset 0 0 0 4px #354a68;
}

html[data-theme="dark"] :is(.choice-card, .choice-card.selected) svg {
  color: var(--blue);
}

html[data-theme="dark"] :is(.header-action, .btn.soft, .num, .pill, .auto-age, .segment, .segmented, .plan-current, .pillar-card, .stat, .source-box, .round-result, .metric-detail, .data-status, .trust-facts > div, .bonus-number b) {
  background: var(--surface-subtle);
  color: var(--ink-soft);
  border-color: var(--line);
  box-shadow: none;
}

html[data-theme="dark"] :is(.segment.active, .header-action:hover) {
  background: var(--blue-soft);
  border-color: #819ac0;
  color: var(--blue-deep);
}

html[data-theme="dark"] :is(.eyebrow, .text-action, .dream-more summary, .trust-brief-head b, .plan-current b, .metric-card b, .disclosure-panel > summary svg) {
  color: var(--blue-deep);
}

html[data-theme="dark"] .metric-card span {
  color: var(--ink-soft);
}

html[data-theme="dark"] :is(.field label, .control-label, .element-score) {
  color: var(--ink-soft);
}

.trust-brief p b {
  display: inline;
}

html[data-theme="dark"] :is(.preview-row, .analysis-detail, .report-standard) {
  background: var(--surface-subtle);
  border-color: var(--line);
  box-shadow: none;
}

html[data-theme="dark"] .report-standard {
  border-left-color: #829bc4;
}

html[data-theme="dark"] :is(.tag, .source-link, .hot-chip) {
  background: #28374b;
  border-color: #4e6380;
  color: #c4d8f7;
}

html[data-theme="dark"] .count-chip {
  background: transparent;
}

html[data-theme="dark"] :is(.element-mark, .count-chip).wood {
  color: #95dcbb;
  border-color: #46755e;
  background: #243c32;
}

html[data-theme="dark"] :is(.element-mark, .count-chip).fire {
  color: #ffb0b6;
  border-color: #805257;
  background: #402b30;
}

html[data-theme="dark"] :is(.element-mark, .count-chip).earth {
  color: #f0d78f;
  border-color: #7c6e43;
  background: #3c3524;
}

html[data-theme="dark"] :is(.element-mark, .count-chip).metal {
  color: #d7c5ff;
  border-color: #6e5e8c;
  background: #362e46;
}

html[data-theme="dark"] :is(.element-mark, .count-chip).water {
  color: #b3d4ff;
  border-color: #506f98;
  background: #29394e;
}

html[data-theme="dark"] :is(.bar, .legend-item i) {
  background: #424c59;
}

html[data-theme="dark"] :is(.bar i, .legend-item i::after) {
  background: #93b7ec;
}

html[data-theme="dark"] .radar-grid :is(polygon, line) {
  stroke: #66758a;
  stroke-opacity: 0.6;
}

html[data-theme="dark"] :is(#radarPolygon, .radar-shape) {
  fill: rgba(122, 168, 238, 0.13);
  stroke: #aecbff;
}

html[data-theme="dark"] :is(.radar-dot, .radar-dots circle) {
  fill: #222c3a;
  stroke: #c4d8ff;
}

html[data-theme="dark"] .radar-wrap text {
  fill: #c1cbd8;
}

html[data-theme="dark"] :is(.radar-center, .mini-radar-center) b {
  color: #eef4ff;
}

html[data-theme="dark"] :is(.radar-center, .mini-radar-center) :is(small, span, span.good) {
  color: #bacde6 !important;
}

html[data-theme="dark"] :is(.radar-center, .mini-radar-center) span.watch {
  color: #ebd18f !important;
}

html[data-theme="dark"] :is(.notice, .connection-banner) {
  background: #363127;
  color: #edd8a0;
  border-color: #716647;
}

html[data-theme="dark"] :is(.form-error, .danger-action, .status-error h4) {
  color: #ffb4bb;
}

html[data-theme="dark"] :is(.danger-action, .dream-card.status-error) {
  border-color: #7c555e;
  background: #38272d;
}

html[data-theme="dark"] .toast {
  background: #e5eaf1;
  color: #202734;
  border: 1px solid #ffffff;
}

html[data-theme="dark"] :where(button, input, select, textarea, summary, a):focus-visible {
  outline-color: #a7caff;
}

html[data-theme="dark"] :is(.card, .offline-card) {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: none;
}

.offline-card h1 { font-size: 32px; }

@media (max-width: 430px) {
  .offline-card h1 { font-size: 28px; }
}

body[data-text-size="large"] .phone :is(.copy, .strong, .flow-step span, .dream-card p, .value-card span, .trust-brief p) {
  font-size: 18px;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html[data-theme="dark"] :is(header, nav) {
    background: #20262d;
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-option { transition: none; }
}
