:root {
  --ink: #080604;
  --ink2: #110d09;
  --ink3: #1c1510;
  --gold: #c9983a;
  --gold-light: #e8c46a;
  --gold-dim: #7a5c1e;
  --cinnabar: #b52318;
  --cinnabar-light: #d4382a;
  --parchment: #ede0c4;
  --parchment-dim: #a8946e;
  --yang-glow: rgba(201,152,58,0.4);
  --yin-glow: rgba(181,35,24,0.3);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
  width: 100%;
}

body {
  background: var(--ink);
  color: var(--parchment);
  font-family: 'Noto Serif SC', serif;
  min-height: 100vh;
  overflow-x: clip;
  position: relative;
  width: 100%;
  max-width: 100vw;
}


/* ── Layout ── */
.layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
  width: 100%;
  overflow-x: clip;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 280px;
  background: rgba(8,6,4,0.97);
  border-right: 1px solid rgba(201,152,58,0.12);
  display: flex;
  flex-direction: column;
  transform: translateX(-280px);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  z-index: 100;
  overflow: hidden;
}

.sidebar.open { transform: translateX(0); }

.sidebar-toggle {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  z-index: 101;
  background: rgba(12,9,5,0.95);
  border: 1px solid rgba(201,152,58,0.2);
  border-left: none;
  border-radius: 0 6px 6px 0;
  padding: 14px 8px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.sidebar-toggle:hover { background: rgba(20,14,7,0.98); border-color: var(--gold-dim); }
.sidebar-toggle.shifted { left: 280px; }

.sidebar-toggle-icon {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-toggle-icon span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--gold-dim);
  border-radius: 1px;
  transition: all 0.3s;
}

.sidebar-toggle.open .sidebar-toggle-icon span:nth-child(1) {
  transform: rotate(45deg) translate(3px, 3px);
}
.sidebar-toggle.open .sidebar-toggle-icon span:nth-child(2) { opacity: 0; }
.sidebar-toggle.open .sidebar-toggle-icon span:nth-child(3) {
  transform: rotate(-45deg) translate(3px, -3px);
}

.sidebar-toggle-label {
  font-size: 9px;
  color: var(--gold-dim);
  letter-spacing: 1px;
  writing-mode: vertical-rl;
  margin-top: 4px;
  opacity: 0.7;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.sidebar-head {
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(201,152,58,0.1);
  flex-shrink: 0;
}

.sidebar-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.sidebar-head-actions {
  display: flex;
  gap: 6px;
}

.sidebar-title {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 18px;
  color: var(--gold);
  letter-spacing: 4px;
}

.sidebar-clear {
  background: none;
  border: 1px solid rgba(181,35,24,0.25);
  border-radius: 3px;
  padding: 3px 8px;
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(212,56,42,0.55);
  font-family: 'Noto Serif SC', serif;
  cursor: pointer;
  transition: all 0.2s;
}

.sidebar-clear:hover { border-color: var(--cinnabar); color: var(--cinnabar-light); }

.sidebar-io-btn {
  background: none;
  border: 1px solid rgba(201,152,58,0.2);
  border-radius: 3px;
  padding: 4px 10px;
  font-size: 10px;
  letter-spacing: 1px;
  color: rgba(201,152,58,0.55);
  font-family: 'Noto Serif SC', serif;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
  text-align: center;
}
.sidebar-io-btn:hover { border-color: var(--gold-dim); color: var(--gold); }
.sidebar-io-btn.import { border-color: rgba(201,152,58,0.15); }
.sidebar-io-import-label {
  display: block;
  font-size: 10px;
  letter-spacing: 1px;
  color: rgba(201,152,58,0.55);
  font-family: 'Noto Serif SC', serif;
  cursor: pointer;
  border: 1px solid rgba(201,152,58,0.2);
  border-radius: 3px;
  padding: 4px 10px;
  flex: 1;
  text-align: center;
  transition: all 0.2s;
}
.sidebar-io-import-label:hover { border-color: var(--gold-dim); color: var(--gold); }

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dim) transparent;
}

.sidebar-empty {
  padding: 32px 16px;
  text-align: center;
  font-size: 11px;
  color: rgba(168,148,110,0.28);
  letter-spacing: 3px;
  line-height: 2;
}

/* History item in sidebar */
.hist-item {
  border-bottom: 1px solid rgba(201,152,58,0.06);
  transition: background 0.2s;
}

.hist-item-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.hist-item-head:hover { background: rgba(255,255,255,0.03); }

.hist-item-sym {
  font-size: 24px;
  flex-shrink: 0;
  line-height: 1;
  opacity: 0.9;
}

.hist-item-info { flex: 1; min-width: 0; }

.hist-item-name {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 17px;
  color: var(--gold);
  letter-spacing: 2px;
  line-height: 1.3;
}

.hist-item-meta {
  font-size: 12px;
  color: var(--parchment);
  opacity: 0.6;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.hist-item-time {
  font-size: 10px;
  color: var(--parchment);
  opacity: 0.45;
  text-align: right;
  flex-shrink: 0;
  line-height: 1.5;
}

.hist-arrow {
  font-size: 10px;
  color: var(--gold-dim);
  flex-shrink: 0;
  transition: transform 0.25s;
  opacity: 0.6;
}

.hist-item.expanded .hist-arrow { transform: rotate(90deg); }

/* Expandable detail */
.hist-detail {
  display: none;
  padding: 0 14px 12px;
  border-top: 1px solid rgba(201,152,58,0.07);
  background: rgba(0,0,0,0.15);
  animation: fadeIn 0.3s ease;
}

.hist-item.expanded .hist-detail { display: block; }

.hist-detail-section {
  margin-top: 10px;
}

.hist-detail-label {
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--gold);
  opacity: 0.75;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hist-detail-label::before {
  content: '';
  display: block;
  width: 2px;
  height: 10px;
  background: var(--gold-dim);
  border-radius: 1px;
}

.hist-detail-text {
  font-size: 12px;
  line-height: 1.9;
  color: var(--parchment);
  opacity: 0.85;
}

.hist-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-top: 6px;
}

