* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #030409;
  color: #f9fafb;
  overflow: hidden;
}

:root {
  --blue: #2563eb;
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
}

.app {
  position: relative;
  width: 100vw;
  height: 100vh;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: scale(1.02);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.intro-center {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.intro-text {
  text-align: center;
  margin-bottom: 32px;
}

.intro-title {
  font-size: clamp(36px, 4vw, 48px);
  font-weight: 400;
  letter-spacing: 0.04em;
  background: linear-gradient(
    90deg,
    #8fa4ff 0%,
    #f5f7ff 50%,
    #8fa4ff 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.intro-subtitle {
  margin-top: 8px;
  font-size: 18px;
  letter-spacing: 0.04em;
  background: linear-gradient(
    90deg,
    #90a6ff 0%,
    #f4f6ff 50%,
    #90a6ff 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.intro-input-wrap {
  position: relative;
  width: min(560px, 90%);
  top: 35vh;
}

.input-wrapper {
  position: relative;
}

.main-input {
  width: 100%;
  padding: 14px 24px;
  font-size: 16px;
  border-radius: 17px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: #3a3a3a;
  color: #d4dcff;
  outline: none;
}

.main-input::placeholder {
  background: linear-gradient(
    90deg,
    #bfcaff 0%,
    #e7ecff 50%,
    #a4b4ff 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 1;
}

.input-orbs {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.orb-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 14px rgba(255, 255, 255, 0.4),
    inset 0 0 8px rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(6px);
  cursor: pointer;
  transition: 0.2s;
}

.orb-btn:hover {
  box-shadow:
    0 0 20px rgba(120, 160, 255, 0.8),
    inset 0 0 8px rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.orb-btn img,
.orb-btn svg {
  width: 40px;
  height: 37px;
  filter: brightness(200%);
}

.glow-floor {
  position: absolute;
  left: 50%;
  bottom: -60px;
  transform: translateX(-50%);
  width: 98vh;
  height: 18vh;
  background: radial-gradient(circle at 50% 10%, #3966F9, transparent 70%);
  filter: blur(8vh);
  opacity: 0.9;
  pointer-events: none;
}

.chat-layout {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 40px;
  padding: 32px 60px 40px;
  min-height: 0;
}

.history-panel {
  width: 260px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
  padding-bottom: 10px;
}

.history-header h2 {
  font-weight: 500;
  font-size: 20px;
}

.new-chat-btn {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.8);
  background: transparent;
  color: #e5f0ff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.7);
  transition: transform 0.6s ease;
}

.new-chat-btn:hover {
  transform: rotate(90deg);
}

.history-list {
  margin-top: 10px;
  overflow-y: auto;
  flex-grow: 1;
  padding-right: 5px;
  position: relative;
}

.history-list::-webkit-scrollbar {
  width: 6px;
}
.history-list::-webkit-scrollbar-thumb {
  background: rgba(59,130,246,0.4);
  border-radius: 4px;
}

.history-list::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  bottom: 2px;
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(to bottom, #60a5fa, transparent 60%);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.9);
}

.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 0 4px 4px;
  transition: color 0.18s ease-out, transform 0.18s ease-out;
}

.history-item .history-bullet {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  border: 1px solid #60a5fa;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.8);
}

.history-item:hover {
  color: #e5f0ff;
  transform: translateX(2px);
}

.history-item.active {
  color: #e5f0ff;
  font-weight: 500;
}

.chat-main {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 140px;
  min-height: 0;
}

.chat-messages::-webkit-scrollbar,
.history-list::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb {
  background: rgba(55, 65, 81, 0.8);
  border-radius: 999px;
}

.message-row {
  display: flex;
  margin-bottom: 10px;
}

.message-row.assistant {
  justify-content: flex-start;
}

.message-row.user {
  justify-content: flex-end;
}

.message-row.assistant .message-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin: 0 8px;
  background: radial-gradient(circle at 40% 30%, #dff1ff, #7aa7ff, #3d5cff);
  border: 1px solid rgba(255,255,255,0.2);
}

.message-row.user .message-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin: 0 8px;
  background: radial-gradient(circle at 40% 30%, #dff1ff, #48495b, #939ed6);
  border: 1px solid rgba(255,255,255,0.13);
}

.message-bubble {
  max-width: min(620px, 72%);
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 0 14px rgba(15, 23, 42, 0.95), 0 0 2px rgba(37, 99, 235, 0.65);
}

.message-row.assistant .message-bubble {
  margin-right: 40px;
  margin-left: 4px;
  background: radial-gradient(circle at 0% 0%, rgb(22 95 197 / 45%), #0f1023 70%) #0d111c;
}

.message-row.user .message-bubble {
  margin-left: 40px;
  margin-right: 4px;
  background: radial-gradient(circle at 0% 0%, rgb(22 95 197 / 45%), #0f1023 70%) #0d111c;
}

.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.typing-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #e5f0ff;
  opacity: 0.5;
  animation: typing 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

.chat-input-area {
  position: relative;
  width: min(640px, 100%);
  margin: 0 auto 4px;
  z-index: 1;
}

.floor-glow-bottom {
  position: absolute;
  left: 50%;
  bottom: -120px;
  transform: translateX(-50%);
  opacity: 0.95;
  pointer-events: none;
  width: 169vh;
  height: 23vh;
  background: radial-gradient(circle at 50% 10%, #3966F9, transparent 70%);
  filter: blur(10vh);
}

.theme-toggle {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 12px rgba(255, 255, 255, 0.25),
    inset 0 0 8px rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(6px);
  z-index: 99999;
  transition: 0.25s ease;
}

.theme-toggle:hover {
  transform: scale(1.08);
}

@media (max-width: 900px) {
  .chat-layout {
    grid-template-columns: 1fr;
    padding: 20px 14px 30px;
  }

  .history-panel {
    display: none;
  }

  .chat-input-area {
    width: 100%;
  }

  .message-bubble {
    max-width: 82%;
  }
}

@media (max-width: 768px) {
  .theme-toggle{
    display: none;
  }
  body {
    overflow: auto;
  }

  .chat-layout {
    grid-template-columns: 1fr;
    padding: 12px 12px 24px;
    gap: 16px;
  }

  .history-panel {
    display: none;
  }

  .chat-messages {
    padding: 8px 0 100px;
  }

  .message-bubble {
    max-width: 90%;
    font-size: 14px;
  }

  .main-input {
    font-size: 15px;
    padding: 12px 18px;
  }

  .chat-input-area {
    width: 100%;
    padding: 0 6px;
  }

  .floor-glow-bottom {
    width: 120vw;
    height: 22vh;
    bottom: -80px;
    filter: blur(60px);
  }

  .glow-floor {
    width: 120vw;
    height: 18vh;
    bottom: -30px;
  }
}