/** @format */

/* ============================= */
/* MODULE STYLESHEETS — pillar 1: main.css is the ONLY stylesheet the Fortune
   Timeline loads. Module-specific CSS lives in jsmodules/ next to its module JS
   and is @imported here. (CSS @imports must precede all other rules.) */
/* ============================= */
@import url("jsmodules/OuijaSentence.css");
@import url("jsmodules/NineStarKi.css");
@import url("jsmodules/Tarot.css?v=2");
@import url("jsmodules/ChaosBirthstone.css?v=2");
@import url("jsmodules/Yukhyo.css");
@import url("jsmodules/PeriodicElement.css?v=2");
@import url("jsmodules/Zodiac.css?v=2");
@import url("jsmodules/Cloud9.css?v=2");
@import url("jsmodules/Icosahedron.css");
@import url("jsmodules/Voodoo.css?v=3");
@import url("jsmodules/Nostradamus.css");
@import url("jsmodules/DukeOfZhou.css");
@import url("jsmodules/Thoth.css?v=2");
@import url("jsmodules/Confucius.css");
@import url("jsmodules/CrystalBall.css?v=2");
@import url("jsmodules/FinalFortune.css?v=2");
@import url('./jsmodules/Omikuji.css?v=1');
@import url("jsmodules/CrtOverlay.css?v=2");

/* Master containing borders (2026-08-28 polish pass — the owner's
   "same organization style of having a fully containing border").
   Every oracle stage sits inside ONE fully containing bordered
   container; each module overrides the accent (border-color /
   background / glow) in its own jsmodules CSS. */
.oracle-master {
  margin: 24px 0;
  padding: 18px 14px;
  border: 2px solid #b8912f;
  border-radius: 14px;
  background: #0f0c14;
  box-shadow: 0 0 26px rgba(0, 0, 0, 0.85);
}

@media (max-width: 480px) {
  .oracle-master {
    padding: 12px 8px;
  }
}

/* Module menu bar (2026-08-28 owner ruling: inside the main timeline div,
   not the header; 2026-08-28 pass 2: flush to the container's top edge
   (negative margins cancel #timeline-container's padding) and full-width,
   redesigned to the Oracle's own aesthetic — deep plum-violet glass, gold
   Pirata One lettering, the gradient under-glow instead of the launcher's
   gray bar. */
.timeline-menu {
  /* width calc(100% + the container's 2×1rem horizontal padding) + the
     negative margins — the bar truly spans the container edge-to-edge. */
  width: calc(100% + 2rem);
  box-sizing: border-box;
  position: relative;
  margin: -2rem -1rem 18px -1rem;
  padding: 10px 18px 12px 18px;
  background:
    radial-gradient(ellipse at 50% -80%, rgba(154, 123, 255, 0.22), transparent 65%),
    radial-gradient(ellipse at 15% 120%, rgba(255, 215, 0, 0.12), transparent 50%),
    linear-gradient(180deg, #1a1226 0%, #0e0918 60%, #070510 100%);
  border-bottom: 2px solid;
  border-image: linear-gradient(90deg, rgba(154, 123, 255, 0.9), #d4af37, rgba(154, 123, 255, 0.9)) 1;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.6), 0 0 26px rgba(154, 123, 255, 0.12);
}
.timeline-menu::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 2px, transparent 2px 5px);
}
.timeline-menu-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  padding: 0;
  margin: 0;
  justify-content: center;
  align-items: center;
  gap: 6px 22px;
  position: relative;
  z-index: 10; /* above .timeline-btn-center's strip (z 5) so the open
                 dropdowns are never covered by the cast-button row */
}
.timeline-menu-link,
.timeline-menu-toggle {
  font-family: 'Pirata One', 'Liberation Serif', serif;
  font-weight: 400;
  font-style: normal;
  font-size: 16px;
  letter-spacing: 1.5px;
  line-height: 1.15;
  white-space: nowrap;
  text-decoration: none;
  color: #d8c58a;
  padding: 3px 10px;
  border-radius: 6px;
  background: transparent;
  transition: color 0.25s, text-shadow 0.25s, background 0.25s;
}
.timeline-menu-link:hover,
.timeline-menu-dropdown:focus-within .timeline-menu-toggle {
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.55);
  background: rgba(154, 123, 255, 0.12);
  cursor: pointer;
}
.timeline-menu-active {
  color: #ffd700;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
  border-bottom: 2px solid;
  border-image: linear-gradient(90deg, #9a7bff, #ffd700) 1;
  border-radius: 0;
}
.timeline-menu-dropdown {
  position: relative;
}
.timeline-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}
.timeline-menu-zh {
  font-family: 'Noto Serif KR', serif;
  font-size: 15px;
  color: #9a7bff;
}
.timeline-menu-dropdown-list {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 230px;
  margin: 0; /* no gap between the toggle and the list — a margin dead-zone
                drops :hover mid-path and closes the dropdown (the visual
                spacing lives in the padding below) */
  padding: 14px 0 8px 0;
  list-style: none;
  display: none;
  z-index: 60;
  background: linear-gradient(180deg, #171022 0%, #08050f 100%);
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7), 0 0 18px rgba(154, 123, 255, 0.18);
}
.timeline-menu-dropdown:hover .timeline-menu-dropdown-list,
.timeline-menu-dropdown:focus-within .timeline-menu-dropdown-list {
  display: block;
}
.timeline-menu-dropdown-list li {
  margin: 0;
}
.timeline-menu-dropdown-list .timeline-menu-link {
  display: block;
  padding: 6px 16px;
  font-size: 14.5px;
  letter-spacing: 1px;
}
.timeline-menu-dropdown-list .timeline-menu-link:hover {
  color: #ffd700;
  background: rgba(154, 123, 255, 0.16);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.45);
}
@media (max-width: 640px) {
  .timeline-menu {
    margin: -1.2rem -0.4rem 14px -0.4rem;
    width: calc(100% + 0.8rem);
    padding: 8px 8px 10px 8px;
  }
  .timeline-menu-list {
    gap: 4px 10px;
  }
  .timeline-menu-link,
  .timeline-menu-toggle {
    font-size: 13.5px;
    letter-spacing: 1px;
    padding: 2px 6px;
  }
}


/* The Forged Quantum Serial — its own fully containing frame
   (green terminal accent matching the seal's phosphor green).
   2026-08-28 pass 2 (owner: the blank pre-cast div was awkward):
   the frame now reads as a POWERED-DOWN CRT terminal (glass
   reflection, scanlines, a dim ● STANDBY) and reserves its full
   height BEFORE the cast, so nothing shifts when the seal types.
   On cast the tube powers on (flash → line collapse → field
   expansion → settle) and then the serial types in normally. */
.quantum-serial-master {
  margin: 24px 0;
  padding: 18px 14px;
  border: 2px solid #19ff19;
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(25, 255, 25, 0.05), transparent 70%),
    #040a04;
  box-shadow: 0 0 26px rgba(0, 0, 0, 0.85), 0 0 18px rgba(25, 255, 25, 0.1);
  position: relative;
  overflow: hidden;
  /* the terminal reserves its full ~3-line height from the start —
     the seal types INTO reserved space, never pushing the layout */
  min-height: 138px;
  box-sizing: border-box;
}

/* the glass + scanlines — the tube is there even when powered down */
.quantum-serial-master::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.05) 0%, transparent 34%),
    repeating-linear-gradient(0deg, rgba(25, 255, 25, 0.03) 0 2px, transparent 2px 8px);
  border-radius: 12px;
}

/* the standby LED — fades away once the tube is on */
.quantum-serial-master::after {
  content: '● STANDBY';
  position: absolute;
  right: 14px;
  bottom: 10px;
  font-family: "OCR A Std", "OCR-A", "Consolas", "Courier New", monospace;
  font-size: 0.66em;
  letter-spacing: 0.14em;
  color: rgba(25, 255, 25, 0.5);
  text-shadow: 0 0 7px rgba(25, 255, 25, 0.35);
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.quantum-serial-master.powered::after {
  opacity: 0;
}

/* the CRT power-on choreography (1.4s): flash → line collapse →
   field expansion → flicker → settle. The serial types in after the
   flash crests. */
.quantum-serial-master.powering-on {
  animation: quantumCrtPowerOn 1.4s ease-out;
}
@keyframes quantumCrtPowerOn {
  0%   { box-shadow: 0 0 26px rgba(0, 0, 0, 0.85), 0 0 18px rgba(25, 255, 25, 0.1); }
  10%  { box-shadow: inset 0 0 70px 34px rgba(130, 255, 130, 0.85), 0 0 26px rgba(0, 0, 0, 0.85); }
  24%  { box-shadow: inset 0 0 120px 12px rgba(25, 255, 25, 0.4), 0 0 26px rgba(0, 0, 0, 0.85); }
  36%  { box-shadow: inset 0 -52px 90px -10px rgba(25, 255, 25, 0.28), inset 0 52px 90px -10px rgba(25, 255, 25, 0.28), 0 0 26px rgba(0, 0, 0, 0.85); }
  58%  { box-shadow: inset 0 0 150px 4px rgba(25, 255, 25, 0.26), 0 0 26px rgba(0, 0, 0, 0.85); }
  74%  { box-shadow: inset 0 0 90px 0 rgba(25, 255, 25, 0.15), 0 0 26px rgba(0, 0, 0, 0.85); }
  90%  { box-shadow: inset 0 0 55px 0 rgba(25, 255, 25, 0.1), 0 0 26px rgba(0, 0, 0, 0.85); }
  100% { box-shadow: inset 0 0 26px 0 rgba(25, 255, 25, 0.05), 0 0 26px rgba(0, 0, 0, 0.85), 0 0 18px rgba(25, 255, 25, 0.1); }
}

@media (max-width: 480px) {
  .quantum-serial-master {
    padding: 12px 8px;
    min-height: 126px;
  }
}


.timeline-flex-spacer {
  flex: 1;
}

/* Design tokens */
:root {
  --imperial-gold: #ffd700;
  --shadow-purple: #b478ff;
}
/** @format */

/* Timeline layout: single consolidated rule */
.timeline-flex-row {
  display: flex;
  justify-content: flex-start; /* keep content left-aligned; button will be absolutely centered */
  align-items: flex-start;
  margin-bottom: 10px;
  width: 100%;
  position: relative; /* establish containing block for absolute centering */
}

/* Coin and fortune cookie row (placed under the form) */
.coin-cookie-row {
  display: flex;
  gap: 1.5em;
  margin-top: 0px;
  justify-content: center; /* center all items */
  align-items: flex-start;
  flex-wrap: wrap;
  position: relative;
}

.coin-cookie-row #coin-flip-container {
  order: 1;
  flex: 0 0 auto;
  position: absolute;
  left: 0;
}

.coin-cookie-row #martian-clock-container {
  order: 2;
  flex: 0 0 auto;
  position: relative; /* keeps it in the normal flow for centering */
}

.coin-cookie-row #fortune-cookie-container {
  order: 3;
  flex: 0 0 auto;
  /* no absolute positioning so it participates in normal flow */
  position: relative;
  right: auto;
  transform: none;
}

/* Prevent the global spacer from pushing coin/cookie to center/right */
.coin-cookie-row .timeline-flex-spacer,
.coin-cookie-row + .timeline-flex-spacer {
  display: none;
}

/* Make the coin itself left-aligned within its container */
#coin-flip-container {
  justify-content: flex-start;
  padding-left: 55px;
}

