/* ============================================================
   I Ching Oracle — Tech-Mysticism Theme
   ============================================================ */

:root {
  --void:      #080810;
  --obsidian:  #0f0f1a;
  --surface:   #14142200;
  --indigo:    #7B5EA7;
  --teal:      #4ECDC4;
  --ghost:     #F1F3FA;
  --nebula:    #A5ACCC;
  --gold:      #F4C430;
  --silver:    #CAD2E4;
  --crimson:   #FF4D6D;

  --serif: "Cormorant Garamond", Georgia, serif;
  --sans:  "Inter", system-ui, sans-serif;
  --display: "Cinzel", serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Always honor [hidden] regardless of stage layout rules */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(123,94,167,0.28), transparent 55%),
    radial-gradient(ellipse at 50% 110%, rgba(78,205,196,0.12), transparent 55%),
    var(--void);
  color: var(--ghost);
  font-family: var(--sans);
  font-weight: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-x: hidden;
  padding: 0 1rem;
  padding-bottom: 0;
}

#starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---------- Bagua (八卦) celestial ring ---------- */
.bagua {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(94vmin, 880px);
  height: min(94vmin, 880px);
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
  opacity: 0.22; /* ghostly background backdrop so it doesn't conflict with text */
}
.bagua__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(123,94,167,0.22);
  box-shadow:
    0 0 60px rgba(123,94,167,0.1),
    inset 0 0 80px rgba(78,205,196,0.04);
}
.bagua__ring--inner {
  inset: 15%;
  border-color: rgba(78,205,196,0.18);
  border-style: dashed;
}
.bagua__spin {
  position: absolute;
  inset: 0;
  animation: baguaSpin 120s linear infinite;
}
@keyframes baguaSpin { to { transform: rotate(360deg); } }
.bagua__tri {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: clamp(1.4rem, 3.5vmin, 2.4rem);
  color: var(--teal);
  text-shadow: 0 0 14px rgba(78,205,196,0.4);
  /* place each trigram around the circle */
  transform:
    translate(-50%, -50%)
    rotate(calc(var(--i) * 45deg))
    translateY(calc(min(94vmin, 880px) / -2 + 1.6rem))
    rotate(calc(var(--i) * -45deg));
}
.bagua__tri:nth-child(odd) { color: var(--indigo); text-shadow: 0 0 14px rgba(123,94,167,0.4); }
.bagua__yinyang {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(3rem, 9vmin, 6rem);
  color: rgba(232,232,240,0.05); /* very subtle center icon */
  animation: baguaSpin 90s linear infinite reverse;
}

/* ---------- Site Header & Navigation ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: linear-gradient(180deg, rgba(8,8,16,0.85), rgba(8,8,16,0.7));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(123,94,167,0.15);
  animation: slideDown 0.6s ease both;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-100%); }
  to { opacity: 1; transform: translateY(0); }
}

.site-nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.site-nav__logo {
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--teal);
  text-decoration: none;
  letter-spacing: 0.06em;
  transition: text-shadow 0.3s;
  white-space: nowrap;
}

.site-nav__logo:hover {
  text-shadow: 0 0 18px rgba(78,205,196,0.6);
}

.site-nav__links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.site-nav__link {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--nebula);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.3s;
  white-space: nowrap;
}

.site-nav__link:hover,
.site-nav__link.is-active {
  color: var(--ghost);
}

.site-nav__link.is-active {
  color: var(--teal);
  font-weight: 500;
}

/* Dropdown Menu */
.site-nav__dropdown {
  position: relative;
}

.site-nav__dropdown-toggle {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.dropdown-arrow {
  font-size: 0.7rem;
  transition: transform 0.3s;
}

.site-nav__dropdown-toggle[aria-expanded="true"] .dropdown-arrow {
  transform: rotate(180deg);
}

.site-nav__dropdown-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  min-width: 280px;
  background: linear-gradient(180deg, rgba(15,15,26,0.98), rgba(20,20,34,0.96));
  border: 1px solid rgba(123,94,167,0.3);
  border-radius: 12px;
  padding: 0.5rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  backdrop-filter: blur(12px);
  z-index: 1000;
  animation: dropdownFadeIn 0.3s ease both;
}

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

.site-nav__dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--silver);
  transition: all 0.3s;
}

