html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #0b1220;
  color: #fff;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 12px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

h1 {
  font-size: 20px;
  margin: 8px 0;
}

#settingsBtn {
  background: none;
  border: 1px solid #2a3550;
  color: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 16px;
}

#settingsPanel {
  background: #131c2e;
  border: 1px solid #2a3550;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#settingsPanel.hidden { display: none; }

#settingsPanel label { font-size: 13px; color: #9fb0d0; }

#settingsPanel input {
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #2a3550;
  background: #0b1220;
  color: #fff;
  font-size: 14px;
  width: 100%;
}

#settingsPanel button {
  align-self: flex-start;
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  background: #4c6ef5;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
}

.hint { font-size: 12px; color: #6b7a99; margin: 0; }

#avatarStage {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 110px;
}

.avatar {
  font-size: 56px;
  line-height: 1;
  transition: transform 0.15s ease;
}

.avatar.idle {
  animation: breathe 3s ease-in-out infinite;
}

.avatar.dancing {
  animation: dance 0.5s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.03); }
}

@keyframes dance {
  0%   { transform: translateY(0) rotate(-10deg) scale(1); }
  25%  { transform: translateY(-14px) rotate(8deg) scale(1.08); }
  50%  { transform: translateY(0) rotate(-6deg) scale(1); }
  75%  { transform: translateY(-10px) rotate(10deg) scale(1.06); }
  100% { transform: translateY(0) rotate(-10deg) scale(1); }
}

#chatWindow {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0;
  min-height: 80px;
}

.msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.msg.user {
  align-self: flex-end;
  background: #4c6ef5;
  color: #fff;
  border-bottom-right-radius: 2px;
}

.msg.bot {
  align-self: flex-start;
  background: #131c2e;
  border: 1px solid #2a3550;
  border-bottom-left-radius: 2px;
}

#chatForm {
  display: flex;
  gap: 8px;
  padding: 8px 0;
}

#chatInput {
  flex: 1;
  min-width: 0;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #2a3550;
  background: #131c2e;
  color: #fff;
  font-size: 16px;
}

#sendBtn {
  padding: 12px 18px;
  border-radius: 10px;
  border: none;
  background: #4c6ef5;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  font-size: 15px;
  flex-shrink: 0;
}

#sendBtn:disabled { opacity: 0.5; cursor: not-allowed; }

#statusBar {
  font-size: 12px;
  color: #6b7a99;
  min-height: 18px;
  text-align: center;
}
