/* ============================================================
   三木易經占卜 — Magic Theme
   ============================================================ */

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

:root {
  --gold:        #8b6010;
  --gold-light:  #a07820;
  --gold-dark:   #6b4808;
  --green-deep:  #1a3d28;
  --green-dark:  #1e4a30;
  --green-mid:   #2d6644;
  --green-light: #3d7a55;
  --green-glow:  rgba(45, 102, 68, 0.4);
  --text-main:   #1a2e1e;
  --text-dim:    #4a6655;
  --red-change:  #c03030;
  --panel-bg:    rgba(255, 255, 255, 0.82);
  --panel-border:rgba(45, 90, 61, 0.25);
}

/* ─── Body & Background ─────────────────────────────────── */

body {
  font-family: "Calibri", "Microsoft JhengHei", "微軟正黑體", "PingFang TC", sans-serif;
  background-image: url('background.jpg?v=2');
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
  background-color: #c8e8e0;
  min-height: 100vh;
  padding: 64px 20px 20px; /* 上緣預留回主站標籤的高度 */
  color: var(--text-main);
  overflow-x: hidden;
}

/* ─── Stars (floating sparkles on light bg) ──────────────── */

.stars-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.star {
  position: absolute;
  border-radius: 50%;
  background: rgba(45, 102, 68, 0.4);
  animation: twinkle var(--dur, 3s) ease-in-out infinite var(--delay, 0s);
}

@keyframes twinkle {
  0%, 100% { opacity: var(--min-op, 0.1); transform: scale(1); }
  50%       { opacity: var(--max-op, 0.5); transform: scale(1.4); }
}

/* ─── Magic Burst ────────────────────────────────────────── */

.magic-burst {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
}

.burst-particle {
  position: absolute;
  border-radius: 50%;
  animation: burstFly var(--dur, 1s) ease-out forwards;
}

@keyframes burstFly {
  0%   { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

/* ─── Layout ─────────────────────────────────────────────── */

.main-layout {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 40px);
  align-items: flex-start;
}

/* ─── Chart Panel (left) ─────────────────────────────────── */

.chart-panel {
  flex: 0 0 340px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 24px 20px;
  box-shadow: 0 0 40px rgba(0,0,0,0.6), inset 0 1px 0 rgba(212,168,67,0.15);
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dark) transparent;
}

.chart-panel h3 {
  color: var(--gold);
  font-size: 1.15em;
  text-align: center;
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.chart-hint {
  text-align: center;
  font-size: 0.8em;
  color: var(--text-dim);
  margin-bottom: 14px;
}

/* Hexagram lookup table */
.hexagram-table-wrapper {
  overflow-x: auto;
}

.hexagram-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72em;
}

.hexagram-table th,
.hexagram-table td {
  border: 1px solid rgba(212,168,67,0.2);
  padding: 4px 3px;
  text-align: center;
  color: var(--text-main);
  cursor: default;
}

.hexagram-table th {
  background: rgba(212,168,67,0.12);
  color: var(--gold);
  font-weight: 600;
}

.hexagram-table td {
  background: rgba(255,255,255,0.02);
  transition: background 0.2s;
  white-space: nowrap;
  cursor: pointer;
}

.hexagram-table td:hover {
  background: rgba(212,168,67,0.15);
  color: var(--gold-light);
}

.hexagram-table td.highlight {
  background: rgba(212,168,67,0.3);
  color: var(--gold-light);
  font-weight: bold;
  box-shadow: inset 0 0 6px rgba(212,168,67,0.4);
}

/* ─── Hexagram Info Popup ─────────────────────────────────── */

.hex-popup-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 25, 16, 0.55);
  backdrop-filter: blur(3px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  padding: 20px;
}

.hex-popup-overlay.show {
  opacity: 1;
  visibility: visible;
}

.hex-popup {
  position: relative;
  max-width: 480px;
  width: 100%;
  background: var(--panel-bg);
  border: 1px solid var(--gold);
  border-radius: 16px;
  padding: 30px 32px 28px;
  box-shadow: 0 0 50px rgba(0,0,0,0.6), inset 0 1px 0 rgba(212,168,67,0.2);
  text-align: center;
  transform: scale(0.92) translateY(10px);
  transition: transform 0.25s ease;
}