.site-nav__dropdown-item:hover {
  background: rgba(78,205,196,0.1);
  color: var(--ghost);
}

.dropdown-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.site-nav__dropdown-item strong {
  display: block;
  font-family: var(--display);
  font-size: 0.9rem;
  color: var(--ghost);
  margin-bottom: 0.2rem;
}

.site-nav__dropdown-item small {
  display: block;
  font-size: 0.75rem;
  color: var(--nebula);
  font-style: italic;
}

.oracle {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

/* ---------- Stage transitions ---------- */
.stage {
  width: 100%;
  animation: fadeUp 0.9s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============ INPUT STAGE ============ */
.stage--input {
  text-align: center;
  /* fill exactly one viewport, center content proportionally */
  min-height: calc(100vh - 180px); /* account for header and footer */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* padding-bottom shifts center of gravity to ~40% from top (golden ratio) */
  padding-bottom: clamp(20px, 6vh, 60px);
  padding-top: clamp(100px, 10vh, 120px);
}

.brand__sigil {
  font-size: 3rem;
  color: var(--teal);
  text-shadow: 0 0 24px rgba(78,205,196,0.7);
  animation: spin 36s linear infinite, sigil-pulse 3s ease-in-out infinite;
  display: inline-block;
  cursor: pointer;
  transition: text-shadow 0.3s, transform 0.3s;
}
.brand__sigil:hover {
  text-shadow: 0 0 40px rgba(78,205,196,1);
  animation: spin 36s linear infinite;
  transform: scale(1.15);
}
@keyframes sigil-pulse {
  0%, 100% { text-shadow: 0 0 24px rgba(78,205,196,0.7); }
  50% { text-shadow: 0 0 36px rgba(78,205,196,0.95); }
}
@keyframes spin { to { transform: rotate(360deg); } }

.brand__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 2.4rem;
  letter-spacing: 0.14em;
  margin-top: 0.6rem;
  background: linear-gradient(120deg, var(--ghost), var(--indigo) 60%, var(--teal));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand__subtitle {
  font-family: var(--serif);
  font-style: italic;
  color: var(--nebula);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.88rem;
  margin-top: 0.5rem;
  line-height: 1.5;
}
.brand__subtitle .about-link {
  text-decoration-color: rgba(78,205,196,0.35);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.brand__subtitle .about-link:hover {
  color: var(--teal);
  text-decoration-color: rgba(78,205,196,0.7);
}

.intro {
  margin: 2.4rem 0;
  font-family: var(--serif);
  font-size: 1.35rem;
  line-height: 1.6;
  color: var(--silver);
}
.intro strong {
  color: var(--teal);
  font-weight: 500;
}
.about-link {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dashed;
  text-decoration-color: rgba(78,205,196,0.5);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.3s, text-decoration-color 0.3s;
}
.about-link:hover {
  color: var(--teal);
  text-decoration-color: var(--teal);
}

.help-btn {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 0.3rem;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--indigo);
  background: rgba(123,94,167,0.15);
  color: var(--indigo);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.help-btn:hover {
  background: rgba(123,94,167,0.3);
  border-color: var(--teal);
  color: var(--teal);
  transform: scale(1.1);
}
.help-icon {
  display: block;
  line-height: 1;
}

.cast-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.3rem;
}

.word-input {
  width: 100%;
  max-width: 480px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(136,136,170,0.35);
  border-radius: 14px;
  padding: 0.9rem 1.4rem;
  color: var(--ghost);
  font-family: var(--serif);
  font-size: 1.4rem;
  text-align: center;
  letter-spacing: 0.06em;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
}
.word-input::placeholder { color: rgba(136,136,170,0.75); font-style: italic; }
.word-input:focus {
  border-color: var(--teal);
  background: rgba(78,205,196,0.05);
  box-shadow: 0 0 0 4px rgba(78,205,196,0.12), 0 0 30px rgba(78,205,196,0.18);
}

.love-toggle {
  display: inline-flex;
  border: 1px solid rgba(136,136,170,0.3);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}
.love-toggle__btn {
  background: transparent;
  border: none;
  color: var(--nebula);
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s;
}
.love-toggle__btn.is-active {
  background: rgba(123,94,167,0.25);
  color: var(--ghost);
  box-shadow: inset 0 0 0 1px rgba(123,94,167,0.6);
}

.reveal-btn {
  position: relative;
  margin-top: 0.4rem;
  padding: 0.9rem 3rem;
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ghost);
  background: linear-gradient(120deg, rgba(123,94,167,0.4), rgba(78,205,196,0.3));
  border: 1px solid rgba(78,205,196,0.5);
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.3s, background 0.3s;
}
.reveal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 40px rgba(78,205,196,0.3);
  background: linear-gradient(120deg, rgba(123,94,167,0.6), rgba(78,205,196,0.45));
}
.reveal-btn:active { transform: translateY(0); }