/* Make timeline row reactive: stack on narrow viewports and scale elements */
@media (max-width: 900px) {
  .timeline-flex-row {
    /* allow items to wrap and stay in a row when possible */
    flex-wrap: wrap;
    justify-content: center;
    gap: 1em;
    /* 2026-08-26: NO left/right margins — width:100% + margin-left shifted
       every row 12px right on phones (the systemic off-center the owner
       reported). The container paddings already provide the gutters. */
  }
  .timeline-flex-spacer {
    display: none;
  }
  .timeline-btn-center {
    position: static;
    transform: none;
    order: 2;
    width: auto;
    margin-top: 3px;
  }
  /* slightly smaller coin on tablet/phone landscape */
  .coin-flip-scene,
  .coin-flip-coin3d,
  .coin-flip-face {
    width: 125px;
    height: 125px;
  }
  .fortune-cookie .fortune-cookie-stage {
    width: 200px;
    height: 160px;
  }
  .fortune-cookie .fortune-cookie-img {
    max-width: 200px;
    max-height: 160px;
  }
  .user-input-form {
    max-width: 520px;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .timeline-flex-row {
    gap: 0.75em;
  }
  .coin-flip-scene,
  .coin-flip-coin3d,
  .coin-flip-face {
    width: 80px;
    height: 80px;
  }
  .fortune-cookie .fortune-cookie-stage {
    width: 150px;
    height: 120px;
  }
  .fortune-cookie .fortune-cookie-img {
    max-width: 150px;
    max-height: 120px;
  }
  .user-input-form {
    width: 95%;
    max-width: 360px;
  }
  .timeline-btn-center { order: 3; }
}

/* User input form (placed between Cast and quantum serial seal) */
.user-input-row {
  display: flex;
  justify-content: center;
  padding-bottom: 20px;
}
.user-input-form {
  background: linear-gradient(180deg,#0e1318 0,#0b0f12 100%);
  border: 1px solid rgba(50,200,120,0.08);
  padding: 10px 12px;
  border-radius: 8px;
  width: 86%;
  max-width: 640px; /* reduced width to avoid overflow */
  margin: 0 auto; /* center within row */
  color: #bfeebb;
  box-shadow: 0 6px 18px rgba(0,0,0,0.6);
}
.user-input-row {
  /* keep the user-input-row full width but center its contents */
  width: 100%;
  display: flex;
  justify-content: center;
}
.user-input-form {
  box-sizing: border-box; /* ensure padding doesn't increase visual width */
  /* make form narrower by default and centered */
  width: 86%;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}
.user-input-label {
  display:block;
  color: var(--imperial-gold,#ffd700);
  font-weight:700;
  margin-bottom:8px;
}
.user-dream-input {
  width:100%;
  min-height:56px;
  resize:vertical;
  padding:8px 10px;
  background: rgba(255,255,255,0.02);
  border:1px solid rgba(255,255,255,0.04);
  color: #e6f8e6;
  border-radius:6px;
  margin-bottom:10px;
}
.user-dream-input{box-sizing:border-box;max-width:100%;}
.birth-grid{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}
.birth-field{
  display:flex;
  flex-direction:column;
}
.birth-select, .birth-time-input{
  padding:6px 8px;
  border-radius:6px;
  border:1px solid rgba(255,255,255,0.04);
  background: rgba(0,0,0,0.25);
  color:#e6fff0;
  box-sizing:border-box;
  width:100%;
}
.birth-field{flex:1 1 110px;min-width:80px;}
.user-input-actions{
  margin-top:10px;
  display:flex;
  justify-content:flex-end;
}
.cast-  btn.small{
  width:92px;
  height:36px;
  font-size:0.9em;
}

/* Nine Star Ki Oracle Section */
#nine-star-ki-oracle-section {
  margin: 20px 0;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#nine-star-ki-oracle-section.hidden {
  opacity: 0;
  visibility: hidden;
}

.nsk-container {
  margin: 28px 0;
  padding: 18px 14px;
  border: 2.5px solid #22ddaa;
  border-radius: 14px;
  background: #0f1214;
  box-shadow: 0 0 24px #000;
  color: #ccefe6;
}

.nsk-title {
  font-weight: bold;
  font-size: 16pt;
  margin-bottom: 10px;
  color: #22ddaa;
  text-align: center;
}

.nsk-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}

.nsk-badge {
  flex: 1;
  min-width: 170px;
  border: 1.5px solid #22ddaa;
  border-radius: 10px;
  padding: 10px;
  margin: 6px;
  background: rgba(34, 221, 170, 0.05);
}

.nsk-badge-label {
  font-size: 11px;
  color: #88bfb2;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.nsk-badge-number {
  font-size: 22px;
  font-weight: 800;
  color: #22ddaa;
}

.nsk-badge-meta {
  font-size: 12px;
  color: #a6e7d6;
}

.nsk-info-section {
  margin-top: 12px;
  padding: 10px;
  border: 1px dashed #22ddaa;
  border-radius: 10px;
  background: rgba(34, 221, 170, 0.04);
}

.nsk-info-text {
  font-size: 12px;
  color: #88bfb2;
}

.nsk-info-note {
  font-size: 11px;
  color: #66bfa6;
  margin-top: 4px;
}

.nsk-caption {
  font-size: 11px;
  color: #559d8b;
  margin-top: 8px;
}

.nsk-calculation-info {
  font-size: 10px;
  color: #4aa28e;
  margin-top: 8px;
}

.nsk-fallback-info {
  margin-top: 12px;
  padding: 10px;
  border: 1px dashed #22ddaa;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(34, 221, 170, 0.06), rgba(170, 136, 255, 0.06));
}

.nsk-fallback-text {
  color: #aee9dd;
  font-size: 12px;
}

.nsk-fallback-note {
  color: #7fdcc4;
  font-size: 12px;
  margin-top: 4px;
}

.nsk-trigram-container {
  margin-top: 14px;
  display: flex;
  justify-content: center;
}

/* Trigram crest styles */
.ns-trigram-crest {
  --trigram-color: #e11d2e;
  --trigram-bg: #0f1214;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border: 2px solid var(--trigram-color);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(225, 29, 46, 0.06), rgba(225, 29, 46, 0.03));
  box-shadow: inset 0 0 0 1px rgba(225, 29, 46, 0.12), 0 0 22px rgba(225, 29, 46, 0.12);
}

.ns-trigram-label {
  font-size: 11px;
  letter-spacing: 0.5px;
  color: #ffb6bf;
  text-transform: uppercase;
}

.ns-trigram-name {
  font-weight: 800;
  font-size: 13px;
  color: #ff8a94;
}

.ns-trigram-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0;
  width: 180px;
}

.ns-trigram-line {
  height: 12px;
  border-radius: 8px;
  background: var(--trigram-color);
  position: relative;
  overflow: hidden;
}

.ns-trigram-line.yin {
  background: linear-gradient(
    to right,
    var(--trigram-color) 0%,
    var(--trigram-color) 38%,
    var(--trigram-bg) 38%,
    var(--trigram-bg) 62%,
    var(--trigram-color) 62%,
    var(--trigram-color) 100%
  );
  box-shadow:
    inset 0 0 0 1px rgba(225, 29, 46, 0.06),
    inset 0 0 0 10px transparent;
}

.ns-trigram-meta {
  font-size: 11px;
  color: #ffb6bf;
  opacity: 0.9;
}

/* Center trigram special styling */
.ns-trigram-center-glyph {
  display: grid;
  place-items: center;
  width: 180px;
  height: 72px;
}

.ns-trigram-center-outer {
  width: 88px;
  height: 44px;
  border: 3px solid var(--trigram-color);
  border-radius: 8px;
  position: relative;
}

.ns-trigram-center-inner {
  position: absolute;
  inset: 8px;
  border: 2px solid var(--trigram-color);
  border-radius: 6px;
}

.ns-trigram-center-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  background: var(--trigram-color);
  border-radius: 50%;
}

/* Celestial Map Styles */
.nsk-celestial-container {
  margin-top: 35px;
  padding: 24px 16px 16px 16px;
  border: 1px solid rgba(34, 221, 170, 0.2);
  border-radius: 10px;
  background: rgba(34, 221, 170, 0.02);
}

.nsk-celestial-title {
  color: #22ddaa;
  text-align: center;
  margin-bottom: 20px;
  margin-top: 8px;
  font-size: 18px;
}

.nsk-celestial-map {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  min-height: 300px;
  margin: 15px 0;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(34, 221, 170, 0.1);
  background: #0f1214;
}

.nsk-celestial-info {
  text-align: center;
  color: #88bfb2;
  font-size: 12px;
  margin-top: 15px;
  line-height: 1.4;
}

/* Celestial map legend (top-right overlay — 2026-08-28: moved from the
   bottom-right per owner ruling; the top of the map has more room) */
.nsk-celestial-legend {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 10;
  pointer-events: none;
  background: rgba(10, 14, 16, 0.85);
  border: 1px solid rgba(34, 221, 170, 0.35);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: monospace;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.nsk-legend-title {
  color: #22ddaa;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.5px;
  margin: 4px 0;
}

.nsk-legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
}

.nsk-legend-chip {
  font-size: 10px;
  color: #ccefe6;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nsk-legend-chip::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chip);
  box-shadow: 0 0 6px var(--chip);
}

.nsk-legend-item {
  font-size: 10px;
  color: #ccefe6;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nsk-legend-ring {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px dashed #22ddaa;
}

.nsk-legend-ring.pulse {
  border-style: dashed;
  box-shadow: 0 0 6px rgba(34, 221, 170, 0.8);
  animation: nsk-legend-pulse 1.6s ease-in-out infinite;
}

@keyframes nsk-legend-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.6; }
}

/* Star modal animations */
@keyframes nsk-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes nsk-slide-in {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Responsive Celestial Map */
@media (max-width: 900px) {
  .nsk-celestial-container {
    padding: 20px 12px 12px 12px;
    margin-top: 30px;
  }
}

@media (max-width: 768px) {
  .user-input-form{max-width:100%; padding:10px}
  .birth-grid{gap:6px}
  .birth-field{flex:1 1 100%;}
  
  .nsk-celestial-container {
    padding: 16px 8px 8px 8px;
    margin-top: 25px;
  }
  
  .nsk-celestial-title {
    font-size: 16px;
    margin-top: 4px;
  }
  
  .nsk-celestial-info {
    font-size: 11px;
    padding: 0 5px;
  }
}

@media (max-width: 480px) {
  /* 2026-08-26 mobile pass: reclaim the horizontal room the desktop
     paddings eat on phones — every stage gets the full 390px to work with. */
  main {
    padding: 0.5rem;
  }
  #timeline-container {
    padding: 1.2rem 0.4rem;
  }

  .nsk-celestial-container {
    padding: 12px 6px 6px 6px;
    margin-top: 20px;
  }
  
  .nsk-celestial-title {
    font-size: 14px;
    margin-bottom: 12px;
    margin-top: 2px;
  }
  
  .nsk-celestial-legend {
    right: 6px;
    bottom: 6px;
    top: auto; /* clear the desktop top anchor — top+bottom together
                  stretched the panel over the whole map (2026-08-29 fix) */
    padding: 6px 8px;
  }
  
  .nsk-legend-chip,
  .nsk-legend-item {
    font-size: 9px;
  }
}

.timeline-btn-center {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  position: relative; /* keep in normal flow so it won't be pushed */
  transform: none;
  left: auto;
  z-index: 5; /* sit above generated content but remain in document flow */
}

/* Square cast button */
.cast-hexagram-btn {
  width: 300px;
  height: 300px;
  border-radius: 8px; /* small rounding to match image if needed */
  background: transparent; /* no background around image */
  color: inherit;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none; /* remove surrounding glow/outline */
  padding: 0; /* ensure image fits exactly */
}
.cast-hexagram-btn .cast-label {
  font-size: 0.95em;
}
.cast-hexagram-btn .cast-sub {
  font-size: 1.2em;
  margin-top: 4px;
  color: #ffd700;
}
#coin-flip-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

#quantum-serial-seal {
  /* Hidden by default so it does not occupy layout space before activation */
  display: none;
  text-align: left;
  font-weight: bold;
  font-size: 1.13em;
  letter-spacing: 0.04em;
  font-family: "OCR A Std", "OCR-A", "Consolas", "Courier New", monospace;
  color: #19ff19;
  z-index: 1;
}

/* When visible, restore display and preserve the intended spacing/margins */
#quantum-serial-seal.visible {
  display: block;
  visibility: visible;
  margin: 2.5em 0 1.2em 0.2em; /* merged from inline style */
  margin-top: 2.5em;
}

/* 2026-08-28: inside the new master frame the 2.5em top margin is excessive */
.quantum-serial-master #quantum-serial-seal.visible {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

/* Quantum Serial / Forged Seal text pieces (migrated from inline styles) */
.quantum-seal-prefix {
  display: inline-block;
  font-size: 0.665em;
  color: #0f0;
  margin-bottom: 0.1em;
  vertical-align: middle;
}
.quantum-seal-subtext {
  display: inline-block;
  font-size: 0.59em;
  color: gray;
  margin-bottom: 0.3em;
}
.quantum-seal-digit {
  font-size: 0.96em;
  color: #19ff19;
  vertical-align: middle;
}
.quantum-seal-letter {
  font-size: 0.96em;
  color: #fff;
}
.quantum-seal-tilde {
  font-size: 0.96em;
  color: #19ff19;
}
.quantum-seal-digit-power {
  font-size: 1.22em;
  color: #ff2a2a;
  vertical-align: middle;
  font-weight: bold;
}

/* Temporary typing line containers to reserve layout while the seal types out */
.quantum-line {
  display: block;
  line-height: 1.2;
  margin: 0.1em 0;
  white-space: pre-wrap;
  font-family: "OCR A Std", "OCR-A", "Consolas", "Courier New", monospace;
}
.quantum-line * {
  display: inline;
}
.quantum-line-1 { font-size: 0.96em; color: #0f0; }
.quantum-line-2 { font-size: 0.86em; color: gray; }
.quantum-line-3 { font-size: 1.02em; color: #19ff19; font-weight: 700; }

/* When the fortune cookie container is placed near the end of the document
   we want it centered and visually separated from the hexagram output. */
#fortune-cookie-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 1.5em 0 3em 0; /* give breathing room */
}

/* 2026-08-26: the legacy base margin pushed the cookie right of center on
   phones ("knocked to the right") — keep the desktop look, center on mobile. */
@media (max-width: 768px) {
  .fortune-cookie#fortune-cookie-container {
    margin-left: 0;
  }
}

.fortune-cookie {
  text-align: center; /* ensure inner content is centered */
}

