/* ===============================
   ASK JUPITER LAYOUT RESET
   S24 Ultra first, then wider sizes
=================================*/

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

:root {
  --page-max: 1200px;
  --content-max: 720px;
  --panel-max: min(100%, var(--content-max));

  --space-1: 8px;
  --space-2: 12px;
  --space-3: 18px;

  --logo-gap: 10px;
  --side-logo-size: 86px;
  --ask-logo-size: 240px;
  --jupiter2-logo-size: 176px;

  --nav-width: 140px;
  --control-btn-size: 34px;
  --new-btn-width: 44px;
  --query-controls-w: 160px;
  --control-gap: 3px;

  --topbar-h: 50px;
  --footer-h: 28px;
  --search-h: 46px;
  --dock-gap: 6px;
  --dock-h: calc(var(--search-h) + var(--footer-h) + var(--dock-gap) + 8px);
  --dock-bottom: calc(var(--footer-h) + 2px);

}

@font-face {
  font-family: "ComicSansCustom";
  src: url("/fonts/ComicSansMS.woff2") format("woff2");
  font-display: swap;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  font-family: "ComicSansCustom", "Comic Sans MS", "Comic Neue", "Trebuchet MS", sans-serif;
  background: #000;
  color: #00ff99;
}

body {
  background: radial-gradient(ellipse at center, #020617 0%, #000 70%);
}

body > *:not(#starfield) {
  position: relative;
  z-index: 10;
}

body.image-overlay-open .page-content,
body.image-overlay-open header,
body.image-overlay-open footer,
body.image-overlay-open #search-box,
body.image-overlay-open .reply-topbar,
body.image-overlay-open .chat-shell,
body.image-overlay-open #reply-panel,
body.image-overlay-open #chat-messages,
body.image-overlay-open .bottom-dock {
  visibility: hidden !important;
}

#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.page-content,
.app-shell {
  position: relative;
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

.container {
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 1px;
  display: block;
}

.logo-row,
.glass,
#search-box,
footer {
  width: 100%;
  max-width: none;
  margin-left: auto;
  margin-right: auto;
}

.reply-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  z-index: 3600;
  color: #ff0000;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: transparent;
  border-bottom: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.22s ease;
}

.reply-topbar-title {
  pointer-events: none;
}

.reply-topbar .menu-toggle {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 46px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: transparent;
  border: none;
  z-index: 3650;
  padding: 0;
  border-radius: 10px;
  box-shadow: 0 0 8px rgba(255, 0, 0, 0.22);
  transition: transform 0.22s ease, filter 0.22s ease, box-shadow 0.22s ease;
}

.reply-topbar .menu-toggle img {
  display: block;
  width: 30px;
  height: 43px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(255, 0, 0, 0.45));
  transition: transform 0.28s ease, filter 0.28s ease;
}

.reply-topbar .menu-toggle:hover {
  filter: drop-shadow(0 0 8px rgba(255, 235, 0, 0.55));
}

.reply-topbar .menu-toggle:hover img {
  filter: drop-shadow(0 0 10px rgba(255, 235, 0, 0.7));
}

.reply-topbar .menu-toggle.open {
  box-shadow: 0 0 16px rgba(255, 235, 0, 0.30);
  animation: menuIconPulse 1.35s ease-in-out infinite;
}

.reply-topbar .menu-toggle.open img {
  transform: rotate(-10deg) scale(1.06);
  filter: drop-shadow(0 0 12px rgba(255, 235, 0, 0.85));
}

@keyframes menuIconPulse {
  0%   { box-shadow: 0 0 6px rgba(255, 235, 0, 0.10); }
  50%  { box-shadow: 0 0 18px rgba(255, 235, 0, 0.38); }
  100% { box-shadow: 0 0 6px rgba(255, 235, 0, 0.10); }
}

