/* Cloud 11 AR Discovery Mission — Prototype styles */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --card: #1a1e2a;
  --card-2: #232838;
  --text: #eef1f8;
  --muted: #9aa3b8;
  --accent: #4f7cff;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 16px;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans Thai', sans-serif;
  min-height: 100%;
}

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.test-badge {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: repeating-linear-gradient(45deg, #b45309, #b45309 12px, #92400e 12px, #92400e 24px);
  color: #fff;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 4px;
}
body { padding-top: 24px; }

h1 { font-size: 22px; margin: 16px 0 4px; }
h2 { font-size: 17px; margin: 20px 0 8px; }
.sub { color: var(--muted); font-size: 14px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
  border: 1px solid #2a3042;
}

.progress-bar {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}
.progress-dot {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--card-2);
}
.progress-dot.done { background: var(--success); }

.station-list { display: flex; flex-direction: column; gap: 10px; }
.station-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-2);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid transparent;
}
.station-item.done { border-color: var(--success); }
.station-emoji { font-size: 26px; }
.station-info { flex: 1; }
.station-name { font-weight: 600; font-size: 15px; }
.station-kw { font-size: 12px; color: var(--muted); }
.station-kw code {
  background: #0f1117;
  padding: 1px 6px;
  border-radius: 4px;
  color: #7dd3fc;
  font-weight: 700;
}
.station-status { font-size: 12px; color: var(--muted); }
.station-status.done { color: var(--success); font-weight: 700; }

.btn {
  display: inline-block;
  width: 100%;
  text-align: center;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  min-height: 48px;
}
.btn:active { transform: scale(0.98); }
.btn.secondary { background: var(--card-2); color: var(--text); }
.btn.success { background: var(--success); }
.btn.small { width: auto; padding: 8px 14px; font-size: 13px; min-height: 40px; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* mock LINE chat */
.chat {
  background: #06182b;
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
  max-height: 320px;
  overflow-y: auto;
}
.bubble {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.bubble.user { align-self: flex-end; background: #22c55e; color: #06281a; border-bottom-right-radius: 4px; }
.bubble.bot { align-self: flex-start; background: #1e293b; border-bottom-left-radius: 4px; }
.bubble .btn { margin-top: 8px; }
.chat-input { display: flex; gap: 8px; margin-top: 10px; }
.chat-input input {
  flex: 1;
  background: var(--card-2);
  color: var(--text);
  border: 1px solid #2a3042;
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
}

.keyword-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  background: var(--card-2);
  border: 1px solid #2a3042;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}

.target-preview { text-align: center; }
.target-preview img {
  max-width: 70%;
  border-radius: 8px;
  border: 2px solid #2a3042;
}

.note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

/* ===== AR page ===== */
.ar-body { overflow: hidden; height: 100vh; padding-top: 0; }

/* MindAR แทรก <video> ของกล้องเข้า parent ของ a-scene ด้วย position:absolute; z-index:-2
   และวัดขนาดจาก clientWidth/Height ของ container จึงต้อง:
   1) ให้ container เต็มจอ (ไม่งั้นวิดีโอสูง 0px)
   2) สร้าง stacking context ใหม่ (z-index บวก) ไม่งั้นวิดีโอ z-index ติดลบ
      จะถูกวาดอยู่หลังพื้นหลังทึบของ body → จอดำ */
#ar-container {
  position: fixed;
  inset: 0;
  z-index: 10;
}
#ar-container a-scene {
  position: absolute !important;
  inset: 0;
  width: 100%;
  height: 100%;
}
.overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  gap: 14px;
}
.overlay.hidden-overlay { display: none; }
.overlay .big-emoji { font-size: 64px; }
.overlay h1 { font-size: 20px; }
.overlay p { color: var(--muted); font-size: 14px; line-height: 1.7; max-width: 320px; }
.overlay .btn { max-width: 320px; }

.hud {
  position: fixed;
  left: 0; right: 0;
  z-index: 400;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.hud.top { top: 34px; }
.hud.bottom { bottom: 28px; padding: 0 20px; }
.hud-pill {
  background: rgba(10, 12, 20, 0.82);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  backdrop-filter: blur(6px);
}
.tap-btn {
  pointer-events: auto;
  width: 100%;
  max-width: 340px;
  border: none;
  border-radius: 16px;
  padding: 18px;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.scan-frame {
  position: fixed;
  top: 50%; left: 50%;
  width: 240px; height: 240px;
  transform: translate(-50%, -50%);
  z-index: 300;
  border: 2px dashed rgba(255,255,255,0.5);
  border-radius: 20px;
  pointer-events: none;
}
.support-ref {
  font-size: 11px;
  color: #5b6478;
  margin-top: 10px;
  font-family: monospace;
}
