:root {
  --bg-1: #150f1e;
  --bg-2: #251734;
  --bg-3: #3a2547;
  --card: rgba(255, 255, 255, 0.055);
  --card-strong: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.13);
  --text: #f4edff;
  --muted: #b9a8d4;
  --accent: #e0b268;
  --accent-strong: #f0c97f;
  --rose: #e58ba6;
  --danger: #ff7d7d;
  --ok: #8fe3a7;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans", "Noto Sans SC", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 700px at 15% -10%, var(--bg-3), transparent 60%),
    radial-gradient(1000px 600px at 100% 0%, #3d1f3a, transparent 55%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2) 70%);
  min-height: 100vh;
  line-height: 1.65;
}

h1, h2, h3, h4 {
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", Georgia, serif;
  line-height: 1.35;
}

.hidden {
  display: none !important;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  max-width: 1080px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand-icon {
  font-size: 26px;
  filter: drop-shadow(0 2px 6px rgba(224, 178, 104, 0.5));
}

.lang-box {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

#lang-select {
  appearance: none;
  background: var(--card-strong);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 30px 7px 12px;
  font-size: 14px;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--accent) 50%),
    linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

#lang-select option {
  background: #241733;
  color: var(--text);
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 8px 28px 60px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.hero {
  text-align: center;
  padding: 28px 12px 10px;
}

.hero h1 {
  font-size: clamp(26px, 4.2vw, 42px);
  background: linear-gradient(120deg, #fff 20%, var(--accent-strong) 55%, var(--rose) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 12px;
}

.hero p {
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto;
  font-size: 15px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.section-title h2 {
  font-size: 20px;
  font-weight: 600;
}

.step-badge {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #2a1a10;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  box-shadow: 0 4px 14px rgba(224, 178, 104, 0.35);
}

.hands-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.dropzone {
  position: relative;
  border: 2px dashed rgba(224, 178, 104, 0.45);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.16);
  min-height: 250px;
  overflow: hidden;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
  cursor: pointer;
  outline: none;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.dragover {
  border-color: var(--accent-strong);
  background: rgba(224, 178, 104, 0.08);
  transform: translateY(-2px);
}

.dz-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 248px;
  padding: 22px;
  text-align: center;
}

.dz-icon {
  font-size: 46px;
  opacity: 0.9;
}

.dz-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--accent-strong);
}

.dz-hint {
  font-size: 13px;
  color: var(--muted);
}

.dz-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.dz-preview {
  position: relative;
  width: 100%;
  min-height: 248px;
}

.dz-preview img {
  width: 100%;
  height: 248px;
  object-fit: cover;
  display: block;
}

.dz-overlay {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
}

.hidden-input {
  display: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 12px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s, background 0.15s;
  color: var(--text);
  background: var(--card-strong);
  border: 1px solid var(--border);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  color: #2a1a10;
  border: none;
  box-shadow: 0 10px 28px rgba(224, 178, 104, 0.35);
  font-size: 17px;
  padding: 15px 40px;
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 14px 34px rgba(224, 178, 104, 0.5);
}

.btn-ghost {
  padding: 9px 16px;
  font-size: 13px;
}

.btn-danger {
  border-color: rgba(255, 125, 125, 0.4);
  color: var(--danger);
}

.btn-mini {
  padding: 6px 12px;
  font-size: 12px;
}

.form-hint {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

.gender-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 14px;
  max-width: 560px;
}

.gender-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.14);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
  user-select: none;
}

.gender-option:hover {
  transform: translateY(-2px);
}

.gender-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.gender-option:has(input:checked) {
  border-color: var(--accent);
  background: rgba(224, 178, 104, 0.14);
  box-shadow: 0 0 0 1px var(--accent), 0 8px 22px rgba(224, 178, 104, 0.22);
}

.gender-emoji {
  font-size: 30px;
}

.gender-text {
  font-size: 15px;
  font-weight: 600;
}

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.currency-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin: 14px 0 10px;
}

.currency-title:first-of-type {
  margin-top: 0;
}

.currency-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  max-width: 460px;
}

.currency-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.14);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}

.currency-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.currency-option:has(input:checked) {
  border-color: var(--accent);
  background: rgba(224, 178, 104, 0.14);
  box-shadow: 0 0 0 1px var(--accent);
}

.currency-symbol {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-strong);
}

.provider-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  max-width: 560px;
}

