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

/* Nuclear transparency — everything must be transparent */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  background: transparent !important;
  border: none !important;
  outline: none !important;
}

body {
  background: transparent !important;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-app-region: drag;
}

/* Fully transparent window — only avatar + chatbox visible */
.amika-window {
  position: fixed;
  width: 100vw;
  height: 100vh;
  top: 0;
  left: 0;
  background: transparent !important;
  backdrop-filter: none !important;
  border: none !important;
  box-shadow: none !important;
  display: flex;
  flex-direction: column;
  z-index: 10000;
  pointer-events: auto;
  /* Entire window is draggable */
  -webkit-app-region: drag;
}

.amika-window * {
  -webkit-app-region: no-drag;
}

/* Live2D canvas — takes up most of the window */
.live2d-container {
  position: relative;
  width: 100%;
  height: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: transparent !important;
}

#stageArea {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent !important;
}

#live2d-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: auto;
  display: block;
  background: transparent !important;
  border: none !important;
}

/* Chatbox — semi-transparent, at bottom */
.chatbox {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  pointer-events: auto;
  -webkit-app-region: no-drag;
}

.chatbox-messages {
  max-height: 120px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.chatbox-messages::-webkit-scrollbar {
  width: 6px;
}
.chatbox-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chatbox-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.chatbox-msg {
  max-width: 85%;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.3;
  white-space: pre-wrap;
}

.chatbox-msg.user {
  align-self: flex-end;
  background: rgba(216, 180, 226, 0.9);
  color: #1a0d18;
  border-bottom-right-radius: 2px;
}

.chatbox-msg.amika {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.9);
  color: #1a0d18;
  border-bottom-left-radius: 2px;
}

.chatbox-input-area {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.chatbox-input-area input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: #1a0d18;
  font-size: 13px;
  outline: none;
}

.chatbox-input-area input:focus {
  border-color: #d8b4e2;
}

.chatbox-input-area button {
  padding: 6px 14px;
  background: #d8b4e2;
  color: #1a0d18;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  -webkit-app-region: no-drag;
}

.chatbox-input-area button:hover {
  background: #c8a8e0;
}

.chatbox-input-area button:active {
  background: #b894d2;
}

/* Chat bubble */
.chat-bubble {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 200px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  border-radius: 16px 16px 16px 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  font-size: 14px;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  white-space: pre-wrap;
}

.chat-bubble.visible {
  opacity: 1;
}

.chat-bubble.hidden {
  display: none;
}

.bubble-tail {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid rgba(255, 255, 255, 0.95);
}

/* Status indicator */
.status-indicator {
  position: fixed;
  top: 10px;
  left: 10px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border-radius: 20px;
  font-size: 12px;
  z-index: 10002;
  pointer-events: none;
  -webkit-app-region: no-drag;
}

/* Hidden utility */
.hidden {
  display: none !important;
}

/* Button that opens the chatbox in a separate window */
.chat-toggle {
  position: absolute;
  top: 10px;
  right: 46px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  z-index: 10003;
  pointer-events: auto;
  -webkit-app-region: no-drag;
  backdrop-filter: blur(6px);
  transition: background 0.2s, transform 0.15s;
}

.chat-toggle:hover {
  background: rgba(0, 0, 0, 0.75);
  transform: scale(1.08);
}

.chat-toggle:active {
  transform: scale(0.95);
}

/* Fallback CSS avatar (only shows if Live2D fails) */
.css-avatar {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 160px;
  pointer-events: none;
}

.css-avatar .face {
  width: 100px;
  height: 100px;
  background: #ffe0cc;
  border-radius: 50% 50% 45% 45%;
  margin: 0 auto;
  border: 2px solid #333;
  position: relative;
}

.css-avatar .eye {
  width: 16px;
  height: 16px;
  background: #333;
  border-radius: 50%;
  position: absolute;
  top: 35px;
}

.css-avatar .eye.left { left: 25px; }
.css-avatar .eye.right { right: 25px; }

.css-avatar .mouth {
  width: 30px;
  height: 12px;
  background: #e74c3c;
  border-radius: 50%;
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
}

.css-avatar .hair {
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: 40px;
  background: #2d1b1b;
  border-radius: 80px 80px 0 0;
}

.css-avatar.show { display: block; }
.css-avatar.hide { display: none; }
