
:root {
  --blue: #244CC5;
  --sage: #A3B7A1;
  --cream: #F7F5EF;
  --ink: #242A27;
  --muted: #777E77;
  --white: #FFFFFF;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: system-ui, -apple-system, sans-serif;
}

button, textarea { font: inherit; }
button { cursor: pointer; }

.app {
  min-height: 100dvh;
  max-width: 850px;
  margin: auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: var(--cream);
  border-bottom: 1px solid #E8E5DC;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-icon { 
  display: grid;
  place-items: center;
  color: white;
  background: var(--blue);
  border-radius: 17px;
}

.logo {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.brand h1 {
  margin: 0;
  font-size: 23px;
  color: var(--blue);
  letter-spacing: -1px;
}

.brand p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.new-chat {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 14px;
  background: #E5EAFB;
  color: var(--blue);
  font-size: 28px;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
}

.welcome {
  margin: auto 0;
  padding: 30px 0;
  text-align: center;
}

.hero-icon {
    width: 76px;
    height: 76px;
    margin: 0 auto 22px;
    border-radius: 20px;
    font-size: 42px;
    box-shadow: 0 8px 24px #244CC522;
    overflow: hidden;
}

.welcome h2 {
  font-size: 30px;
  margin: 0 0 8px;
}

.welcome h3 {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 21px;
}

.welcome p {
  color: var(--muted);
  line-height: 1.6;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  margin-top: 24px;
}

.suggestions button {
  background: white;
  color: var(--ink);
  border: 1px solid #E5E3DA;
  border-radius: 22px;
  padding: 11px 14px;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.message {
  max-width: 90%;
  padding: 14px 16px;
  border-radius: 18px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.user {
  align-self: flex-end;
  background: var(--blue);
  color: white;
  border-bottom-right-radius: 5px;
}

.message.assistant {
  align-self: flex-start;
  background: white;
  border: 1px solid #E8E5DC;
  border-bottom-left-radius: 5px;
}

.message.error { color: #9B2929; }

.composer-wrap {
  position: sticky;
  bottom: 0;
  padding: 10px 16px 14px;
  background: var(--cream);
}

.status {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 10px;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: white;
  padding: 9px;
  border: 1px solid #E0DED5;
  border-radius: 24px;
  box-shadow: 0 4px 20px #00000008;
}

.composer textarea {
  flex: 1;
  min-width: 0;
  max-height: 140px;
  resize: none;
  border: 0;
  outline: none;
  padding: 11px 8px;
  background: transparent;
  color: var(--ink);
}

#sendBtn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 16px;
  background: var(--blue);
  color: white;
  font-size: 25px;
}

#sendBtn:disabled { opacity: 0.5; }

.footer {
  text-align: center;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--muted);
  margin-top: 12px;
}

@media (min-width: 600px) {
  main { padding: 30px; }
  .composer-wrap { padding: 12px 30px 20px; }
}

/* ===== TNT AI CHAT HISTORY ===== */

.header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.history-btn {
  border: 0;
  border-radius: 13px;
  padding: 11px 15px;
  background: #E5EAFB;
  color: var(--blue);
  font-weight: 600;
}

.history-panel {
  position: absolute;
  top: 78px;
  right: max(12px, calc((100vw - 850px) / 2 + 12px));
  z-index: 5;
  width: min(340px, calc(100vw - 24px));
  max-height: 65vh;
  overflow-y: auto;
  padding: 16px;
  background: white;
  border: 1px solid #E8E5DC;
  border-radius: 18px;
  box-shadow: 0 12px 35px #00000018;
}

.history-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.history-heading h3 {
  margin: 0;
  color: var(--blue);
}

.history-heading button {
  border: 0;
  background: #F1F2F5;
  border-radius: 10px;
  width: 34px;
  height: 34px;
  font-size: 22px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid #E8E5DC;
  border-radius: 12px;
}

.history-open {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.history-delete {
  flex-shrink: 0;
  border: 0;
  border-radius: 9px;
  padding: 8px;
  background: #FCEAEA;
  color: #9B2929;
}

.history-empty {
  color: var(--muted);
  text-align: center;
  padding: 20px 5px;
  font-size: 13px;
}

@media (max-width: 400px) {
  .history-btn {
    padding: 10px;
    font-size: 13px;
  }
}

/* ===== TNT AI VOICE INPUT ===== */

#micBtn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 16px;
  background: #E5EAFB;
  color: var(--blue);
  font-size: 21px;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
}

#micBtn:active {
  transform: scale(0.92);
}

#micBtn.recording {
  background: #FCEAEA;
  color: #D93030;
  animation: micPulse 1s infinite;
}