.hist-detail-chip {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(201,152,58,0.08);
  border-radius: 3px;
  padding: 5px 7px;
}

.hist-detail-chip-label {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--parchment);
  opacity: 0.55;
  margin-bottom: 2px;
}

.hist-detail-chip-val {
  font-size: 13px;
  color: var(--gold-light);
  font-family: 'Ma Shan Zheng', cursive;
  letter-spacing: 2px;
}

.hist-detail-warning {
  font-size: 12px;
  color: var(--cinnabar-light);
  border-left: 2px solid var(--cinnabar);
  padding-left: 8px;
  line-height: 1.8;
  margin-top: 6px;
}

/* Note area */
.hist-note-area { margin-top: 18px; }

.hist-note-display {
  font-size: 11px;
  color: var(--parchment-dim);
  font-style: italic;
  line-height: 1.7;
  padding: 6px 8px;
  background: rgba(255,255,255,0.02);
  border-radius: 3px;
  border-left: 2px solid rgba(201,152,58,0.2);
}

.hist-note-btn {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(201,152,58,0.5);
  cursor: pointer;
  margin-top: 4px;
  transition: color 0.2s;
}

.hist-note-btn:hover { color: var(--gold); }

.hist-note-input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(201,152,58,0.2);
  border-radius: 3px;
  padding: 6px 8px;
  font-family: 'Noto Serif SC', serif;
  font-size: 11px;
  color: var(--parchment);
  outline: none;
  resize: none;
  min-height: 56px;
  letter-spacing: 1px;
  line-height: 1.7;
  margin-top: 6px;
}

.hist-note-input:focus { border-color: var(--gold-dim); }

.hist-note-save {
  margin-top: 5px;
  background: rgba(201,152,58,0.1);
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
  padding: 4px 12px;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--gold);
  font-family: 'Noto Serif SC', serif;
  cursor: pointer;
  transition: all 0.2s;
}

.hist-note-save:hover { background: rgba(201,152,58,0.2); }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

.sidebar-overlay.visible { display: block; }

/* ── Main content ── */
.app {
  flex: 1;
  max-width: 560px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 30px 24px 60px;
  overflow-x: clip;
  transition: margin-left 0.35s cubic-bezier(0.4,0,0.2,1);
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 36px;
}

.header-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 14px;
}

.ornament-line {
  height: 1px;
  width: 60px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), var(--gold), var(--gold-dim), transparent);
}

.ornament-diamond {
  width: 8px;
  height: 8px;
  background: var(--gold);
  transform: rotate(45deg);
  box-shadow: 0 0 8px var(--yang-glow);
}

.title-main {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: clamp(32px, 10vw, 46px);
  color: var(--gold);
  text-shadow: 0 0 30px rgba(201,152,58,0.5), 0 2px 4px rgba(0,0,0,0.8);
  letter-spacing: clamp(2px, 1.5vw, 6px);
  line-height: 1;
  margin-bottom: 8px;
}

.title-sub {
  font-size: 13px;
  color: var(--parchment-dim);
  letter-spacing: 5px;
  font-weight: 300;
}

.time-display {
  margin-top: 14px;
  font-size: 12px;
  color: var(--parchment);
  letter-spacing: 2px;
  opacity: 0.55;
}

#start-time-label {
  margin-top: 6px;
  font-size: 12px;
  color: var(--gold-dim);
  letter-spacing: 2px;
  min-height: 18px;
}

/* Yao slot placeholders */
.hex-line-slot {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  width: 100%;
  height: 32px;
  opacity: 0.18;
  transition: opacity 0.4s;
}

.hex-line-slot.filled {
  opacity: 1;
  animation: slotAppear 0.45s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

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

.slot-placeholder-bar {
  width: clamp(100px, 40vw, 160px);
  height: 10px;
  border-radius: 5px;
  background: rgba(201,152,58,0.1);
  border: 1px dashed rgba(201,152,58,0.18);
}

/* Coin stage */
.coin-stage {
  display: flex;
  justify-content: center;
  gap: clamp(10px, 4vw, 28px);
  margin-bottom: 32px;
}

.coin-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  perspective: 800px;
}

.coin-container {
  width: clamp(72px, 22vw, 100px);
  height: clamp(72px, 22vw, 100px);
  position: relative;
  transform-style: preserve-3d;
  cursor: default;
}

.coin-face, .coin-back {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}

/* Coin SVG faces */
.coin-svg {
  width: 100%;
  height: 100%;
}

.coin-back { transform: rotateY(180deg); }

.coin-label {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--parchment-dim);
  opacity: 0;
  transition: opacity 0.5s;
  font-family: 'Ma Shan Zheng', cursive;
}

.coin-label.visible { opacity: 1; }
.coin-label.yang { color: var(--gold-light); }
.coin-label.yin { color: var(--cinnabar-light); }

/* Coin settings */
.coin-settings-area {
  margin-bottom: 20px;
}

.coin-settings-toggle {
  display: block;
  margin: 0 auto;
  background: none;
  border: 1px solid rgba(201,152,58,0.15);
  border-radius: 4px;
  padding: 5px 14px;
  font-family: 'Noto Serif SC', serif;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--parchment-dim);
  cursor: pointer;
  transition: all 0.3s;
  opacity: 0.6;
}

.coin-settings-toggle:hover {
  opacity: 1;
  border-color: var(--gold-dim);
  color: var(--gold);
}

.coin-settings-panel {
  margin-top: 14px;
  padding: 16px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(201,152,58,0.12);
  border-radius: 6px;
  animation: fadeIn 0.3s ease;
}

.coin-settings-row {
  margin-bottom: 14px;
}

