/* Fortune Teller's Deck - 復古像素風格 */
@font-face {
  font-family: 'Cubic 11';
  src: url('../assets/fonts/Cubic_11.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Press Start 2P';
  src: url('../assets/fonts/PressStart2P.ttf') format('truetype');
  font-display: swap;
}

:root {
  --bg-deep: #0a0612;
  --bg-purple: #1a0a1f;
  --candle: #ff9a3c;
  --candle-glow: #ffd76b;
  --gold: #d4a437;
  --blood: #6b1f2e;
  --mist: rgba(180, 140, 220, 0.15);
  --text: #e8d9b8;
  --text-dim: #9a8a72;
}

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

html, body {
  height: 100%;
  background: var(--bg-deep);
  color: var(--text);
  font-family: "Cubic 11", "Press Start 2P", "Courier New", monospace;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at center 60%, rgba(60, 30, 80, 0.4), transparent 70%),
    radial-gradient(circle at center 90%, rgba(255, 154, 60, 0.15), transparent 60%),
    var(--bg-deep);
}

#game {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  width: 100vw;
  height: 100vh;
  /* iOS：以「實際可見」高度為準，避免被網址列蓋住頂部 */
  height: 100svh;
  background: transparent;
  cursor: pointer;
}

#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

#topbar {
  pointer-events: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 0;
  font-size: 16px;
  letter-spacing: 1px;
  background: linear-gradient(180deg, rgba(10, 6, 18, 0.85), transparent);
}

#stats { display: flex; gap: 18px; }
.stat {
  color: var(--candle-glow);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 6px rgba(255, 215, 107, 0.35);
}

#lang-toggle button {
  background: transparent;
  color: var(--candle-glow);
  border: none;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 16px;
  cursor: pointer;
  margin-left: 3px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
#lang-toggle button:active { color: #fff; }

#tooltip {
  position: fixed;
  top: 58px;
  left: 14px;
  max-width: 320px;
  background: rgba(20, 10, 30, 0.95);
  border: 1px solid var(--gold);
  color: var(--candle-glow);
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  z-index: 60;
  pointer-events: none;
  transition: opacity 0.25s;
}
#tooltip.hidden { opacity: 0; }

.stat { cursor: pointer; }

#fader {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 50;
}
#fader.dark { opacity: 1; }

#banner-slot {
  margin-top: auto;
  pointer-events: auto;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(
    45deg,
    rgba(107, 31, 46, 0.1),
    rgba(107, 31, 46, 0.1) 10px,
    rgba(20, 10, 30, 0.2) 10px,
    rgba(20, 10, 30, 0.2) 20px
  );
  border-top: 1px dashed var(--text-dim);
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 2px;
  font-style: italic;
}

@media (max-width: 480px) {
  #banner-slot { height: 50px; font-size: 10px; }
}

#banner-slot.empty { display: none; }

/* 角落版本浮水印（取代以前掛在 banner 的標籤） */
#build-tag {
  position: fixed;
  right: 6px;
  bottom: 6px;
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 1px;
  opacity: 0.35;
  pointer-events: none;
  z-index: 5;
}

/* Credits 內的偏好切換 */
.credits-pref {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 13px;
  margin-top: 6px;
}
.credits-pref input { transform: scale(1.2); accent-color: var(--gold); }

#prophecy {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(20, 10, 30, 0.95), rgba(0, 0, 0, 0.98));
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  z-index: 100;
  padding: 40px;
}
#prophecy.hidden { display: none; }

#prophecy-text {
  font-size: 22px;
  line-height: 1.8;
  text-align: center;
  max-width: 600px;
  color: var(--candle-glow);
  text-shadow: 0 0 12px rgba(255, 154, 60, 0.4);
  letter-spacing: 2px;
  white-space: pre-wrap;
}

#prophecy-close {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 10px 30px;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
#prophecy-close:hover {
  background: rgba(212, 164, 55, 0.15);
  box-shadow: 0 0 20px rgba(212, 164, 55, 0.3);
}

/* ---------- Credits ---------- */
#credits-modal {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(20, 10, 30, 0.96), rgba(0, 0, 0, 0.98));
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 110;
  padding: 30px;
}
#credits-modal.hidden { display: none; }
#credits-modal h2 {
  color: var(--gold);
  font-size: 22px;
  letter-spacing: 4px;
  text-shadow: 0 0 10px rgba(212, 164, 55, 0.4);
}
.credits-note, .credits-mod {
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
  max-width: 520px;
}
.credits-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 540px;
}
.credits-list li {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}
.c-what { color: var(--candle-glow); }
.credits-list a {
  color: var(--gold);
  text-decoration: underline dotted;
}
#credits-close {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 8px 26px;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 3px;
  cursor: pointer;
}
#credits-btn { font-size: 13px; }
