:root {
  --colorscheme-primary: #0088cc;
  --colorscheme-secondary: #5ac8fb;
  --colorscheme-dark: #0077b6;
  --colorscheme-light: #e1f5fe;
  --colorscheme-hover: #007eb8;
  --colorscheme-active: #006aa3;
  --colorscheme-bg: #e7f0f7;
  --colorscheme-chat-bg: #e6ebee;
  --colorscheme-user-bubble: #b1e5fd;
  --colorscheme-assistant-bubble: #ffffff;
}

#splashScreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("assets/default/background.png") center center / cover
    no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transition: opacity 0.5s ease;
  cursor: pointer;
  opacity: 1;
}

#splashScreen.hidden {
  display: none;
}
.splash-content {
  text-align: center;
  padding: 20px;
  max-width: 90%;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: fadeInUp 0.8s ease-out;
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.app-logo {
  width: 100px;
  height: 100px;
  background: white;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  animation: pulse 2s infinite;
  border: 3px solid var(--colorscheme-primary);
}
.app-logo i {
  font-size: 50px;
  color: var(--colorscheme-primary);
}
.app-title {
  font-size: 28px;
  font-weight: bold;
  color: white;
  margin-bottom: 10px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
.app-subtitle {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 30px;
  max-width: 80%;
  line-height: 1.5;
  margin: 0 auto 30px;
}
.tap-to-start {
  font-size: 16px;
  color: white;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 30px;
  animation: pulse 2s infinite;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.4);
  transition: all 0.3s ease;
  display: inline-block;
  font-weight: 600;
}
.tap-to-start:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--colorscheme-bg);
  color: #000000;
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
  font-size: 16px;
}

.header {
  height: 56px;
  background: var(--colorscheme-primary);
  color: white;
  display: flex;
  align-items: center;
  padding: 0 16px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  justify-content: space-between;
}

.header-title {
  font-weight: 500;
  font-size: 18px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  margin-left: auto;
  flex-shrink: 0;
}

.header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#toggleSidebar {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 18px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

#toggleSidebar:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar {
  width: 280px;
  min-width: 280px;
  background: #ffffff;
  color: #333333;
  padding: 10px 0;
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 10;
  position: fixed;
  top: 56px;
  bottom: 0;
  left: 0;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar.hidden {
  transform: translateX(-100%);
}

.menu-item {
  padding: 12px 20px;
  margin: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #555555;
  transition: all 0.2s;
  font-size: 15px;
}

.menu-item:hover {
  background: var(--colorscheme-light);
  color: #000000;
}

.menu-item.active {
  background: var(--colorscheme-light);
  color: var(--colorscheme-primary);
}

.menu-item i {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  position: relative;
  background: var(--colorscheme-bg);
  padding-top: 56px;
}

#chat {
  flex: 1;
  padding: 8px 10px 75px;
  overflow-y: auto;
  background: url("assets/default/bgchat.png") no-repeat center center fixed;
  background-size: cover;
  background-color: var(--colorscheme-chat-bg);
  background-blend-mode: multiply;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
  opacity: 0.99;
}

.message {
  line-height: 1.6;
  font-size: 16px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  position: relative;
  margin-top: 4px;
}

.message.user {
  background: var(--colorscheme-user-bubble);
  color: #000000;
  align-self: flex-end;
  border-bottom-right-radius: 0px;
  margin-right: 5px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.message.assistant {
  background: var(--colorscheme-assistant-bubble);
  color: #000000;
  align-self: flex-start;
  border-bottom-left-radius: 0px;
  margin-left: 5px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
  min-width: 40%;
  width: fit-content;
}

.message-content {
  width: 100%;
  overflow: visible;
}

.message-content p {
  margin-bottom: 1em;
  line-height: 1.6;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content > * {
  max-width: 100%;
  overflow-wrap: break-word;
}

.message.assistant ol,
.message.assistant ul {
  padding-left: 24px;
  margin: 8px 0;
  list-style-position: outside;
}

.message.assistant li {
  margin-bottom: 6px;
  position: relative;
  left: 0;
  word-wrap: break-word;
}

.message.assistant ul li {
  padding-left: 4px;
}

.message.assistant ol {
  counter-reset: item;
  padding-left: 28px;
}

.message.assistant ol li {
  display: block;
}

.message.assistant ol li:before {
  content: counters(item, ".") ". ";
  counter-increment: item;
  position: absolute;
  left: -20px;
}

.message.assistant ol ol,
.message.assistant ul ul,
.message.assistant ol ul,
.message.assistant ul ol {
  padding-left: 20px;
  margin-top: 6px;
}

.message-timestamp {
  font-size: 12px;
  color: #666666;
  text-align: right;
  margin-top: 6px;
  margin-right: 4px;
  opacity: 0.8;
}

.message-timestamp {
  display: none !important;
}

.image-preview {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  margin-top: 8px;
  cursor: pointer;
  object-fit: contain;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.input-area {
  padding: 12px;
  background: #ffffff;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  border-top: 1px solid #d3d9de;
  z-index: 50;
}

.input-container {
  flex: 1;
  display: flex;
  align-items: center;
  background: #f5f9fc;
  border-radius: 20px;
  padding: 0 12px;
  margin-left: 10px;
  margin-right: 10px;
}

#prompt {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  padding: 10px 0;
  border: none;
  background: transparent;
  resize: none;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  outline: none;
  box-shadow: none;
  margin: 0 8px;
}

button {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--colorscheme-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

button:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

button:active {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  color: #a0a0a0;
}

#sendBtn {
  background: var(--colorscheme-primary);
  color: white;
  display: none;
  margin-right: 10px;
}

#sendBtn:hover {
  background: var(--colorscheme-dark);
}

#uploadBtn {
  color: var(--colorscheme-primary);
}

