/* =====================================================
   LIQUID GLASS — Light Theme  |  Google DeepMine v2.2
   Physics-based: Gaussian blur + Fresnel rim
   ===================================================== */

/* ── RESET & BASE ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, #bae6fd 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, #ddd6fe 0%, transparent 55%),
    linear-gradient(160deg, #e0f2fe 0%, #f0fdf4 40%, #faf5ff 100%);
  background-attachment: fixed;
}

/* ── SHELL ────────────────────────────────────────── */
#app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 448px;
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  margin: 0 auto;
  background: rgba(255,255,255,0.45);
  backdrop-filter: blur(40px) saturate(1.8);
  -webkit-backdrop-filter: blur(40px) saturate(1.8);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.70) inset,
    0 2px 0 0   rgba(255,255,255,0.90) inset,
    0 32px 80px -8px rgba(100,130,200,0.22),
    0 8px  24px -4px rgba(80,100,180,0.12);
  overflow: hidden;
}

/* ── IFRAME LAYER ─────────────────────────────────── */
/*
  คำนวณความสูง iframe:
  total = 100dvh
  header ≈ calc(2.75rem + env(safe-area-inset-top) + 1.1rem padding)
  iframe height = 100dvh - header height
  ใช้ stretch + dvh เพื่อให้พอดีทุกอุปกรณ์
*/
.iframe-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100dvw;
  max-width: 448px;
  height: 100dvh;
  min-height: 100dvh;
  z-index: 1;
  overflow: hidden;
}

iframe {
  border: none;
  display: block;
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
}

/* ── GLASS HEADER ─────────────────────────────────── */
.glass-header {
  position: relative;
  z-index: 20;
  width: 100%;
  flex-shrink: 0;
  padding-top: env(safe-area-inset-top);
  background: rgba(255,255,255,0.58);
  backdrop-filter: blur(28px) saturate(1.6) brightness(1.08);
  -webkit-backdrop-filter: blur(28px) saturate(1.6) brightness(1.08);
  border-top: 1.5px solid rgba(255,255,255,0.95);
  border-bottom: 1px solid rgba(180,200,255,0.25);
  box-shadow:
    0 1px 0 0 rgba(255,255,255,0.80) inset,
    0 4px 24px -2px rgba(100,130,220,0.10);
}

/* ── HEADER INNER ─────────────────────────────────── */
.header-inner {
  padding: 0.55rem 0 0.55rem 0;
  display: flex;
  align-items: center;
  gap: 0;
  overflow: hidden;
}

/* ── LOGO SLOT (always visible, fixed left) ───────── */
.logo-slot {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.5rem 0 0.75rem;
  z-index: 2;
  position: relative;
}

.logo-slot::after {
  content: '';
  position: absolute;
  right: -12px;
  top: 0; bottom: 0;
  width: 12px;
  background: linear-gradient(to right, rgba(255,255,255,0.4), transparent);
  pointer-events: none;
  z-index: 3;
}

/* ── LOGO BUTTON ──────────────────────────────────── */
.back-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.70);
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  background:
    linear-gradient(
      135deg,
      rgba(255,200,100,0.90) 0%,
      rgba(249,115,22,0.85)  100%
    );
  backdrop-filter: blur(12px) saturate(1.5);
  -webkit-backdrop-filter: blur(12px) saturate(1.5);
  box-shadow:
    0 1px 0 0 rgba(255,255,255,0.80) inset,
    0 2px 8px -1px rgba(249,115,22,0.40);
  transition: transform 0.12s cubic-bezier(.34,1.56,.64,1),
              box-shadow 0.12s ease;
}

.back-icon-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  border-radius: inherit;
}

.back-icon-btn:active {
  transform: scale(0.93) translateY(1px);
  box-shadow: 0 1px 3px rgba(249,115,22,0.30);
}

/* ── BUTTON SCROLL RAIL ───────────────────────────── */
.scrollable-buttons {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.scrollable-buttons::-webkit-scrollbar { display: none; }

.btn-scroll-area { padding-bottom: 0.1rem; }

/* ── QUESTION BUTTONS ─────────────────────────────── */
.question-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.72);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  font-size: 0.865rem;
  font-weight: 550;
  line-height: 1.2;
  color: #1e3a5f;
  letter-spacing: 0.01em;
  background:
    linear-gradient(
      135deg,
      rgba(255,255,255,0.82) 0%,
      rgba(220,235,255,0.55) 100%
    );
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  box-shadow:
    0 1px 0 0  rgba(255,255,255,0.90) inset,
    0 -1px 0 0 rgba(100,140,220,0.12) inset,
    0 2px 8px -1px rgba(80,120,200,0.15),
    0 1px 2px 0   rgba(80,100,180,0.10);
  transition: transform 0.12s cubic-bezier(.34,1.56,.64,1),
              box-shadow 0.12s ease,
              background 0.12s ease;
}

.question-btn:active {
  transform: scale(0.95) translateY(1px);
  background: linear-gradient(135deg,rgba(200,220,255,0.75) 0%,rgba(180,210,255,0.55) 100%);
  box-shadow:
    0 1px 0 0 rgba(255,255,255,0.70) inset,
    0 1px 4px rgba(80,120,200,0.20);
}

/* ── LOADING STATE ────────────────────────────────── */
.btn-loading {
  opacity: 0.5;
  pointer-events: none;
}

/* ── REDUCED MOTION ───────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .question-btn, .back-icon-btn { transition: none; }
}