.hint {
  margin-top: 2rem;
  color: rgba(136,136,170,0.85);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

/* ============ CASTING STAGE ============ */
.stage--casting {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 85vh;
}

.cast-lines {
  display: flex;
  flex-direction: column-reverse; /* draw bottom-to-top */
  gap: 14px;
  margin-bottom: 3rem;
}
.cast-line {
  display: flex;
  justify-content: center;
  gap: 16px;
  height: 14px;
  opacity: 0;
  transform: scale(0.6);
  animation: lineIn 0.5s ease forwards;
}
.cast-line__seg {
  width: 90px;
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--indigo), var(--teal));
  box-shadow: 0 0 18px rgba(78,205,196,0.6);
}
.cast-line.is-broken .cast-line__seg { width: 38px; }
.cast-line.is-moving .cast-line__seg {
  background: linear-gradient(90deg, var(--crimson), #ff8fa3);
  box-shadow: 0 0 24px rgba(255,77,109,0.8);
  animation: pulse 0.9s ease-in-out infinite;
}
@keyframes lineIn {
  to { opacity: 1; transform: scale(1); }
}
@keyframes pulse {
  0%,100% { filter: brightness(1); }
  50%     { filter: brightness(1.6); }
}

.cast-phrase {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--silver);
  letter-spacing: 0.05em;
  text-align: center;
  min-height: 1.6em;
  animation: phraseGlow 2s ease-in-out infinite;
}
@keyframes phraseGlow {
  0%,100% { opacity: 0.55; }
  50%     { opacity: 1; }
}

/* ============ RESULT STAGE ============ */
.stage--result {
  background: linear-gradient(180deg, rgba(20,20,34,0.7), rgba(15,15,26,0.55));
  border: 1px solid rgba(123,94,167,0.25);
  border-radius: 22px;
  padding: 2.4rem;
  padding-top: 100px;
  backdrop-filter: blur(8px);
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
/* solid background used only for image capture */
.stage--result.is-capture {
  background: linear-gradient(180deg, rgb(24,24,36), rgb(17,17,26));
  color: #ffffff;
  --ghost: #ffffff;
  --silver: #eef2ff;
  --nebula: #dbe2ff;
  --gold: #ffe070;
  --teal: #7fe9df;
  --indigo: #9e82d6;
  padding-top: 3.5rem !important; /* extra top padding for notch clearance */
}
.stage--result.is-capture, .stage--result.is-capture * { opacity: 1 !important; animation: none !important; }

.stage--result.is-capture .section__text,
.stage--result.is-capture .guidance-summary,
.stage--result.is-capture .dim__text { color: var(--ghost); }
.stage--result.is-capture .dim__label { color: var(--nebula); }
.stage--result.is-capture .trio-label { color: var(--nebula); }
.stage--result.is-capture .hexagram-cn { color: var(--ghost); }
.stage--result.is-capture .result-head__stars { color: var(--gold); text-shadow: none; }

.result-head {
  text-align: center;
  padding-bottom: 0;
  border-bottom: none;
}
.result-head__label {
  font-family: var(--display);
  font-size: 0.82rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--nebula);
  margin-bottom: 0.6rem;
}
.result-head__meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--silver);
}
.result-date {
  color: var(--teal);
  font-weight: 500;
  letter-spacing: 0.05em;
}
.result-word-label {
  color: var(--nebula);
  font-size: 0.88rem;
}
.result-word-label em {
  color: var(--ghost);
  font-style: normal;
  font-weight: 600;
  text-transform: capitalize;
  padding: 0 0.3rem;
}
.result-head__stars {
  color: var(--gold);
  font-size: 1.4rem;
  letter-spacing: 0.3em;
  text-shadow: 0 0 16px rgba(244,196,48,0.5);
  margin-bottom: 1.2rem;
}
.result-head__url {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--teal);
  margin-bottom: 1.5rem;
  opacity: 0.9;
}
  
