:root {
  --bg: #0f1115;
  --panel: #161922;
  --ink: #e9edf2;
  --muted: #8b93a3;
  --accent: #ffd45e;
  --accent-2: #6ec1ff;
  --board: #fbf7ec;
  --line: #2a2f3a;
  --chalk: #2c2a26;
  font-family: ui-sans-serif, system-ui, "Segoe UI", "Apple SD Gothic Neo",
    "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

/* ---- top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.logo { font-size: 20px; }
.brand-name { letter-spacing: 0.2px; }
.topbar-right { display: flex; gap: 8px; }
.icon-btn {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.15s ease;
}
.icon-btn:hover { border-color: var(--accent-2); transform: translateY(-1px); }
.icon-btn.off { opacity: 0.45; }

/* ---- stage / board ---- */
.stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  min-height: 0;
}
.board-wrap {
  position: relative;
  width: min(100%, 1100px);
  aspect-ratio: 16 / 10;
  max-height: 100%;
  border-radius: 16px;
  background: var(--board);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}
#board { display: block; width: 100%; height: 100%; }

.caption {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  max-width: 90%;
  padding: 8px 16px;
  background: rgba(20, 20, 24, 0.86);
  color: #fff;
  font-size: clamp(14px, 2.2vw, 19px);
  line-height: 1.4;
  border-radius: 12px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.caption.show { opacity: 1; }

.status-pill {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  background: rgba(20, 20, 24, 0.8);
  color: var(--accent);
  border-radius: 999px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-pill[hidden] { display: none; }
.status-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:.3} 50%{opacity:1} }

/* ---- ask bar ---- */
.askbar {
  flex: 0 0 auto;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: thin;
}
.chip {
  flex: 0 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.chip:hover { color: var(--ink); border-color: var(--accent-2); }
.ask-form { display: flex; gap: 10px; }
#askInput {
  flex: 1 1 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 15px;
  outline: none;
}
#askInput:focus { border-color: var(--accent-2); }
#askBtn {
  flex: 0 0 auto;
  background: var(--accent);
  color: #1a1a1a;
  border: none;
  border-radius: 12px;
  padding: 0 22px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}
#askBtn:hover { filter: brightness(1.05); transform: translateY(-1px); }
#askBtn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