.hex-popup-overlay.show .hex-popup {
  transform: scale(1) translateY(0);
}

.hex-popup-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  color: var(--gold);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.hex-popup-close:hover {
  opacity: 1;
}

.hex-popup-title {
  color: var(--text-main);
  font-size: 1.08em;
  font-weight: bold;
  line-height: 1.6;
  letter-spacing: 0.5px;
}

.hex-popup-sub {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--panel-border);
  color: var(--gold);
  font-size: 1.02em;
  line-height: 1.5;
}

.hex-popup-sub:empty {
  display: none;
}

/* ─── Divination Panel (right) ───────────────────────────── */

.divination-panel {
  flex: 1;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: 0 0 60px rgba(0,0,0,0.7), inset 0 1px 0 rgba(212,168,67,0.15);
  text-align: center;
}

/* ─── Title ──────────────────────────────────────────────── */

.title-area {
  position: relative;
  margin-bottom: 24px;
}

.title-glow {
  display: none;
}

@keyframes titlePulse {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}

h1 {
  position: relative;
  font-size: 2.4em;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--green-deep);
}

.subtitle {
  margin-top: 6px;
  font-size: 0.95em;
  letter-spacing: 3px;
  color: var(--text-dim);
}

/* ─── Instruction ────────────────────────────────────────── */

.instruction .no-break {
  white-space: nowrap;
}

.instruction {
  color: var(--green-mid);
  font-size: 0.95em;
  line-height: 1.7;
  padding: 12px 20px;
  background: rgba(45,102,68,0.07);
  border: 1px solid rgba(45,102,68,0.2);
  border-radius: 12px;
  margin-bottom: 24px;
  letter-spacing: 0.5px;
}

/* ─── Question Input ─────────────────────────────────────── */

.question-section {
  margin-bottom: 24px;
  text-align: left;
}

.question-section label {
  display: block;
  color: var(--gold);
  font-size: 0.9em;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.question-section textarea {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(212,168,67,0.3);
  border-radius: 10px;
  color: var(--text-main);
  font-size: 0.95em;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.question-section textarea::placeholder {
  color: var(--text-dim);
}

.question-section textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(212,168,67,0.2);
}

/* ─── Coins ──────────────────────────────────────────────── */

.coins-area {
  display: flex;
  justify-content: center;
  gap: 50px;
  margin-bottom: 20px;
  min-height: 130px;
  perspective: 1200px;
  padding: 16px 0;
}

.coin {
  width: 90px;
  height: 90px;
  perspective: 1000px;
  filter: drop-shadow(0 0 8px rgba(212,168,67,0.4));
  transition: filter 0.3s;
}

.coin.heads,
.coin.tails {
  filter: drop-shadow(0 0 14px rgba(212,168,67,0.7));
}

.coin-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(15deg) rotateY(-10deg);
  transition: transform 0.3s ease;
}

.coin.flipping .coin-inner {
  animation: coinFlip 0.8s ease-in-out forwards;
}

@keyframes coinFlip {
  0%   { transform: rotateX(15deg) rotateY(-10deg) rotateX(0deg); }
  50%  { transform: rotateX(15deg) rotateY(-10deg) rotateX(900deg) scale(1.12); }
  100% { transform: rotateX(15deg) rotateY(-10deg) rotateX(1800deg); }
}

.coin.heads .coin-inner { transform: rotateX(15deg) rotateY(-10deg) rotateX(0deg); }
.coin.tails .coin-inner { transform: rotateX(15deg) rotateY(-10deg) rotateX(180deg); }

.coin-face {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  backface-visibility: hidden;
}