.hexagram-trio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 1.4rem;
  border-top: 1px solid rgba(123,94,167,0.2);
  border-bottom: 1px solid rgba(123,94,167,0.2);
}
.trio-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  text-align: center;
  padding: 1.3rem 0.8rem 1.1rem;
  border-right: 1px solid rgba(123,94,167,0.15);
}
.trio-card:last-child { border-right: none; }
.trio-label {
  font-size: 0.58rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--nebula);
}
.hexagram-visual {
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
}
.hx-line {
  display: flex;
  justify-content: center;
  gap: 10px;
  height: 9px;
}
.hx-line__seg {
  width: 46px; height: 9px; border-radius: 3px;
  background: var(--silver);
}
.hx-line.is-yang .hx-line__seg { width: 102px; background: var(--gold); }
.hx-line.is-moving .hx-line__seg {
  background: var(--crimson);
  box-shadow: 0 0 14px rgba(255,77,109,0.8);
  animation: pulse 1.2s ease-in-out infinite;
}
.hexagram-cn {
  font-family: var(--display); font-size: 1.1rem; letter-spacing: 0.08em;
  color: var(--ghost);
}
.trio-moving {
  color: var(--crimson);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  margin-top: 0.4rem;
}

/* ---- clickable trio label ---- */
.concept-link {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dashed;
  text-decoration-color: rgba(78,205,196,0.5);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  transition: color 0.3s, text-decoration-color 0.3s, text-shadow 0.3s;
}
.concept-link:hover {
  color: var(--teal);
  text-decoration-color: var(--teal);
  text-shadow: 0 0 8px rgba(78,205,196,0.3);
}

/* ---- clickable hexagram name ---- */
.gua-link {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dashed;
  text-decoration-color: rgba(244,196,48,0.5);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
  transition: color 0.3s, text-decoration-color 0.3s, text-shadow 0.3s;
}
.gua-link:hover {
  color: var(--gold);
  text-decoration-color: var(--gold);
  text-shadow: 0 0 12px rgba(244,196,48,0.4);
}

/* ---- result body sections ---- */
.result-body { margin-top: 1.8rem; }
.section { margin-bottom: 1.9rem; }
.section__title {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--teal);
  margin-bottom: 0.7rem;
}
.section__text {
  font-family: var(--serif);
  font-size: 1.22rem;
  line-height: 1.75;
  color: var(--ghost);
}
.section--key .section__text {
  color: var(--gold);
  font-style: italic;
}

.dimensions { list-style: none; display: flex; flex-direction: column; gap: 0.9rem; }
.dimensions li {
  display: grid;
  grid-template-columns: 1.6rem 5rem 1fr;
  align-items: baseline;
  gap: 0.5rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px dashed rgba(136,136,170,0.15);
}
.dim__label {
  font-size: 0.78rem; letter-spacing: 0.1em; color: var(--nebula);
  text-transform: uppercase;
}
.dim__text {
  font-family: var(--serif); font-size: 1.12rem; line-height: 1.6; color: var(--silver);
}

.guidance-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: baseline;
  margin-bottom: 0.7rem;
  font-size: 1.05rem;
}
.guidance-line span { font-size: 0.85rem; letter-spacing: 0.06em; color: var(--nebula); }
.guidance-line em {
  font-style: normal;
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--ghost);
}
.guidance-line--yes em { color: var(--teal); }
.guidance-line--no  em { color: #ff8fa3; }
.guidance-summary {
  margin-top: 1.1rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--gold);
  text-align: center;
}