.coin-settings-row:last-child {
  margin-bottom: 0;
}

.coin-settings-label {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--gold);
  opacity: 0.75;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.coin-settings-label .coin-settings-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.coin-settings-label .dot-yang { background: var(--gold); }
.coin-settings-label .dot-yin { background: var(--cinnabar); }

.coin-settings-input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(201,152,58,0.18);
  border-radius: 4px;
  padding: 8px 10px;
  font-family: 'Noto Serif SC', serif;
  font-size: 11px;
  color: var(--parchment);
  outline: none;
  resize: none;
  min-height: 48px;
  letter-spacing: 0.5px;
  line-height: 1.5;
  word-break: break-all;
}

.coin-settings-input:focus {
  border-color: var(--gold-dim);
}

.coin-settings-input::placeholder {
  color: rgba(168,148,110,0.3);
}

.coin-settings-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  min-height: 40px;
}

.coin-settings-preview-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(201,152,58,0.25);
  background: var(--ink2);
}

.coin-settings-preview-text {
  font-size: 10px;
  color: var(--parchment-dim);
  opacity: 0.5;
}

.coin-settings-btns {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.coin-settings-btn {
  flex: 1;
  padding: 7px 12px;
  border-radius: 4px;
  font-family: 'Noto Serif SC', serif;
  font-size: 11px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.2s;
}

.coin-settings-apply {
  background: rgba(201,152,58,0.12);
  border: 1px solid var(--gold-dim);
  color: var(--gold);
}

.coin-settings-apply:hover {
  background: rgba(201,152,58,0.22);
}

.coin-settings-reset {
  background: rgba(181,35,24,0.08);
  border: 1px solid rgba(181,35,24,0.25);
  color: rgba(212,56,42,0.65);
}

.coin-settings-reset:hover {
  background: rgba(181,35,24,0.15);
  color: var(--cinnabar-light);
}

.coin-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.coin-settings-hint {
  font-size: 10px;
  color: var(--parchment-dim);
  opacity: 0.4;
  letter-spacing: 1px;
  margin-top: 8px;
  line-height: 1.7;
  text-align: center;
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}

.divider-text {
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--parchment-dim);
  white-space: nowrap;
}

/* Cast button */
/* ── Mode Selector ── */
.mode-selector-area {
  margin-bottom: 20px;
  max-height: 56px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.45s cubic-bezier(0.4,0,0.2,1),
              opacity 0.3s ease,
              margin-bottom 0.35s ease;
}
.mode-selector-area.hidden {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
  pointer-events: none;
}

.mode-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(201,152,58,0.18);
  border-radius: 6px;
  background: rgba(15,10,5,0.6);
  overflow: hidden;
  height: 40px;
}

.mode-btn {
  flex: 1;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--parchment-dim);
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 15px;
  letter-spacing: 4px;
  cursor: pointer;
  transition: color 0.25s, background 0.25s;
  position: relative;
}
.mode-btn.active {
  color: var(--gold-light);
  background: linear-gradient(135deg, rgba(201,152,58,0.12), rgba(201,152,58,0.06));
}
.mode-btn:not(.active):hover {
  color: var(--parchment);
  background: rgba(201,152,58,0.05);
}
.mode-divider {
  width: 1px;
  height: 60%;
  background: rgba(201,152,58,0.18);
  flex-shrink: 0;
}

/* ── Coin stage show/hide ── */
.coin-stage {
  transition: max-height 0.45s cubic-bezier(0.4,0,0.2,1),
              opacity 0.35s ease,
              margin-bottom 0.35s ease;
  overflow: hidden;
}
.coin-stage.mode-hidden {
  max-height: 0 !important;
  opacity: 0;
  margin-bottom: 0;
  pointer-events: none;
}

/* ── Manual Yao Panel ── */
.manual-panel {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-bottom: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(18,12,6,0.9), rgba(10,7,3,0.95));
  transition: max-height 0.5s cubic-bezier(0.4,0,0.2,1),
              opacity 0.4s ease,
              margin-bottom 0.4s ease,
              border-color 0.4s ease;
}
.manual-panel.visible {
  max-height: 600px;
  opacity: 1;
  margin-bottom: 20px;
  border-color: rgba(201,152,58,0.18);
}

.manual-panel-title {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 13px;
  letter-spacing: 5px;
  color: var(--parchment-dim);
  text-align: center;
  padding: 11px 0 8px;
  border-bottom: 1px solid rgba(201,152,58,0.1);
}

.manual-yao-grid {
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.manual-yao-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  border-radius: 4px;
  transition: background 0.2s;
}
.manual-yao-row:hover { background: rgba(201,152,58,0.04); }

.manual-yao-name {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--parchment-dim);
  width: 28px;
  flex-shrink: 0;
  text-align: center;
  line-height: 1;
}

.manual-yao-options {
  display: flex;
  gap: 5px;
  flex: 1;
}

/* Each selectable option */
.manual-yao-opt {
  flex: 1;
  position: relative;
  cursor: pointer;
  min-width: 0;
}
.manual-yao-opt input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
  pointer-events: none;
}

.manual-yao-opt-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px 5px;
  border-radius: 5px;
  border: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  background: rgba(255,255,255,0.02);
}

/* ── Mini yao bar visuals ── */
.myo-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
}

/* Yang = solid bar */
.myo-yang {
  display: block;
  width: 85%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(122,92,30,0.5), rgba(201,152,58,0.5), rgba(122,92,30,0.5));
  transition: background 0.2s, box-shadow 0.2s;
}

/* Yin = two broken segments */
.myo-yin {
  display: flex;
  width: 85%;
  gap: 10%;
}
.myo-yin span {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(120,25,18,0.5), rgba(181,35,24,0.5));
  transition: background 0.2s, box-shadow 0.2s;
}