.coin-front {
  background:
    radial-gradient(ellipse at 28% 28%, rgba(255,255,220,0.9) 0%, rgba(255,240,160,0.4) 30%, transparent 60%),
    radial-gradient(ellipse at 72% 72%, rgba(160,100,0,0.4) 0%, transparent 50%),
    linear-gradient(135deg,
      #ffe87a 0%, #ffd700 12%, #f5c800 22%, #e8b800 32%,
      #d4a500 42%, #c49000 52%, #d4a500 62%, #e8b800 72%,
      #ffd700 85%, #ffe87a 100%);
  border: 3px solid #c49000;
  transform: translateZ(8px);
  box-shadow:
    0 8px 24px rgba(0,0,0,0.45),
    3px 5px 10px rgba(60,60,60,0.35),
    inset 0 3px 6px rgba(255,255,200,0.7),
    inset 0 -3px 6px rgba(140,90,0,0.4),
    0 0 0 4px rgba(220,185,60,0.45),
    0 0 18px rgba(255,210,0,0.25);
}

.coin-front::before {
  content: '';
  position: absolute;
  width: 78%;
  height: 78%;
  border-radius: 50%;
  border: 2px solid rgba(184,134,11,0.5);
}

.coin-back {
  background:
    radial-gradient(ellipse at 28% 28%, rgba(180,130,80,0.5) 0%, transparent 45%),
    radial-gradient(ellipse at 72% 72%, rgba(30,15,0,0.6) 0%, transparent 50%),
    linear-gradient(135deg,
      #7a5020 0%, #6b4015 15%, #5a3010 28%, #4a2208 42%,
      #3d1a05 52%, #4a2208 62%, #5a3010 72%, #6b4015 85%, #7a5020 100%);
  border: 3px solid #3d1a05;
  transform: rotateX(180deg) translateZ(8px);
  box-shadow:
    0 8px 24px rgba(0,0,0,0.6),
    3px 5px 10px rgba(30,15,0,0.5),
    inset 0 3px 5px rgba(160,110,60,0.4),
    inset 0 -3px 6px rgba(20,10,0,0.6),
    0 0 0 4px rgba(100,65,20,0.5);
}

.coin-back::before {
  content: '';
  position: absolute;
  width: 78%;
  height: 78%;
  border-radius: 50%;
  border: 2px solid rgba(139,105,20,0.5);
}

.coin-text {
  font-size: 2.2em;
  font-weight: normal;
  z-index: 1;
  line-height: 1;
}

.coin-front .coin-text {
  color: #7a4e00;
  text-shadow: 0 1px 2px rgba(255,240,180,0.8), 0 -1px 1px rgba(100,60,0,0.4);
  -webkit-text-fill-color: #7a4e00;
}

.coin-back .coin-text {
  color: #d4903a;
  text-shadow: 0 1px 3px rgba(200,140,60,0.5), 0 -1px 1px rgba(0,0,0,0.4);
  -webkit-text-fill-color: #d4903a;
}

.coin-edge {
  position: absolute;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.coin-edge::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 16px;
  background: repeating-linear-gradient(90deg,
    #e8c040 0px, #e8c040 2px, #7a5010 2px, #5a3808 3px, #7a5010 4px, #e8c040 5px);
  top: 50%;
  left: 0;
  transform: translateY(-50%) rotateX(90deg);
  border-radius: 2px;
}

/* ─── Throw Info ─────────────────────────────────────────── */

.throw-info {
  font-size: 1.05em;
  color: var(--green-mid);
  margin-bottom: 16px;
  min-height: 28px;
  font-weight: 600;
  letter-spacing: 1px;
}

/* ─── Divine Button ──────────────────────────────────────── */

.divine-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(145deg, var(--green-mid), var(--green-deep));
  color: #f5d060;
  border: 1px solid #c49000;
  padding: 14px 48px;
  font-size: 1.2em;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 3px;
  border-radius: 40px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow:
    0 4px 20px rgba(0,0,0,0.5),
    0 0 20px rgba(212,168,67,0.15),
    inset 0 1px 0 rgba(212,168,67,0.2);
  margin-bottom: 12px;
  overflow: hidden;
}

.divine-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 30%, rgba(212,168,67,0.08) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.5s;
}

.divine-btn:hover::before { transform: translateX(100%); }

.divine-btn:hover {
  transform: translateY(-3px);
  box-shadow:
    0 8px 30px rgba(0,0,0,0.5),
    0 0 30px rgba(212,168,67,0.3),
    inset 0 1px 0 rgba(212,168,67,0.3);
  border-color: var(--gold);
}

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

.divine-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-icon {
  font-size: 0.8em;
  animation: iconSpin 4s linear infinite;
}

@keyframes iconSpin {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25%       { transform: rotate(90deg) scale(1.2); }
  50%       { transform: rotate(180deg) scale(1); }
  75%       { transform: rotate(270deg) scale(1.2); }
}

.quota-notice {
  color: var(--text-dim);
  font-size: 0.82em;
  margin-bottom: 4px;
  letter-spacing: 1px;
}

.global-notice {
  color: var(--text-dim);
  font-size: 0.78em;
  margin-bottom: 20px;
  letter-spacing: 1px;
  opacity: 0.85;
  min-height: 1.2em;
}

/* ─── Hexagram Lines Area ────────────────────────────────── */

.hexagram-area {
  margin: 20px 0;
  padding: 20px 24px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(212,168,67,0.1);
  border-radius: 16px;
  position: relative;
}

.trigram-label {
  font-size: 0.78em;
  color: var(--gold);
  letter-spacing: 2px;
  opacity: 0.7;
  text-align: center;
  margin: 4px 0;
}

.trigram-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,168,67,0.3), transparent);
  margin: 8px 0;
}