.result-actions { margin-top: 1.4rem; display: flex; justify-content: center; gap: 0.8rem; flex-wrap: wrap; }
.action-btn {
  font-family: var(--display);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.82rem;
  padding: 0.8rem 2rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s;
}
.action-btn--primary {
  background: linear-gradient(120deg, rgba(123,94,167,0.6), rgba(78,205,196,0.5));
  color: var(--ghost);
  border: 1px solid rgba(78,205,196,0.6);
}
.action-btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(78,205,196,0.3);
}
.action-btn--ghost {
  background: transparent;
  color: var(--silver);
  border: 1px solid rgba(136,136,170,0.4);
}
.action-btn--ghost:hover {
  color: var(--ghost);
  border-color: var(--teal);
  box-shadow: 0 0 24px rgba(78,205,196,0.2);
}

.help-modal-content {
  max-width: 460px;
}

.site-footer {
  position: relative;
  z-index: 1;
  margin-top: auto;
  width: 100%;
  max-width: 100%;
  padding: 1.5rem 1.5rem 1rem;
  font-size: 0.72rem;
  line-height: 1.5;
  color: rgba(136,136,170,0.74);
  letter-spacing: 0.03em;
  background: linear-gradient(180deg, transparent, rgba(8,8,16,0.4));
  border-top: 1px solid rgba(123,94,167,0.1);
}
.site-footer__main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
  text-align: center;
}
.site-footer__text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.site-footer__text p {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.4;
}
.site-footer__links {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}
.site-footer__links a {
  color: rgba(136,136,170,0.85);
  text-decoration: none;
  font-size: 0.75rem;
  transition: color 0.3s;
}
.site-footer__links a:hover {
  color: var(--teal);
}
.site-footer__links .separator {
  color: rgba(136,136,170,0.4);
  font-size: 0.75rem;
  user-select: none;
}
.site-footer__copyright {
  text-align: center;
  font-size: 0.68rem;
  color: rgba(136,136,170,0.55);
  padding-top: 0.6rem;
}
.powered-by {
  margin-top: 1.4rem;
  text-align: center;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: rgba(136,136,170,0.7);
  letter-spacing: 0.04em;
}
.powered-by .about-link {
  color: rgba(78,205,196,0.75);
  text-decoration-color: rgba(78,205,196,0.6);
  text-decoration-thickness: 1.5px;
  font-weight: 500;
}
.powered-by .about-link:hover {
  color: var(--teal);
  text-decoration-color: var(--teal);
}

.about-modal-content {
  max-width: 520px;
}

/* ============ MODAL ============ */
.modal-wrap,
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.3s ease;
}
.modal-content {
  position: relative;
  z-index: 1;
  background: linear-gradient(165deg, rgba(20,20,34,0.95), rgba(15,15,26,0.92));
  border: 1px solid rgba(123,94,167,0.4);
  border-radius: 18px;
  padding: 1.8rem 2.2rem;
  max-width: 620px;
  width: 100%;
  max-height: 95vh;
  overflow-y: auto;
  box-shadow: 0 40px 100px rgba(0,0,0,0.7);
  animation: slideUp 0.4s ease both;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255,255,255,0.05);
  color: var(--silver);
  font-size: 1.8rem;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.modal-close:hover {
  background: rgba(255,77,109,0.2);
  color: var(--crimson);
  transform: rotate(90deg);
}
.modal-title {
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--teal);
  text-align: center;
  margin: 0 0 1.5rem;
  letter-spacing: 0.05em;
}
.modal-body {
  color: var(--silver);
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.7;
}
.modal-body p {
  margin: 0 0 1rem;
}
.modal-body strong {
  color: var(--teal);
  font-weight: 500;
}
.modal-subtitle {
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--indigo);
  margin: 1.4rem 0 0.8rem;
  letter-spacing: 0.05em;
}
.modal-divider {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(123,94,167,0.3), transparent);
  margin: 1.6rem 0;
}
.modal-footer {
  text-align: center;
  font-style: italic;
  color: var(--nebula);
  margin: 1.6rem 0 1.2rem !important;
  font-size: 1rem;
}
.modal-btn {
  display: block;
  width: 100%;
  max-width: 200px;
  margin: 0 auto;
  padding: 0.9rem 2rem;
  background: linear-gradient(135deg, var(--indigo), var(--teal));
  border: none;
  border-radius: 12px;
  color: var(--void);
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 16px rgba(78,205,196,0.3);
}
.modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(78,205,196,0.5);
}

