@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/dm-sans/dm-sans-400.ttf") format("truetype");
}

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./fonts/dm-sans/dm-sans-500.ttf") format("truetype");
}

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./fonts/dm-sans/dm-sans-600.ttf") format("truetype");
}

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./fonts/dm-sans/dm-sans-700.ttf") format("truetype");
}

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("./fonts/dm-sans/dm-sans-800.ttf") format("truetype");
}

:root {
  --orbibrain-cyan: #27daf3;
  --orbibrain-cyan-soft: #8cefff;
  --orbibrain-ink: #f4f7fa;
  --orbibrain-muted: #b8c3cd;
  --orbibrain-panel-top: #3b4650;
  --orbibrain-panel-bottom: #202a33;
  --orbibrain-surface: #45515c;
  --orbibrain-surface-deep: #303b45;
  --orbibrain-line: rgba(207, 224, 236, 0.32);
}

.orbibrain-widget,
.orbibrain-widget * {
  box-sizing: border-box;
}

.orbibrain-widget {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 2147482000;
  color: var(--orbibrain-ink);
  font-family: "DM Sans", Inter, "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}

.orbibrain-widget button,
.orbibrain-widget textarea {
  font: inherit;
}

.orbibrain-widget button {
  cursor: pointer;
}

.orbibrain-launcher {
  position: relative;
  display: grid;
  grid-template-columns: auto 14px 44px;
  align-items: center;
  min-width: 194px;
  min-height: 50px;
  padding: 3px 3px 3px 20px;
  overflow: visible;
  border: 1px solid rgba(154, 230, 243, 0.75);
  border-radius: 999px;
  background:
    linear-gradient(105deg, rgba(29, 38, 46, 0.98) 0%, rgba(35, 48, 58, 0.98) 52%, rgba(84, 191, 211, 0.7) 82%, rgba(176, 235, 244, 0.9) 100%);
  color: #fff;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  isolation: isolate;
}

.orbibrain-launcher::before {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(110deg, rgba(18, 24, 30, 0.88), rgba(36, 48, 57, 0.84) 64%, rgba(76, 166, 183, 0.4));
}

.orbibrain-launcher:hover,
.orbibrain-launcher:focus-visible {
  border-color: #b8f7ff;
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.42), 0 0 28px rgba(39, 218, 243, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  outline: none;
  transform: translateY(-2px);
}

.orbibrain-launcher-label {
  font-size: 16.5px;
  font-weight: 750;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.orbibrain-launcher-arrow,
.orbibrain-action-arrow {
  display: grid;
  place-items: center;
  color: var(--orbibrain-cyan);
}

.orbibrain-launcher-arrow svg,
.orbibrain-action-arrow svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.orbi-orb-mark {
  position: relative;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(39, 218, 243, 0.76);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 48%, #07131b 0 38%, transparent 40%),
    conic-gradient(from 205deg, #1197cb, #7ef2ff 22%, #069bc9 48%, #08131a 62%, #30dff3 86%, #1197cb);
  box-shadow: 0 0 20px rgba(39, 218, 243, 0.62), inset 0 0 14px rgba(6, 14, 19, 0.92);
}

.orbi-orb-core {
  width: 24px;
  height: 24px;
  border: 3px solid #1bd6ee;
  border-right-color: #8df3ff;
  border-bottom-color: #0788bd;
  border-radius: 50%;
  box-shadow: 0 0 9px rgba(59, 228, 248, 0.72);
}

.orbibrain-launcher-orb {
  width: 44px;
  height: 44px;
  margin-right: -3px;
  background:
    radial-gradient(circle at 50% 48%, #07131b 0 39%, transparent 41%),
    conic-gradient(from 205deg, #1197cb, #8cf5ff 22%, #069bc9 48%, #07131a 62%, #32e5f7 86%, #1197cb);
}

.orbibrain-launcher-orb .orbi-orb-core {
  width: 22px;
  height: 22px;
  border-width: 3px;
}

.orbibrain-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-rows: auto minmax(178px, 1fr) auto auto auto;
  width: min(390px, calc(100vw - 36px));
  height: min(720px, calc(100dvh - 36px));
  min-height: 560px;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid rgba(217, 232, 241, 0.62);
  border-radius: 28px;
  background:
    radial-gradient(circle at 88% 96%, rgba(73, 205, 226, 0.2), transparent 24%),
    linear-gradient(155deg, var(--orbibrain-panel-top), #303b45 45%, var(--orbibrain-panel-bottom));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.54), 0 0 32px rgba(39, 218, 243, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(18px) saturate(1.08);
}

.orbibrain-panel[hidden] {
  display: none !important;
}

.orbibrain-header {
  position: static !important;
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  width: auto !important;
  min-height: 76px;
  margin: 0 !important;
  padding: 11px 16px !important;
  border: 0;
  border-bottom: 1px solid rgba(219, 233, 241, 0.17);
  background: linear-gradient(180deg, rgba(35, 44, 52, 0.34), rgba(31, 39, 47, 0.08));
  transform: none !important;
}

.orbibrain-identity,
.orbibrain-window-controls {
  display: flex;
  align-items: center;
}

.orbibrain-identity {
  min-width: 0;
  gap: 12px;
}

.orbibrain-header-orb {
  width: 44px;
  height: 44px;
}

.orbibrain-identity-copy {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.orbibrain-title {
  overflow: hidden;
  color: #f8fafc;
  font-size: 17px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orbibrain-window-controls {
  gap: 5px;
}

.orbibrain-language-control {
  display: flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 5px;
  border: 1px solid rgba(188, 218, 230, 0.2);
  border-radius: 10px;
  background: rgba(26, 35, 42, 0.28);
}

.orbibrain-language-option {
  min-width: 25px !important;
  min-height: 24px !important;
  margin: 0 !important;
  padding: 2px 4px !important;
  border: 0 !important;
  border-radius: 7px !important;
  background: transparent !important;
  color: #a7b2bb !important;
  box-shadow: none !important;
  font-size: 10px !important;
  font-weight: 750 !important;
  letter-spacing: 0.04em;
  line-height: 1 !important;
}

.orbibrain-language-option[aria-pressed="true"] {
  background: linear-gradient(145deg, rgba(44, 190, 211, 0.28), rgba(27, 76, 86, 0.5)) !important;
  color: #43e4f7 !important;
  box-shadow: inset 0 0 0 1px rgba(61, 220, 241, 0.48), 0 0 8px rgba(39, 218, 243, 0.15) !important;
}

.orbibrain-language-option:hover,
.orbibrain-language-option:focus-visible {
  color: #fff !important;
  outline: 1px solid rgba(77, 225, 244, 0.48);
  outline-offset: 1px;
}

.orbibrain-language-separator {
  width: 1px;
  height: 13px;
  background: rgba(199, 222, 232, 0.26);
}

.orbibrain-icon-button {
  display: grid !important;
  place-items: center;
  width: 38px !important;
  min-width: 38px !important;
  height: 38px !important;
  min-height: 38px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid transparent !important;
  border-radius: 12px !important;
  background: transparent !important;
  color: #eef4f7 !important;
  box-shadow: none !important;
}

.orbibrain-icon-button:hover,
.orbibrain-icon-button:focus-visible {
  border-color: rgba(104, 227, 245, 0.42) !important;
  background: rgba(71, 87, 99, 0.56) !important;
  outline: none;
}

.orbibrain-icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.orbibrain-conversation {
  min-height: 0;
  padding: 10px 16px 12px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(116, 137, 151, 0.75) transparent;
}

.orbibrain-message-row {
  display: flex;
  align-items: flex-end;
  margin-bottom: 8px;
}

.orbibrain-message-row.user {
  justify-content: flex-end;
}

.orbibrain-message {
  max-width: 88%;
  padding: 12px 14px;
  border: 1px solid rgba(219, 231, 239, 0.12);
  border-radius: 16px;
  color: #f4f7f9;
  font-size: 14px;
  line-height: 1.46;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.orbibrain-message.assistant {
  border-bottom-left-radius: 6px;
  background: linear-gradient(145deg, rgba(78, 91, 102, 0.96), rgba(58, 70, 80, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.orbibrain-message.user {
  border-color: rgba(255, 255, 255, 0.72);
  border-bottom-right-radius: 6px;
  background: linear-gradient(145deg, #f4f6f7, #e4e9ec);
  color: #202b33;
  box-shadow: 0 4px 14px rgba(5, 12, 17, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.orbibrain-message a,
.orbibrain-status a {
  color: #9ff2ff;
  text-decoration-color: rgba(159, 242, 255, 0.55);
  text-underline-offset: 2px;
}

.orbibrain-message.user a {
  color: #0a6574;
  text-decoration-color: rgba(10, 101, 116, 0.5);
}

.orbibrain-actions {
  display: grid;
  gap: 8px;
  padding: 0 18px 14px 56px;
}

.orbibrain-actions[hidden] {
  display: none;
}

.orbibrain-action {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 20px;
  align-items: center;
  width: 100% !important;
  min-height: 45px !important;
  margin: 0 !important;
  padding: 9px 13px 9px 15px !important;
  border: 1px solid rgba(197, 218, 229, 0.36) !important;
  border-radius: 15px !important;
  background: linear-gradient(135deg, rgba(57, 70, 80, 0.8), rgba(48, 61, 70, 0.72)) !important;
  color: #f6f8fa !important;
  box-shadow: none !important;
  font-family: "DM Sans", Inter, "Segoe UI", system-ui, sans-serif !important;
  text-align: left;
}

.orbibrain-action:hover,
.orbibrain-action:focus-visible {
  border-color: rgba(80, 224, 244, 0.7) !important;
  background: linear-gradient(135deg, rgba(66, 82, 93, 0.95), rgba(47, 72, 82, 0.9)) !important;
  outline: none;
}

.orbibrain-action-label {
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orbibrain-status {
  min-height: 0;
  padding: 0 20px 9px;
  color: var(--orbibrain-muted);
  font-size: 12px;
}

.orbibrain-status:empty {
  display: none;
}

.orbibrain-composer {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 48px;
  align-items: center;
  gap: 8px;
  min-height: 76px;
  margin: 0 !important;
  padding: 10px 14px !important;
  border: 0;
  border-top: 1px solid rgba(220, 234, 241, 0.2);
  background:
    radial-gradient(circle at 88% 82%, rgba(42, 207, 231, 0.16), transparent 32%),
    linear-gradient(180deg, rgba(67, 80, 90, 0.7), rgba(47, 59, 68, 0.9));
}

.orbibrain-input {
  width: 100% !important;
  min-width: 0;
  min-height: 48px !important;
  max-height: 112px;
  margin: 0 !important;
  padding: 13px 15px !important;
  resize: none;
  border: 1px solid rgba(209, 226, 235, 0.28) !important;
  border-radius: 17px !important;
  background: linear-gradient(135deg, rgba(54, 66, 75, 0.86), rgba(45, 56, 65, 0.9)) !important;
  color: #f7fafb !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
  font-size: 14px !important;
  line-height: 1.4;
}

.orbibrain-input::placeholder {
  color: #bdc7cf;
  opacity: 1;
}

.orbibrain-input:focus {
  border-color: rgba(72, 223, 243, 0.72) !important;
  outline: 2px solid rgba(39, 218, 243, 0.15);
  outline-offset: 1px;
}

.orbibrain-send {
  display: grid !important;
  place-items: center;
  width: 48px !important;
  min-width: 48px !important;
  height: 48px !important;
  min-height: 48px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid rgba(85, 232, 250, 0.8) !important;
  border-radius: 50% !important;
  background:
    radial-gradient(circle at 36% 26%, rgba(62, 89, 101, 0.85), transparent 35%),
    linear-gradient(145deg, #1e5262, #152d37) !important;
  color: var(--orbibrain-cyan) !important;
  box-shadow: 0 0 22px rgba(39, 218, 243, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}

.orbibrain-send:hover,
.orbibrain-send:focus-visible {
  color: #c1f9ff !important;
  box-shadow: 0 0 28px rgba(39, 218, 243, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.16) !important;
  outline: none;
}

.orbibrain-send svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.orbibrain-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 820px) {
  .orbibrain-widget {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
  }

  .orbibrain-panel {
    width: min(380px, calc(100vw - 28px));
    height: min(700px, calc(100dvh - 28px));
  }
}

@media (max-width: 520px) {
  .orbibrain-widget {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
  }

  .orbibrain-launcher {
    grid-template-columns: auto 13px 40px;
    min-width: 178px;
    min-height: 48px;
    padding: 3px 3px 3px 18px;
  }

  .orbibrain-launcher-label {
    font-size: 16px;
  }

  .orbibrain-launcher-orb {
    width: 40px;
    height: 40px;
  }

  .orbibrain-launcher-orb .orbi-orb-core {
    width: 20px;
    height: 20px;
    border-width: 3px;
  }

  .orbibrain-panel {
    position: fixed;
    inset: max(58px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
    width: auto;
    height: auto;
    min-height: 0;
    border-radius: 24px;
  }

  .orbibrain-header {
    min-height: 68px;
    padding: 9px 10px !important;
  }

  .orbibrain-header-orb {
    width: 36px;
    height: 36px;
  }

  .orbibrain-header-orb .orbi-orb-core {
    width: 18px;
    height: 18px;
  }

  .orbibrain-title {
    font-size: 14.5px;
  }

  .orbibrain-identity {
    gap: 8px;
  }

  .orbibrain-language-control {
    padding-inline: 3px;
  }

  .orbibrain-language-option {
    min-width: 22px !important;
    padding-inline: 3px !important;
  }

  .orbibrain-window-controls {
    gap: 2px;
  }

  .orbibrain-icon-button {
    width: 32px;
    height: 32px;
  }

  .orbibrain-conversation {
    padding: 9px 10px 10px;
  }

  .orbibrain-message {
    max-width: 86%;
    padding: 10px 12px;
    font-size: 13px;
  }

  .orbibrain-composer {
    min-height: 70px;
    padding: 8px 10px !important;
  }
}

@media (max-height: 620px) and (min-width: 521px) {
  .orbibrain-panel {
    height: calc(100vh - 24px);
    min-height: 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .orbibrain-launcher,
  .orbibrain-action,
  .orbibrain-send {
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, background 160ms ease;
  }

  .orbibrain-panel:not([hidden]) {
    animation: orbibrain-enter 180ms ease-out both;
    transform-origin: right bottom;
  }

  .orbibrain-widget-attention .orbibrain-launcher {
    animation: orbibrain-initial-attention 5s ease-in-out infinite;
  }

  .orbibrain-widget-unread .orbibrain-launcher {
    animation: orbibrain-unread-response 0.9s cubic-bezier(0.22, 0.72, 0.3, 1) infinite;
    will-change: transform, box-shadow;
  }

  @keyframes orbibrain-enter {
    from { opacity: 0; transform: translateY(8px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }

  @keyframes orbibrain-initial-attention {
    0%, 76%, 92%, 100% { transform: translateY(0); }
    80% { transform: translateY(-10px); }
    84% { transform: translateY(0); }
    88% { transform: translateY(-4px); }
  }

  @keyframes orbibrain-unread-response {
    0%, 68%, 100% {
      transform: translateY(0) scale(1);
      box-shadow: 0 15px 34px rgba(0, 0, 0, 0.38), 0 0 18px rgba(23, 218, 255, 0.22);
    }
    20% {
      transform: translateY(-13px) scale(1.03);
      box-shadow: 0 20px 42px rgba(0, 0, 0, 0.42), 0 0 34px rgba(23, 218, 255, 0.5);
    }
    40% { transform: translateY(0) scale(1); }
    54% { transform: translateY(-5px) scale(1.012); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .orbibrain-widget,
  .orbibrain-widget *,
  .orbibrain-widget *::before,
  .orbibrain-widget *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