.line-row {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px 0;
  min-height: 30px;
}

.line-label {
  width: 44px;
  text-align: right;
  margin-right: 16px;
  color: var(--text-dim);
  font-size: 0.85em;
  letter-spacing: 1px;
}

.line-display {
  width: 100px;
  height: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 16px;
  transition: all 0.4s ease;
}

.line-display.yang {
  background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-dark));
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(212,168,67,0.5);
  animation: lineAppear 0.4s ease-out;
}

.line-display.yin {
  background: transparent;
  position: relative;
  animation: lineAppear 0.4s ease-out;
}

.line-display.yin::before,
.line-display.yin::after {
  content: '';
  position: absolute;
  width: 44%;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(212,168,67,0.5);
}

.line-display.yin::before { left: 0; }
.line-display.yin::after  { right: 0; }

@keyframes lineAppear {
  from { opacity: 0; transform: scaleX(0); }
  to   { opacity: 1; transform: scaleX(1); }
}

.line-result {
  width: 44px;
  text-align: left;
  font-size: 0.85em;
}

.line-result .changing {
  color: var(--red-change);
  font-weight: bold;
  text-shadow: 0 0 8px rgba(224,80,80,0.6);
  animation: changePulse 1.5s ease-in-out infinite;
}

@keyframes changePulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ─── Result Area ────────────────────────────────────────── */

.result-area {
  margin-top: 20px;
  padding: 28px;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(45,90,61,0.25);
  border-radius: 16px;
  display: none;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.result-area.show {
  display: block;
  animation: fadeInUp 0.6s ease-out;
}

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

.result-area h2 {
  color: var(--gold);
  font-size: 1.3em;
  margin-bottom: 16px;
  letter-spacing: 3px;
}

.hexagram-number {
  font-size: 0.85em;
  color: var(--text-dim);
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.hexagram-symbol-large {
  font-size: 3.5em;
  line-height: 1;
  margin: 8px 0;
  filter: drop-shadow(0 0 12px rgba(212,168,67,0.6));
}

.hexagram-name-main {
  font-size: 1.6em;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 4px;
  margin-bottom: 4px;
}

.hexagram-name-full {
  font-size: 1.1em;
  color: var(--text-main);
  margin-bottom: 6px;
  letter-spacing: 2px;
}

.hexagram-meaning {
  font-size: 0.95em;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.changed-hexagram-section {
  margin-top: 14px;
  padding: 10px 16px;
  background: rgba(212,168,67,0.06);
  border: 1px solid rgba(212,168,67,0.2);
  border-radius: 10px;
  font-size: 0.9em;
  color: var(--text-main);
}

.changing-note {
  margin-top: 12px;
  padding: 10px 16px;
  background: rgba(224,80,80,0.08);
  border: 1px solid rgba(224,80,80,0.3);
  border-radius: 10px;
  color: var(--red-change);
  font-size: 0.9em;
  line-height: 1.6;
}

/* ─── AI Result Area ─────────────────────────────────────── */

.ai-result-area {
  display: none;
  margin-top: 20px;
  padding: 28px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(45,90,61,0.2);
  border-left: 4px solid var(--green-mid);
  border-radius: 16px;
  text-align: left;
  animation: fadeInUp 0.6s ease-out;
}

.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
  color: var(--green-mid);
  font-size: 1em;
  letter-spacing: 1px;
}

/* Magic Spinner */
.magic-spinner {
  position: relative;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--green-mid);
  border-right-color: rgba(45,102,68,0.3);
  animation: spin 1.2s linear infinite;
}

.spinner-ring::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-bottom-color: var(--green-light);
  animation: spin 0.8s linear infinite reverse;
}