/* ============ MEANING MODAL ============ */
.meaning-modal-content {
  max-width: 520px;
  text-align: center;
}
.meaning-header {
  margin-bottom: 0.2rem;
}
.meaning-hex-name {
  font-family: var(--display);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-shadow: 0 0 20px rgba(244,196,48,0.3);
  margin-bottom: 0.4rem;
}
.meaning-hex-en {
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--teal);
  letter-spacing: 0.1em;
  margin-bottom: 0.6rem;
}
.meaning-hex-image {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--nebula);
  letter-spacing: 0.04em;
}
.meaning-body {
  padding: 0.4rem 0;
}
.meaning-essence {
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.85;
  color: var(--ghost);
  text-align: center;
  margin: 0;
}
.meaning-disclaimer {
  text-align: left;
  padding: 0 0.2rem;
}
.meaning-disclaimer p {
  font-family: var(--serif);
  font-size: 0.88rem;
  line-height: 1.65;
  color: rgba(200,200,220,0.85);
  margin: 0 0 0.6rem;
}
.meaning-disclaimer strong {
  color: var(--nebula);
  font-weight: 500;
}

/* ============ CONCEPT MODAL ============ */
.concept-modal-content {
  max-width: 540px;
  text-align: left;
}
.concept-header {
  text-align: center;
  margin-bottom: 0.2rem;
}
.concept-title {
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--teal);
  letter-spacing: 0.1em;
  margin-bottom: 0.4rem;
}
.concept-subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.92rem;
  color: var(--nebula);
}
.concept-body {
  padding: 0.4rem 0;
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--silver);
}
.concept-body p {
  margin: 0 0 0.9rem;
}
.concept-body strong {
  color: var(--teal);
  font-weight: 500;
}

@media (max-width: 560px) {
  .brand__title { font-size: 1.9rem; }
  .intro { font-size: 1.15rem; }
  .stage--result { padding: 1.5rem; }
  .hexagram-block { gap: 1rem; }
  .dimensions li { grid-template-columns: 1.4rem 1fr; }
  .dim__label { display: none; }
  
  /* navigation stacks on mobile */
  .site-nav {
    flex-direction: column;
    gap: 0.8rem;
    padding: 0.6rem 1rem;
  }
  .site-nav__links {
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
  }
  .site-nav__link {
    font-size: 0.8rem;
  }
  
  /* dropdown adjustments for mobile */
  .site-nav__dropdown-menu {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    top: auto;
    min-width: calc(100vw - 2rem);
    max-width: 320px;
  }
  
  .site-nav__dropdown-item {
    padding: 0.7rem 0.8rem;
  }
  
  .dropdown-icon {
    font-size: 1.3rem;
  }
  
  .site-nav__dropdown-item strong {
    font-size: 0.85rem;
  }
  
  .site-nav__dropdown-item small {
    font-size: 0.7rem;
  }
  
  /* footer adjustments on mobile */
  .site-footer {
    padding: 1.2rem 1rem 0.8rem;
  }
  .site-footer__main {
    gap: 0.6rem;
    margin-bottom: 0.6rem;
  }
  .site-footer__text p {
    font-size: 0.7rem;
  }
  .site-footer__links a {
    font-size: 0.7rem;
  }
  .site-footer__copyright {
    font-size: 0.65rem;
  }
  /* proportional centering on compact screens */
  .stage--input {
    min-height: calc(100vh - 200px);
    padding-bottom: clamp(20px, 8vh, 80px);
    padding-top: clamp(100px, 12vh, 140px);
  }
  .stage--result {
    padding-top: 120px;
  }
  .stage--casting {
    min-height: 75vh;
  }

  /* ---- mobile hexagram trio fix ---- */
  .trio-card { padding: 1rem 0.3rem 0.8rem; gap: 0.5rem; overflow: hidden; }
  .hexagram-visual { gap: 4px; }
  .hx-line { gap: 6px; height: 7px; }
  .hx-line__seg { width: 28px; height: 7px; border-radius: 2px; }
  .hx-line.is-yang .hx-line__seg { width: 62px; }
  .hexagram-cn { font-size: 0.85rem; }
  .trio-label { font-size: 0.52rem; }
  .trio-moving { font-size: 0.68rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ============ COOKIE CONSENT BANNER ============ */
.cookie-consent {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  background: linear-gradient(180deg, rgba(20,20,34,0.98), rgba(15,15,26,0.96));
  border-top: 1px solid rgba(123,94,167,0.4);
  backdrop-filter: blur(12px);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
  animation: slideUp 0.5s ease both;
}

.cookie-consent__content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

@media (min-width: 768px) {
  .cookie-consent__content {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
  }
}

.cookie-consent__text {
  flex: 1;
  min-width: 0;
}

.cookie-consent__title {
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--teal);
  margin: 0 0 0.5rem;
  letter-spacing: 0.08em;
}

.cookie-consent__description {
  font-family: var(--sans);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--silver);
  margin: 0;
}