.provider-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.14);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: border-color 0.15s, background 0.15s, opacity 0.15s;
  user-select: none;
}

.provider-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.provider-option:has(input:checked) {
  border-color: var(--accent);
  background: rgba(224, 178, 104, 0.14);
  box-shadow: 0 0 0 1px var(--accent);
}

.provider-option:not(.available) {
  opacity: 0.45;
  cursor: not-allowed;
}

.provider-icon {
  font-size: 20px;
}

.pay-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
}

.price-label {
  font-size: 26px;
  font-weight: 700;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}

.paid-box {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(143, 227, 167, 0.45);
  border-radius: 14px;
  background: rgba(143, 227, 167, 0.1);
}

.paid-icon {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: #0d2b16;
  background: var(--ok);
}

.paid-title {
  font-weight: 700;
  color: var(--ok);
}

.paid-info {
  font-size: 13px;
  color: var(--muted);
}

.sandbox-notice {
  color: var(--accent) !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 6, 16, 0.78);
  backdrop-filter: blur(6px);
  padding: 20px;
}

.modal {
  position: relative;
  background: linear-gradient(160deg, #2a1a38, #1c1228);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 30px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
}

.modal h3 {
  font-size: 16px;
  margin-bottom: 16px;
  color: var(--accent-strong);
}

.modal img {
  background: #fff;
  border-radius: 10px;
  padding: 8px;
  width: 240px;
  height: 240px;
  max-width: 100%;
}

.modal-status {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text);
}