/* Imperial Wisdom title card (migrated from inline styles) */
.iching-title-card {
  text-align: center;
  padding: 20px;
  margin: -10px -10px 20px -10px;
  background: linear-gradient(
    135deg,
    rgba(255, 215, 0, 0.15),
    rgba(255, 165, 0, 0.1)
  );
  border: 2px solid rgba(255, 215, 0, 0.4);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  background-image: linear-gradient(
      135deg,
      rgba(255, 215, 0, 0.15),
      rgba(255, 165, 0, 0.1)
    ),
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 20px,
      rgba(255, 215, 0, 0.05) 20px,
      rgba(255, 215, 0, 0.05) 40px
    );
}
.iching-title-heading {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 8px;
  color: #ffd700;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
  letter-spacing: 2px;
}
.iching-title-sub {
  font-size: 24px;
  margin-top: 5px;
  filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.6));
}

/* Hexagram card and visual components */
.hexagram-card {
  border-radius: 12px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.hexagram-card.primary {
  background: linear-gradient(
    135deg,
    rgba(30, 30, 60, 0.9),
    rgba(60, 30, 90, 0.7)
  );
  border: 2px solid rgba(255, 215, 0, 0.4);
  box-shadow: 0 8px 32px rgba(255, 215, 0, 0.2);
}
.hexagram-card-header {
  background: linear-gradient(
    90deg,
    rgba(255, 215, 0, 0.1),
    rgba(255, 165, 0, 0.05)
  );
  margin: -10px -10px 15px -10px;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
}
.hexagram-card-title {
  color: var(--imperial-gold, #ffd700);
  margin: 0;
  font-size: 18px;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}
.hexagram-card-subtitle {
  color: #ddd;
  font-size: 16px;
  margin-top: 5px;
}
.hexagram-visual {
  display: flex;
  justify-content: center;
  margin: 15px 0;
}
.hexagram-visual .placeholder {
  width: 180px;
  height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.4));
  border: 3px solid var(--imperial-gold, #ffd700);
  border-radius: 12px;
  box-shadow: rgba(255, 215, 0, 0.25) 0 0 25px,
    rgba(255, 255, 255, 0.1) 0 1px 0 inset;
  padding: 15px;
  position: relative;
  transition: 0.3s;
  cursor: default;
}
.hexagram-visual-badge {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  font-weight: bold;
  color: var(--imperial-gold, #ffd700);
  text-shadow: var(--imperial-gold, #ffd700) 0 0 12px;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 8px;
  border-radius: 4px;
}
.hexagram-visual-caption {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 15px;
  font-weight: bold;
  color: var(--imperial-gold, #ffd700);
  text-shadow: 0 0 15px var(--imperial-gold, #ffd700);
}
.hexagram-section {
  margin: 15px 0;
}
.hexagram-section-body.italic {
  font-style: italic;
}

/* Cast button image styling */
.cast-hexagram-btn img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 300px;
  border-radius: 12px;
  object-fit: contain;
}

/* Accessibility helper */
.visually-hidden {
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap; /* prevent wrap */
}

/* Make sure cast button background doesn't conflict with image */
.cast-hexagram-btn {
  background: transparent;
  padding: 0;
}
/* Grid layout for the primary/shadow hexagram cards */
.iching-wisdom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 20px 0;
}

@media (max-width: 768px) {
  .iching-wisdom-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
}

.hexagram-section-title {
  color: var(--imperial-gold, #ffd700);
  font-weight: bold;
  margin-bottom: 8px;
}
/* Shadow hexagram card styles (migrated from inline styles) */
.hexagram-card.shadow {
  background: linear-gradient(
    135deg,
    rgba(60, 30, 60, 0.9),
    rgba(90, 30, 60, 0.7)
  );
  border: 2px solid rgba(180, 120, 255, 0.4);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(180, 120, 255, 0.2);
  position: relative;
  overflow: hidden;
}
.hexagram-card.shadow .hexagram-card-header {
  background: linear-gradient(
    90deg,
    rgba(180, 120, 255, 0.1),
    rgba(160, 100, 255, 0.05)
  );
  margin: -10px -10px 15px -10px;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
}
.hexagram-card.shadow .hexagram-card-header h3 {
  color: #b478ff;
  margin: 0;
  font-size: 18px;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(180, 120, 255, 0.8);
}
.hexagram-card.shadow .hexagram-card-subtitle {
  color: #ddd;
  font-size: 16px;
  margin-top: 5px;
}
.hexagram-visual.shadow {
  display: flex;
  justify-content: center;
  margin: 15px 0;
}

/* Override styles for the dynamically-generated shadow hexagram visual.
   These use stronger rules to ensure visual parity even if the generator
   writes inline styles. */
#shadow-hexagram-visual > div {
  width: 180px !important;
  height: 180px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  background: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.6),
    rgba(0, 0, 0, 0.4)
  ) !important;
  border: 3px solid var(--shadow-purple, #b478ff) !important;
  border-radius: 12px !important;
  box-shadow: rgba(180, 120, 255, 0.25) 0 0 25px,
    rgba(255, 255, 255, 0.1) 0 1px 0 inset !important;
  padding: 15px !important;
  position: relative !important;
  transition: 0.3s !important;
  cursor: default !important;
  transform: scale(1) !important;
}

/* Hover effect parity with primary hexagram visual. Use strong specificity
   and !important to override any inline styles the generator may add. */
#shadow-hexagram-visual > div:hover {
  transform: scale(1.03) !important;
  box-shadow: rgba(180, 120, 255, 0.35) 0 0 32px,
    rgba(255, 255, 255, 0.12) 0 1px 0 inset !important;
}

#shadow-hexagram-visual .hexagram-visual-badge,
#shadow-hexagram-visual > div > div:first-child {
  position: absolute !important;
  top: 8px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  font-size: 14px !important;
  font-weight: bold !important;
  color: var(--shadow-purple, #b478ff) !important;
  text-shadow: var(--shadow-purple, #b478ff) 0 0 12px !important;
  background: rgba(0, 0, 0, 0.3) !important;
  padding: 4px 8px !important;
  border-radius: 4px !important;
}

#shadow-hexagram-visual .hexagram-visual-caption,
#shadow-hexagram-visual > div > div:last-child {
  position: absolute !important;
  bottom: 6px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  font-size: 15px !important;
  font-weight: bold !important;
  color: var(--shadow-purple, #b478ff) !important;
  text-shadow: var(--shadow-purple, #b478ff) 0 0 15px !important;
}

/* Primary hexagram visual overrides to restore mouseover parity with the shadow */
#primary-hexagram-visual > div {
  width: 180px !important;
  height: 180px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  background: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.6),
    rgba(0, 0, 0, 0.4)
  ) !important;
  border: 3px solid var(--imperial-gold, #ffd700) !important;
  border-radius: 12px !important;
  box-shadow: rgba(255, 215, 0, 0.25) 0 0 25px,
    rgba(255, 255, 255, 0.1) 0 1px 0 inset !important;
  padding: 15px !important;
  position: relative !important;
  transition: 0.3s !important;
  cursor: default !important;
  transform: scale(1) !important;
}

#primary-hexagram-visual > div:hover {
  transform: scale(1.03) !important;
  box-shadow: rgba(255, 215, 0, 0.35) 0 0 32px,
    rgba(255, 255, 255, 0.12) 0 1px 0 inset !important;
}