/* Changing dot indicator (○) */
.myo-dot {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(201,152,58,0.4);
  transition: background 0.2s, box-shadow 0.2s;
}
.myo-dot.yin-dot { background: rgba(181,35,24,0.4); }

.myo-label {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 11px;
  letter-spacing: 1px;
  line-height: 1;
  color: rgba(168,148,110,0.55);
  transition: color 0.2s;
  white-space: nowrap;
}

/* ── Unselected hover ── */
.manual-yao-opt:hover .manual-yao-opt-inner {
  background: rgba(255,255,255,0.04);
}

/* ── YANG selected ── */
.manual-yao-opt.yang input:checked ~ .manual-yao-opt-inner,
.manual-yao-opt.yang-change input:checked ~ .manual-yao-opt-inner {
  border-color: rgba(201,152,58,0.55);
  background: rgba(201,152,58,0.1);
  box-shadow: 0 0 8px rgba(201,152,58,0.15);
}
.manual-yao-opt.yang input:checked ~ .manual-yao-opt-inner .myo-yang,
.manual-yao-opt.yang-change input:checked ~ .manual-yao-opt-inner .myo-yang {
  background: linear-gradient(90deg, var(--gold-dim), var(--gold), var(--gold-dim));
  box-shadow: 0 0 6px rgba(201,152,58,0.4);
}
.manual-yao-opt.yang input:checked ~ .manual-yao-opt-inner .myo-label,
.manual-yao-opt.yang-change input:checked ~ .manual-yao-opt-inner .myo-label {
  color: var(--gold-light);
}
.manual-yao-opt.yang-change input:checked ~ .manual-yao-opt-inner .myo-dot {
  background: var(--gold);
  box-shadow: 0 0 5px rgba(201,152,58,0.6);
}

/* ── YIN selected ── */
.manual-yao-opt.yin input:checked ~ .manual-yao-opt-inner,
.manual-yao-opt.yin-change input:checked ~ .manual-yao-opt-inner {
  border-color: rgba(181,35,24,0.55);
  background: rgba(181,35,24,0.1);
  box-shadow: 0 0 8px rgba(181,35,24,0.15);
}
.manual-yao-opt.yin input:checked ~ .manual-yao-opt-inner .myo-yin span,
.manual-yao-opt.yin-change input:checked ~ .manual-yao-opt-inner .myo-yin span {
  background: linear-gradient(90deg, var(--cinnabar), rgba(181,35,24,0.85));
  box-shadow: 0 0 5px rgba(181,35,24,0.35);
}
.manual-yao-opt.yin input:checked ~ .manual-yao-opt-inner .myo-label,
.manual-yao-opt.yin-change input:checked ~ .manual-yao-opt-inner .myo-label {
  color: #e07070;
}
.manual-yao-opt.yin-change input:checked ~ .manual-yao-opt-inner .myo-dot.yin-dot {
  background: var(--cinnabar-light);
  box-shadow: 0 0 5px rgba(181,35,24,0.6);
}

.cast-btn {
  display: block;
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #1a1208, #2d1f0a);
  border: 1px solid var(--gold-dim);
  border-radius: 6px;
  color: var(--gold);
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 22px;
  letter-spacing: 6px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
  margin-bottom: 30px;
  box-shadow: 0 2px 20px rgba(0,0,0,0.5), inset 0 1px 0 rgba(201,152,58,0.1);
}

.cast-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(201,152,58,0.12), transparent, rgba(201,152,58,0.06));
  opacity: 0;
  transition: opacity 0.3s;
}

.cast-btn:not(:disabled):hover {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(201,152,58,0.2), 0 2px 20px rgba(0,0,0,0.5);
  color: var(--gold-light);
}

.cast-btn:not(:disabled):hover::before { opacity: 1; }
.cast-btn:not(:disabled):active { transform: scale(0.99); }

.cast-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Progress indicators */
.progress-area {
  margin-bottom: 28px;
}

.progress-label {
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--parchment);
  opacity: 0.75;
  margin-bottom: 12px;
  text-align: center;
  min-height: 18px;
  transition: opacity 0.3s;
}

.line-progress {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.line-dot {
  width: 28px;
  height: 4px;
  border-radius: 2px;
  background: var(--ink3);
  border: 1px solid rgba(201,152,58,0.15);
  transition: all 0.4s;
}

.line-dot.active {
  background: rgba(201,152,58,0.3);
  border-color: var(--gold-dim);
  box-shadow: 0 0 6px rgba(201,152,58,0.2);
}

.line-dot.done-yang {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(201,152,58,0.4);
}

.line-dot.done-yin {
  background: var(--cinnabar);
  border-color: var(--cinnabar);
  box-shadow: 0 0 8px rgba(181,35,24,0.4);
}

.line-dot-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.line-dot-digits {
  font-size: 9px;
  color: var(--gold-dim);
  letter-spacing: 1px;
  min-height: 13px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.4s;
  font-family: 'Noto Serif SC', serif;
}

.line-dot-digits.visible {
  opacity: 0.85;
}

.hist-yao-table {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.hist-yao-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  padding: 3px 6px;
  background: rgba(255,255,255,0.02);
  border-radius: 3px;
}

.hist-yao-name {
  color: var(--parchment);
  opacity: 0.7;
  min-width: 28px;
}

.hist-yao-digits {
  color: var(--gold-dim);
  letter-spacing: 2px;
  min-width: 40px;
}

.hist-yao-result {
  font-size: 11px;
  letter-spacing: 1px;
}

/* Hexagram display */
.hexagram-area {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s, transform 0.6s;
}

.hexagram-area.visible {
  opacity: 1;
  transform: translateY(0);
}

.hex-lines-display {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  padding: 14px 20px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(201,152,58,0.12);
  border-radius: 8px;
  position: relative;
  min-height: 0;
}

.hex-line-row {
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.5s, transform 0.5s;
  width: 100%;
  justify-content: center;
}

.hex-line-row.visible {
  opacity: 1;
  transform: translateX(0);
}

.hex-line-num {
  font-size: 12px;
  color: var(--parchment);
  opacity: 0.5;
  width: 16px;
  text-align: right;
  flex-shrink: 0;
}

.hex-line-bar {
  display: flex;
  gap: 0;
  align-items: center;
}

/* Yang line - solid */
.hex-line-yang {
  width: clamp(100px, 40vw, 160px);
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold), var(--gold-dim));
  box-shadow: 0 0 8px rgba(201,152,58,0.3);
}