.nav {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  width: max-content;
  max-width: min(86vw, 360px);
  min-width: 0;
  height: auto;
  max-height: calc(100dvh - var(--topbar-h) - 10px);
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(8, 10, 18, 0.98);
  padding: 14px;
  border-right: 1px solid rgba(255,255,255,0.10);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  box-shadow: 12px 0 36px rgba(0,0,0,0.42);
  transform: translateX(calc(-100% - 18px));
  opacity: 0;
  transition: transform 0.34s cubic-bezier(0.22, 0.9, 0.25, 1), opacity 0.22s ease;
  will-change: transform, opacity;
  z-index: 3800;
  overflow-y: auto;
  border-radius: 0 0 14px 0;
}

.nav.open {
  transform: translateX(0);
  opacity: 1;
}

.nav a {
  display: block;
  width: max-content;
  max-width: 100%;
  text-decoration: none;
  color: #ffee00;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.05);
  white-space: nowrap;
}

.nav a:hover {
  background: rgba(255,255,255,0.12);
  color: #ffee00;
}

.menu-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: max-content;
  max-width: 100%;
}

.menu-section + .menu-section {
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.menu-section-title {
  color: #ff6464;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 6px;
}

.app-shell.chat-active .reply-topbar .menu-toggle {
  display: inline-flex;
}

.landing-shell {
  position: absolute;
  inset: 0 0 var(--dock-h) 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.chat-shell {
  position: absolute;
  inset: var(--topbar-h) 0 var(--dock-h) 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.35) rgba(255,255,255,0.08);
}

.bottom-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3400;
  pointer-events: none;
}

.bottom-dock > * {
  pointer-events: auto;
}

header {
  width: 100%;
  position: relative;
}

.title-row {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.logo-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  margin-top: -38px;
  margin-bottom: 0;
}

.side-logo {
  width: calc(var(--ask-logo-size) * 0.42);
  flex: 0 0 auto;
  transform: translateY(-8px);
}

.logo-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  min-width: 0;
}

.ask-logo {
  width: var(--ask-logo-size);
  max-width: 100%;
  height: auto;
  transform: translateY(-10px);
}

.jupiter2-logo {
  width: calc(var(--ask-logo-size) * 0.70);
  max-width: 100%;
  height: auto;
}


.teal { color: #00cab1; }
.yellow { color: #ffee00; }
.green { color: #00ff99; }

.glass {
  border-radius: 12px;
  padding: var(--space-1);
  max-width: var(--panel-max);
}

#quote1-panel,
#quote2-panel {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100vw - 6px);
  max-width: calc(100vw - 6px);
  min-width: calc(100vw - 6px);
  padding-left: 16px;
  padding-right: 16px;
  overflow: hidden;
}

#quote1-panel {
  margin-bottom: 1px;
}

#quote2-panel {
  margin-bottom: 0;
  padding-top: 2px;
  padding-bottom: 0.5px;
}

#quote1-panel .quote-text,
#quote2-panel .quote-text,
#quote1-panel .quote-author,
#quote2-panel .quote-author {
  display: block;
  width: 100%;
  max-width: 100%;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  margin-left: auto;
  margin-right: auto;
}

#quote2-panel .quote-text,
#quote2-panel .quote-author {
  margin: 0;
  line-height: 1.18;
}

#reply-panel {
  width: calc(100vw - 4px);
  margin: 0 auto;
  background: transparent;
  border-radius: 12px;
  padding: 2px 4px 2px;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

#reply-panel.has-content {
  background: var(--panel-red);
}

#chat-messages {
  width: 100%;
  min-height: 100%;
  overflow: visible;
  overflow-x: hidden;
  text-align: left;
  padding: 0 2px 4px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
}

#chat-messages img {
  max-width: 100%;
  height: auto;
  display: block;
}

.chat-shell::-webkit-scrollbar {
  width: 10px;
}

.chat-shell::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.08);
}

.chat-shell::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.35);
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.08);
}

.citation-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0 2px 0;
  padding-left: 2px;
}

