/* Sarathi — HUD Theme with Dynamic Accents, Odontogram & Multilingual UI. */

:root {
  --hue: 175;
  --accent: hsl(var(--hue), 85%, 55%);
  --accent-dim: hsl(var(--hue), 60%, 35%);
  --accent-glow: hsla(var(--hue), 85%, 55%, 0.35);
  --bg: hsl(var(--hue), 25%, 6%);
  --bg-panel: hsl(var(--hue), 20%, 10%);
  --bg-card: hsl(var(--hue), 18%, 14%);
  --text: hsl(var(--hue), 15%, 92%);
  --muted: hsl(var(--hue), 12%, 60%);
  --border: hsla(var(--hue), 40%, 50%, 0.25);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Noto Sans", sans-serif;
  min-height: 100vh;
}

#app { max-width: 1140px; margin: 0 auto; padding: 0 1rem 3rem; }

/* ---------- top bar ---------- */
#topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1.2rem 0; border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 0.8rem; }
.brand-icon { font-size: 2.2rem; filter: drop-shadow(0 0 8px var(--accent-glow)); }
.brand h1 { font-size: 1.45rem; letter-spacing: 0.5px; }
.brand h1 .hi { color: var(--accent); font-weight: 600; }
.tagline { color: var(--muted); font-size: 0.85rem; }
.developer { color: var(--accent); font-size: 0.78rem; margin-top: 0.15rem; opacity: 0.95; }
.developer strong { font-weight: 600; }
.guidance { color: var(--muted); font-size: 0.72rem; margin-top: 0.1rem; font-style: italic; }

.header-actions { display: flex; align-items: center; gap: 0.8rem; }

/* PWA Install Button */
.pwa-install-btn {
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.45rem 1.05rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.4);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.pwa-install-btn.hidden { display: none !important; }
.pwa-install-btn:hover {
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.6);
}

.lang-selector-wrap {
  display: flex; align-items: center; gap: 0.4rem;
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 0.35rem 0.75rem; border-radius: 999px;
  font-size: 0.85rem; color: var(--text);
}
.lang-selector-wrap select {
  background: transparent; color: var(--accent); border: none;
  font-weight: 600; font-size: 0.85rem; outline: none; cursor: pointer;
}
.lang-selector-wrap select option {
  background: var(--bg-panel); color: #fff;
}

#tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; width: 100%; margin-top: 0.3rem; }
.tab {
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.42rem 0.9rem; cursor: pointer; font-size: 0.84rem;
  transition: all 0.2s;
}
.tab:hover { color: var(--text); border-color: var(--accent); }
.tab.active {
  background: var(--accent-dim); color: #fff; border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ---------- panels ---------- */
.panel { display: none; padding-top: 1.5rem; animation: fadein 0.25s ease; }
.panel.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

.panel-head { margin-bottom: 1.2rem; }
.panel-head h2 { font-size: 1.3rem; margin-bottom: 0.3rem; }
.muted { color: var(--muted); font-size: 0.85rem; }

/* ---------- HUD / reactor & Talking Avatar Widget ---------- */
.hud { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; padding: 1rem 0; }
.hud-interactive-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.8rem;
  position: relative;
  width: 100%;
  margin-bottom: 0.4rem;
}
#reactor { filter: drop-shadow(0 0 18px var(--accent-glow)); transition: transform 0.1s ease; }

