#omg-header {
  z-index: 450;
}

/* core.css is shared across other projects, so the theme-picker's swatch
   styling stays untouched there -- this overrides it to render icons
   (sun/moon/spiral, same set as react-morph-charts' ThemeToggle) instead of
   plain colored circles, without needing to edit the shared file. */
#omg-theme-picker {
  gap: 2px;
}
#omg-theme-picker > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  width: 28px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: none;
  color: currentColor;
  opacity: 0.75;
}
#omg-theme-picker > a:hover {
  opacity: 1;
}
#omg-theme-picker > a.selected {
  opacity: 1;
}

.tagline {
  opacity: 0.85;
  margin: 0 0 20px;
}

.detail-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 400;
}

.card-detail {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 90vw);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 500;
  padding: 60px 24px 24px;
  border-radius: 0;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.35);
}
.card-detail.open {
  transform: translateX(0);
}

.detail-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.6em;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  padding: 4px 8px;
  margin: 0;
}

.detail-header {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 15px;
}
.detail-header .card-frame {
  width: 100px;
  flex-shrink: 0;
}
.detail-header h3 {
  margin: 0 0 4px;
}
.detail-position {
  opacity: 0.7;
  margin-bottom: 8px;
}

.keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.keyword {
  font-size: 0.75em;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid currentColor;
  opacity: 0.85;
}

.card-detail h4 {
  margin: 14px 0 6px;
}
.card-detail ul {
  margin: 0;
  padding-left: 20px;
}
.card-detail .fortune {
  font-style: italic;
}
.card-detail .position-meaning {
  margin: 0;
  line-height: 1.5;
}

.detail-credit {
  margin: 16px 0 0;
  font-size: 0.75em;
  opacity: 0.65;
  line-height: 1.4;
}
.detail-credit a {
  color: inherit;
}


/* ---------------------------------------------------------------- I Ching */

/* The themes ship a generic svg rule (22px, tan fill, orange on hover) meant
   for icons; hexagram drawings opt out of it. */