.citation-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: 34px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  color: #ffee00;
  background: rgba(0, 255, 255, 0.14);
  border: 1px solid rgba(0, 255, 255, 0.22);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.08);
}

.citation-chip:hover {
  background: rgba(255, 255, 255, 0.12);
}

.citation-icon {
  display: block;
  width: 14px;
  height: 14px;
  min-width: 14px;
  min-height: 14px;
  flex: 0 0 14px;
  object-fit: contain;
  border-radius: 2px;
  overflow: hidden;
}

#search-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 4px 4px 4px 10px;
  min-height: var(--search-h);
  height: auto;
  max-height: 130px;
  background: #0b0f1f;
  border: 1px solid rgba(0,255,255,0.25);
  border-radius: 24px;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: var(--dock-bottom);
  width: calc(100% - 12px);
  z-index: 3500;
  overflow: hidden;
}

.search-inner {
  width: 100%;
  min-height: var(--search-h);
  height: auto;
  display: flex;
  align-items: flex-end;
  position: relative;
}

#chat-input {
  flex: 1 1 auto;
  width: 100%;
  min-height: 38px;
  height: auto;
  max-height: 120px;
  line-height: 1.3;
  font-size: 16px;
  background: transparent;
  border: none;
  outline: none;
  color: white;
  resize: none;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 10px calc(var(--query-controls-w) + 6px) 10px 0;
}

.search-status {
  display: none !important;
}

.search-actions {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--control-gap);
  width: var(--query-controls-w);
  height: 100%;
  z-index: 2000;
}

.mode-indicator {
  position: absolute;
  top: 2px;
  right: 2px;
  width: var(--query-controls-w);
  text-align: center;
  color: #b8fff1;
  font-size: 0.62rem;
  line-height: 1;
  pointer-events: none;
}

.mic-btn-slot { grid-column: 1; grid-row: 2; }
.audio-btn { grid-column: 2; grid-row: 2; }
.new-chat-btn { grid-column: 3; grid-row: 2; }
.search-btn { grid-column: 4; grid-row: 2; }

.new-chat-btn,
.search-btn,
.voice-btn,
.audio-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 0;
}

.search-btn,
.voice-btn,
.audio-btn {
  width: var(--control-btn-size);
  min-width: var(--control-btn-size);
  height: var(--control-btn-size);
  background: rgba(0,255,255,0.15);
  color: yellow;
}

.new-chat-btn {
  width: var(--new-btn-width);
  min-width: var(--new-btn-width);
  height: var(--control-btn-size);
  background: rgba(0,255,255,0.15);
  color: #ffee00;
  font: inherit;
  font-size: 0.78rem;
}

.icon {
  width: 18px;
  height: 18px;
  stroke: #ffff00;
  stroke-width: 2;
  fill: none;
}

.audio-btn {
  position: relative;
}

.audio-btn::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 2px;
  background: #ff4d4d;
  transform: rotate(45deg) scaleX(0);
  transform-origin: center;
  transition: transform 0.25s ease, opacity 0.2s ease;
  opacity: 0;
}

#voice-toggle:not(:checked) + .audio-btn::after {
  transform: rotate(45deg) scaleX(1);
  opacity: 1;
}

#voice-toggle:not(:checked) + .audio-btn .icon {
  opacity: 0.6;
}

.voice-btn.active {
  background: rgba(255, 0, 0, 0.12);
  animation: micPulse 1.4s ease-in-out infinite;
}

.voice-btn.active .icon {
  stroke: #ff4d4d;
}

@keyframes micPulse {
  0% { box-shadow: 0 0 6px rgba(255,0,0,0.3); }
  50% { box-shadow: 0 0 18px rgba(255,0,0,0.9); }
  100% { box-shadow: 0 0 6px rgba(255,0,0,0.3); }
}

.typingGlow {
  box-shadow: 0 0 0 1px rgba(0,255,255,0.28), 0 0 16px rgba(0,255,255,0.18);
}