#primary-hexagram-visual .hexagram-visual-badge,
#primary-hexagram-visual > div > div:first-child {
  position: absolute !important;
  top: 8px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  font-size: 14px !important;
  font-weight: bold !important;
  color: var(--imperial-gold, #ffd700) !important;
  text-shadow: var(--imperial-gold, #ffd700) 0 0 12px !important;
  background: rgba(0, 0, 0, 0.3) !important;
  padding: 4px 8px !important;
  border-radius: 4px !important;
}

#primary-hexagram-visual .hexagram-visual-caption,
#primary-hexagram-visual > div > div:last-child {
  position: absolute !important;
  bottom: 6px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  font-size: 15px !important;
  font-weight: bold !important;
  color: var(--imperial-gold, #ffd700) !important;
  text-shadow: var(--imperial-gold, #ffd700) 0 0 15px !important;
}
.hexagram-section-body {
  color: #ccc;
  font-size: 14px;
  line-height: 1.4;
}
.mystic-window {
  color: #e6e6e6;
  font-size: 14px;
  line-height: 1.5;
  font-style: italic;
  background: rgba(0, 0, 0, 0.2);
  padding: 10px;
  border-radius: 6px;
  border-left: 3px solid var(--imperial-gold, #ffd700);
}

/* Cosmic Synthesis card migrated from inline styles in JS */
.synthesis-card {
  background: linear-gradient(
    135deg,
    rgba(139, 69, 19, 0.3),
    rgba(160, 82, 45, 0.2)
  );
  border: 2px solid rgba(255, 215, 0, 0.3);
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  text-align: center;
}
.synthesis-title {
  color: #ffd700;
  margin: 0 0 15px 0;
  font-size: 18px;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}
.synthesis-body {
  color: #ddd;
  font-size: 15px;
  line-height: 1.6;
  font-style: italic;
  max-width: 800px;
  margin: 0 auto;
}

/* The Cosmic Synthesis gallery image (owner ruling 2026-08-26): the wide
   Asian-inspired scene sits below the synthesis text. */
.synthesis-image-wrap {
  margin-top: 16px;
}
.synthesis-image {
  width: 100%;
  max-width: 800px;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 10px;
  border: 1px solid rgba(255, 215, 0, 0.25);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}

/* Wrapper previously emitted with inline styles in JS */
.enhanced-wisdom-shell {
  margin: 20px 0;
  padding: 25px;
  background: linear-gradient(
    135deg,
    rgba(139, 69, 19, 0.15),
    rgba(160, 82, 45, 0.15)
  );
  border: 3px solid rgba(218, 165, 32, 0.6);
  border-radius: 15px;
  color: #daa520;
  font-family: "Courier New", monospace;
  box-shadow: 0 0 25px rgba(218, 165, 32, 0.4);
  position: relative;
  overflow: hidden;
}

/* Responsive helpers moved from inline template in thefortunetimeline.js */
.yarrow-bar {
  word-break: break-all;
  overflow-wrap: anywhere;
  white-space: pre-line;
  min-width: 0;
  line-height: 1.1;
}

@media (max-width: 768px) {
  /* Ensure wisdom grid collapses to a single column on small screens */
  .iching-wisdom-display > div:first-child > div:nth-child(2) {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }
  .yarrow-bar {
    min-width: 0 !important;
    font-size: 0.9em !important;
    word-break: break-all !important;
    overflow-wrap: anywhere !important;
    white-space: pre-line !important;
    line-height: 1.1 !important;
  }
}

/* Round details expand/collapse (migrated from inline JS display toggles) */
.round-details-content {
  display: none;
}
.round-details-content.open {
  display: block;
}
/* Styling for the round details containers and toggle button (migrated from inline styles) */
.round-details-container {
  margin: 10px 0;
  border-radius: 12px;
  background: linear-gradient(90deg, #181c24 0%, #3a2d22 60%, #6a4fb6 100%);
  box-shadow: 0 2px 12px 0 #0ff2, 0 2px 8px #ffd70022;
  border: 2px solid #ffd70033;
}
.round-details-toggle {
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: bold;
  background: linear-gradient(90deg, #ffd70022, #6a4fb622);
  color: #4a90e2;
  border: none;
  outline: none;
  cursor: pointer;
  border-radius: 12px 12px 0 0;
  transition: background 0.2s;
  box-shadow: 0 1px 6px #ffd70022;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.round-details-toggle:focus {
  box-shadow: 0 0 0 3px rgba(130, 87, 255, 0.12);
}
.round-details-content {
  padding: 12px 18px 16px 18px;
  background: linear-gradient(90deg, #181818 60%, #222 100%);
  border-radius: 0 0 12px 12px;
}

/* Toggle button internal layout pieces to replace previous inline spans */
.round-details-toggle .toggle-left,
.round-details-toggle .toggle-center,
.round-details-toggle .toggle-right {
  flex: 1;
}
.round-details-toggle .toggle-left {
  text-align: left;
}
.round-details-toggle .toggle-center {
  text-align: center;
}
.round-details-toggle .toggle-right {
  text-align: right;
  color: #aaa;
  font-weight: normal;
}
.meta-silver {
  color: silver;
}

/* Yarrow Stalk Hexagram Diagnostic styles (migrated from inline templates) */
.yarrow-diagnostic {
  margin: 20px 0;
  padding: 20px;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 2px solid #ffd70055;
  border-radius: 12px;
}
.yarrow-title {
  color: #ff0000;
  text-align: center;
  margin: 0 0 20px 0;
  font-size: 1.4em;
  text-shadow: 0 0 5px #000;
}
.yarrow-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.yarrow-list li {
  margin-bottom: 0.5em;
  list-style: none;
}

.line-panel {
  padding: 15px;
  background: #1a1a2e;
  border-radius: 8px;
  margin: 10px 0;
}
.line-header {
  margin-bottom: 15px;
  padding: 10px;
  background: rgba(255, 215, 0, 0.1);
  border-radius: 6px;
  border-left: 3px solid #ffd700;
}
.line-value-title {
  color: #ffd700;
  font-weight: bold;
  font-size: 16px;
}
.division-block {
  margin: 15px 0;
  padding: 12px;
  background: rgba(76, 175, 80, 0.1);
  border-radius: 6px;
}
.division-block.completed {
  border-left: 3px solid #4caf50;
}
.division-block.inprogress {
  border-left: 3px solid #ff9800;
}
.division-note {
  color: #ff69b4;
  margin: 8px 0;
  font-size: 14px;
}
.random-division {
  margin: 10px 0;
  padding: 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}
.pile-columns {
  display: flex;
  gap: 20px;
  margin: 8px 0;
}
.pile {
  flex: 1;
}
.pile .pile-count {
  color: #aaa;
  margin-left: 10px;
}
.stalks-process {
  margin: 10px 0;
  padding: 8px;
  background: rgba(25, 255, 25, 0.1);
  border-radius: 4px;
}
.stalks-process .stalks-text {
  color: #ccc;
  font-size: 13px;
  line-height: 1.4;
}
.stalks-removed {
  margin: 10px 0;
  padding: 8px;
  background: rgba(255, 215, 0, 0.1);
  border-radius: 4px;
}
.stalks-removed .stalks-removed-text {
  color: #ffd700;
  font-weight: bold;
}

/* Side-specific yarrow bar color helpers (used by generatePileVisual) */
.yarrow-left {
  color: #19ff19;
  font-family: monospace;
}
.yarrow-right {
  color: #4a90e2;
  font-family: monospace;
}

/* Hexagram Alchemy container replacements for inline styles */
.hexagram-alchemy-container {
  max-width: 800px;
  width: 90%;
  margin: 20px auto;
  padding: 15px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(0, 255, 0, 0.3);
  border-radius: 8px;
  font-family: "Courier New", monospace;
  color: #0f0;
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.imperial-hexagram-container {
  order: 1;
  margin-bottom: 20px;
}
.active-work-area {
  order: 2;
  margin-bottom: 15px;
}
.completed-container {
  order: 3;
}

/* Hexagram Alchemy: status indicator and titles */
.alchemizing-text {
  font-weight: bold;
  color: #ff4444;
  text-align: center;
}
.cosmic-status-indicator {
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  color: #ff4444;
  padding: 15px;
  margin-bottom: 15px;
  background: linear-gradient(
    135deg,
    rgba(255, 68, 68, 0.15),
    rgba(139, 69, 19, 0.15)
  );
  border: 2px solid rgba(255, 68, 68, 0.6);
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(255, 68, 68, 0.4);
}
.cosmic-status-indicator.complete {
  color: #9370db;
  background: linear-gradient(
    135deg,
    rgba(147, 112, 219, 0.25),
    rgba(72, 61, 139, 0.25)
  );
  border: 2px solid rgba(147, 112, 219, 0.8);
  text-shadow: 0 0 15px rgba(147, 112, 219, 1);
}
.cosmic-progress-wrapper {
  margin-top: 10px;
  font-size: 14px;
  color: #ff6666;
}
.cosmic-progress-bar-outer {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  height: 8px;
  margin: 8px 20px;
  overflow: hidden;
}
.cosmic-progress-bar-inner {
  height: 100%;
  width: 0%;
  transition: width 0.5s ease;
  border-radius: 10px;
  background: linear-gradient(90deg, #ff4444, #ff6666);
}
.cosmic-progress-bar-inner.progress-glow {
  box-shadow: 0 0 12px rgba(255, 102, 102, 0.6);
}
.cosmic-progress-subtext {
  font-size: 12px;
  opacity: 0.8;
}

.stat-title {
  font-weight: bold;
  margin-bottom: 8px;
  color: #dda0dd;
}
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.alchemy-title {
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 15px;
  color: #9370db;
  text-shadow: 0 0 12px rgba(147, 112, 219, 0.6);
}
.hexagram-alchemy-overview {
  background: rgba(147, 112, 219, 0.1);
  border: 1px solid rgba(147, 112, 219, 0.3);
  border-radius: 6px;
  padding: 12px;
  margin: 10px 0;
  color: #9370db;
  font-size: 12px;
}

.hex-alchemy-active-title {
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  color: #19ff19;
  margin-bottom: 8px;
}
.hex-line-container {
  background: rgba(0, 0, 0, 0.25);
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 8px;
}
.active-division-area {
  padding: 8px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 6px;
}
.completed-divisions-container {
  padding: 8px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
}
.line-result {
  padding: 10px;
  background: rgba(25, 255, 25, 0.04);
  border-radius: 6px;
}
.completed-line-container {
  padding: 10px;
  background: rgba(0, 0, 0, 0.16);
  border-radius: 6px;
}
.completed-header {
  font-weight: bold;
  color: #ffd700;
  margin-bottom: 6px;
}
.completed-division {
  padding: 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.12);
  margin-bottom: 6px;
}
.completed-indicator {
  color: #4caf50;
  font-weight: bold;
}
.division-header {
  font-weight: bold;
  margin-bottom: 6px;
}
.preparation-display {
  padding: 8px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 6px;
}
.result-display {
  padding: 8px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 6px;
}
.entropy-div {
  padding: 8px;
  background: rgba(255, 215, 0, 0.04);
  border-radius: 6px;
}
.hex-display {
  padding: 8px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
}

.division-container {
  margin: 10px 0;
  padding: 12px;
  background: rgba(74, 169, 155, 0.08);
  border: 2px solid rgba(74, 169, 155, 0.4);
  border-radius: 6px;
  box-shadow: 0 0 12px rgba(74, 169, 155, 0.3);
}
.division-header {
  font-weight: bold;
  color: #4a9;
  margin-bottom: 8px;
  text-align: center;
  text-shadow: 0 0 8px rgba(74, 169, 155, 0.6);
}
.preparation-display {
  margin: 6px 0;
  padding: 4px;
  background: rgba(0, 255, 255, 0.05);
  border: 1px dashed rgba(0, 255, 255, 0.2);
  border-radius: 3px;
  font-size: 11px;
  color: #0ff;
  text-align: center;
}
.division-display-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin: 8px 0;
}
.result-display {
  margin-top: 8px;
  padding: 6px;
  background: rgba(170, 85, 255, 0.1);
  color: #a5f;
  border-left: 3px solid #a5f;
  font-size: 12px;
}
.entropy-div {
  background: rgba(255, 255, 0, 0.1);
  padding: 6px;
  margin: 4px 0;
  border-radius: 3px;
  font-size: 11px;
  color: #ff0;
}
.division-completed {
  opacity: 1;
}

/* Stalk rendering and counting visuals (migrated from inline styles) */
.stalk-label {
  color: #ddd;
  font-size: 12px;
  margin-bottom: 4px;
  font-weight: bold;
  text-align: center;
}
.stalk-row {
  margin: 1px 0;
  line-height: 1.2;
  min-height: 14px;
  text-align: center;
}
.stalk-more {
  font-size: 10px;
  opacity: 0.7;
  text-align: center;
}
.stalk-char {
  margin: 0 1px;
  opacity: 0;
  transition: opacity 0.12s ease-in;
  font-family: monospace;
}
.stalk-char.visible {
  opacity: 1;
}
.stalk-left {
  color: #4a9;
}
.stalk-right {
  color: #a94;
}
.stalk-removed {
  color: #f44;
  font-weight: bold;
}
.stalks-wrapper {
  text-align: center;
  padding: 4px;
}

.counting-display {
  margin: 8px 0;
  padding: 6px;
  background: rgba(255, 0, 255, 0.1);
  border-radius: 3px;
  font-size: 11px;
}
.counting-title {
  color: #f0f;
  font-weight: bold;
  margin-bottom: 4px;
}
.counting-line-left {
  color: #4a9;
}
.counting-line-right {
  color: #a94;
}
.counting-result {
  color: #f44;
  font-weight: bold;
  padding: 4px;
  background: rgba(255, 68, 68, 0.1);
  border-radius: 3px;
  border-left: 3px solid #f44;
}
.hexagram-lines-display {
  font-size: 16px;
  line-height: 1.6;
  margin: 15px 0;
  color: #dda0dd;
  min-height: 200px;
}
.hexagram-line {
  margin: 4px 0;
  padding: 6px;
  background: rgba(221, 160, 221, 0.05);
  border: 1px dashed rgba(221, 160, 221, 0.2);
  border-radius: 4px;
  font-family: "Courier New", monospace;
  color: #666;
  transition: all 0.3s ease;
}
.hexagram-line.awaiting-revelation {
  /* subtle glow reserved for when lines reveal — non-intrusive by default */
  background: rgba(221, 160, 221, 0.08);
  box-shadow: 0 0 10px rgba(221, 160, 221, 0.18);
  transition: box-shadow 260ms ease, background 260ms ease;
}
.imperial-hexagram-display {
  padding: 20px;
  background: linear-gradient(
    135deg,
    rgba(25, 25, 112, 0.3),
    rgba(72, 61, 139, 0.3)
  );
  border: 2px solid rgba(138, 43, 226, 0.6);
  border-radius: 10px;
  text-align: center;
}
.hexagram-shadow-display {
  margin-top: 15px;
  padding: 15px;
  background: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.5),
    rgba(25, 25, 25, 0.5)
  );
  border: 2px solid rgba(85, 85, 85, 0.6);
  border-radius: 8px;
  text-align: center;
}
.shadow-lines-display {
  font-size: 14px;
  line-height: 1.4;
  margin: 10px 0;
  color: #555;
  min-height: 140px;
}
.shadow-line {
  margin: 3px 0;
  padding: 4px;
  background: rgba(85, 85, 85, 0.1);
  border: 1px dashed rgba(85, 85, 85, 0.2);
  border-radius: 3px;
  font-family: "Courier New", monospace;
  color: #444;
  font-size: 12px;
}
.shadow-line.updated {
  background: rgba(85, 85, 85, 0.2);
  border: 1px solid rgba(85, 85, 85, 0.4);
  color: #888;
  box-shadow: 0 0 5px rgba(85, 85, 85, 0.3);
}
.hexagram-metadata {
  margin-top: 12px;
  font-size: 12px;
  color: #9370db;
  border-top: 1px solid rgba(147, 112, 219, 0.3);
  padding-top: 10px;
}
.imperial-table-building {
  margin-top: 18px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid #9370db;
  border-radius: 8px;
  color: #9370db;
  font-size: 13px;
  font-family: "Courier New", monospace;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
.imperial-table-building .imperial-table-title {
  font-weight: bold;
  margin-bottom: 6px;
}
.imperial-table-building table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.imperial-table-building th {
  border-bottom: 1px solid #9370db;
}
.imperial-table-building td {
  text-align: center;
}

/* HexagramAlchemy helper classes */
.progress-subtext {
  font-size: 12px;
  opacity: 0.8;
}
.hexagram-line-dim {
  color: #888;
}
.hexagram-line.revealed {
  margin: 4px 0;
  padding: 6px;
  background: rgba(221, 160, 221, 0.15);
  border: 1px solid rgba(221, 160, 221, 0.4);
  border-radius: 4px;
  font-family: "Courier New", monospace;
  color: #dda0dd;
  box-shadow: 0 0 8px rgba(221, 160, 221, 0.3);
  transition: all 0.5s ease;
}
.imperial-hexagram-title {
  font-size: 18px;
  font-weight: bold;
  color: #9370db;
  margin-bottom: 15px;
  text-shadow: 0 0 15px rgba(147, 112, 219, 0.8);
}
.hexagram-stat-overview {
  background: rgba(147, 112, 219, 0.1);
  border: 1px solid rgba(147, 112, 219, 0.3);
  border-radius: 6px;
  padding: 12px;
  margin: 10px 0;
  color: #9370db;
  font-size: 12px;
}
.active-division-area {
  order: 1;
  margin-bottom: 10px;
}
.completed-divisions-container {
  order: 2;
}
.division-container {
  margin: 10px 0;
  padding: 12px;
  background: rgba(74, 169, 155, 0.08);
  border: 2px solid rgba(74, 169, 155, 0.4);
  border-radius: 6px;
  box-shadow: 0 0 12px rgba(74, 169, 155, 0.3);
}
.division-header {
  font-weight: bold;
  color: #4a9;
  margin-bottom: 8px;
  text-align: center;
  text-shadow: 0 0 8px rgba(74, 169, 155, 0.6);
}
.preparation-display {
  margin: 6px 0;
  padding: 4px;
  background: rgba(0, 255, 255, 0.05);
  border: 1px dashed rgba(0, 255, 255, 0.2);
  border-radius: 3px;
  font-size: 11px;
  color: #0ff;
  text-align: center;
}
.division-result-display {
  margin-top: 8px;
  padding: 6px;
  background: rgba(170, 85, 255, 0.1);
  color: #a5f;
  border-left: 3px solid #a5f;
  font-size: 12px;
}
.entropy-display {
  background: rgba(255, 255, 0, 0.1);
  padding: 6px;
  margin: 4px 0;
  border-radius: 3px;
  font-size: 11px;
  color: #ff0;
}
.imperial-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.imperial-table th {
  border-bottom: 1px solid #9370db;
}

.status-complete {
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  color: #9370db;
  padding: 15px;
  margin-bottom: 15px;
  background: linear-gradient(
    135deg,
    rgba(147, 112, 219, 0.25),
    rgba(72, 61, 139, 0.25)
  );
  border: 2px solid rgba(147, 112, 219, 0.8);
  border-radius: 10px;
  text-shadow: 0 0 15px rgba(147, 112, 219, 1);
  box-shadow: 0 0 20px rgba(147, 112, 219, 0.5);
}
.shadow-line.updated {
  background: rgba(85, 85, 85, 0.2);
  border: 1px solid rgba(85, 85, 85, 0.4);
  box-shadow: 0 0 5px rgba(85, 85, 85, 0.3);
  color: #888;
  padding: 4px;
  margin: 3px 0;
  border-radius: 3px;
  font-family: "Courier New", monospace;
  font-size: 12px;
}
.shadow-metadata {
  margin-top: 8px;
  font-size: 11px;
  color: #666;
  border-top: 1px solid rgba(85, 85, 85, 0.3);
  padding-top: 8px;
}
.hexagram-metadata {
  margin-top: 12px;
  font-size: 12px;
  color: #9370db;
  border-top: 1px solid rgba(147, 112, 219, 0.3);
  padding-top: 10px;
}

.division-status {
  color: #4caf50;
  font-weight: bold;
  margin-bottom: 8px;
}
.division-number {
  color: #ffd700;
  font-weight: bold;
  margin-bottom: 8px;
}
.division-block.inprogress .division-status {
  color: #ff9800;
}
.pile-title {
  color: #19ff19;
  font-size: 14px;
  margin-bottom: 4px;
}
.pile-body {
  margin-left: 10px;
}
.pile-count {
  color: #aaa;
  margin-left: 10px;
}
.random-title {
  color: #ffd700;
  font-weight: bold;
  margin-bottom: 6px;
}
.stalks-process .stalks-text,
.stalks-process .stalks-text + .stalks-text {
  color: #ccc;
  font-size: 13px;
  line-height: 1.4;
}
/* Align coin to the right of the button - consolidated above (removed nested/invalid rules) */
/* Coin Flip 3D Styles (matches original CoinFlip app) */
.coin-flip-scene {
  width: 125px;
  height: 125px;
  perspective: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(ellipse at 60% 65%, #0005 0%, #0000 70%);
  box-shadow: 0 0 16px 0 #0006;
}
.coin-flip-coin3d {
  width: 125px;
  height: 125px;
  position: relative;
  transform-style: preserve-3d;
  transition: box-shadow 0.2s;
  box-shadow: 0 2px 12px #0006;
  border-radius: 50%;
}
.coin-flip-face {
  position: absolute;
  width: 125px;
  height: 125px;
  border-radius: 50%;
  backface-visibility: hidden;
  background-size: cover;
  background-position: center;
  box-shadow: 0 0 0 2px #fff2, 0 1px 8px #0005;
}
.coin-flip-heads {
  background-image: url("images/CoinHEADS.png");
  z-index: 2;
}
.coin-flip-tails {
  background-image: url("images/CoinTails.png");
  transform: rotateY(180deg);
  z-index: 1;
}

/* iChing Wisdom styles */
@keyframes goldShimmer {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}
.iching-wisdom-title {
  margin: 20px 0;
  padding: 25px;
  background: linear-gradient(
    135deg,
    rgba(139, 69, 19, 0.15),
    rgba(160, 82, 45, 0.15)
  );
  border: 3px solid rgba(218, 165, 32, 0.6);
  border-radius: 15px;
  color: #daa520;
  font-family: "Courier New", monospace;
  box-shadow: 0 0 25px rgba(218, 165, 32, 0.4);
}
.iching-wisdom-heading {
  text-align: center;
  padding: 20px;
  margin: -10px -10px 20px -10px;
  background: linear-gradient(
    135deg,
    rgba(255, 215, 0, 0.15),
    rgba(255, 165, 0, 0.1)
  );
  border: 2px solid rgba(255, 215, 0, 0.4);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 8px;
  color: #ffd700;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-size: 200% 100%;
  animation: goldShimmer 3s ease-in-out infinite;
  letter-spacing: 2px;
}
.iching-wisdom-dragon {
  text-align: center;
  font-size: 24px;
  margin-top: 5px;
  filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.6));
}
.iching-single-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 15px 0;
}

/* iChing header and content layout */
.iching-header-section {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 25px;
  align-items: start;
}
@media (max-width: 768px) {
  .iching-header-section {
    grid-template-columns: 1fr;
    gap: 15px;
    text-align: center;
  }
}
.iching-header-text {
  /* small layout defaults for header text area */
  display: block;
  color: inherit;
  margin-bottom: 6px;
}
.iching-trigram-block {
  margin-bottom: 15px;
}
.iching-trigram-title {
  font-weight: bold;
  margin-bottom: 6px;
  font-size: 14px;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.25);
}
.iching-trigram-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px;
  border-radius: 6px;
}
.iching-trigram-cell {
  color: #ddd;
}
.iching-musing-block {
  padding: 12px;
  background: linear-gradient(
    135deg,
    rgba(255, 215, 0, 0.1),
    rgba(255, 215, 0, 0.05)
  );
  border-left: 4px solid #ffd700;
  border-radius: 6px;
}
.iching-musing-title {
  font-weight: bold;
  margin-bottom: 6px;
  font-size: 14px;
}
.iching-musing-body {
  font-style: italic;
  color: #f5f5dc;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 500;
}
.iching-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 5px;
}
@media (max-width: 768px) {
  .iching-cards-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
}
.hexagram-title-visual {
  margin-left: auto;
  margin-right: auto;
}