.spinner-symbol {
  font-size: 1.4em;
  color: var(--green-mid);
  animation: symbolPulse 2s ease-in-out infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes symbolPulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50%       { transform: scale(1.2); opacity: 1; }
}

/* AI Content */
.ai-content h2 {
  color: var(--gold);
  font-size: 1.2em;
  margin-bottom: 16px;
  letter-spacing: 3px;
  text-align: center;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(212,168,67,0.2);
}

.ai-text {
  color: var(--text-main);
  font-size: 0.95em;
  line-height: 1.9;
}

.ai-text h3, .ai-text h4 {
  color: var(--gold-light);
  margin: 14px 0 6px;
}

.ai-text strong {
  color: var(--gold);
}

.ai-text ul, .ai-text ol {
  padding-left: 20px;
}

.ai-text li {
  margin: 4px 0;
}

.ai-text p {
  margin: 8px 0;
}

.ai-hint {
  text-align: center;
  color: var(--text-dim);
  font-style: italic;
  padding: 20px;
}

.ai-error {
  text-align: center;
  color: var(--red-change);
  padding: 16px;
}

/* ─── Scrollbar ──────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--gold-dark);
  border-radius: 3px;
}

/* ─── Responsive ─────────────────────────────────────────── */

@media (max-width: 1100px) {
  .main-layout { flex-direction: column; }
  .chart-panel { flex: none; position: static; max-height: none; width: 100%; }
}

@media (max-width: 600px) {
  body { padding: 52px 12px 12px; /* 上緣預留回主站標籤的高度 */ }

  .divination-panel { padding: 24px 18px; }

  h1 { font-size: 1.8em; }

  .coins-area { gap: 28px; }

  .coin { width: 72px; height: 72px; }

  .coin-text { font-size: 1.6em; }

  .coin-edge::before { height: 12px; }

  .line-display { width: 80px; }

  .divine-btn { padding: 12px 32px; font-size: 1.05em; letter-spacing: 2px; }
}

/* ─── Site Footer ────────────────────────────────────────── */

.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  margin: 24px auto 0;
  max-width: 640px;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  color: var(--text-dim);
  font-size: 0.82em;
  letter-spacing: 1px;
  line-height: 1.9;
  margin-bottom: 72px;
}

.site-footer a {
  color: var(--green-mid);
  text-decoration: underline;
}

/* ─── Home FAB（回主站標籤） ─────────────────────────────── */

.home-fab {
  position: fixed;
  left: 20px;
  top: 20px;
  z-index: 900;
  background: linear-gradient(145deg, var(--green-mid), var(--green-deep));
  color: #f5d060;
  border: 1px solid #c49000;
  padding: 8px 16px;
  font-size: 0.88em;
  font-weight: 600;
  letter-spacing: 1px;
  border-radius: 30px;
  text-decoration: none;
  transition: all 0.3s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4), 0 0 16px rgba(212,168,67,0.15);
}

.home-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(0,0,0,0.45), 0 0 24px rgba(212,168,67,0.3);
  border-color: var(--gold);
}

/* ─── Donate Card ────────────────────────────────────────── */

.donate-card {
  margin-top: 20px;
  padding: 20px 18px 18px;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: rgba(255,255,255,0.5);
  text-align: center;
  transition: box-shadow 0.4s, border-color 0.4s;
}