.hexagram-svg {
  display: block;
  fill: currentColor;
  stroke: currentColor;
  cursor: inherit;
  flex-shrink: 0;
}
.hexagram-svg:hover {
  fill: currentColor;
}
.hexagram-svg rect,
.hexagram-svg .hx-mark {
  transition: opacity 0.3s ease;
}
.hexagram-svg rect {
  stroke: none;
}
.hx-empty {
  opacity: 0.12;
}
.hx-changing rect {
  fill: #ffa500;
}
.hx-changing .hx-mark {
  stroke: #ffa500;
}
.hx-new {
  animation: hx-drop 0.5s ease;
}
@keyframes hx-drop {
  from {
    opacity: 0;
    transform: translateY(-14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Coin toss */
.cast-area {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 30px;
  margin: 10px 0 20px;
}
.coins {
  display: flex;
  gap: 16px;
  perspective: 600px;
}
.coin {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4em;
  font-weight: bold;
  color: #5a3d00;
  background: radial-gradient(circle at 35% 30%, #ffe08a, #e0a526 70%, #b57f10);
  border: 3px solid #b57f10;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.18);
  opacity: 0.55;
}
.coin.face-3,
.coin.face-2 {
  opacity: 1;
}
.coin.face-2 {
  background: radial-gradient(circle at 35% 30%, #e3e6ea, #a9b0b9 70%, #838b96);
  border-color: #838b96;
  color: #3a4048;
}
.coin.spinning {
  opacity: 1;
  animation: coin-spin 0.9s ease-in-out;
}
.coin.spinning:nth-child(2) {
  animation-delay: 0.08s;
}
.coin.spinning:nth-child(3) {
  animation-delay: 0.16s;
}
@keyframes coin-spin {
  0% {
    transform: translateY(0) rotateY(0);
  }
  45% {
    transform: translateY(-38px) rotateY(720deg);
  }
  100% {
    transform: translateY(0) rotateY(1440deg);
  }
}
.cast-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.cast-progress {
  opacity: 0.85;
}
.toss-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.toss-btn {
  margin: 4px 5px 0 0;
}
/* "Toss All": an outline button, as "Draw All" in Rune Reading */
.toss-btn.secondary {
  background-color: transparent;
  border: 2px solid #3182ce;
}
.toss-btn.secondary:hover,
.toss-btn.secondary:focus {
  background-color: #2b6cb0;
}
/* light theme: the theme's buttons have white text, which vanishes on the transparent outline button */
html[data-theme="light"] .toss-btn.secondary {
  color: #2b6cb0;
}
html[data-theme="light"] .toss-btn.secondary:hover,
html[data-theme="light"] .toss-btn.secondary:focus {
  color: white;
}
/* blue theme: the outline button must stand out on the blue background */
html[data-theme="evol-blue"] .toss-btn.secondary {
  color: white;
  border-color: white;
}
html[data-theme="evol-blue"] .toss-btn.secondary:hover,
html[data-theme="evol-blue"] .toss-btn.secondary:focus {
  background-color: rgba(255, 255, 255, 0.2);
}
.toss-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.toss-log {
  display: grid;
  gap: 4px;
  max-width: 460px;
  margin: 0 0 10px;
  font-size: 0.85em;
}
.toss-row {
  display: grid;
  grid-template-columns: 5.5em 8em 1fr;
  gap: 8px;
  opacity: 0.8;
}
.toss-row.changing {
  opacity: 1;
  color: #ffb74d;
}
.toss-n {
  font-weight: bold;
}

/* Buttons above the reading */
.interpret-bar {
  min-height: 1px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.interpret-btn {
  margin: 10px 0 5px 0;
}

/* Hexagram cards: same look as the omg-themes feature cards, with the
   figure and the explanation text as two nested columns. */
.hexagram-board {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin: 20px 0;
}
.hexagram-board.hidden {
  display: none;
}
.hex-arrow {
  font-size: 2em;
  opacity: 0.7;
}
.hex-card {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  box-sizing: border-box;
  width: min(460px, 100%);
  background-color: var(--card-bg);
  border: 3px solid var(--card-border);
  border-radius: 10px;
  padding: 15px 20px 20px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.hex-card.pending {
  cursor: default;
  width: auto;
  min-width: 260px;
}
.hex-card:not(.pending):hover {
  border-color: color-mix(in srgb, var(--card-border), white 40%);
}
.hex-card.active {
  border-color: currentColor;
}
.hex-figure {
  flex-shrink: 0;
}
.hex-info {
  min-width: 0;
}
.hex-role {
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
}
.hex-name {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--card-strong);
  margin: 2px 0 2px;
}
.hex-sub {
  font-size: 0.85em;
  color: var(--card-foot);
  margin-bottom: 8px;
}
.hex-card .keywords {
  margin-bottom: 8px;
}
.hex-line {
  font-size: 0.85em;
  color: var(--card-foot);
  margin: 0;
  line-height: 1.4;
}
.hex-card.line-card {
  cursor: default;
  width: min(360px, 100%);
}

/* Interpretation view */
.interpretation-view {
  display: none;
  margin: 20px 0;
}
.interpretation-view.open {
  display: block;
}
.interpret-section {
  margin-bottom: 30px;
}
.interpret-section h3 {
  margin: 0 0 14px;
  font-size: 1em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.85;
}
.interpret-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.interpret-note {
  margin: 14px 0 0;
  max-width: 640px;
  opacity: 0.85;
  font-size: 0.9em;
}
.interpret-credit {
  margin: 100px 0 0;
  font-size: 0.85em;
  opacity: 0.7;
}

@media print {
  .hex-card {
    width: 100%;
  }
}

/* less empty space above the footer (the shared core.css puts 90vh there) */
.big-v-space {
  margin-top: 40px;
}