/* --- Fortune Cookie styles (scoped under .fortune-cookie to avoid global bleed) --- */
.fortune-cookie {
  --paper-bg: #fff;
  color: #fff;
  /* removed padding-right so cookie can sit flush to the right edge */
}
.fortune-cookie#fortune-cookie-container {
  /* 2026-08-26 (owner: the cookie was knocked right on phones): the legacy
     1.5em base margin pushed it off center — the flex container centers it,
     so no base margin at all. */
}
.fortune-cookie .fortune-stage {
  display: flex;
  align-items: center;
  justify-content: center;
}
.fortune-cookie .fortune-cookie-stage {
  position: relative;
  width: 260px;
  height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fortune-cookie .fortune-cookie-img {
  position: absolute;
  max-width: 260px;
  max-height: 210px;
  z-index: 1; /* keep cookie image behind central button */
  cursor: pointer;
}
@keyframes fortune-shake {
  0% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px) rotate(-3deg);
  }
  40% {
    transform: translateX(6px) rotate(3deg);
  }
  60% {
    transform: translateX(-4px) rotate(-2deg);
  }
  80% {
    transform: translateX(4px) rotate(2deg);
  }
  100% {
    transform: translateX(0) rotate(0);
  }
}
.fortune-cookie .shake {
  animation: fortune-shake 400ms ease-in-out;
}
.fortune-cookie .fortune-paper {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 210px;
  height: 48px;
  background: var(--paper-bg);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  color: #111;
  z-index: 1;
  transform: translateX(-50%) translateY(-5px);
  opacity: 0;
  transition: transform 800ms ease-out, opacity 800ms ease-out;
}
.fortune-cookie .fortune-paper.show {
  transform: translateX(-50%) translateY(100px);
  opacity: 1;
}
.fortune-cookie .fortune-text {
  font-size: 14px;
  line-height: 1.2;
  text-align: center;
  color: #111;
}
/* End fortune cookie styles */

body {
  background: #181c24 !important;
  color: #e6e6ea;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Arial, sans-serif;
}

.timeline-load-error {
  max-width: 640px;
  margin: 60px auto;
  padding: 28px;
  border: 2px solid #22ddaa;
  border-radius: 14px;
  background: #0f1214;
  color: #ccefe6;
  text-align: center;
  box-shadow: 0 0 24px #000;
}

.timeline-load-error h2 {
  color: #22ddaa;
  margin-top: 0;
  font-family: "Orbitron", monospace;
}

.timeline-load-error p {
  font-size: 14px;
  line-height: 1.6;
}

.timeline-load-error code {
  color: #fc8181;
}

.timeline-load-error pre {
  background: #181c24;
  color: #68d391;
  padding: 10px;
  border-radius: 8px;
  display: inline-block;
  font-family: monospace;
}
.cosmic-hexagram-summary,
.cosmic-hexagram-shadow {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.1) 0px,
    rgba(0, 0, 0, 0.1) 2px,
    transparent 2px,
    transparent 12px
  );
}
/* --- Cosmic/Imperial Hexagram Layout Enhancements --- */
.cosmic-hexagram-summary {
  background: linear-gradient(90deg, #2d223a 60%, #6a4fb6 100%);
  color: #b6a4e6;
  border-radius: 10px;
  box-shadow: 0 2px 8px #6a4fb622;
  text-align: center;
  /* max-width removed to allow full width */
  font-family: "Segoe UI", Arial, sans-serif;
}
.cosmic-hexagram-summary svg,
.cosmic-hexagram-shadow svg {
  display: block;
  margin: 0.5em 0 0.5em 0;
}
.cosmic-hexagram-summary .imperial-title {
  color: #c084fc;
}
.cosmic-hexagram-shadow {
  background: linear-gradient(90deg, #232136 60%, #444 100%);
  color: #b6b6cc;
  border-radius: 10px;
  box-shadow: 0 2px 8px #6a4fb622;
  text-align: center;
  /* max-width removed to allow full width */
  font-family: "Segoe UI", Arial, sans-serif;
}
.cosmic-hexagram-shadow .shadow-title {
  color: #a78bfa;
}
.mini-shadow-hexagram {
  margin-top: 1.2em;
  text-align: right;
  font-size: 1.5em;
  color: #b6b6cc;
  filter: grayscale(0.7);
}
.imperial-table-seal {
  /* Layout + visual styling consolidated into a single block */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin: 2em 0 1.5em 0;
  background: linear-gradient(90deg, #2d223a 60%, #3a2d22 100%);
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(106, 79, 182, 0.08);
  padding: 1.2em 1.5em 1.2em 1.5em;
  text-align: center;
  border: 2px solid #ffd700;
}
.imperial-table-seal > .imperial-table-title {
  align-self: center;
}
.imperial-table-seal > div {
  width: 100%;
}
@media (max-width: 900px) {
  .imperial-table-seal > div[style*="display:flex"] {
    flex-direction: column !important;
    gap: 1em !important;
  }
  .cosmic-hexagram-summary,
  .cosmic-hexagram-shadow {
    max-width: 100%;
    text-align: center;
  }
  .mini-shadow-hexagram {
    text-align: center;
  }
}

/* Enhanced Hexagram Wisdom Cards Responsive Design */
@media (max-width: 768px) {
  /* Make header section single column on mobile */
  .hexagram-wisdom-header {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
    text-align: center;
  }

  /* Make cards section single column on mobile */
  .hexagram-wisdom-cards {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }

  /* Reduce hexagram visual size on mobile */
  .hexagram-visual-enhanced {
    width: 140px !important;
    height: 140px !important;
    margin: 0 auto;
  }

  /* Adjust card padding on mobile */
  .hexagram-content-card {
    padding: 12px !important;
  }
}
.kingwen-411 {
  color: #3ecfff;
  font-size: 1em;
  text-align: center;
}
.imperial-table-visual {
  margin: 0 auto;
}
/* Imperial Hexagram Table Seal */
.imperial-table-title {
  font-size: 1.1em;
  font-weight: bold;
  color: #ffd700;
  margin-bottom: 0.7em;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 8px #ffd70044;
}
.imperial-table-visual {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.2em;
}
.imperial-table-row {
  transition: background 0.4s;
}
.imperial-table-row:hover {
  background: rgba(255, 215, 0, 0.08);
}
.imperial-table-num {
  font-weight: bold;
  color: #ffd700;
  width: 2em;
  font-size: 1.1em;
  text-align: right;
  padding-right: 0.7em;
}
.imperial-table-lines {
  font-size: 1.25em;
  color: #fff;
  letter-spacing: 0.12em;
  text-align: left;
  font-family: "Fira Mono", "Consolas", "Menlo", monospace;
  animation: imperialSealFadeIn 0.7s cubic-bezier(0.4, 2, 0.6, 1) both;
}
@keyframes imperialSealFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* I Ching Monitor/Terminal Unified Output */
.iching-monitor-container {
  background: #181c24;
  border-radius: 14px;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.18), 0 1.5px 0 #ffd700 inset;
  padding: 2.2em 1.5em 1.5em 1.5em;
  margin: 2em 0 2em 0;
  width: 100%;
  color: #ffd700;
  font-family: "Fira Mono", "Consolas", "Menlo", monospace;
  position: relative;
  box-sizing: border-box;
  overflow-x: auto;
}
.iching-monitor-header {
  font-size: 1.25em;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-align: center;
  margin-bottom: 1.2em;
  color: #fff;
  background: linear-gradient(90deg, #ffd700 0%, #6a4fb6 100%);
  border-radius: 8px;
  padding: 0.5em 0;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.08);
}
.iching-hexagram-summary {
  display: flex;
  align-items: center;
  gap: 1.5em;
  margin-bottom: 1.5em;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 1em 1.2em;
  box-shadow: 0 1px 6px rgba(255, 215, 0, 0.04);
  justify-content: flex-end;
  text-align: right;
}
.hexagram-visual-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hexagram-line-vis {
  width: 60px;
  height: 8px;
  margin: 0 auto;
}
.hexagram-summary-text {
  font-size: 1em;
  color: #ffd700;
  line-height: 1.5;
}
.iching-breakdown-section {
  margin-top: 1.5em;
}
/* Duplicate light-theme body removed to preserve the dark theme declared above */

header {
  /*background: #23242a;*/
  color: #ff0000;
  font-family: "Quintessential";
  text-align: center;
  padding-top: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.h1 {
  color: #ff0000;
  margin: 0;
  padding: .01rem;
  font-size: 2.5rem;
}
.h3 {
  color:#2fca00;
  margin: 0;
  padding: .01rem;
  font-size: 1.5rem;
}
main {
  max-width: 1024px;
  width: 100%;
  margin: 0.1rem auto;
  padding: 1rem;
  background: #000000;
  border-radius: 40px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
  box-sizing: border-box;
}

/* Accessibility: visible focus for keyboard users */
:focus {
  outline: none;
}
:focus-visible {
  outline: 3px solid rgba(130, 87, 255, 0.9);
  outline-offset: 2px;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

#timeline-container {
  min-height: 300px;
  padding: 2rem 1rem;
  /*border: 2px dashed #b6a4e6;*/
  border-radius: 8px;
  background: #23242a;
  max-width: 1024px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

footer {
  text-align: center;
  color: #888;
  padding: 1rem 0;
  font-size: 0.9rem;
}

/* Utility text color helpers */
.white-text {
  color: #ffffff !important;
}

@media (max-width: 1100px) {
  #timeline-container,
  main {
    max-width: 98vw;
  }
}

/* ======================================
   BIRTHSTONES SCANNING CONTAINER STYLES
   ====================================== */

/* Birthstones row positioning */
.birthstones-row {
  display: flex;
  justify-content: center;
  
}

/* Smaller birthstones container */
.birthstones-container-small {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    align-content: center;
    gap: 10px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.359);
    border-radius: 15px;
    backdrop-filter: blur(8px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.8);
    margin-bottom: 20px;
}

/* Smaller birthstone icons - half the size */
.birthstone-icon-small {
    width: 30px;
    height: 30px;
    object-fit: contain;
    display: block;
    margin: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0);
    transition: all 0.3s ease;
    background: transparent !important;
    cursor: pointer;
}

/* Hover effect for smaller icons */
.birthstone-icon-small:hover {
    width: 35px;
    height: 35px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

/* base glow effect for smaller icons */
.birthstone-icon-small.glow {
    background: transparent !important;
    border-radius: 0 !important;
    transform: scale(1.15);
    transform-origin: center center;
    transition: filter 0.35s ease, transform 0.3s ease;
    z-index: 2;
    display: inline-block;
    vertical-align: middle;
}

/* Dim non-selected small birthstones when one is selected */
.birthstones-container-small.has-selection .birthstone-icon-small:not(.glow) {
    filter: brightness(0.8) saturate(0.6);
    opacity: 0.7;
    transition: filter 0.35s ease, opacity 0.35s ease;
}

/* 2026-08-26 (owner: two even rows on phones): a 6+6 grid keeps the scan row
   symmetric instead of wrapping unevenly. */
@media (max-width: 480px) {
    .birthstones-container-small {
        display: grid;
        grid-template-columns: repeat(6, auto);
        justify-content: center;
        align-items: center;
        gap: 8px;
        padding: 12px 10px;
    }
}

/* Individual glow colors for small birthstone icons - reduced radius and intensity */
/* January - Garnet (Deep Red) */
.birthstone-icon-small[data-month="january"].glow {
    filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 3px rgba(220, 20, 60, 0.8)) drop-shadow(0 0 4px rgba(139, 0, 0, 0.6));
}

/* February - Amethyst (Purple) */
.birthstone-icon-small[data-month="february"].glow {
    filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 3px rgba(147, 112, 219, 0.8)) drop-shadow(0 0 4px rgba(138, 43, 226, 0.6));
}

/* March - Aquamarine (Blue-Green) */
.birthstone-icon-small[data-month="march"].glow {
    filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 3px rgba(127, 255, 212, 0.8)) drop-shadow(0 0 4px rgba(0, 206, 209, 0.6));
}