/* Talking Dental Emoji Character Widget */
.talking-avatar-widget {
  width: 125px;
  height: 140px;
  position: relative;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.talking-avatar-widget:hover {
  transform: scale(1.06);
}
.talking-avatar-widget.idle {
  animation: avatar-float 3s ease-in-out infinite alternate;
}
@keyframes avatar-float {
  0% { transform: translateY(0px); }
  100% { transform: translateY(-7px); }
}

.avatar-face {
  width: 105px;
  height: 115px;
  background: linear-gradient(160deg, #ffffff 0%, #f0fdfa 55%, #ccfbf1 100%);
  border-radius: 46% 46% 48% 48% / 55% 55% 42% 42%;
  border: 3px solid #14b8a6;
  box-shadow: 0 8px 24px rgba(20, 184, 166, 0.35), inset 0 2px 6px rgba(255, 255, 255, 0.9);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.avatar-crown-sparkle {
  position: absolute;
  top: -12px;
  right: 6px;
  font-size: 1.3rem;
  animation: sparkle-spin 4s linear infinite;
}
@keyframes sparkle-spin {
  0% { transform: rotate(0deg) scale(0.9); }
  50% { transform: rotate(180deg) scale(1.15); }
  100% { transform: rotate(360deg) scale(0.9); }
}

.avatar-eyes {
  display: flex;
  gap: 26px;
  margin-top: 10px;
}
.avatar-eye {
  width: 15px;
  height: 19px;
  background: #0f172a;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  animation: eye-blink 4s infinite;
}
@keyframes eye-blink {
  0%, 96%, 100% { transform: scaleY(1); }
  98% { transform: scaleY(0.1); }
}
.avatar-eye .pupil {
  width: 5px;
  height: 5px;
  background: #ffffff;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
}

.avatar-cheeks {
  display: flex;
  gap: 52px;
  position: absolute;
  top: 56px;
}
.cheek {
  width: 12px;
  height: 8px;
  background: #f472b6;
  border-radius: 50%;
  opacity: 0.65;
}

/* Talking Mouth with Teeth row */
.avatar-mouth {
  width: 24px;
  height: 9px;
  background: #991b1b;
  border-radius: 0 0 12px 12px;
  margin-top: 15px;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
  border: 1px solid #7f1d1d;
}
.teeth-row-inner {
  width: 100%;
  height: 3px;
  background: #ffffff;
  position: absolute;
  top: 0;
  left: 0;
}

/* When Talking: Mouth visibly articulates! */
.talking-avatar-widget.talking .avatar-mouth {
  animation: talk-viseme 0.22s ease-in-out infinite alternate;
}
@keyframes talk-viseme {
  0% { height: 6px; width: 18px; border-radius: 0 0 8px 8px; }
  50% { height: 22px; width: 30px; border-radius: 14px; }
  100% { height: 10px; width: 24px; border-radius: 4px; }
}
.talking-avatar-widget.talking .avatar-face {
  box-shadow: 0 0 32px var(--accent-glow);
}

/* When Listening */
.talking-avatar-widget.listening .avatar-face {
  border-color: #38ef7d;
  box-shadow: 0 0 30px rgba(56, 239, 125, 0.65);
}
.talking-avatar-widget.listening .avatar-eye {
  transform: scale(1.15);
}

/* Avatar Speech Bubble */
.avatar-speech-bubble {
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 0.5rem 0.95rem;
  border-radius: 12px;
  font-size: 0.82rem;
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  pointer-events: none;
  z-index: 50;
  animation: fadein 0.2s ease;
}
.avatar-speech-bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: var(--accent) transparent transparent transparent;
}
.avatar-speech-bubble.hidden { display: none; }

/* Floating Widget Mode (Screen Persistent) */
.talking-avatar-widget.floating {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 99999;
  transform: scale(0.92);
  filter: drop-shadow(0 14px 30px rgba(0,0,0,0.7));
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  padding: 0.6rem;
  border-radius: 26px;
  border: 2px solid var(--accent);
}
.talking-avatar-widget.floating:hover {
  transform: scale(1.02);
}

#status-line { color: var(--muted); font-size: 0.9rem; min-height: 1.4em; text-align: center; }
.hud-controls { display: flex; gap: 0.7rem; flex-wrap: wrap; justify-content: center; }
.round-btn {
  width: 52px; height: 52px; border-radius: 50%; font-size: 1.3rem; cursor: pointer;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  transition: all 0.2s;
}
.round-btn:hover { border-color: var(--accent); box-shadow: 0 0 14px var(--accent-glow); }
.round-btn.on { background: var(--accent-dim); border-color: var(--accent); box-shadow: 0 0 16px var(--accent-glow); }

/* ---------- quick triage chips ---------- */
.quick-chips-wrap { margin: 0.8rem 0; }
.quick-label { font-size: 0.8rem; color: var(--accent); font-weight: 600; display: block; margin-bottom: 0.4rem; }
.quick-chips-row { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.quick-chip {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  border-radius: 999px; padding: 0.35rem 0.8rem; font-size: 0.8rem; cursor: pointer;
  transition: all 0.2s; white-space: nowrap;
}
.quick-chip:hover {
  background: var(--accent-dim); border-color: var(--accent); color: #fff;
  transform: translateY(-1px); box-shadow: 0 2px 8px var(--accent-glow);
}

/* ---------- chat ---------- */
#chat-log {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 14px;
  height: 380px; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem;
}
.msg { max-width: 82%; padding: 0.75rem 1.05rem; border-radius: 14px; line-height: 1.55; white-space: pre-wrap; font-size: 0.95rem; }
.msg.user { align-self: flex-end; background: var(--accent-dim); border-bottom-right-radius: 4px; color: #fff; }
.msg.bot { align-self: flex-start; background: var(--bg-card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg .qa-question { color: var(--accent); font-size: 0.82rem; margin-bottom: 0.35rem; font-weight: 600; }
.msg .related { margin-top: 0.6rem; padding-top: 0.5rem; border-top: 1px dashed var(--border); font-size: 0.82rem; }
.msg .related a { color: var(--accent); cursor: pointer; display: block; margin-top: 0.25rem; text-decoration: underline; }
.msg .briefing-block { margin-top: 0.5rem; font-size: 0.88rem; }
.msg .briefing-block b { color: var(--accent); }

#chat-form { display: flex; gap: 0.6rem; margin-top: 0.8rem; }
#chat-input {
  flex: 1; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 999px;
  padding: 0.8rem 1.3rem; color: var(--text); font-size: 0.98rem; outline: none;
}
#chat-input:focus { border-color: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }
#btn-send {
  background: var(--accent-dim); border: 1px solid var(--accent); color: #fff;
  border-radius: 50%; width: 50px; height: 50px; font-size: 1.2rem; cursor: pointer;
  transition: all 0.2s;
}
#btn-send:hover { box-shadow: 0 0 12px var(--accent-glow); transform: scale(1.05); }

/* ---------- visual brushing quadrant timer ---------- */
#timer-display {
  text-align: center; margin-top: 1.2rem; padding: 1.2rem;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 14px;
}
#timer-display.hidden { display: none; }
.timer-quadrants {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; max-width: 280px; margin: 0 auto 1rem;
}
.quadrant-box {
  background: var(--bg-card); border: 1px solid var(--border); padding: 0.6rem;
  border-radius: 8px; font-size: 0.82rem; color: var(--muted); transition: all 0.3s;
}
.quadrant-box.active {
  background: var(--accent-dim); border-color: var(--accent); color: #fff;
  font-weight: bold; box-shadow: 0 0 12px var(--accent-glow); transform: scale(1.04);
}
.timer-ring {
  width: 100px; height: 100px; margin: 0 auto; border-radius: 50%;
  border: 4px solid var(--accent); display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700; box-shadow: 0 0 16px var(--accent-glow);
  animation: pulse 1s infinite alternate;
}
@keyframes pulse { from { box-shadow: 0 0 8px var(--accent-glow); } to { box-shadow: 0 0 24px var(--accent-glow); } }
#timer-subtext { margin-top: 0.8rem; font-size: 0.88rem; color: var(--muted); }
.secondary-btn {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 0.4rem 1.2rem; margin-top: 0.8rem; cursor: pointer;
}
.secondary-btn:hover { border-color: var(--accent); color: var(--text); }

/* ---------- interactive odontogram / tooth map ---------- */
.odontogram-controls { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.legend-badge {
  font-size: 0.75rem; padding: 0.2rem 0.65rem; border-radius: 6px; font-weight: 600;
}
.legend-badge.incisor { background: #1e3a8a; color: #93c5fd; }
.legend-badge.canine { background: #064e3b; color: #6ee7b7; }
.legend-badge.premolar { background: #78350f; color: #fde68a; }
.legend-badge.molar { background: #4c1d95; color: #c4b5fd; }
.legend-badge.wisdom { background: #831843; color: #fbcfe8; }

.odontogram-container { display: flex; flex-direction: column; gap: 1.4rem; }
.arch-section { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px; padding: 1.2rem; }
.arch-title { font-size: 0.95rem; color: var(--accent); margin-bottom: 0.8rem; text-align: center; }
.teeth-row {
  display: flex; justify-content: center; gap: 0.35rem; flex-wrap: wrap;
}
.tooth-btn {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  width: 52px; height: 68px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; cursor: pointer;
  transition: all 0.2s; position: relative;
}
.tooth-btn:hover {
  transform: translateY(-3px); border-color: var(--accent);
  box-shadow: 0 4px 12px var(--accent-glow);
}
.tooth-btn.selected {
  border-color: var(--accent); background: var(--accent-dim);
  box-shadow: 0 0 16px var(--accent-glow);
}
.tooth-btn .t-num { font-size: 0.78rem; font-weight: 700; color: #fff; }
.tooth-btn .t-name { font-size: 0.65rem; color: var(--muted); text-align: center; line-height: 1.1; margin-top: 0.15rem; }
.tooth-btn .t-dot {
  width: 6px; height: 6px; border-radius: 50%; position: absolute; bottom: 4px;
}
.tooth-btn[data-type="incisor"] .t-dot { background: #60a5fa; }
.tooth-btn[data-type="canine"] .t-dot { background: #34d399; }
.tooth-btn[data-type="premolar"] .t-dot { background: #fbbf24; }
.tooth-btn[data-type="molar"] .t-dot { background: #a78bfa; }
.tooth-btn[data-type="wisdom"] .t-dot { background: #f472b6; }

.tooth-detail-view {
  background: var(--bg-card); border: 1px solid var(--accent);
  padding: 1.3rem; border-radius: 12px; animation: fadein 0.2s ease;
}
.tooth-detail-view.hidden { display: none; }
.tooth-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.8rem; }
.tooth-header h3 { font-size: 1.2rem; color: var(--accent); margin-bottom: 0.3rem; }
.close-btn { background: transparent; border: none; color: var(--muted); font-size: 1.2rem; cursor: pointer; }
.close-btn:hover { color: #fff; }
.tooth-desc { font-size: 0.92rem; line-height: 1.5; margin-bottom: 1rem; }
.tooth-clinical-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.8rem; margin-bottom: 1rem; }
.clinical-box { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px; padding: 0.8rem; }
.clinical-box h4 { font-size: 0.85rem; color: var(--accent); margin-bottom: 0.4rem; }
.clinical-box p { font-size: 0.84rem; line-height: 1.45; color: var(--text); }
.tooth-actions { text-align: right; }

/* ---------- interactive aligner coach ---------- */
.aligner-coach-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.2rem; }
.aligner-input-card, .aligner-result-card { padding: 1.4rem; border-radius: 12px; }
.slider-wrap { margin: 1.2rem 0; text-align: center; }
.slider-wrap input[type="range"] { width: 100%; accent-color: var(--accent); height: 8px; cursor: pointer; }
.slider-val-display { font-size: 1.8rem; font-weight: 700; color: var(--accent); margin-top: 0.5rem; }
.aligner-inputs-extra { display: flex; flex-direction: column; gap: 0.8rem; margin-top: 1rem; }
.aligner-inputs-extra label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
.aligner-inputs-extra input, .aligner-inputs-extra select {
  background: var(--bg-panel); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 0.5rem 0.8rem; outline: none;
}
.compliance-gauge-wrap { display: flex; justify-content: center; margin-bottom: 1rem; }
.compliance-gauge {
  width: 120px; height: 120px; border-radius: 50%;
  border: 8px solid var(--success); display: flex; flex-direction: column;
  align-items: center; justify-content: center; transition: border-color 0.3s;
}
.compliance-gauge.good { border-color: var(--success); box-shadow: 0 0 16px rgba(34, 197, 94, 0.35); }
.compliance-gauge.warn { border-color: var(--warning); box-shadow: 0 0 16px rgba(245, 158, 11, 0.35); }
.compliance-gauge.danger { border-color: var(--danger); box-shadow: 0 0 16px rgba(239, 68, 68, 0.35); }
#compliance-pct { font-size: 1.6rem; font-weight: 800; }
.compliance-lbl { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; }
#compliance-status { font-size: 1.1rem; text-align: center; margin-bottom: 0.5rem; }
#compliance-detail { font-size: 0.9rem; line-height: 1.5; color: var(--muted); text-align: center; margin-bottom: 1.2rem; }
.compliance-forecast { background: var(--bg-panel); border-radius: 8px; padding: 0.8rem; display: flex; flex-direction: column; gap: 0.5rem; }
.forecast-item { display: flex; justify-content: space-between; font-size: 0.85rem; }
.forecast-title { color: var(--muted); }
.forecast-val { font-weight: 600; color: var(--accent); }

/* ---------- cards & lists ---------- */
.card-list { display: flex; flex-direction: column; gap: 0.8rem; }
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 1rem 1.2rem; transition: border-color 0.2s;
}
.card:hover { border-color: var(--accent); }
.card h3 { font-size: 1.02rem; margin-bottom: 0.35rem; }
.card .meta { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 0.5rem; font-size: 0.78rem; color: var(--muted); }
.card .tag {
  background: var(--accent-dim); color: #fff; border-radius: 999px;
  padding: 0.1rem 0.6rem; font-size: 0.72rem;
}
.card p { color: var(--text); line-height: 1.55; font-size: 0.92rem; }
.card .card-actions { margin-top: 0.6rem; display: flex; gap: 0.5rem; }
.card button {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 8px; padding: 0.3rem 0.8rem; cursor: pointer; font-size: 0.8rem;
}
.card button:hover { color: var(--text); border-color: var(--accent); }

/* knowledge accordion */
.kb-item .kb-q { cursor: pointer; display: flex; justify-content: space-between; gap: 1rem; font-weight: 600; }
.kb-item .kb-q:hover { color: var(--accent); }
.kb-item .kb-a { display: none; margin-top: 0.6rem; color: var(--text); line-height: 1.6; font-size: 0.92rem; }
.kb-item.open .kb-a { display: block; }
.kb-item .kb-cat { font-size: 0.72rem; color: var(--muted); font-weight: 400; }

/* chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.chip {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 0.3rem 0.85rem; font-size: 0.8rem; cursor: pointer;
}
.chip:hover, .chip.active { color: #fff; background: var(--accent-dim); border-color: var(--accent); }

/* forms */
.inline-form { display: flex; gap: 0.6rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.inline-form input {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.6rem 1rem; color: var(--text); flex: 1; min-width: 180px; outline: none;
}
.inline-form button, .primary {
  background: var(--accent-dim); border: 1px solid var(--accent); color: #fff;
  border-radius: 10px; padding: 0.6rem 1.4rem; cursor: pointer; transition: all 0.2s;
}
.inline-form button:hover, .primary:hover {
  box-shadow: 0 0 12px var(--accent-glow); transform: translateY(-1px);
}
#kb-search {
  width: 100%; background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.7rem 1rem; color: var(--text); margin-top: 0.6rem; outline: none;
}
#kb-search:focus { border-color: var(--accent); }

.settings-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem; margin-bottom: 1.2rem;
}
.settings-grid label { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.88rem; color: var(--muted); }
.settings-grid input[type="text"] {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.6rem 0.9rem; color: var(--text); outline: none;
}
.settings-grid input[type="range"] { accent-color: var(--accent); }

footer {
  margin-top: 3.5rem; padding-top: 1.2rem; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 0.78rem; text-align: center; line-height: 1.5;
}

@media (max-width: 768px) {
  #topbar { flex-direction: column; align-items: flex-start; }
  .header-actions { width: 100%; justify-content: space-between; flex-wrap: wrap; }
  .msg { max-width: 95%; }
  #chat-log { height: 320px; }
  .tooth-btn { width: 44px; height: 58px; }
  .tooth-btn .t-num { font-size: 0.7rem; }
  .tooth-btn .t-name { font-size: 0.58rem; }
  .hud-interactive-stage { flex-direction: column; gap: 0.8rem; }
}