@keyframes micPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 #D9303044;
  }
  50% {
    box-shadow: 0 0 0 9px #D9303000;
  }
}
.tnt-mark {
    font-size: 23px;
    font-weight: 900;
    letter-spacing: -1.5px;
    color: white;
    text-shadow: 0 0 10px #ffffff88;
    user-select: none;
}
.creator-credit {
    margin-top: -14px;
    margin-bottom: 20px;
    font-family: Georgia, serif;
    font-size: 11px;
    font-style: italic;
    font-weight: 600;
    letter-spacing: 1.2px;
    color: #6685C8;
    text-align: center;
    opacity: 0.9;
    text-shadow: 0 0 8px #6685C833;
}

/* ===== TNT AI V2 PREMIUM POLISH ===== */

.topbar {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 20px #244CC508;
}

.brand h1 {
  text-shadow: 0 2px 12px #244CC51A;
}

.new-chat,
.history-btn,
#micBtn,
#sendBtn,
.suggestions button {
  transition: all 0.25s ease;
}

.new-chat:hover,
.history-btn:hover,
.suggestions button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px #244CC51A;
}

#sendBtn:hover {
  transform: scale(1.06);
  box-shadow: 0 5px 16px #244CC544;
}

.composer {
  transition: border-color 0.25s ease,
              box-shadow 0.25s ease;
}

.composer:focus-within {
  border-color: #244CC588;
  box-shadow: 0 5px 25px #244CC51A;
}

.message {
  animation: messageAppear 0.3s ease;
}