/* Yin line - broken */
.hex-line-yin {
  display: flex;
  gap: 8px;
}

.hex-line-yin-seg {
  width: clamp(46px, 18.5vw, 72px);
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--cinnabar) 0%, rgba(181,35,24,0.8) 100%);
  box-shadow: 0 0 6px rgba(181,35,24,0.25);
}

/* Changing lines */
.hex-line-changing .hex-line-yang,
.hex-line-changing .hex-line-yin-seg {
  animation: changingGlow 1.5s ease-in-out infinite;
}

@keyframes changingGlow {
  0%,100% { box-shadow: 0 0 8px rgba(232,196,106,0.4); }
  50% { box-shadow: 0 0 16px rgba(232,196,106,0.8), 0 0 30px rgba(232,196,106,0.3); }
}

.hex-line-tag {
  font-size: 12px;
  color: var(--gold);
  letter-spacing: 1px;
  min-width: 32px;
  opacity: 0.8;
}

.hex-line-tag.changing {
  color: var(--gold-light);
  opacity: 1;
  font-weight: 600;
}

/* Hexagram result info */
.hex-result {
  text-align: center;
  margin-bottom: 28px;
  padding: 20px;
  background: linear-gradient(135deg, rgba(201,152,58,0.04), rgba(181,35,24,0.03));
  border: 1px solid rgba(201,152,58,0.15);
  border-radius: 8px;
}

.hex-symbol {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 12px rgba(201,152,58,0.4));
  animation: symbolAppear 0.8s ease-out forwards;
}

@keyframes symbolAppear {
  from { transform: scale(0.5) rotate(-10deg); opacity: 0; }
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}

.hex-number {
  font-size: 13px;
  color: var(--parchment);
  letter-spacing: 3px;
  margin-bottom: 4px;
  opacity: 0.7;
}

.hex-name-display {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 42px;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(201,152,58,0.4);
  letter-spacing: 4px;
  margin-bottom: 6px;
}

.hex-upper-lower {
  font-size: 14px;
  color: var(--parchment);
  letter-spacing: 2px;
  margin-bottom: 8px;
  opacity: 0.75;
}

.hex-nature {
  font-size: 15px;
  color: var(--gold-light);
  letter-spacing: 3px;
  border-top: 1px solid rgba(201,152,58,0.15);
  padding-top: 10px;
  margin-top: 8px;
}

/* Changing hexagram */
.zhigua-section {
  text-align: center;
  margin-bottom: 20px;
  padding: 14px;
  border: 1px dashed rgba(201,152,58,0.2);
  border-radius: 6px;
  font-size: 13px;
  color: var(--parchment-dim);
}

.zhigua-title {
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--parchment);
  opacity: 0.65;
  margin-bottom: 8px;
}

.zhigua-name {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 30px;
  color: var(--gold);
  letter-spacing: 3px;
  opacity: 0.8;
}

/* Analysis tabs */
.analysis-section {
  margin-top: 20px;
  max-width: 100%;
}

.analysis-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(201,152,58,0.15);
  overflow-x: auto;
  scrollbar-width: none;
}

.analysis-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 8px 14px;
  background: none;
  border: none;
  color: var(--parchment);
  font-family: 'Noto Serif SC', serif;
  font-size: 13px;
  letter-spacing: 2px;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  transition: color 0.3s;
  opacity: 0.65;
}

.tab-btn::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transition: transform 0.3s;
}

.tab-btn.active {
  color: var(--gold);
  opacity: 1;
}

.tab-btn.active::after {
  transform: scaleX(1);
}

.tab-content {
  display: none;
  animation: fadeIn 0.4s ease;
}

.tab-content.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.analysis-card {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(201,152,58,0.1);
  border-radius: 6px;
  padding: 20px;
}

.analysis-title {
  font-size: 13px;
  letter-spacing: 4px;
  color: var(--gold);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.85;
}

.analysis-title::before {
  content: '';
  display: block;
  width: 3px;
  height: 14px;
  background: var(--gold);
  border-radius: 2px;
  opacity: 1;
}

.analysis-text {
  font-size: 15px;
  line-height: 2;
  color: var(--parchment);
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.meta-item {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(201,152,58,0.1);
  border-radius: 4px;
  padding: 10px 12px;
}

.meta-label {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--parchment);
  opacity: 0.55;
  margin-bottom: 5px;
}

.meta-value {
  font-size: 15px;
  color: var(--gold-light);
  font-family: 'Ma Shan Zheng', cursive;
  letter-spacing: 2px;
}

.warning-text {
  font-size: 13px;
  color: var(--cinnabar-light);
  border-left: 2px solid var(--cinnabar);
  padding-left: 12px;
  margin-top: 16px;
  line-height: 1.9;
}

/* Trivial items */
.trivial-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.trivial-item {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(201,152,58,0.1);
  border-radius: 6px;
  padding: 16px;
  transition: border-color 0.3s;
}

.trivial-item:hover {
  border-color: rgba(201,152,58,0.25);
}

.trivial-item-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.trivial-item-icon {
  font-size: 15px;
  line-height: 1;
}

.trivial-item-label {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--gold);
  opacity: 0.85;
}

.trivial-item-text {
  font-size: 13px;
  line-height: 1.9;
  color: var(--parchment);
  opacity: 0.85;
}

