:root {
  --bg: #0b0f1a;
  --panel: #0f1524;
  --fg: #e8eefc;
  --muted: #9bb0d3;
  --accent: #66d9ff;
  --accent-2: #9b7bff;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { background-color: var(--bg); }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background-color: var(--bg);
  background-image: radial-gradient(1200px 600px at 50% 0%, #10182b 0%, var(--bg) 60%);
  background-repeat: no-repeat;
  background-attachment: scroll;
  color: var(--fg);
}
/* 版面採用 Flex 以便 footer 貼底且具回應式 */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header, .site-footer {
  text-align: center;
  padding: 16px 12px;
}
.site-header h1 {
  margin: 16px 0 4px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000; /* 置於 3D 場景之上 */
  background-color: rgba(11, 15, 26, 0.98);
  background-image: none;
  transform: translateZ(0); /* 強制合成層，避免被 3D 場景蓋掉 */
  will-change: transform;
  isolation: isolate; /* 建立新的 stacking context */
}
/* 取消提昇 header 層級，恢復前一版 */
.subtitle { color: var(--muted); margin: 0; }

main { padding: 12px; flex: 1 0 auto; }
.stage {
  position: relative;
  padding-top: 50px;
  perspective: 1200px;
  height: min(70svh, 720px);
  display: grid;
  place-items: center;
  /* 恢復前一版：允許卡片在容器外可見 */
  background-color: rgba(11, 15, 26, 0.98); /* 行動端避免重繪閃白 */
}

.ring {
  position: relative;
  transform-style: preserve-3d;
  width: 800px;
  height: 800px;
  max-width: 92vw;
  max-height: 92vw;
  animation: none;
  will-change: transform; /* 穩定合成層 */
  z-index: 1; /* 確保低於 header */
}

/* 由 JS 控制旋轉位置與朝向，確保永遠朝向使用者 */

.card {
  position: absolute;
  top: 50%; left: 50%;
  transform-style: preserve-3d;
  width: 240px;
  height: 320px;
  margin: -160px 0 0 -120px;
  display: grid;
  place-items: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.thumb {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: linear-gradient(180deg, #1a2340, #0e1326);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.05);
  overflow: hidden;
  display: grid;
  grid-template-rows: 1fr auto;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

@media (max-width: 768px) {
  /* 手機端降低陰影成本，減少重繪與閃爍 */
  .thumb {
    box-shadow: 0 8px 24px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(255,255,255,0.05);
  }
}

.thumb img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}

.title {
  padding: 10px 12px;
  font-size: 14px;
  color: #e9f1ff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  background: linear-gradient(180deg, rgba(13,18,35,0.4), rgba(8,12,25,0.7));
  border-top: 1px solid rgba(255,255,255,0.06);
}

.thumb:focus, .thumb:hover { outline: none; box-shadow: 0 16px 48px rgba(0,0,0,0.55), 0 0 0 1px rgba(102,217,255,0.4) inset; }

.status { text-align: center; color: var(--muted); margin-top: 16px; }

/* footer 在彈性版面中自動推到底端 */
.site-footer { margin-top: auto; padding-bottom: 50px; z-index: 100 !important; }

@media (max-width: 600px) {
  .card { width: 180px; height: 240px; margin: -120px 0 0 -90px; }
}