@keyframes messageAppear {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.history-panel {
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 15px 45px #00000020;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== TNT AI PREMIUM CHAT BUBBLES ===== */

.message {
  padding: 15px 18px;
  border-radius: 20px;
  line-height: 1.7;
  box-shadow: 0 3px 14px #00000008;
}

.message.user {
  border-bottom-right-radius: 6px;
  background: linear-gradient(135deg, #244CC5, #4169DB);
  box-shadow: 0 5px 16px #244CC522;
}

.message.assistant {
  border: 1px solid #E4E9F5;
  border-bottom-left-radius: 6px;
  background: linear-gradient(145deg, #FFFFFF, #FAFBFF);
}

.message.error {
  border: 1px solid #F2CACA;
}


/* ===== TNT AI PREMIUM BUTTON EFFECTS ===== */

button {
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease,
              box-shadow 0.2s ease,
              background 0.2s ease;
}

button:active {
  transform: scale(0.95);
}

#micBtn:hover {
  background: #DCE5FF;
  box-shadow: 0 5px 16px #244CC522;
}

.new-chat:hover,
.history-btn:hover {
  background: #DCE5FF;
}

#sendBtn {
  box-shadow: 0 4px 12px #244CC533;
}

#sendBtn:disabled {
  box-shadow: none;
  cursor: not-allowed;
}

/* ===== TNT AI PREMIUM WELCOME SCREEN ===== */

.welcome {
  animation: welcomeAppear 0.8s ease both;
}

.welcome h2 {
  letter-spacing: -1.2px;
  font-weight: 800;
}

.welcome h3 {
  letter-spacing: -0.5px;
  text-shadow: 0 3px 12px #244CC51A;
}

.welcome p {
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.hero-icon {
  box-shadow:
    0 10px 30px #244CC533,
    0 0 0 8px #244CC50A;
  transition: transform 0.3s ease;
}

.hero-icon:hover {
  transform: translateY(-5px) rotate(-3deg);
}

@keyframes welcomeAppear {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== TNT AI PREMIUM COMPOSER ===== */

.composer-wrap {
  padding-top: 14px;
}

.composer {
  border-radius: 26px;
  padding: 10px 11px;
  box-shadow:
    0 8px 30px #0000000A,
    0 2px 8px #244CC50A;
}

.composer textarea {
  font-size: 15px;
  line-height: 1.6;
}

.composer textarea::placeholder {
  color: #9BA3B5;
}

.composer:focus-within {
  border-color: #244CC5;
  box-shadow:
    0 8px 30px #244CC51A,
    0 0 0 3px #244CC510;
}

#sendBtn,
#micBtn {
  border-radius: 17px;
}

/* ===== TNT AI PREMIUM SUGGESTIONS ===== */

.suggestions {
  gap: 12px;
}

.suggestions button {
  padding: 12px 17px;
  border-radius: 16px;
  background: linear-gradient(145deg, #FFFFFF, #F5F7FF);
  border: 1px solid #E2E8FA;
  color: #34436B;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 3px 12px #244CC50A;
}

.suggestions button:hover {
  border-color: #244CC588;
  background: #FFFFFF;
  color: var(--blue);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px #244CC51A;
}

/* ===== TNT AI PREMIUM TOPBAR ===== */

.topbar {
  padding: 14px 20px;
  border-bottom: 1px solid #E5EAF5;
  box-shadow: 0 4px 20px #244CC508;
}

.brand {
  gap: 14px;
}

.brand h1 {
  font-weight: 850;
  letter-spacing: -1.2px;
}

.brand p {
  font-size: 11px;
  letter-spacing: 0.3px;
}

.logo {
  border-radius: 16px;
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: rotate(-5deg) scale(1.05);
}

.new-chat,
.history-btn {
  border-radius: 15px;
}

/* ===== TNT AI MOBILE EXPERIENCE ===== */

@media (max-width: 600px) {

  .app {
    width: 100%;
    min-height: 100dvh;
  }

  .topbar {
    padding: 12px 14px;
  }

  .logo {
    width: 48px;
    height: 48px;
  }

  .brand h1 {
    font-size: 20px;
  }

  main {
    padding: 18px 13px;
  }

  .welcome h2 {
    font-size: 26px;
  }

  .welcome h3 {
    font-size: 19px;
  }

  .message {
    max-width: 94%;
    font-size: 14px;
  }

  .composer-wrap {
    padding: 8px 10px 12px;
  }

  .suggestions {
    gap: 8px;
  }

  .suggestions button {
    padding: 10px 13px;
  }

}

/* ===== TNT AI SMOOTH SCROLLING ===== */

html {
  scroll-behavior: smooth;
}

.messages {
  scroll-margin-top: 20px;
}

.history-panel,
.history-list {
  scrollbar-width: thin;
  scrollbar-color: #A8B9E8 transparent;
}

.history-panel::-webkit-scrollbar {
  width: 6px;
}

.history-panel::-webkit-scrollbar-thumb {
  background: #A8B9E8;
  border-radius: 20px;
}

.history-panel::-webkit-scrollbar-track {
  background: transparent;
}

::selection {
  background: #244CC533;
  color: #172C68;
}

/* ===== TNT AI MOBILE COMPOSER REDESIGN ===== */

@media (max-width: 600px) {

  .composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(3, 44px);
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: 24px;
  }

  .composer textarea {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 44px;
    max-height: 120px;
    padding: 10px;
    font-size: 15px;
  }

  #voiceLang {
    grid-column: 1;
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 0 8px;
    border: 1px solid #E0E5F2;
    border-radius: 12px;
    background: #F7F8FC;
    color: var(--ink);
    font-size: 13px;
  }

  #voiceModeBtn,
  #micBtn,
  #sendBtn {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 14px;
    display: grid;
    place-items: center;
  }

  #voiceModeBtn {
    border: 0;
    background: #E5EAFB;
    color: var(--blue);
    font-size: 20px;
  }

}

/* ===== TNT AI MOBILE NAVIGATION ===== */

@media (max-width: 600px) {

  .topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
  }

  .brand {
    flex: 1;
    min-width: 0;
    gap: 10px;
  }

  .logo {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
  }

  .brand h1 {
    font-size: 19px;
  }

  .brand p {
    font-size: 11px;
  }

  .header-actions {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
  }

  .history-btn {
    padding: 10px 16px;
    font-size: 13px;
    border-radius: 13px;
    white-space: nowrap;
  }

  .new-chat {
    width: 42px;
    height: 42px;
    font-size: 25px;
    border-radius: 13px;
    flex-shrink: 0;
  }

}


/* ===== TNT AI PREMIUM LANGUAGE SELECTOR ===== */

#voiceLang {
  outline: none;
  cursor: pointer;
  transition: all 0.25s ease;
}

#voiceLang:hover {
  border-color: #244CC5;
  box-shadow: 0 3px 12px #244CC51A;
}