.cookie-consent__actions {
  display: flex;
  gap: 0.8rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.cookie-btn {
  font-family: var(--display);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

.cookie-btn--primary {
  background: linear-gradient(120deg, rgba(123,94,167,0.7), rgba(78,205,196,0.6));
  color: var(--ghost);
  border: 1px solid rgba(78,205,196,0.7);
}

.cookie-btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(78,205,196,0.4);
  background: linear-gradient(120deg, rgba(123,94,167,0.85), rgba(78,205,196,0.75));
}

.cookie-btn--secondary {
  background: transparent;
  color: var(--silver);
  border: 1px solid rgba(136,136,170,0.5);
}

.cookie-btn--secondary:hover {
  color: var(--ghost);
  border-color: var(--nebula);
  background: rgba(136,136,170,0.1);
}

.cookie-btn--ghost {
  background: transparent;
  color: var(--teal);
  border: 1px solid rgba(78,205,196,0.4);
}

.cookie-btn--ghost:hover {
  color: var(--ghost);
  border-color: var(--teal);
  background: rgba(78,205,196,0.15);
}

/* ============ COOKIE SETTINGS MODAL ============ */
.cookie-modal-content {
  max-width: 580px;
}

.cookie-intro {
  font-size: 0.95rem;
  color: var(--silver);
  margin-bottom: 1.5rem;
  font-style: italic;
}

.cookie-category {
  margin-bottom: 1.2rem;
  padding: 1rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(123,94,167,0.2);
  border-radius: 12px;
}

.cookie-category__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.cookie-category__info {
  flex: 1;
  min-width: 0;
}

.cookie-category__title {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ghost);
  margin: 0 0 0.4rem;
  letter-spacing: 0.06em;
}

.cookie-category__desc {
  font-family: var(--sans);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--nebula);
  margin: 0;
}

.cookie-toggle {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
  flex-shrink: 0;
}

.cookie-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cookie-toggle__slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(136,136,170,0.3);
  border-radius: 26px;
  transition: all 0.3s;
  border: 1px solid rgba(136,136,170,0.4);
}

.cookie-toggle__slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--silver);
  border-radius: 50%;
  transition: all 0.3s;
}

.cookie-toggle input:checked + .cookie-toggle__slider {
  background: linear-gradient(120deg, var(--indigo), var(--teal));
  border-color: var(--teal);
}

.cookie-toggle input:checked + .cookie-toggle__slider:before {
  transform: translateX(24px);
  background-color: var(--ghost);
}

.cookie-toggle input:disabled + .cookie-toggle__slider {
  background: rgba(123,94,167,0.3);
  border-color: rgba(123,94,167,0.4);
  cursor: not-allowed;
}

.cookie-toggle input:disabled + .cookie-toggle__slider:before {
  background-color: var(--nebula);
}

.cookie-modal-actions {
  display: flex;
  justify-content: center;
  margin-top: 0.5rem;
}

@media (max-width: 560px) {
  .cookie-consent__content {
    padding: 1.2rem 1rem;
  }
  
  .cookie-consent__title {
    font-size: 1rem;
  }
  
  .cookie-consent__description {
    font-size: 0.85rem;
  }
  
  .cookie-btn {
    padding: 0.6rem 1rem;
    font-size: 0.75rem;
  }
  
  .cookie-category__header {
    flex-direction: column;
    gap: 0.8rem;
  }
  
  .cookie-toggle {
    width: 44px;
    height: 24px;
  }
  
  .cookie-toggle__slider:before {
    height: 16px;
    width: 16px;
  }
  
  .cookie-toggle input:checked + .cookie-toggle__slider:before {
    transform: translateX(20px);
  }
}