.trivial-empty {
  text-align: center;
  padding: 20px;
  color: var(--parchment-dim);
  opacity: 0.4;
  font-size: 12px;
  letter-spacing: 3px;
  line-height: 2;
}

.trivial-copy-box {
  margin-top: 16px;
  border: 1px solid rgba(201,152,58,0.15);
  border-radius: 6px;
  overflow: hidden;
  background: rgba(0,0,0,0.18);
}
.trivial-copy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(201,152,58,0.05);
  border-bottom: 1px solid rgba(201,152,58,0.1);
}
.trivial-copy-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--gold-dim);
  opacity: 0.85;
  flex: 1;
  margin-right: 8px;
}
.trivial-copy-btn {
  background: rgba(201,152,58,0.1);
  border: 1px solid rgba(201,152,58,0.25);
  border-radius: 3px;
  padding: 3px 12px;
  font-family: 'Noto Serif SC', serif;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--gold);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.trivial-copy-btn:hover { background: rgba(201,152,58,0.22); }
.trivial-copy-btn.copied { color: #6dbf8e; border-color: rgba(109,191,142,0.4); }
.trivial-copy-textarea {
  display: block;
  width: 100%;
  min-height: 160px;
  max-height: 420px;
  padding: 10px 12px;
  font-size: 11px;
  font-family: 'Noto Serif SC', serif;
  color: var(--parchment);
  opacity: 0.8;
  line-height: 1.85;
  letter-spacing: 0.4px;
  white-space: pre-wrap;
  background: transparent;
  border: none;
  outline: none;
  resize: vertical;
  box-sizing: border-box;
}

/* Loading state */

.loading-indicator {
  display: none;
  text-align: center;
  padding: 20px;
  color: var(--parchment-dim);
  font-size: 12px;
  letter-spacing: 3px;
}

.loading-dots span {
  animation: blink 1.2s infinite;
  opacity: 0;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%,80%,100% { opacity: 0; }
  40% { opacity: 1; }
}

/* Error message */
.error-msg {
  display: none;
  text-align: center;
  padding: 14px;
  color: var(--cinnabar-light);
  font-size: 13px;
  letter-spacing: 2px;
  border: 1px solid rgba(181,35,24,0.3);
  border-radius: 6px;
  margin-bottom: 16px;
}


/* ── 离页重置提示 Toast ── */
.reset-toast {
  position: fixed;
  top: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  z-index: 999;
  background: linear-gradient(135deg, rgba(18,12,6,0.97), rgba(28,18,8,0.97));
  border: 1px solid rgba(201,152,58,0.35);
  border-radius: 8px;
  padding: 13px 22px 13px 16px;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  max-width: min(340px, 90vw);
  box-shadow: 0 8px 32px rgba(0,0,0,0.7), 0 0 0 1px rgba(201,152,58,0.08);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34,1.4,0.64,1);
}
.reset-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.reset-toast-icon {
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1.4;
  color: var(--gold);
}
.reset-toast-body {
  flex: 1;
  min-width: 0;
}
.reset-toast-title {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--gold-light);
  margin-bottom: 4px;
  line-height: 1.4;
}
.reset-toast-desc {
  font-size: 12px;
  letter-spacing: 1.5px;
  color: var(--parchment-dim);
  line-height: 1.6;
}
.reset-toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--parchment-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 0 0 0 4px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.2s;
  margin-top: 1px;
}
.reset-toast-close:hover { opacity: 1; }

/* Footer */
.footer-area {
  text-align: center;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid rgba(201,152,58,0.08);
  font-size: 11px;
  color: rgba(168,148,110,0.35);
  letter-spacing: 3px;
}

/* Scrollbar — desktop only, hidden on touch devices */
@media (hover: hover) and (pointer: fine) {
  ::-webkit-scrollbar { width: 4px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 2px; }
}
@media (hover: none) {
  ::-webkit-scrollbar { display: none; width: 0; }
  * { scrollbar-width: none; }
}

/* Coin shimmer effect during spin */
.coin-spinning .coin-svg {
  filter: brightness(1.25) drop-shadow(0 0 6px rgba(212,175,55,0.45));
  transition: filter 0.2s ease;
}

/* Transitions when results appear */
.result-appear {
  animation: resultAppear 0.6s ease-out forwards;
}

