:root {
  --ink: #1b1b2f;
  --paper: #fffdf7;
  --blue: #4d96ff;
  --pink: #f15bb5;
  --yellow: #ffd93d;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang HK", "Noto Sans TC", sans-serif;
}
#ar { position: fixed; inset: 0; }
/* MindAR inserts the <video> and canvas here */
#ar video { object-fit: cover; }

.screen {
  position: fixed; inset: 0; z-index: 10;
  display: grid; place-items: center; padding: 16px;
  background:
    conic-gradient(from 30deg at 20% 20%, #ff6b6b, #ffd93d, #6bcb77, #4d96ff, #9b5de5, #f15bb5, #ff6b6b);
}
.card {
  width: min(380px, 100%);
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 28px;
  box-shadow: 8px 8px 0 var(--ink);
  padding: 28px 24px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.badge {
  background: var(--ink); color: var(--yellow);
  font-weight: 900; letter-spacing: .1em;
  padding: 4px 12px; border-radius: 999px; font-size: 13px;
}
h1 { margin: 4px 0 0; font-size: 34px; line-height: 1.05; font-weight: 900; }
.card p { margin: 0; font-size: 16px; }
.camera-btn {
  margin-top: 12px;
  width: 96px; height: 96px; border-radius: 50%;
  border: 4px solid var(--ink);
  background: var(--blue); color: #fff;
  box-shadow: 0 6px 0 var(--ink);
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform .1s, box-shadow .1s;
  animation: pulse 2s infinite;
}
.camera-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.camera-btn:disabled { opacity: .5; animation: none; }
@keyframes pulse {
  0%, 100% { outline: 0 solid rgba(77,150,255,.5); }
  50% { outline: 14px solid rgba(77,150,255,0); }
}
.btn-label { font-weight: 800; font-size: 15px; }
.poster-link { font-size: 13px; color: #555; }
.error { color: #c0392b !important; font-size: 14px !important; }

.hint {
  position: fixed; inset: 0; z-index: 5; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
}
.hint p {
  margin: 0; color: #fff; font-weight: 800;
  background: rgba(27,27,47,.75); padding: 10px 18px; border-radius: 999px;
}
.frame {
  width: min(62vw, 300px); aspect-ratio: 10 / 13;
  border: 4px dashed rgba(255,255,255,.9); border-radius: 20px;
  animation: breathe 1.6s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: scale(1.05); opacity: .6; } }

.controls {
  position: fixed; z-index: 6; left: 0; right: 0;
  bottom: calc(20px + env(safe-area-inset-bottom));
  display: flex; justify-content: center; gap: 10px; padding: 0 16px;
}
.controls button {
  font: inherit; font-weight: 800; font-size: 16px;
  padding: 12px 18px; border-radius: 999px;
  border: 3px solid var(--ink); background: var(--paper); color: var(--ink);
  box-shadow: 0 4px 0 var(--ink); cursor: pointer;
}
.controls button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
#stopBtn { width: 50px; padding: 12px 0; flex: none; }
@media (max-width: 480px) {
  .controls { gap: 6px; }
  .controls button { font-size: 14px; padding: 10px 10px; white-space: nowrap; }
  #stopBtn { width: 44px; padding: 10px 0; }
}
[hidden] { display: none !important; }