.message.assistant pre {
  background: #f5f5f5 !important;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  position: relative;
  border: 1px solid #e0e0e0;
  margin: 8px 0;
}

.code-copy-btn {
  position: absolute;
  right: 8px;
  top: 8px;
  background: #e0e0e0;
  border: none;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  color: #555555;
}

.code-copy-btn:hover {
  background: #d0d0d0;
}

pre {
  position: relative !important;
  padding-top: 2em !important;
  overflow-x: auto;
}

.code-copy-btn {
  position: absolute !important;
  top: 10px !important;
  right: 10px !important;
  z-index: 100;
  background: rgba(0, 0, 0, 0.3);
  border: none;
  border-radius: 4px;
  color: white;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.code-copy-btn:hover {
  background: rgba(0, 0, 0, 0.5);
}

@media (max-width: 768px) {
  .code-copy-btn {
    top: 5px !important;
    right: 5px !important;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.5);
  }
}

table {
  border-collapse: collapse;
  margin: 12px 0;
  width: 100%;
  max-width: 100%;
  display: block;
  overflow-x: auto;
}

th,
td {
  border: 1px solid #e0e0e0;
  padding: 8px 12px;
  text-align: left;
}

th {
  background: #f5f5f5;
}

blockquote {
  border-left: 3px solid var(--colorscheme-primary);
  padding-left: 12px;
  margin: 8px 0;
  color: #555555;
}

.typing-indicator {
  display: flex;
  padding: 12px 16px;
  background: #ffffff;
  border-radius: 12px;
  align-self: flex-start;
  margin-bottom: 8px;
  gap: 6px;
  width: fit-content;
  margin-left: 10px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--colorscheme-primary);
  border-radius: 50%;
  animation: typingAnimation 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
  animation-delay: 0s;
}
.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}
.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingAnimation {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-5px);
  }
}

.modal {
  display: none;
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  justify-content: center;
  align-items: center;
  touch-action: none;
}

.modal-content {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
}

.close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 40px;
  cursor: pointer;
  z-index: 101;
}

.upload-status {
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.05);
}

.upload-status i {
  font-size: 16px;
}

.upload-status.success {
  background: rgba(0, 200, 83, 0.1);
  color: #00c853;
}

.upload-status.error {
  background: rgba(229, 57, 53, 0.1);
  color: #e53935;
}

@media (max-width: 768px) {
  body {
    font-size: 17px;
  }
  .sidebar {
    width: 260px;
    min-width: 260px;
    transform: translateX(-100%);
  }
  .sidebar:not(.hidden) {
    transform: translateX(0);
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.3);
  }
  .header-title {
    font-size: 17px;
    max-width: 50%;
  }
  .header-avatar {
    width: 36px;
    height: 36px;
  }
  .menu-item {
    font-size: 15px;
    padding: 12px 18px;
  }
  .message {
    max-width: 90%;
    padding: 12px 14px;
    font-size: 15px;
  }

  .message-content img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 8px;
    margin: 8px 0;
    display: block;
  }

  .message.user .message-content img {
    margin-left: 0;
    margin-right: auto;
  }

  .message.assistant .message-content img {
    margin-left: auto;
    margin-right: 0;
  }

  #prompt {
    font-size: 15px;
    padding: 10px 0;
    margin: 0 6px;
  }
  .input-area {
    padding: 12px;
  }
  button {
    width: 40px;
    height: 40px;
    min-width: 40px;
    font-size: 18px;
  }
  .input-container {
    margin-left: 8px;
    margin-right: 8px;
  }
  #chat {
    padding-bottom: 145px;
  }
  .message.assistant ol,
  .message.assistant ul {
    padding-left: 22px;
  }
  .message.assistant ol {
    padding-left: 26px;
  }
  .app-logo {
    width: 80px;
    height: 80px;
  }
  .app-logo i {
    font-size: 40px;
  }
  .app-title {
    font-size: 24px;
  }
  .app-subtitle {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 16px;
  }
  .header {
    padding: 0 10px;
  }
  .header-title {
    font-size: 16px;
    max-width: 45%;
  }
  #chat {
    padding: 14px 8px 140px;
  }
  .message {
    font-size: 15px;
    padding: 10px 14px;
  }

  .message-content img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 8px;
    margin: 8px 0;
    display: block;
  }

  .message.user .message-content img {
    margin-left: 0;
    margin-right: auto;
  }

  .message.assistant .message-content img {
    margin-left: auto;
    margin-right: 0;
  }

  .message.user {
    padding: 10px 14px;
  }
  .input-area {
    gap: 8px;
    padding: 10px;
  }
  .menu-item {
    padding: 12px 16px;
    font-size: 14px;
  }
  #prompt {
    font-size: 15px;
  }
  #sendBtn {
    margin-right: 8px;
  }
}
