:root {
  color-scheme: dark;
  --bg: #000;
  --panel: #0b0b0b;
  --panel-2: #151515;
  --text: #f7f7f7;
  --muted: #a8a8a8;
  --faint: #6d6d6d;
  --line: rgba(255, 255, 255, 0.16);
  --line-strong: rgba(255, 255, 255, 0.32);
  --ink: #000;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button {
  border: 0;
  color: inherit;
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  position: relative;
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px 150px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h2,
h3,
p {
  margin: 0;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-mark {
  display: inline-block;
  width: 26px;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 28%, #fff 0 16%, #a8a8a8 17% 28%, #111 58%, #000 100%);
  box-shadow: inset -5px -8px 13px rgba(255, 255, 255, 0.24);
}

.top-menu {
  position: relative;
}

.top-menu summary {
  display: grid;
  width: 42px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #050505;
  cursor: pointer;
  list-style: none;
}

.top-menu summary::-webkit-details-marker {
  display: none;
}

.top-menu summary span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}

.menu-options {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  display: grid;
  min-width: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: rgba(0, 0, 0, 0.92);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.5);
}

.menu-options button {
  min-height: 34px;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 750;
  padding: 0 10px;
  text-align: left;
}

.current-widget {
  display: block;
  margin-top: 18px;
}

.widget-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.mic-button:active {
  transform: translateY(1px);
}

.widget-card {
  overflow: hidden;
}

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
}

.widget-header h3 {
  min-width: 0;
  font-size: 1rem;
}

.tag {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: #111;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 800;
}

.widget-body {
  padding: 14px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stat {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  background: var(--panel-2);
}

.stat strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 1.18rem;
}

.stat span {
  color: var(--muted);
  font-size: 0.72rem;
}

.deal-list,
.task-list,
.profile-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.profile-grid {
  grid-template-columns: 1fr;
  margin-top: 0;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  background: #111;
}

.row strong {
  flex: 0 0 auto;
}

.row span {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
  text-align: right;
}

.row span {
  overflow-wrap: anywhere;
}

.progress {
  overflow: hidden;
  height: 9px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #070707;
}

.progress div {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #fff, #a7a7a7, #4f4f4f);
}

.mercury-dock {
  position: fixed;
  left: 50%;
  bottom: max(5vh, env(safe-area-inset-bottom));
  z-index: 30;
  display: grid;
  width: min(184px, 50vw);
  aspect-ratio: 1;
  place-items: center;
  transform: translateX(-50%);
  cursor: pointer;
  pointer-events: auto;
}

.conversation-feed {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 24px);
  width: min(340px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 7px;
  transform: translateX(-50%);
  pointer-events: none;
}

.message {
  max-height: 5.4em;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: rgba(0, 0, 0, 0.78);
  color: #f3f3f3;
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  backdrop-filter: blur(10px);
}

.assistant-message {
  margin-right: 28px;
}

.user-message {
  margin-left: 28px;
  color: var(--muted);
}

.message.fading-out {
  animation: messageFadeOut 0.45s ease forwards;
}

.word {
  opacity: 0;
  animation: wordFadeIn 0.28s ease forwards;
}

@keyframes wordFadeIn {
  from {
    opacity: 0;
    filter: blur(5px);
  }

  to {
    opacity: 1;
    filter: blur(0);
  }
}

@keyframes messageFadeOut {
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

#mercuryCanvas {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 22px 28px rgba(255, 255, 255, 0.18));
  pointer-events: auto;
}

.mic-button {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  width: 58px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.42);
  color: var(--text);
  transform: translate(-50%, -50%);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.mic-button.active {
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}

.mic-icon svg {
  display: block;
  width: 28px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

@media (max-width: 360px) {
  .app-shell {
    padding-inline: 12px;
    padding-bottom: 140px;
  }

  .mercury-dock {
    width: min(168px, 54vw);
  }

  .mic-button {
    width: 52px;
  }
}