/* April - Diamond (Clear/White) */
.birthstone-icon-small[data-month="april"].glow {
    filter: brightness(1.3) saturate(1.2) drop-shadow(0 0 3px rgba(255, 255, 255, 0.8)) drop-shadow(0 0 4px rgba(230, 230, 250, 0.7));
}

/* May - Emerald (Green) */
.birthstone-icon-small[data-month="may"].glow {
    filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 3px rgba(50, 205, 50, 0.8)) drop-shadow(0 0 4px rgba(0, 128, 0, 0.6));
}

/* June - Alexandrite (Color-changing Green-Red) */
.birthstone-icon-small[data-month="june"].glow {
    filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 3px rgba(106, 90, 205, 0.8)) drop-shadow(0 0 4px rgba(255, 20, 147, 0.5));
}

/* July - Ruby (Fiery Red) */
.birthstone-icon-small[data-month="july"].glow {
    filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 3px rgba(255, 0, 0, 0.8)) drop-shadow(0 0 4px rgba(220, 20, 60, 0.7));
}

/* August - Peridot (Olive Green) */
.birthstone-icon-small[data-month="august"].glow {
    filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 3px rgba(154, 205, 50, 0.8)) drop-shadow(0 0 4px rgba(107, 142, 35, 0.6));
}

/* September - Sapphire (Blue) */
.birthstone-icon-small[data-month="september"].glow {
    filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 3px rgba(65, 105, 225, 0.8)) drop-shadow(0 0 4px rgba(0, 0, 139, 0.6));
}

/* October - Opal (Multi-colored/Iridescent) */
.birthstone-icon-small[data-month="october"].glow {
    filter: brightness(1.2) saturate(1.4) drop-shadow(0 0 3px rgba(255, 182, 193, 0.7)) drop-shadow(0 0 4px rgba(255, 215, 0, 0.5)) drop-shadow(0 0 8px rgba(138, 43, 226, 0.4));
}

/* November - Topaz (Golden Yellow) */
.birthstone-icon-small[data-month="november"].glow {
    filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 3px rgba(255, 215, 0, 0.8)) drop-shadow(0 0 4px rgba(255, 165, 0, 0.6));
}

/* December - Turquoise (Sky Blue) */
.birthstone-icon-small[data-month="december"].glow {
    filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 3px rgba(64, 224, 208, 0.8)) drop-shadow(0 0 4px rgba(0, 206, 209, 0.6));
}

/* Pulsing animations for birthstones */
@keyframes garnet-pulse {
  0%,100% { filter: brightness(.7) saturate(1.5) drop-shadow(0 0 5px rgba(220,20,60,1)) drop-shadow(0 0 6px rgba(139,0,0,0.8)); }
  50%    { filter: brightness(.9) saturate(1.8) drop-shadow(0 0 5px rgba(220,20,60,1)) drop-shadow(0 0 6px rgba(139,0,0,1)); }
}

@keyframes amethyst-pulse {
  0%,100% { filter: brightness(1.3) saturate(1.5) drop-shadow(0 0 5px rgba(147,112,219,1)) drop-shadow(0 0 6px rgba(138,43,226,0.8)); }
  50%    { filter: brightness(1.6) saturate(1.8) drop-shadow(0 0 5px rgba(147,112,219,1)) drop-shadow(0 0 6px rgba(138,43,226,1)); }
}

@keyframes aquamarine-pulse {
  0%,100% { filter: brightness(.8) saturate(1.5) drop-shadow(0 0 5px rgba(127,255,212,1)) drop-shadow(0 0 6px rgba(0,206,209,0.8)); }
  50%    { filter: brightness(1) saturate(1.8) drop-shadow(0 0 5px rgba(127,255,212,1)) drop-shadow(0 0 6px rgba(0,206,209,1)); }
}

@keyframes diamond-pulse {
  0%,100% { filter: brightness(.9) saturate(1.4) drop-shadow(0 0 5px rgba(255,255,255,1)) drop-shadow(0 0 6px rgba(230,230,250,0.9)); }
  50%    { filter: brightness(1.1) saturate(1.6) drop-shadow(0 0 5px rgba(255,255,255,1)) drop-shadow(0 0 6px rgba(230,230,250,1)); }
}

@keyframes emerald-pulse {
  0%,100% { filter: brightness(1.3) saturate(1.5) drop-shadow(0 0 5px rgba(50,205,50,1)) drop-shadow(0 0 6px rgba(0,128,0,0.8)); }
  50%    { filter: brightness(1.6) saturate(1.8) drop-shadow(0 0 5px rgba(50,205,50,1)) drop-shadow(0 0 6px rgba(0,128,0,1)); }
}

@keyframes alexandrite-pulse {
  0%,100% { filter: brightness(1.3) saturate(1.5) drop-shadow(0 0 5px rgba(106,90,205,1)) drop-shadow(0 0 6px rgba(255,20,147,0.7)); }
  50%    { filter: brightness(1.6) saturate(1.8) drop-shadow(0 0 5px rgba(106,90,205,1)) drop-shadow(0 0 6px rgba(255,20,147,1)); }
}

@keyframes ruby-pulse {
  0%,100% { filter: brightness(.7) saturate(1.5) drop-shadow(0 0 5px rgba(255,0,0,1)) drop-shadow(0 0 6px rgba(220,20,60,0.9)); }
  50%    { filter: brightness(.9) saturate(1.8) drop-shadow(0 0 5px rgba(255,0,0,1)) drop-shadow(0 0 6px rgba(220,20,60,1)); }
}

@keyframes peridot-pulse {
  0%,100% { filter: brightness(.8) saturate(1.5) drop-shadow(0 0 5px rgba(154,205,50,1)) drop-shadow(0 0 6px rgba(107,142,35,0.8)); }
  50%    { filter: brightness(1.1) saturate(1.8) drop-shadow(0 0 5px rgba(154,205,50,1)) drop-shadow(0 0 6px rgba(107,142,35,1)); }
}

@keyframes sapphire-pulse {
  0%,100% { filter: brightness(1.3) saturate(1.5) drop-shadow(0 0 5px rgba(65,105,225,1)) drop-shadow(0 0 6px rgba(0,0,139,0.8)); }
  50%    { filter: brightness(1.6) saturate(1.8) drop-shadow(0 0 5px rgba(65,105,225,1)) drop-shadow(0 0 6px rgba(0,0,139,1)); }
}

@keyframes opal-pulse {
  0%,100% { filter: brightness(.9) saturate(1.6) drop-shadow(0 0 5px rgba(255,182,193,0.9)) drop-shadow(0 0 6px rgba(255,215,0,0.7)) drop-shadow(0 0 13px rgba(138,43,226,0.6)); }
  50%    { filter: brightness(1.2) saturate(1.9) drop-shadow(0 0 5px rgba(255,182,193,1)) drop-shadow(0 0 6px rgba(255,215,0,1)) drop-shadow(0 0 13px rgba(138,43,226,1)); }
}

@keyframes topaz-pulse {
  0%,100% { filter: brightness(1) saturate(1.5) drop-shadow(0 0 5px rgba(255,215,0,1)) drop-shadow(0 0 6px rgba(255,165,0,0.8)); }
  50%    { filter: brightness(1.2) saturate(1.8) drop-shadow(0 0 5px rgba(255,215,0,1)) drop-shadow(0 0 6px rgba(255,165,0,1)); }
}

@keyframes turquoise-pulse {
  0%,100% { filter: brightness(.9) saturate(1.5) drop-shadow(0 0 5px rgba(64,224,208,1)) drop-shadow(0 0 6px rgba(0,206,209,0.8)); }
  50%    { filter: brightness(1.3) saturate(1.8) drop-shadow(0 0 5px rgba(64,224,208,1)) drop-shadow(0 0 6px rgba(0,206,209,1)); }
}

/* Apply pulse animations to small birthstone icons */
.birthstone-icon-small[data-month="january"].glow.pulse { animation: garnet-pulse 1.6s infinite; }
.birthstone-icon-small[data-month="february"].glow.pulse { animation: amethyst-pulse 1.6s infinite; }
.birthstone-icon-small[data-month="march"].glow.pulse { animation: aquamarine-pulse 1.6s infinite; }
.birthstone-icon-small[data-month="april"].glow.pulse { animation: diamond-pulse 1.6s infinite; }
.birthstone-icon-small[data-month="may"].glow.pulse { animation: emerald-pulse 1.6s infinite; }
.birthstone-icon-small[data-month="june"].glow.pulse { animation: alexandrite-pulse 1.6s infinite; }
.birthstone-icon-small[data-month="july"].glow.pulse { animation: ruby-pulse 1.6s infinite; }
.birthstone-icon-small[data-month="august"].glow.pulse { animation: peridot-pulse 1.6s infinite; }
.birthstone-icon-small[data-month="september"].glow.pulse { animation: sapphire-pulse 1.6s infinite; }
.birthstone-icon-small[data-month="october"].glow.pulse { animation: opal-pulse 1.6s infinite; }
.birthstone-icon-small[data-month="november"].glow.pulse { animation: topaz-pulse 1.6s infinite; }
.birthstone-icon-small[data-month="december"].glow.pulse { animation: turquoise-pulse 1.6s infinite; }