#voiceLang:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px #244CC51A;
}

#voiceLang option {
  background: white;
  color: var(--ink);
}

@media (min-width: 601px) {
  #voiceLang {
    height: 44px;
    padding: 0 12px;
    border: 1px solid #E0E5F2;
    border-radius: 12px;
    background: #F7F8FC;
    color: var(--ink);
  }
}

/* ===== TNT AI BUTTON CONSISTENCY ===== */

.history-btn,
.new-chat,
#voiceModeBtn,
#micBtn,
#sendBtn {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.history-btn:focus-visible,
.new-chat:focus-visible,
#voiceModeBtn:focus-visible,
#micBtn:focus-visible,
#sendBtn:focus-visible {
  outline: 3px solid #244CC566;
  outline-offset: 3px;
}

.history-btn:active,
.new-chat:active,
#voiceModeBtn:active,
#micBtn:active,
#sendBtn:active {
  transform: scale(0.94);
}

/* ===== TNT AI V2 PREMIUM DARK MODE ===== */

body.dark-mode {
  --cream: #0B1020;
  --ink: #E8EEFF;
  --muted: #A0AAC2;
  --white: #FFFFFF;
  --blue: #5B83FF;

  background: #0B1020;
  color: #E8EEFF;
}

/* Main background */

body.dark-mode .app {
  background: #0B1020;
}

/* Navigation */

body.dark-mode .topbar {
  background: #10182C;
  border-color: #263451;
}

body.dark-mode .brand h1 {
  color: #7FA0FF;
}

body.dark-mode .brand p {
  color: #A0AAC2;
}

/* Welcome screen */

body.dark-mode .welcome h2 {
  color: #F1F5FF;
}

body.dark-mode .welcome h3 {
  color: #7FA0FF;
}

body.dark-mode .welcome p {
  color: #A0AAC2;
}

body.dark-mode .creator-credit {
  color: #8DAAFF;
}

/* Chat messages */

body.dark-mode .message.assistant {
  background: #17223A;
  color: #E8EEFF;
  border-color: #293957;
}

body.dark-mode .message.user {
  background: linear-gradient(135deg, #315FD8, #527FFF);
  color: white;
}

/* Composer */

body.dark-mode .composer-wrap {
  background: #0B1020;
}

body.dark-mode .composer {
  background: #17223A;
  border-color: #34486C;
}

body.dark-mode .composer textarea {
  color: #FFFFFF;
}

body.dark-mode .composer textarea::placeholder {
  color: #8492AD;
}

/* Buttons */

body.dark-mode .history-btn,
body.dark-mode .new-chat,
body.dark-mode #micBtn,
body.dark-mode #voiceModeBtn {
  background: #253657;
  color: #A8C0FF;
}

body.dark-mode #sendBtn {
  background: #416FE8;
  color: white;
}

/* Suggestions */

body.dark-mode .suggestions button {
  background: #17223A;
  color: #DCE6FF;
  border-color: #34486C;
}

/* History and memory */

body.dark-mode .history-panel {
  background: #131E34;
  border-color: #34486C;
}

body.dark-mode .history-heading h3 {
  color: #8DAAFF;
}

body.dark-mode .history-item {
  background: #17223A;
  border-color: #34486C;
}

body.dark-mode .history-open {
  color: #E8EEFF;
}

body.dark-mode .history-heading button {
  background: #253657;
  color: white;
}

/* Language selector */

body.dark-mode #voiceLang {
  background: #253657;
  color: #FFFFFF;
  border-color: #34486C;
}

/* Footer */

body.dark-mode .footer,
body.dark-mode .status {
  color: #8795B0;
}


/* ===== TNT AI SMOOTH THEME TRANSITION ===== */

body,
.app,
.topbar,
main,
.composer-wrap,
.composer,
.message,
.history-panel,
.history-item,
.suggestions button,
.history-btn,
.new-chat,
#micBtn,
#voiceModeBtn,
#sendBtn,
#voiceLang,
.welcome h2,
.welcome h3,
.welcome p,
.brand h1,
.brand p,
.footer,
.status {
  transition:
    background-color 0.35s ease,
    color 0.35s ease,
    border-color 0.35s ease,
    box-shadow 0.35s ease;
}

#themeToggle {
  transition: transform 0.3s ease;
}