.donate-card.flash {
  border-color: var(--gold);
  box-shadow: 0 0 24px rgba(212,168,67,0.45);
}

.donate-copy {
  color: var(--text-main);
  font-size: 0.95em;
  line-height: 1.7;
  margin-bottom: 8px;
}

.donate-title {
  color: var(--gold);
  font-size: 1.1em;
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.donate-note {
  color: var(--text-dim);
  font-size: 0.85em;
  line-height: 1.7;
  margin-bottom: 12px;
}

/* 領取解鎖碼：咖啡底白字 */
.coffee-btn {
  display: inline-block;
  background: linear-gradient(145deg, #7a5230, #59371d);
  color: #ffffff;
  border: 1px solid #8a6238;
  padding: 7px 16px;
  font-size: 0.85em;
  font-weight: 600;
  letter-spacing: 0.5px;
  border-radius: 20px;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.25s;
  box-shadow: 0 3px 10px rgba(0,0,0,0.25);
  margin-bottom: 10px;
}

.coffee-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(0,0,0,0.3), 0 0 12px rgba(212,168,67,0.3);
  border-color: var(--gold);
}

/* 填寫表單：小型按鈕 */
.form-btn {
  display: inline-block;
  background: linear-gradient(145deg, var(--green-mid), var(--green-deep));
  color: #f5d060;
  border: 1px solid #c49000;
  padding: 4px 14px;
  font-size: 0.95em;
  font-weight: 600;
  border-radius: 18px;
  text-decoration: none;
  transition: all 0.25s;
}

.form-btn:hover {
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(212,168,67,0.3);
}

/* 單純請喝咖啡：小型文字連結 */
.coffee-link {
  color: #7a5230;
  font-size: 0.92em;
  text-decoration: underline;
  transition: color 0.2s;
}

.coffee-link:hover { color: var(--gold); }

/* AI 解卦免責聲明 */
.ai-disclaimer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--panel-border);
  color: var(--text-dim);
  font-size: 0.82em;
  letter-spacing: 1px;
  text-align: center;
}

.ai-disclaimer a {
  color: var(--green-mid);
  text-decoration: underline;
}

.donate-unlock {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--panel-border);
  text-align: left;
}

.donate-unlock h4 {
  color: var(--green-mid);
  font-size: 0.95em;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.donate-text {
  color: var(--text-dim);
  font-size: 0.9em;
  line-height: 1.7;
  margin-bottom: 10px;
}

.donate-btn {
  display: inline-block;
  background: linear-gradient(145deg, var(--green-mid), var(--green-deep));
  color: #f5d060;
  border: 1px solid #c49000;
  padding: 8px 18px;
  font-size: 0.9em;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 1px;
  border-radius: 24px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.25s;
}

.donate-btn:hover {
  transform: translateY(-1px);
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(212,168,67,0.3);
}

.donate-btn:disabled { opacity: 0.6; cursor: wait; }

.unlock-input-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.unlock-input-row input {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 0.95em;
  letter-spacing: 1px;
  color: var(--text-main);
  text-transform: uppercase;
}

.unlock-input-row input:focus {
  outline: none;
  border-color: var(--gold);
}

.unlock-status {
  margin-top: 8px;
  font-size: 0.88em;
  min-height: 1.4em;
  color: var(--text-dim);
}

.unlock-status.ok    { color: var(--green-mid); }
.unlock-status.error { color: var(--red-change); }

/* 領取解鎖碼：展開的 Email 輸入＋付款按鈕 */
.donate-buy {
  margin: 10px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.donate-buy[hidden] { display: none; }
.donate-buy input {
  width: 100%;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 0.95em;
  color: var(--text-main);
}
.donate-buy input:focus { outline: none; border-color: var(--gold); }
.buy-status {
  font-size: 0.85em;
  min-height: 1.2em;
  color: var(--text-dim);
}

.unlock-status a, .unlock-cta {
  color: var(--gold);
  text-decoration: underline;
  cursor: pointer;
}

@media (max-width: 600px) {
  .donate-card { padding: 16px 14px 14px; }
  .home-fab { left: 12px; top: 12px; padding: 7px 13px; font-size: 0.82em; }
}