/* Knight Rider scanning effect animations */
@keyframes garnet-scan {
    0%, 90%, 100% { filter: none; transform: scale(1); }
    5%, 15% { filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 3px rgba(220, 20, 60, 0.8)) drop-shadow(0 0 4px rgba(139, 0, 0, 0.6)); transform: scale(1.1); }
}

@keyframes amethyst-scan {
    0%, 90%, 100% { filter: none; transform: scale(1); }
    5%, 15% { filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 3px rgba(147, 112, 219, 0.8)) drop-shadow(0 0 4px rgba(138, 43, 226, 0.6)); transform: scale(1.1); }
}

@keyframes aquamarine-scan {
    0%, 90%, 100% { filter: none; transform: scale(1); }
    5%, 15% { filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 3px rgba(127, 255, 212, 0.8)) drop-shadow(0 0 4px rgba(0, 206, 209, 0.6)); transform: scale(1.1); }
}

@keyframes diamond-scan {
    0%, 90%, 100% { filter: none; transform: scale(1); }
    5%, 15% { filter: brightness(1.3) saturate(1.2) drop-shadow(0 0 3px rgba(255, 255, 255, 0.8)) drop-shadow(0 0 4px rgba(230, 230, 250, 0.7)); transform: scale(1.1); }
}

@keyframes emerald-scan {
    0%, 90%, 100% { filter: none; transform: scale(1); }
    5%, 15% { filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 3px rgba(50, 205, 50, 0.8)) drop-shadow(0 0 4px rgba(0, 128, 0, 0.6)); transform: scale(1.1); }
}

@keyframes alexandrite-scan {
    0%, 90%, 100% { filter: none; transform: scale(1); }
    5%, 15% { filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 3px rgba(106, 90, 205, 0.8)) drop-shadow(0 0 4px rgba(255, 20, 147, 0.5)); transform: scale(1.1); }
}

@keyframes ruby-scan {
    0%, 90%, 100% { filter: none; transform: scale(1); }
    5%, 15% { filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 3px rgba(255, 0, 0, 0.8)) drop-shadow(0 0 4px rgba(220, 20, 60, 0.7)); transform: scale(1.1); }
}

@keyframes peridot-scan {
    0%, 90%, 100% { filter: none; transform: scale(1); }
    5%, 15% { filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 3px rgba(154, 205, 50, 0.8)) drop-shadow(0 0 4px rgba(107, 142, 35, 0.6)); transform: scale(1.1); }
}

@keyframes sapphire-scan {
    0%, 90%, 100% { filter: none; transform: scale(1); }
    5%, 15% { filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 3px rgba(65, 105, 225, 0.8)) drop-shadow(0 0 4px rgba(0, 0, 139, 0.6)); transform: scale(1.1); }
}

@keyframes opal-scan {
    0%, 90%, 100% { filter: none; transform: scale(1); }
    5%, 15% { filter: brightness(1.2) saturate(1.4) drop-shadow(0 0 3px rgba(255, 182, 193, 0.7)) drop-shadow(0 0 4px rgba(255, 215, 0, 0.5)) drop-shadow(0 0 8px rgba(138, 43, 226, 0.4)); transform: scale(1.1); }
}

@keyframes topaz-scan {
    0%, 90%, 100% { filter: none; transform: scale(1); }
    5%, 15% { filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 3px rgba(255, 215, 0, 0.8)) drop-shadow(0 0 4px rgba(255, 165, 0, 0.6)); transform: scale(1.1); }
}

@keyframes turquoise-scan {
    0%, 90%, 100% { filter: none; transform: scale(1); }
    5%, 15% { filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 3px rgba(64, 224, 208, 0.8)) drop-shadow(0 0 4px rgba(0, 206, 209, 0.6)); transform: scale(1.1); }
}

/* Knight Rider scanning effect class */
.knight-rider-scan {
    position: relative;
}

/* Individual birthstone scanning animations with their specific colors */
.knight-rider-scan .birthstone-icon-small[data-month="january"] { animation: garnet-scan 6s ease-in-out infinite; animation-delay: 0s; }
.knight-rider-scan .birthstone-icon-small[data-month="february"] { animation: amethyst-scan 6s ease-in-out infinite; animation-delay: 0.25s; }
.knight-rider-scan .birthstone-icon-small[data-month="march"] { animation: aquamarine-scan 6s ease-in-out infinite; animation-delay: 0.5s; }
.knight-rider-scan .birthstone-icon-small[data-month="april"] { animation: diamond-scan 6s ease-in-out infinite; animation-delay: 0.75s; }
.knight-rider-scan .birthstone-icon-small[data-month="may"] { animation: emerald-scan 6s ease-in-out infinite; animation-delay: 1s; }
.knight-rider-scan .birthstone-icon-small[data-month="june"] { animation: alexandrite-scan 6s ease-in-out infinite; animation-delay: 1.25s; }
.knight-rider-scan .birthstone-icon-small[data-month="july"] { animation: ruby-scan 6s ease-in-out infinite; animation-delay: 1.5s; }
.knight-rider-scan .birthstone-icon-small[data-month="august"] { animation: peridot-scan 6s ease-in-out infinite; animation-delay: 1.75s; }
.knight-rider-scan .birthstone-icon-small[data-month="september"] { animation: sapphire-scan 6s ease-in-out infinite; animation-delay: 2s; }
.knight-rider-scan .birthstone-icon-small[data-month="october"] { animation: opal-scan 6s ease-in-out infinite; animation-delay: 2.25s; }
.knight-rider-scan .birthstone-icon-small[data-month="november"] { animation: topaz-scan 6s ease-in-out infinite; animation-delay: 2.5s; }
.knight-rider-scan .birthstone-icon-small[data-month="december"] { animation: turquoise-scan 6s ease-in-out infinite; animation-delay: 2.75s; }

/* Paused state - stops the scanning animation */
.knight-rider-scan.paused .birthstone-icon-small {
    animation-play-state: paused !important;
}

/* Responsive adjustments for birthstones */
@media (max-width: 768px) {
    .birthstones-container-small {
        gap: 8px;
        padding: 12px;
    }

    .birthstone-icon-small {
        width: 20px;
        height: 20px;
    }

    .birthstone-icon-small:hover {
        width: 24px;
        height: 24px;
    }
}

/* ================================================= */
/* Atomic Martian Clock Styles */
/* ================================================= */

.amc-header {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 17px;
  font-family: 'Orbitron', sans-serif;
  text-align: center;
}

.amc-result {
  margin: 4px 0;
  text-align: center;
}

.amc-mars-time {
  text-align: center;
}

.amc-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 8px 0;
}

.amc-visual img {
  width: 125px;
  height: 125px;
  border-radius: 50%;
  display: block;
  margin: 0 auto;
  object-fit: cover;
  padding-top: 10px;
  padding-bottom: 10px;
}

/* hide inline SVG fallback by default; JS will show it if image fails */
.amc-visual svg {
  display: none;
}

/* utility classes used by JS to show/hide fallbacks without inline styles */
.hidden { display: none !important; }
.visible { display: block !important; }

.amc-content {
  text-align: center;
}

.amc-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 12px 0 6px 0;
  font-family: 'Orbitron', sans-serif;
}

.amc-note {
  color: #ccc;
}

#mars-birthday-result {
  margin-top: 9px;
}



.amc-subheader {
  font-weight: 600;
  margin-bottom: 6px;
}

.amc-mars-date {
  margin-bottom: 10px;
  font-size: 1.08rem;
}

.amc-age-block {
  margin-top: 14px;
}

.amc-age-heading {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 2px;
}

/* panel border and subtle glowing effect */
.amc-panel {
  padding: 27px 27px;
  border-radius: 12px;
  border: 2px solid rgba(220,50,50,0.9);
  /* outer soft glow + layered, softer red inner glow for smooth fade */
  box-shadow:
    0 0 18px rgba(220,50,50,0.12),
    inset 0 0 8px rgba(220,50,50,0.06),
    inset 0 0 24px rgba(220,50,50,0.10),
    inset 0 0 48px rgba(220,50,50,0.08);
  transition: box-shadow 0.3s ease, transform 0.25s ease;
  backdrop-filter: blur(6px);
  background: rgba(26, 26, 26, 0.8);
  color: #fff;
  font-family: 'Orbitron', sans-serif;
}

/* create a smooth inner glow using a pseudo-element so the fade looks nicer */
.amc-panel {
  position: relative;
  overflow: hidden;
}

.amc-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  /* radial gradient produces a smoother falloff than stacked inset shadows */
  background: radial-gradient(ellipse at center,
    rgba(220,50,50,0.28) 0%,
    rgba(220,50,50,0.16) 20%,
    rgba(220,50,50,0.08) 40%,
    rgba(220,50,50,0.04) 55%,
    transparent 72%);
  mix-blend-mode: screen;
  opacity: 0.45;
  transition: opacity 240ms ease;
}

.amc-panel:hover::before {
  opacity: 0.9;
}

@keyframes amc-inner-fade {
  0% { opacity: 0.45; }
  50% { opacity: 0.8; }
  100% { opacity: 0.45; }
}

.amc-panel.pulse::before {
  animation: amc-inner-fade 3s ease-in-out infinite;
}

/* Keep panel width stable so inner typing doesn't expand the border */
.amc-panel {
  box-sizing: border-box;
  /* target a narrower panel width (up to 400px), but allow smaller screens to shrink */
  width: min(92vw, 400px);
  max-width: 400px;
  min-width: 280px;
}

/* Ensure text will wrap inside the panel instead of widening it */
.amc-result,
.amc-subheader,
.amc-title,
.amc-mars-date,
#mars-birthday-result {
  overflow-wrap: anywhere;
  word-break: break-word;
}



.amc-panel:hover {
  box-shadow:
    0 0 28px rgba(220,50,50,0.18),
    inset 0 0 18px rgba(220,50,50,0.10),
    inset 0 0 36px rgba(220,50,50,0.20),
    inset 0 0 60px rgba(220,50,50,0.12);
  transform: translateY(-2px);
}

@keyframes amc-pulse {
  0% {
    box-shadow: 0 0 12px rgba(220,50,50,0.06), inset 0 0 8px rgba(220,50,50,0.04), inset 0 0 24px rgba(220,50,50,0.08), inset 0 0 48px rgba(220,50,50,0.06);
  }
  50% {
    box-shadow: 0 0 26px rgba(220,50,50,0.14), inset 0 0 12px rgba(220,50,50,0.08), inset 0 0 36px rgba(220,50,50,0.16), inset 0 0 72px rgba(220,50,50,0.09);
  }
  100% {
    box-shadow: 0 0 12px rgba(220,50,50,0.06), inset 0 0 8px rgba(220,50,50,0.04), inset 0 0 24px rgba(220,50,50,0.08), inset 0 0 48px rgba(220,50,50,0.06);
  }
}

.amc-panel.pulse {
  animation: amc-pulse 3s ease-in-out infinite;
}

/* Responsive adjustments for the Martian Clock in Fortune Timeline context */
@media (max-width: 900px) {
  .coin-cookie-row {
    justify-content: center;
    gap: 1em;
  }
  
  .amc-panel {
    width: min(85vw, 350px);
    max-width: 350px;
    padding: 20px;
  }
  
  .amc-visual img {
    width: 100px;
    height: 100px;
  }
}

@media (max-width: 480px) {
  .coin-cookie-row {
    flex-direction: column;
    align-items: center;
    gap: 1em;
  }
  
  .amc-panel {
    width: min(90vw, 300px);
    max-width: 300px;
    padding: 15px;
  }
  
  .amc-visual img {
    width: 80px;
    height: 80px;
  }
  
  .amc-header {
    font-size: 1.1rem;
  }
  
  .amc-title {
    font-size: 1rem;
  }
}


/* Star Modal Styles */
#star-modal {
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Modal responsive adjustments */
@media (max-width: 768px) {
  #star-modal {
    width: 95% !important;
    max-height: 90vh;
    overflow-y: auto;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
  }
  
  #star-modal .star-info-grid {
    flex-direction: column !important;
  }
  
  #star-modal .star-info-grid > div {
    margin: 5px 0 !important;
  }
}

@media (max-width: 480px) {
  #star-modal {
    padding: 15px !important;
    font-size: 14px !important;
  }
  
  #star-modal h4 {
    font-size: 14px !important;
  }
}

/* ========================================
   YUKHYO ORACLE STYLES
   ======================================== */

.yukhyo-oracle-container {
  width: 100%;
  margin: 20px 0;
  display: none;
}

.yukhyo-oracle-container.active {
  display: block;
}

.yukhyo-card-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
}