#themeToggle:active {
  transform: rotate(25deg) scale(0.9);
}

/* ===== TNT AI V2 MIDNIGHT BLUE THEME ===== */

body.midnight-mode {
  --cream: #060B1A;
  --ink: #EAF0FF;
  --muted: #91A3C8;
  --white: #FFFFFF;
  --blue: #4D8DFF;

  background: #060B1A;
  color: #EAF0FF;
}

body.midnight-mode .app {
  background: #060B1A;
}

body.midnight-mode .topbar {
  background: #0B1530;
  border-color: #1B3260;
}

body.midnight-mode .brand h1,
body.midnight-mode .welcome h3 {
  color: #62A0FF;
}

body.midnight-mode .brand p,
body.midnight-mode .welcome p {
  color: #91A3C8;
}

body.midnight-mode .welcome h2 {
  color: #F0F5FF;
}

body.midnight-mode .message.assistant {
  background: #101E3B;
  color: #EAF0FF;
  border-color: #244477;
}

body.midnight-mode .message.user {
  background: linear-gradient(135deg, #1558D6, #347EFF);
  color: white;
}

body.midnight-mode .composer-wrap {
  background: #060B1A;
}

body.midnight-mode .composer {
  background: #101E3B;
  border-color: #31558D;
}

body.midnight-mode .composer textarea {
  color: #FFFFFF;
}

body.midnight-mode .composer textarea::placeholder {
  color: #8297C2;
}

body.midnight-mode .history-btn,
body.midnight-mode .new-chat,
body.midnight-mode #micBtn,
body.midnight-mode #voiceModeBtn {
  background: #172B50;
  color: #8DBAFF;
}

body.midnight-mode #sendBtn {
  background: #246CE8;
  color: white;
}

body.midnight-mode .suggestions button {
  background: #101E3B;
  color: #DCE9FF;
  border-color: #31558D;
}

body.midnight-mode .history-panel,
body.midnight-mode .history-item {
  background: #0D1933;
  border-color: #31558D;
}

body.midnight-mode .history-open {
  color: #EAF0FF;
}

body.midnight-mode #voiceLang {
  background: #172B50;
  color: white;
  border-color: #31558D;
}

body.midnight-mode .footer,
body.midnight-mode .status {
  color: #8297C2;
}

body.midnight-mode .creator-credit {
  color: #62A0FF;
}

/* ===== TNT AI V2 PREMIUM ANIMATED BACKGROUND ===== */

body {
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 15% 20%, rgba(36, 76, 197, 0.08), transparent 30%),
    radial-gradient(circle at 85% 75%, rgba(91, 131, 255, 0.08), transparent 30%);
  animation: ambientGlow 10s ease-in-out infinite alternate;
}

@keyframes ambientGlow {
  from {
    opacity: 0.5;
    transform: scale(1);
  }
  to {
    opacity: 1;
    transform: scale(1.08);
  }
}

body.dark-mode::before,
body.midnight-mode::before {
  background:
    radial-gradient(circle at 15% 20%, rgba(55, 110, 255, 0.16), transparent 35%),
    radial-gradient(circle at 85% 75%, rgba(30, 90, 220, 0.14), transparent 35%);
}

@media (prefers-reduced-motion: reduce) {
  body::before {
    animation: none;
  }
}

/* ===== TNT AI V2 TYPING INDICATOR ===== */

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  background: #EAF0FF;
  border-radius: 16px;
  width: fit-content;
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  background: var(--blue);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-7px);
    opacity: 1;
  }
}

body.dark-mode .typing-indicator,
body.midnight-mode .typing-indicator {
  background: #172B50;
}

@media (prefers-reduced-motion: reduce) {
  .typing-indicator span {
    animation: none;
  }
}
/* =================================
   TNT AI HOLOGRAPHIC CORE
================================= */

.holo-core {
  position: relative;
  width: 230px;
  height: 230px;
  margin: 30px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 800px;
}

.holo-orb {
  width: 115px;
  height: 115px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  background: radial-gradient(
    circle at 35% 30%,
    #b9ffff,
    #00bfff 25%,
    #0754a5 60%,
    #020b27 100%
  );

  border: 2px solid #63efff;

  box-shadow:
    0 0 15px #00d9ff,
    0 0 35px #008cff,
    0 0 75px #0066ff,
    inset 0 0 25px #8affff;

  animation: holoFloat 3s ease-in-out infinite;
  z-index: 2;
}