.typing,
.chat-msg {
  width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2500;
  height: var(--footer-h);
  min-height: 0;
  padding: 1px 6px;
  display: flex;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  line-height: 1;
  font-size: 0.7rem;
  background: rgba(0,0,0,0.28);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.footer-login-trigger,
.footer-login-trigger img,
footer a,
footer button {
  background: transparent;
  box-shadow: none;
  border: 0;
  outline: 0;
}

.footer-login-trigger {
  appearance: none;
  -webkit-appearance: none;
  border-radius: 0;
  padding: 0;
}

.login-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.login-modal-backdrop.open {
  display: flex;
}

.login-modal {
  width: min(92vw, 420px);
  background: rgba(14, 18, 35, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  color: #fff;
}

.login-modal h2 { margin: 0 0 12px; font-size: 1.35rem; }
.login-modal p { margin: 0 0 12px; }

.login-modal input {
  width: 100%;
  margin-bottom: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.login-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.login-actions button {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
}

.login-actions .secondary {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.login-actions .primary {
  background: #ff4d5a;
  color: #fff;
}

.login-status {
  min-height: 1.2em;
  margin-top: 10px;
  opacity: 0.92;
}

/* smoother landing -> chat handoff */
.landing-shell,
.chat-shell,
.reply-topbar {
  transition:
    opacity 0.32s ease,
    transform 0.34s cubic-bezier(0.22, 0.9, 0.25, 1),
    filter 0.28s ease;
  will-change: opacity, transform, filter;
}

.landing-shell {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

.chat-shell {
  display: block;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.app-shell.chat-active .reply-topbar {
  opacity: 1;
  pointer-events: auto;
}

.app-shell.chat-active .landing-shell {
  opacity: 0;
  transform: translateY(-14px);
  filter: blur(6px);
  pointer-events: none;
}

.app-shell.chat-active .chat-shell {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@media (max-width: 768px) {
    .search-btn {
    display: none !important;
  }

  :root {
    --query-controls-w: 122px;
  }
}

@media (min-width: 360px) and (max-width: 420px) {
  :root {
    --ask-logo-size: clamp(220px, 60vw, 360px);
  }

  .logo-row {
    gap: calc(var(--ask-logo-size) * 0.01);
  }

  .side-logo {
    transform: translateY(15px);
  }
}

@media (min-width: 769px) {
  :root {
    --content-max: 760px;
    --footer-h: 24px;
    --topbar-h: 56px;
    --dock-h: calc(var(--search-h) + var(--footer-h) + 10px);
    --dock-bottom: calc(var(--footer-h) + 2px);
    --ask-logo-size: clamp(220px, calc(20vw + 6vh), 420px);
  }

  .container {
    width: min(100% - 24px, var(--page-max));
    padding: 0 12px;
  }

  .logo-row,
  .glass,
  #search-box,
  footer {
    width: min(100%, var(--content-max));
  }

  #quote1-panel,
  #quote2-panel,
  #reply-panel {
    width: min(100%, var(--content-max));
    max-width: min(100%, var(--content-max));
    min-width: 0;
    left: auto;
    transform: none;
  }

  #search-box {
    width: min(100% - 18px, var(--content-max));
  }
}


/* icon skin on working menu button */
.reply-topbar .icon-menu-toggle {
  width: 38px;
  height: 44px;
  padding: 0;
  overflow: hidden;
  border-radius: 8px;
}
.reply-topbar .icon-menu-toggle img {
  display: block;
  width: 30px;
  height: 43px;
  object-fit: contain;
  pointer-events: none;
}
.reply-topbar .icon-menu-toggle span {
  display: none;
}

.reply-topbar,
.reply-topbar-title,
.chat-shell,
#reply-panel,
#chat-messages {
  border: none !important;
  border-top: none !important;
  border-bottom: none !important;
  outline: none !important;
  box-shadow: none !important;
}