@keyframes resultAppear {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Fortune level badge */
.fortune-badge {
  display: inline-block;
  padding: 4px 16px;
  border-radius: 4px;
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 22px;
  letter-spacing: 4px;
  margin: 10px 0 6px;
  border: 1px solid;
  white-space: nowrap;
  animation: fortuneAppear 0.6s ease-out forwards;
}

@keyframes fortuneAppear {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.fortune-daji {
  color: #ffd700;
  border-color: rgba(255,215,0,0.5);
  background: rgba(255,215,0,0.08);
  text-shadow: 0 0 18px rgba(255,215,0,0.6);
  box-shadow: 0 0 20px rgba(255,215,0,0.15), inset 0 0 12px rgba(255,215,0,0.05);
}

.fortune-ji {
  color: #e8c46a;
  border-color: rgba(232,196,106,0.4);
  background: rgba(232,196,106,0.06);
  text-shadow: 0 0 12px rgba(232,196,106,0.4);
  box-shadow: 0 0 14px rgba(232,196,106,0.1);
}

.fortune-xiaoji {
  color: #a8c06a;
  border-color: rgba(168,192,106,0.35);
  background: rgba(168,192,106,0.05);
  text-shadow: 0 0 10px rgba(168,192,106,0.3);
}

.fortune-ping {
  color: #8aaa9a;
  border-color: rgba(138,170,154,0.3);
  background: rgba(138,170,154,0.04);
}

.fortune-xiaoxiong {
  color: #d49a6a;
  border-color: rgba(212,154,106,0.35);
  background: rgba(212,154,106,0.05);
  text-shadow: 0 0 10px rgba(212,154,106,0.3);
}

.fortune-xiong {
  color: #d4603a;
  border-color: rgba(212,96,58,0.4);
  background: rgba(212,96,58,0.06);
  text-shadow: 0 0 12px rgba(212,96,58,0.3);
}

.fortune-daxiong {
  color: #d4382a;
  border-color: rgba(212,56,42,0.5);
  background: rgba(212,56,42,0.08);
  text-shadow: 0 0 16px rgba(212,56,42,0.5);
  box-shadow: 0 0 18px rgba(212,56,42,0.12), inset 0 0 10px rgba(212,56,42,0.04);
}

/* Fortune in sidebar history */
.hist-fortune-tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 2px;
  font-family: 'Ma Shan Zheng', cursive;
  vertical-align: middle;
  margin-left: 4px;
  border: 1px solid;
}

.hist-fortune-tag.fortune-daji   { color:#ffd700; border-color:rgba(255,215,0,0.35); background:rgba(255,215,0,0.06); }
.hist-fortune-tag.fortune-ji     { color:#e8c46a; border-color:rgba(232,196,106,0.3); background:rgba(232,196,106,0.05); }
.hist-fortune-tag.fortune-xiaoji { color:#a8c06a; border-color:rgba(168,192,106,0.25); background:rgba(168,192,106,0.04); }
.hist-fortune-tag.fortune-ping   { color:#8aaa9a; border-color:rgba(138,170,154,0.25); background:rgba(138,170,154,0.04); }
.hist-fortune-tag.fortune-xiaoxiong { color:#d49a6a; border-color:rgba(212,154,106,0.25); background:rgba(212,154,106,0.04); }
.hist-fortune-tag.fortune-xiong  { color:#d4603a; border-color:rgba(212,96,58,0.3); background:rgba(212,96,58,0.05); }
.hist-fortune-tag.fortune-daxiong { color:#d4382a; border-color:rgba(212,56,42,0.35); background:rgba(212,56,42,0.06); }

/* Single history item delete */
.hist-item-del {
  position: relative;
  width: 20px;
  height: 20px;
  border: none;
  background: none;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hist-item-head:hover .hist-item-del {
  opacity: 0.5;
}

.hist-item-del:hover {
  opacity: 1 !important;
}

.hist-item-del::before,
.hist-item-del::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 1.5px;
  background: var(--cinnabar-light);
  border-radius: 1px;
}

.hist-item-del::before { transform: rotate(45deg); }
.hist-item-del::after  { transform: rotate(-45deg); }

/* Delete confirm tooltip */
.hist-del-confirm {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: rgba(12,9,5,0.97);
  border: 1px solid rgba(181,35,24,0.4);
  border-radius: 4px;
  padding: 6px 0;
  z-index: 10;
  white-space: nowrap;
  animation: fadeIn 0.2s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
}

.hist-del-confirm-btn {
  display: block;
  width: 100%;
  padding: 5px 16px;
  background: none;
  border: none;
  font-family: 'Noto Serif SC', serif;
  font-size: 11px;
  letter-spacing: 2px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.hist-del-confirm-yes {
  color: var(--cinnabar-light);
}

.hist-del-confirm-yes:hover {
  background: rgba(181,35,24,0.15);
}

.hist-del-confirm-no {
  color: var(--parchment-dim);
}

.hist-del-confirm-no:hover {
  background: rgba(255,255,255,0.05);
}

/* Dual hexagram display */
.hex-dual-container {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
  max-width: 100%;
}

.hex-card {
  flex: 1 1 0;       /* 强制等分，忽略内容宽度差异 */
  min-width: 0;
  width: 0;          /* 配合 flex-basis:0 实现严格等宽 */
  max-width: 220px;
  text-align: center;
  padding: 18px 14px 14px;
  background: linear-gradient(135deg, rgba(201,152,58,0.03), rgba(181,35,24,0.02));
  border: 1.5px solid rgba(201,152,58,0.12);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.35s ease;
  position: relative;
}

.hex-card:hover {
  border-color: rgba(201,152,58,0.3);
  background: linear-gradient(135deg, rgba(201,152,58,0.05), rgba(181,35,24,0.03));
}

.hex-card.active {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(201,152,58,0.12), inset 0 0 20px rgba(201,152,58,0.03);
  background: linear-gradient(135deg, rgba(201,152,58,0.07), rgba(181,35,24,0.04));
}

.hex-card.solo {
  max-width: min(380px, 100%);
  width: 100%;
  padding: 20px;
  cursor: default;
}

.hex-card-label {
  font-size: 10px;
  letter-spacing: 4px;
  color: var(--parchment-dim);
  margin-bottom: 10px;
  transition: color 0.3s;
}

.hex-card.active .hex-card-label {
  color: var(--gold);
}

.hex-card-symbol {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 8px rgba(201,152,58,0.3));
  animation: symbolAppear 0.8s ease-out forwards;
}

.hex-card.solo .hex-card-symbol { font-size: clamp(44px, 14vw, 64px); margin-bottom: 10px; }

.hex-card-num {
  font-size: 11px;
  color: var(--parchment);
  letter-spacing: 2px;
  margin-bottom: 3px;
  opacity: 0.6;
}

.hex-card-name {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 30px;
  color: var(--gold);
  text-shadow: 0 0 14px rgba(201,152,58,0.3);
  letter-spacing: 3px;
  margin-bottom: 4px;
}

.hex-card.solo .hex-card-name { font-size: clamp(28px, 9vw, 42px); }

.hex-card-sub {
  font-size: 12px;
  color: var(--parchment);
  letter-spacing: 1px;
  margin-bottom: 4px;
  opacity: 0.7;
}

.hex-card-nature {
  font-size: 11px;
  color: var(--gold-light);
  letter-spacing: 2px;
  margin-top: 6px;
  line-height: 1.6;
}

.hex-card.solo .hex-card-nature { font-size: 14px; letter-spacing: 3px; }

.hex-card:not(.solo) .fortune-badge {
  display: block;          /* 撑满卡片宽度，不再撑开卡片 */
  width: 100%;
  box-sizing: border-box;
  font-size: clamp(11px, 3.2vw, 16px);
  padding: 3px 6px;
  letter-spacing: clamp(1px, 0.4vw, 2px);
  margin: 6px 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.hex-card-indicator {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid var(--gold);
  opacity: 0;
  transition: opacity 0.3s;
}

.hex-card.active .hex-card-indicator { opacity: 1; }

.hex-arrow {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 26px;
  color: var(--gold-dim);
  opacity: 0.5;
  padding: 0 2px;
  user-select: none;
}

.hex-changing-info {
  font-size: 10px;
  color: var(--parchment-dim);
  letter-spacing: 1px;
  margin-top: 8px;
  opacity: 0.55;
  font-family: 'Noto Serif SC', serif;
}

/* Analysis switch animation */
.analysis-card.switching {
  animation: fadeIn 0.35s ease;
}

/* Transition analysis styles */
.transition-tab-btn {
  position: relative;
}

.transition-tab-btn::after {
  content: '✦';
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 8px;
  color: var(--cinnabar-light);
  opacity: 0.8;
}

.transition-section {
  margin-bottom: 14px;
}

.transition-section-title {
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--gold);
  opacity: 0.75;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.transition-section-title::before {
  content: '';
  display: block;
  width: 2px;
  height: 10px;
  background: var(--cinnabar);
  border-radius: 1px;
}

.transition-yao-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(201,152,58,0.07);
}

.transition-yao-row:last-child {
  border-bottom: none;
}

.transition-yao-badge {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 14px;
}

.transition-yao-badge.laoyang {
  background: rgba(201,152,58,0.15);
  border: 1px solid rgba(201,152,58,0.4);
  color: var(--gold-light);
}

.transition-yao-badge.laoyin {
  background: rgba(181,35,24,0.12);
  border: 1px solid rgba(181,35,24,0.35);
  color: var(--cinnabar-light);
}

.transition-yao-info { flex: 1; min-width: 0; }

.transition-yao-label {
  font-size: 11px;
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.transition-yao-label .laoyang-text { color: var(--gold-light); }
.transition-yao-label .laoyin-text { color: var(--cinnabar-light); }

.transition-yao-text {
  font-size: 13px;
  line-height: 1.85;
  color: var(--parchment);
  opacity: 0.88;
}

.transition-flow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(201,152,58,0.12);
  border-radius: 5px;
  margin-bottom: 12px;
}

.transition-flow-hex {
  text-align: center;
  flex: 1;
}

.transition-flow-sym {
  font-size: 28px;
  line-height: 1;
}

.transition-flow-name {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 14px;
  color: var(--gold);
  letter-spacing: 2px;
  margin-top: 3px;
}

.transition-flow-arrow {
  font-size: 18px;
  color: var(--cinnabar);
  opacity: 0.6;
  flex-shrink: 0;
}

.transition-narrative {
  font-size: 13px;
  line-height: 1.9;
  color: var(--parchment);
  opacity: 0.88;
}

.transition-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 0;
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--parchment-dim);
  opacity: 0.6;
}

.transition-loading-dots {
  display: flex;
  gap: 4px;
}

.transition-loading-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold-dim);
  animation: dotPulse 1.2s ease-in-out infinite;
}

.transition-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.transition-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

.transition-summary-box {
  padding: 12px 14px;
  background: rgba(181,35,24,0.06);
  border: 1px solid rgba(181,35,24,0.2);
  border-left: 3px solid var(--cinnabar);
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.85;
  color: var(--parchment);
  opacity: 0.9;
  margin-top: 4px;
}

.transition-error {
  font-size: 12px;
  color: var(--cinnabar-light);
  opacity: 0.7;
  padding: 12px 0;
  letter-spacing: 1px;
}

/* Inner day tabs (今日 / 次日) */
.day-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(201,152,58,0.15);
}
.day-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 6px 20px 8px;
  font-family: 'Noto Serif SC', serif;
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--parchment-dim);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -1px;
  opacity: 0.55;
}
.day-tab-btn:hover { opacity: 0.85; color: var(--parchment); }
.day-tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); opacity: 1; }
.day-tab-content { display: none; }
.day-tab-content.active { display: block; }