.holo-orb span {
  font-family: 'Orbitron', sans-serif;
  font-size: 25px;
  font-weight: 900;
  color: white;
  text-shadow: 0 0 12px #00eaff;
}

.holo-orb small {
  font-family: 'Orbitron', sans-serif;
  font-size: 8px;
  letter-spacing: 3px;
  color: #aaffff;
  margin-top: 5px;
}

.holo-ring {
  position: absolute;
  width: 175px;
  height: 175px;
  border: 2px solid rgba(0, 225, 255, 0.7);
  border-radius: 50%;
  box-shadow: 0 0 15px #00bfff;
}

.ring-1 {
  transform: rotateX(70deg);
  animation: ringRotate 5s linear infinite;
}

.ring-2 {
  transform: rotateY(70deg);
  animation: ringRotate 7s linear infinite reverse;
}

.ring-3 {
  width: 205px;
  height: 205px;
  border-style: dashed;
  border-color: rgba(0, 170, 255, 0.5);
  animation: ringRotate 12s linear infinite;
}

@keyframes holoFloat {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-9px) scale(1.04);
  }
}

@keyframes ringRotate {
  from {
    transform: rotate(0deg) rotateX(65deg);
  }
  to {
    transform: rotate(360deg) rotateX(65deg);
  }
}
/* TNT AI HOLOGRAM STATES */

.holo-core.listening .holo-orb {
  box-shadow:
    0 0 25px #00eaff,
    0 0 60px #00bfff,
    0 0 100px #0077ff;
  animation: holoListen 1s ease-in-out infinite;
}

.holo-core.thinking .holo-ring {
  animation-duration: 1.5s;
  border-color: #b56bff;
  box-shadow: 0 0 20px #a855ff;
}

.holo-core.speaking .holo-orb {
  box-shadow:
    0 0 30px #00ffcc,
    0 0 70px #00ff99,
    0 0 110px #00cc88;
  animation: holoSpeak 0.6s ease-in-out infinite alternate;
}

@keyframes holoListen {
  50% {
    transform: scale(1.12);
  }
}

@keyframes holoSpeak {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.13);
  }
}

/* =====================================
   TNT AI V2 — LEGENDARY MEMORY GALAXY
===================================== */

.memory-galaxy {
  position: relative;
  margin-top: 22px;
  padding: 18px 12px;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(ellipse at 50% 45%, #18245c 0%, #0b1030 45%, #050817 100%);
  border: 1px solid rgba(0, 225, 255, 0.35);
  border-radius: 22px;
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    0 0 20px #0077ff22,
    inset 0 0 35px #0077ff18;
}

.memory-galaxy::before,
.memory-galaxy::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  filter: blur(65px);
  opacity: 0.25;
  pointer-events: none;
  z-index: -1;
}

.memory-galaxy::before {
  background: #005eff;
  top: -100px;
  left: -90px;
  animation: nebulaFloat 8s ease-in-out infinite alternate;
}

.memory-galaxy::after {
  background: #a020ff;
  bottom: -120px;
  right: -80px;
  animation: nebulaFloat 10s ease-in-out infinite alternate-reverse;
}

.galaxy-title {
  position: relative;
  z-index: 2;
}

.galaxy-title h3 {
  margin: 5px 0 8px;
  font-family: Orbitron, sans-serif;
  font-size: 16px;
  letter-spacing: 3px;
  color: #00eaff;
  text-shadow: 0 0 8px #00eaff, 0 0 22px #0077ff;
}

.galaxy-title p {
  color: #aab9e8;
  font-size: 12px;
}

/* Galaxy universe */

.galaxy-universe {
  position: relative;
  width: 100%;
  max-width: 340px;
  height: 300px;
  margin: 20px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, #123c8c22 0%, transparent 65%);
  perspective: 700px;
  overflow: hidden;
}

/* Nebula */

.galaxy-nebula {
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent,
    #087bff22,
    #a020ff33,
    transparent,
    #00eaff22,
    transparent
  );
  filter: blur(18px);
  animation: nebulaRotate 25s linear infinite;
}

/* Orbit rings */

.galaxy-orbit {
  position: absolute;
  border: 1px solid rgba(0, 225, 255, 0.35);
  border-radius: 50%;
  box-shadow: 0 0 10px #00bfff22;
  pointer-events: none;
}