.status-line {
  min-height: 22px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

.status-line.error {
  color: var(--danger);
}

.status-line .elapsed {
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}

.result-body {
  max-height: 70vh;
  overflow-y: auto;
  padding: 8px 4px;
  font-size: 15px;
}

.result-body h3 {
  color: var(--accent-strong);
  font-size: 18px;
  margin: 18px 0 8px;
}

.result-body h3:first-child {
  margin-top: 0;
}

.result-body h4 {
  color: var(--accent);
  font-size: 16px;
  margin: 14px 0 6px;
}

.result-body p {
  margin: 8px 0;
}

.result-body ul {
  margin: 8px 0 8px 22px;
}

.result-body li {
  margin: 4px 0;
}

.result-body strong {
  color: var(--accent-strong);
}

.result-body code {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 13px;
}

.result-actions {
  margin-top: 18px;
  display: flex;
  justify-content: center;
}

.typing-indicator {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 40px 0;
}

.typing-indicator span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.2s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes pulse {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

.notice-card h2 {
  font-size: 16px;
  color: var(--accent);
  margin-bottom: 8px;
}

.notice-card p {
  font-size: 13px;
  color: var(--muted);
  margin: 6px 0;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 24px 16px 36px;
}

@media (max-width: 560px) {
  .site-header {
    padding: 14px 16px;
  }
  .container {
    padding: 6px 16px 50px;
  }
  .card {
    padding: 20px 16px;
  }
  .btn-primary {
    width: 100%;
  }
}

/* ========== 模式切换 ========== */
.mode-tabs {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 4px 0 6px;
  flex-wrap: wrap;
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 26px;
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.mode-tab:hover {
  transform: translateY(-1px);
  color: var(--text);
}

.mode-tab.active {
  color: #2a1a10;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  border-color: transparent;
  box-shadow: 0 10px 26px rgba(224, 178, 104, 0.35);
}

.mode-icon {
  font-size: 18px;
}

/* ========== 六爻：占卜方法 ========== */
.liuyao-steps {
  margin: 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text);
  font-size: 14.5px;
}

.liuyao-steps li::marker {
  color: var(--accent);
  font-weight: 700;
}

/* ========== 六爻：硬币 ========== */
.coin-legend {
  display: flex;
  gap: 22px;
  align-items: center;
  margin: 4px 0 18px;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.coin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: none;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  font-family: "Noto Serif SC", "Songti SC", serif;
}

.coin-sm {
  width: 30px;
  height: 30px;
  font-size: 13px;
  cursor: default;
}

.coin.face-word {
  color: #4a2c0a;
  background: radial-gradient(circle at 35% 30%, #ffe9b8, #e8b45a 55%, #b97e2c);
  box-shadow: 0 4px 12px rgba(232, 180, 90, 0.35), inset 0 2px 3px rgba(255, 255, 255, 0.6), inset 0 -3px 5px rgba(120, 70, 10, 0.45);
}

.coin.face-blank {
  color: #3c4a5c;
  background: radial-gradient(circle at 35% 30%, #f2f6fa, #b9c6d4 55%, #7d8b9c);
  box-shadow: 0 4px 12px rgba(150, 165, 185, 0.3), inset 0 2px 3px rgba(255, 255, 255, 0.7), inset 0 -3px 5px rgba(60, 75, 95, 0.4);
}

.coin.face-blank::after {
  content: "◎";
  font-size: 0.72em;
  opacity: 0.55;
}

.coin.face-pending {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.08);
  border: 2px dashed var(--border);
  box-shadow: none;
}

.coin.face-pending::after {
  content: none;
}

.line-drawing.muted {
  color: var(--muted);
  opacity: 0.6;
}

.line-name.muted {
  color: var(--muted);
  opacity: 0.6;
}

button.coin:hover {
  transform: translateY(-2px) scale(1.04);
}

button.coin:active {
  transform: scale(0.96);
}

button.coin:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

/* ========== 六爻：掷币行 ========== */
.liuyao-casts {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cast-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.14);
  flex-wrap: wrap;
  transition: border-color 0.15s, background 0.15s;
}

.cast-row.completed {
  border-color: rgba(224, 178, 104, 0.5);
  background: rgba(224, 178, 104, 0.07);
}

.cast-label {
  flex: none;
  min-width: 74px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-strong);
}

.cast-coins {
  display: flex;
  gap: 12px;
  align-items: center;
}

.cast-result {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 118px;
}

.line-drawing {
  font-size: 22px;
  color: var(--text);
  font-family: monospace;
  letter-spacing: -1px;
}

.line-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.line-name.moving {
  color: var(--rose);
}

/* ========== 六爻：卦象预览 ========== */
.liuyao-preview {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid rgba(224, 178, 104, 0.35);
  border-radius: 14px;
  background: rgba(224, 178, 104, 0.06);
}

.hex-summary {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.hex-diagram {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: none;
  padding: 6px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
}

.hex-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hex-line .bar {
  display: block;
  width: 64px;
  height: 9px;
  border-radius: 3px;
  background: var(--accent-strong);
}

.hex-line.yin .bar {
  background: linear-gradient(90deg, transparent 0 28%, var(--accent-strong) 28% 72%, transparent 72% 100%);
}

.hex-line .marker {
  font-size: 13px;
  width: 12px;
  color: var(--rose);
}

.hex-line .pos {
  font-size: 11px;
  color: var(--muted);
  width: 30px;
}

.hex-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14.5px;
  min-width: 0;
}

.hex-info .hex-name {
  font-size: 19px;
  font-weight: 700;
  color: var(--accent-strong);
}

.hex-label {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #2a1a10;
  background: var(--accent);
}

.hex-label.bian {
  background: var(--rose);
  color: #2a0f18;
}

/* ========== 六爻：表单 ========== */
.form-field {
  margin-bottom: 16px;
}

.form-field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-strong);
  margin-bottom: 8px;
}

.text-input {
  width: 100%;
  max-width: 520px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224, 178, 104, 0.18);
}

textarea.text-input {
  resize: vertical;
  min-height: 90px;
}

.text-input::-webkit-calendar-picker-indicator {
  filter: invert(0.85);
  cursor: pointer;
}

/* ========== 手相 / 六爻科普介绍卡片 ========== */
.intro-card {
  border-color: rgba(224, 178, 104, 0.35);
  background: linear-gradient(160deg, rgba(224, 178, 104, 0.09), rgba(255, 255, 255, 0.03));
}

.intro-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.intro-badge {
  font-size: 24px;
  filter: drop-shadow(0 2px 6px rgba(224, 178, 104, 0.5));
}

.intro-head h2 {
  font-size: 19px;
  color: var(--accent-strong);
}

.intro-text {
  font-size: 14.5px;
  color: var(--text);
  margin-bottom: 12px;
}

.intro-points {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 0;
  margin: 0 0 14px;
}

.intro-points li {
  position: relative;
  padding-left: 20px;
  font-size: 13.5px;
  color: var(--muted);
}

.intro-points li::before {
  content: "✦";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.intro-cta {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--accent-strong);
  text-align: center;
  padding: 10px 14px;
  border: 1px dashed rgba(224, 178, 104, 0.5);
  border-radius: 12px;
  background: rgba(224, 178, 104, 0.08);
}