.yukhyo-card {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%);
  border: 2px solid var(--imperial-gold);
  border-radius: 15px;
  padding: 25px;
  box-shadow: 
    0 8px 32px rgba(255, 215, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.yukhyo-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    var(--imperial-gold) 20%, 
    var(--shadow-purple) 50%, 
    var(--imperial-gold) 80%, 
    transparent 100%);
}

.yukhyo-card-header {
  text-align: center;
  margin-bottom: 30px;
  border-bottom: 1px solid rgba(255, 215, 0, 0.3);
  padding-bottom: 20px;
}

.yukhyo-card-header h3 {
  /* 2026-08-28 pass 2 (owner): the classical Korean serif — its Latin
     glyphs carry the same refined East-Asian cut as the Hangul/Hanja. */
  font-family: 'Noto Serif KR', 'Nanum Myeongjo', serif;
  font-size: 1.8em;
  font-weight: 700;
  color: var(--imperial-gold);
  margin: 0 0 10px 0;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  letter-spacing: 2px;
}

.yukhyo-card-subtitle {
  font-family: 'Quintessential', cursive;
  font-size: 1.1em;
  color: var(--shadow-purple);
  opacity: 0.9;
  letter-spacing: 1px;
}

.yukhyo-content {
  display: grid;
  /* 2026-08-26: minmax(0, 1fr) prevents grid blowout — the sections were
     sizing to their inner content and sticking out the card's right edge
     (the "dropdowns to the right" the owner saw on the phone). */
  grid-template-columns: minmax(0, 1fr);
  gap: 25px;
}

.yukhyo-section {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 10px;
  padding: 20px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto; /* wide inner content scrolls inside the section */
}

.yukhyo-section h4 {
  font-family: 'Noto Serif KR', 'Nanum Myeongjo', serif;
  font-size: 1.3em;
  color: var(--imperial-gold);
  margin: 0 0 15px 0;
  text-align: center;
  letter-spacing: 1px;
}

/* Birth Information */
.birth-info {
  text-align: center;
}

.birth-display {
  display: flex;
  justify-content: center;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.birth-date, .birth-time {
  font-family: 'Orbitron', monospace;
  font-size: 1.5em;
  color: var(--shadow-purple);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(180, 120, 255, 0.6);
}

.time-source {
  font-family: 'Orbitron', monospace;
  font-size: 0.8em;
  color: #ff6b6b;
  font-style: italic;
  margin-left: 10px;
  opacity: 0.8;
}

/* Four Pillars */
.pillars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
}

.pillar {
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 8px;
  padding: 15px;
  text-align: center;
}

.pillar-label {
  font-family: 'Orbitron', monospace;
  font-size: 0.9em;
  color: var(--imperial-gold);
  margin-bottom: 8px;
  font-weight: 600;
}

.pillar-ganzhi {
  font-family: 'Orbitron', monospace;
  font-size: 1.2em;
  color: #ffffff;
  margin-bottom: 5px;
  font-weight: 700;
}

.pillar-element {
  font-family: 'Quintessential', cursive;
  font-size: 1em;
  color: var(--shadow-purple);
}

.pillar-element.day-master {
  color: var(--imperial-gold);
  font-weight: 700;
  text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

/* Wu Xing Analysis */
.wuxing-grid {
  display: grid;
  gap: 12px;
}

.wuxing-element {
  display: grid;
  grid-template-columns: 80px 1fr 60px auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
}

.element-name {
  font-family: 'Orbitron', monospace;
  font-weight: 600;
  text-align: center;
}

.element-bar {
  background: rgba(0, 0, 0, 0.5);
  height: 20px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.element-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.5s ease;
}

.element-score {
  font-family: 'Orbitron', monospace;
  font-size: 0.9em;
  font-weight: 600;
  text-align: center;
}

.element-sources {
  font-size: 0.8em;
  opacity: 0.7;
  font-style: italic;
}

/* Element colors */
.wuxing-element.wood .element-name, .wuxing-element.wood .element-score {
  color: #4CAF50;
}
.wuxing-element.wood .element-fill {
  background: linear-gradient(90deg, #4CAF50, #8BC34A);
}

.wuxing-element.fire .element-name, .wuxing-element.fire .element-score {
  color: #F44336;
}
.wuxing-element.fire .element-fill {
  background: linear-gradient(90deg, #F44336, #FF9800);
}

.wuxing-element.earth .element-name, .wuxing-element.earth .element-score {
  color: #FF9800;
}
.wuxing-element.earth .element-fill {
  background: linear-gradient(90deg, #FF9800, #FFC107);
}

.wuxing-element.metal .element-name, .wuxing-element.metal .element-score {
  color: #9E9E9E;
}
.wuxing-element.metal .element-fill {
  background: linear-gradient(90deg, #9E9E9E, #CFD8DC);
}

.wuxing-element.water .element-name, .wuxing-element.water .element-score {
  color: #2196F3;
}
.wuxing-element.water .element-fill {
  background: linear-gradient(90deg, #2196F3, #03DAC6);
}

/* Trigram Section */
.trigram-display {
  text-align: center;
}

.trigram-name {
  font-family: 'Orbitron', monospace;
  font-size: 2em;
  color: var(--imperial-gold);
  font-weight: 700;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
  margin-bottom: 10px;
}

.trigram-note {
  font-size: 0.9em;
  color: var(--shadow-purple);
  font-style: italic;
}

/* Hexagram Section */
.hexagram-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
}

.hexagram-lines {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hex-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Orbitron', monospace;
  font-size: 1.2em;
  color: #ffffff;
}

.hex-line.changing {
  color: var(--imperial-gold);
  text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.line-value {
  font-size: 0.8em;
  opacity: 0.7;
  min-width: 20px;
}

.hexagram-details {
  padding-left: 20px;
  border-left: 2px solid rgba(255, 215, 0, 0.3);
}

.changing-lines {
  font-family: 'Orbitron', monospace;
  color: var(--shadow-purple);
}

/* Summary Section */
.summary-content {
  line-height: 1.6;
}

.summary-content > div {
  margin-bottom: 10px;
}

.day-master, .dominant-element {
  font-family: 'Orbitron', monospace;
  color: var(--imperial-gold);
}

.destiny-note {
  margin-top: 15px;
  padding: 15px;
  background: rgba(180, 120, 255, 0.1);
  border: 1px solid rgba(180, 120, 255, 0.3);
  border-radius: 8px;
  font-style: italic;
  color: var(--shadow-purple);
  line-height: 1.7;
}

/* Responsive Design */
@media (max-width: 768px) {
  .yukhyo-card {
    padding: 20px 15px;
  }
  
  .yukhyo-card-header h3 {
    font-size: 1.5em;
  }
  
  .pillars-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
  
  .hexagram-info {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .hexagram-details {
    padding-left: 0;
    padding-top: 15px;
    border-left: none;
    border-top: 2px solid rgba(255, 215, 0, 0.3);
  }
  
  .birth-display {
    flex-direction: column;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  /* 2026-08-26: reclaim the horizontal room for phones. */
  .yukhyo-card-container {
    padding: 0 8px;
  }

  .yukhyo-card {
    padding: 16px 10px;
  }

  .yukhyo-section {
    padding: 14px 10px;
  }

  .wuxing-element {
    grid-template-columns: 60px 1fr 45px;
    gap: 8px;
  }
  
  .element-sources {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 5px;
  }
  
  .yukhyo-card-header h3 {
    font-size: 1.3em;
  }
  
  .trigram-name {
    font-size: 1.5em;
  }
}

/* =======================
   YUKHYO EXPANDABLE SECTIONS & WU XING DIAGRAM
   ======================= */

/* Expandable Section Styles */
.expandable-section {
  transition: all 0.3s ease;
}

.expandable-section .section-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.expandable-section.expanded .section-content {
  max-height: 2000px; /* Large enough to accommodate content */
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 15px;
  background: rgba(255, 215, 0, 0.1);
  border-radius: 8px;
  transition: all 0.2s ease;
  user-select: none;
}

.section-header:hover {
  background: rgba(255, 215, 0, 0.15);
  transform: translateY(-1px);
}

.section-icon {
  font-size: 1.2em;
}

.section-header h4 {
  margin: 0;
  flex: 1;
}

.expand-arrow {
  font-size: 0.8em;
  color: var(--shadow-purple);
  transition: transform 0.3s ease;
}

.expandable-section.expanded .expand-arrow {
  transform: rotate(180deg);
}

/* Subsection Styles */
.subsection {
  margin: 20px 0;
  padding: 15px;
  background: rgba(0, 0, 0, 0.2);
  border-left: 3px solid var(--shadow-purple);
  border-radius: 5px;
}

.subsection h5 {
  font-family: 'Orbitron', monospace;
  color: var(--imperial-gold);
  margin: 0 0 15px 0;
  font-size: 1em;
  letter-spacing: 1px;
}

/* Temporal Grid */
.temporal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
}

.temporal-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.temporal-label {
  font-size: 0.9em;
  color: var(--shadow-purple);
  margin-bottom: 5px;
}

.temporal-value {
  font-family: 'Orbitron', monospace;
  color: var(--imperial-gold);
  font-weight: bold;
  font-size: 1.1em;
}

/* Trigram Grid */
.trigram-grid {
  display: flex;
  gap: 30px;
  justify-content: center;
}

.trigram-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.trigram-label {
  font-family: 'Orbitron', monospace;
  color: var(--imperial-gold);
  font-weight: bold;
  font-size: 1.2em;
  margin-bottom: 5px;
}

.trigram-desc {
  font-size: 0.9em;
  color: var(--shadow-purple);
}

/* Elements Harmony */
.elements-harmony {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.element-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.element {
  padding: 8px 12px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 0.9em;
}

.element.wood { background: rgba(76, 175, 80, 0.3); color: #4CAF50; }
.element.fire { background: rgba(244, 67, 54, 0.3); color: #F44336; }
.element.earth { background: rgba(255, 152, 0, 0.3); color: #FF9800; }
.element.metal { background: rgba(158, 158, 158, 0.3); color: #9E9E9E; }
.element.water { background: rgba(33, 150, 243, 0.3); color: #2196F3; }

.flow-arrow {
  color: var(--shadow-purple);
  font-weight: bold;
}

.dominance-info {
  display: flex;
  gap: 30px;
  justify-content: center;
}

.dominance-header, .needs-header {
  font-family: 'Orbitron', monospace;
  color: var(--imperial-gold);
  font-weight: bold;
}

/* Element Strength Grid */
.element-strength-grid {
  display: grid;
  gap: 10px;
}

.element-strength {
  display: flex;
  align-items: center;
  gap: 15px;
}

.element-name {
  width: 60px;
  font-size: 0.9em;
  font-weight: bold;
}

.strength-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.strength-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.element-strength.wood .strength-fill { background: #4CAF50; }
.element-strength.fire .strength-fill { background: #F44336; }
.element-strength.earth .strength-fill { background: #FF9800; }
.element-strength.metal .strength-fill { background: #9E9E9E; }
.element-strength.water .strength-fill { background: #2196F3; }

/* Hexagram Lines */
.hexagram-info {
  display: flex;
  justify-content: center;
}

.hexagram-details {
  display: flex;
  align-items: center;
  gap: 20px;
}

.hexagram-lines {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hexagram-line {
  height: 8px;
  width: 60px;
  position: relative;
}

.hexagram-line.changing {
  opacity: 0.7;
}

.line-solid {
  height: 100%;
  background: var(--imperial-gold);
  border-radius: 2px;
}

.line-broken {
  height: 100%;
  display: flex;
  gap: 8px;
}

.line-broken span {
  flex: 1;
  background: var(--imperial-gold);
  border-radius: 2px;
}

.hexagram-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hexagram-names {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.chinese-name {
  font-size: 1.8em;
  color: var(--imperial-gold);
}

.english-name {
  font-size: 1.1em;
  color: var(--shadow-purple);
}

.hexagram-trigrams {
  display: flex;
  align-items: center;
  gap: 10px;
}

.trigram-symbol {
  font-size: 1.2em;
  color: var(--imperial-gold);
}

/* Wu Xing Diagram — MOVED to jsmodules/Yukhyo.css (2026-08-28, owner
   ruling: the Ohaeng wheel is replaced by the two-phase trigram layout —
   pillar 1, the module CSS is @imported at the top of this file). */


.verdict-conclusion {
  font-family: 'Orbitron', monospace;
  color: var(--imperial-gold);
  font-weight: bold;
}

/* Narrative Section */
.narrative-section {
  border: none;
  background: rgba(180, 120, 255, 0.1);
}

.narrative-content {
  line-height: 1.7;
  font-size: 1.1em;
  color: #e0e0e0;
}

.narrative-content p {
  margin-bottom: 15px;
}

/* Responsive Design for New Elements */
@media (max-width: 768px) {
  .temporal-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .trigram-grid {
    flex-direction: column;
    gap: 15px;
  }
  
  .element-flow {
    justify-content: flex-start;
    gap: 5px;
  }
  
  .element {
    font-size: 0.8em;
    padding: 6px 10px;
  }
  
  .dominance-info {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
  
  .hexagram-details {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .temporal-grid {
    grid-template-columns: 1fr;
  }
  
  .section-header {
    padding: 12px;
  }
  
  .subsection {
    padding: 12px;
  }
}