.orbit-one {
  width: 130px;
  height: 130px;
  animation: galaxySpin 12s linear infinite;
}

.orbit-two {
  width: 210px;
  height: 210px;
  transform: rotateX(65deg);
  animation: galaxySpin 18s linear infinite reverse;
}

.orbit-three {
  width: 290px;
  height: 250px;
  transform: rotateY(55deg);
  animation: galaxySpin 25s linear infinite;
}

/* TNT central core */

.galaxy-core {
  position: relative;
  z-index: 2;
  width: 76px;
  height: 76px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: radial-gradient(
    circle at 35% 30%,
    #c5ffff,
    #00cfff 25%,
    #0754a5 65%,
    #020b27
  );
  border: 2px solid #75f5ff;
  box-shadow:
    0 0 15px #00eaff,
    0 0 35px #008cff,
    0 0 65px #0066ff,
    inset 0 0 18px #baffff;
  animation: galaxyCoreFloat 3s ease-in-out infinite;
}

.galaxy-core span {
  font-family: Orbitron, sans-serif;
  font-size: 19px;
  font-weight: 900;
  color: white;
  text-shadow: 0 0 12px #00eaff;
}

.galaxy-core small {
  font-family: Orbitron, sans-serif;
  font-size: 7px;
  letter-spacing: 2px;
  color: #c5ffff;
}

/* Memory stars */

.galaxy-stars {
  position: absolute;
  inset: 0;
  z-index: 4;
}

.galaxy-star {
  position: absolute;
  width: 13px;
  height: 13px;
  padding: 0;
  border: 2px solid white;
  border-radius: 50%;
  background: #00eaff;
  box-shadow:
    0 0 7px white,
    0 0 15px #00eaff,
    0 0 30px #0077ff;
  cursor: pointer;
  transform: translate(-50%, -50%);
  animation: starPulse 2s ease-in-out infinite alternate;
  transition: width 0.25s, height 0.25s, background 0.25s;
}

.galaxy-star:hover,
.galaxy-star:focus-visible {
  width: 20px;
  height: 20px;
  background: white;
  outline: 2px solid #00eaff;
  outline-offset: 4px;
}

.galaxy-star.selected {
  width: 19px;
  height: 19px;
  background: #ffffff;
  box-shadow:
    0 0 10px white,
    0 0 25px #00eaff,
    0 0 45px #a020ff;
}

/* Selected memory information */

.galaxy-detail {
  position: relative;
  z-index: 2;
  min-height: 55px;
  padding: 14px;
  color: #b8faff;
  background: rgba(0, 12, 35, 0.75);
  border: 1px solid rgba(0, 225, 255, 0.25);
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  box-shadow: inset 0 0 15px #0077ff12;
}

.galaxy-counter {
  position: relative;
  z-index: 2;
  margin-top: 12px;
  color: #819dce;
  font-family: Orbitron, sans-serif;
  font-size: 9px;
  letter-spacing: 2px;
}

/* Galaxy animations */

@keyframes galaxySpin {
  from {
    rotate: 0deg;
  }
  to {
    rotate: 360deg;
  }
}

@keyframes starPulse {
  from {
    opacity: 0.55;
    filter: brightness(0.8);
  }
  to {
    opacity: 1;
    filter: brightness(1.5);
  }
}

@keyframes galaxyCoreFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}

@keyframes nebulaFloat {
  from {
    transform: scale(0.85);
  }
  to {
    transform: scale(1.2);
  }
}

@keyframes nebulaRotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Mobile galaxy */

@media (max-width: 400px) {
  .memory-galaxy {
    padding: 15px 8px;
  }

  .galaxy-universe {
    height: 270px;
  }

  .orbit-three {
    width: 255px;
    height: 220px;
  }

  .galaxy-title h3 {
    font-size: 14px;
    letter-spacing: 2px;
  }
}

/* Accessibility */

@media (prefers-reduced-motion: reduce) {
  .memory-galaxy *,
  .memory-galaxy::before,
  .memory-galaxy::after {
    animation: none !important;
    transition: none !important;
  }
}
 /* ===== TNT AI MARKDOWN RESPONSE FIX ===== */

.message.assistant {
  display: block;
  min-width: 0;
  max-width: 90%;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.7;
}

.message.assistant p {
  display: block;
  margin: 0 0 14px;
  white-space: normal;
}

