* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: radial-gradient(circle at center, #252b36 0%, #101319 100%);
  color: #f3f4f6;
  overflow: hidden;
  width: 100vw;
  height: 100dvh;
  user-select: none;
}

#canvas-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* แถบด้านบน */
.top-hud {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(94vw, 480px);
  z-index: 10;
  pointer-events: none;
}

.status-card {
  background: rgba(15, 19, 28, 0.78);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 12px 16px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.badge {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  transition: all 0.3s ease;
}

.badge-normal {
  background: rgba(148, 163, 184, 0.25);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.badge-mask {
  background: rgba(122, 214, 59, 0.22);
  color: #a3ff5c;
  border: 1px solid rgba(122, 214, 59, 0.65);
  box-shadow: 0 0 12px rgba(122, 214, 59, 0.35);
}

.mood-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e5e7eb;
}

.mood-bar-bg {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.mood-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  border-radius: 999px;
  transition: width 0.35s ease, background 0.35s ease;
}

.status-hint {
  margin-top: 6px;
  font-size: 0.74rem;
  color: #9ca3af;
  text-align: center;
}

/* แถบด้านล่าง */
.bottom-hud {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(94vw, 540px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
}

.speech-box {
  background: rgba(15, 19, 28, 0.84);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 12px 16px;
  min-height: 76px;
}

.speech-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 0.82rem;
  color: #94a3b8;
  font-weight: 600;
}

.mood-delta {
  font-weight: 700;
  font-size: 0.82rem;
}

.mood-delta.plus { color: #86efac; }
.mood-delta.minus { color: #fca5a5; }

#speech-text {
  font-size: 0.98rem;
  line-height: 1.45;
  color: #ffffff;
}

.controls-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 12px 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffffff;
  cursor: pointer;
  background: rgba(30, 41, 59, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.16);
  transition: transform 0.12s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  background: rgba(51, 65, 85, 0.95);
}

.btn:active {
  transform: scale(0.96);
}

.btn-mask {
  background: linear-gradient(135deg, #2e7d32, #64b52b);
  border-color: rgba(163, 255, 92, 0.6);
  box-shadow: 0 4px 14px rgba(100, 181, 43, 0.35);
}

.btn-mask:hover {
  background: linear-gradient(135deg, #388e3c, #7ad63b);
}

.btn-mask.active {
  background: linear-gradient(135deg, #475569, #334155);
  border-color: rgba(203, 213, 225, 0.45);
  box-shadow: none;
}

@media (max-width: 480px) {
  .controls-bar {
    grid-template-columns: repeat(2, 1fr);
  }
}