/* Copy prompt box */
.copy-prompt-box {
  margin-top: 18px;
  padding: 14px;
  background: rgba(255,255,255,0.015);
  border: 1px dashed rgba(201,152,58,0.2);
  border-radius: 5px;
}

.copy-prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.copy-prompt-label {
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--parchment-dim);
  opacity: 0.6;
}

.copy-prompt-btn {
  background: rgba(201,152,58,0.1);
  border: 1px solid rgba(201,152,58,0.25);
  border-radius: 3px;
  padding: 3px 10px;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--gold-dim);
  font-family: 'Noto Serif SC', serif;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-prompt-btn:hover { background: rgba(201,152,58,0.18); color: var(--gold); border-color: var(--gold-dim); }
.copy-prompt-btn.copied { color: #7bc67e; border-color: rgba(123,198,126,0.4); background: rgba(123,198,126,0.08); }

.copy-prompt-textarea {
  display: block;
  width: 100%;
  min-height: 180px;
  max-height: 480px;
  font-size: 11px;
  font-family: 'Noto Serif SC', serif;
  line-height: 1.8;
  color: var(--parchment);
  opacity: 0.75;
  letter-spacing: 0.5px;
  white-space: pre-wrap;
  background: transparent;
  border: none;
  outline: none;
  resize: vertical;
  box-sizing: border-box;
  padding: 0;
}


/* ── Mobile: prevent iOS auto-zoom on input focus ── */
@media (max-width: 768px) {
  .coin-settings-input,
  .hist-note-input {
    font-size: 16px;
  }
}