.message.assistant p:last-child {
  margin-bottom: 0;
}

.message.assistant ul,
.message.assistant ol {
  display: block;
  padding-left: 24px;
  margin: 10px 0;
}

.message.assistant li {
  display: list-item;
  margin-bottom: 7px;
}

.message.assistant h1,
.message.assistant h2,
.message.assistant h3 {
  display: block;
  margin: 16px 0 10px;
  line-height: 1.4;
}

.message.assistant pre {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  white-space: pre;
}

.message.assistant code {
  overflow-wrap: anywhere;
}

/* =========================================
   TNT AI — UNIFIED FUTURISTIC CONTROLS
========================================= */

@property --tnt-stroke-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

button:not(#discoveryLauncher) {
  position: relative;
  isolation: isolate;
  overflow: hidden;

  color: #eaf7ff;
  background: linear-gradient(
    145deg,
    #10243d,
    #050d1c 65%,
    #102d4c
  );

  border: 1px solid rgba(100, 190, 255, 0.45);
  border-radius: 13px;

  box-shadow:
    inset 0 0 15px rgba(40, 130, 255, 0.10),
    0 0 12px rgba(25, 130, 255, 0.12);

  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    background 0.25s ease;
}

/* Animated light stroke */

button:not(#discoveryLauncher)::before {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: -1;

  padding: 2px;
  border-radius: inherit;

  background: conic-gradient(
    from var(--tnt-stroke-angle),
    transparent 0deg,
    transparent 220deg,
    #167cff 255deg,
    #70eaff 285deg,
    #ffffff 300deg,
    #238aff 320deg,
    transparent 350deg
  );

  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;

  pointer-events: none;

  animation: tntButtonStroke 4s linear infinite;
}

@keyframes tntButtonStroke {
  to {
    --tnt-stroke-angle: 360deg;
  }
}

button:not(#discoveryLauncher):hover {
  transform: translateY(-2px);

  box-shadow:
    inset 0 0 20px rgba(40, 150, 255, 0.18),
    0 0 24px rgba(40, 150, 255, 0.30);
}

button:not(#discoveryLauncher):active {
  transform: scale(0.97);
}

/* Futuristic message writing area */

#userInput {
  color: #eaf7ff;
  background: linear-gradient(
    145deg,
    #10243d,
    #050d1c
  );

  border: 1px solid rgba(100, 190, 255, 0.65);
  border-radius: 16px;

  box-shadow:
    inset 0 0 18px rgba(40, 130, 255, 0.12),
    0 0 15px rgba(25, 130, 255, 0.13);

  outline: none;
  transition: box-shadow 0.3s ease;
}

#userInput:focus {
  border-color: #70dfff;

  box-shadow:
    inset 0 0 20px rgba(40, 150, 255, 0.16),
    0 0 22px rgba(40, 150, 255, 0.28);
}

/* Voice language selector */

#voiceLang {
  color: #eaf7ff;
  background: #10243d;
  border: 1px solid rgba(100, 190, 255, 0.5);
  border-radius: 12px;
  outline: none;
}

/* Dropdown options */

#voiceLang option {
  color: white;
  background: #10243d;
}

/* Respect reduced-motion settings */

@media (prefers-reduced-motion: reduce) {
  button:not(#discoveryLauncher)::before {
    animation: none;
  }
}
/* TNT AI — MEMORY GALAXY STAR POSITION FIX */

#memoryPanel .galaxy-stars {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

#memoryPanel .galaxy-stars button.galaxy-star {
  position: absolute !important;
  display: flex;
  align-items: center;
  justify-content: center;

  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;

  padding: 0;
  overflow: visible;

  border: 2px solid #ffffff;
  border-radius: 50%;

  background: #00eaff;
  color: #ffffff;

  font-size: 12px;
  line-height: 1;

  transform: translate(-50%, -50%);

  box-shadow:
    0 0 8px #ffffff,
    0 0 18px #00eaff,
    0 0 35px #0077ff;

  pointer-events: auto;
  animation: starPulse 2s ease-in-out infinite alternate;
}

#memoryPanel .galaxy-stars button.galaxy-star.selected {
  width: 22px;
  height: 22px;
  background: #ffffff;
  box-shadow:
    0 0 12px #ffffff,
    0 0 28px #00eaff,
    0 0 48px #a020ff;
}