/*
 * Shark AI - reference-auth-chat.css
 *
 * Final presentation layer for the authentication and conversation surfaces.
 * It is intentionally CSS-only: existing IDs, hidden/inert states, forms,
 * conversation persistence, navigation hooks, and mobile menu behavior remain
 * owned by legacy.html and app.js.
 *
 * Reference-only DOM gaps (not fabricated with misleading controls here):
 * - Auth metrics/graph: there is no semantic statistics model in legacy.html.
 * - Chat chrome: browser controls, score strip, attachment/voice buttons,
 *   per-message timestamps, and the signed-in profile row are not in the DOM.
 * - Rich tactical answer: the current assistant paragraph cannot become the
 *   reference's timeline without structured response markup.
 */

:root {
  --ref-bg: #050d1a;
  --ref-bg-deep: #030914;
  --ref-panel: #071323;
  --ref-panel-raised: #0b1a2f;
  --ref-panel-active: #122540;
  --ref-input: #07111f;
  --ref-blue: #246cf2;
  --ref-blue-bright: #3c86ff;
  --ref-blue-soft: #7db2ff;
  --ref-gold: #f0b526;
  --ref-ink: #f5f7fb;
  --ref-copy: #c1ccdc;
  --ref-muted: #94a2b8;
  --ref-faint: #708098;
  --ref-line: rgb(132 151 180 / 0.24);
  --ref-line-strong: rgb(142 165 199 / 0.42);
  --ref-success: #36c96f;
  --ref-danger: #ff7b7b;
  --ref-sidebar: clamp(286px, 22.4vw, 352px);
  --ref-content: 900px;
  --ref-radius: 12px;
  --ref-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ref-fast: 190ms;
}

html,
body {
  background: var(--ref-bg-deep);
}

body {
  color: var(--ref-ink);
  font-family: "Noto Sans Arabic", "SF Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
}

button,
a,
input,
textarea {
  transition-timing-function: var(--ref-ease);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline-color: var(--ref-blue-soft);
  outline-offset: 3px;
}

/* Shared code-native sail mark used by auth, navigation, chat, and reports. */
.shark-sail {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  overflow: visible;
  background: none;
  filter: drop-shadow(0 6px 12px rgb(27 107 255 / 0.24));
}

.shark-sail::before {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, #63c7ff 0%, #2b78ff 48%, #1552d8 100%);
  clip-path: polygon(48% 4%, 96% 93%, 50% 72%, 8% 92%);
  content: "";
}

.shark-sail::after {
  position: absolute;
  inset: 42% 19% 10% 16%;
  border-radius: 50% 0 38% 50%;
  background: var(--ref-bg-deep);
  clip-path: polygon(0 100%, 100% 0, 67% 100%);
  content: "";
}

/* -------------------------------------------------------------------------- */
/* Authentication                                                             */
/* -------------------------------------------------------------------------- */

.auth-gate {
  background: var(--ref-bg-deep);
}

.auth-stage {
  direction: ltr;
  grid-template-columns: minmax(0, 1.62fr) minmax(420px, 0.98fr);
  min-height: 100dvh;
}

.auth-story,
.auth-panel {
  direction: rtl;
}

.auth-story {
  isolation: isolate;
  align-items: stretch;
  justify-content: center;
  min-height: 100dvh;
  padding: clamp(42px, 5.1vw, 78px);
  background:
    linear-gradient(90deg, rgb(3 9 20 / 0.96) 0%, rgb(3 9 20 / 0.7) 39%, rgb(3 9 20 / 0.05) 72%),
    linear-gradient(0deg, var(--ref-bg-deep) 0%, rgb(3 9 20 / 0.82) 12%, transparent 51%),
    radial-gradient(circle at 72% 34%, rgb(38 108 242 / 0.22), transparent 36rem),
    url("/shark-assets/shark-stadium-hero-v4.png") 65% center / cover no-repeat,
    var(--ref-bg-deep);
}

.auth-story::before {
  inset: 0;
  background:
    linear-gradient(90deg, rgb(3 9 20 / 0.94) 0%, rgb(3 9 20 / 0.44) 39%, transparent 68%),
    linear-gradient(0deg, rgb(3 9 20 / 0.94) 0%, transparent 38%);
  filter: none;
  opacity: 0.98;
}

.auth-story::after {
  inset: 0;
  background:
    radial-gradient(ellipse at 78% 49%, transparent 0 23%, rgb(3 9 20 / 0.23) 43%, rgb(3 9 20 / 0.64) 75%),
    linear-gradient(180deg, rgb(4 12 25 / 0.08), transparent 52%, rgb(3 9 20 / 0.72));
  opacity: 1;
}

.auth-brand {
  top: clamp(28px, 4vw, 52px);
  right: auto;
  left: clamp(34px, 4.7vw, 72px);
  gap: 13px;
  direction: ltr;
  color: var(--ref-ink);
  font-size: clamp(1.05rem, 1.5vw, 1.34rem);
  font-weight: 880;
  letter-spacing: -0.025em;
}

.auth-brand img {
  display: none;
}

.auth-brand .shark-sail {
  width: 38px;
}

.auth-brand b {
  color: var(--ref-blue-bright);
}

.auth-mascot {
  display: none;
}

.auth-promise {
  width: min(55%, 540px);
  max-width: 540px;
  margin: clamp(72px, 10vh, 116px) auto 0 0;
  text-align: right;
}

.auth-promise > span {
  display: none;
}

.auth-promise h1 {
  max-width: 10ch;
  margin: 0;
  color: var(--ref-ink);
  font-size: clamp(3rem, 4.7vw, 4.85rem);
  font-weight: 850;
  line-height: 1.12;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.auth-promise h1::after {
  display: block;
  width: 84px;
  height: 4px;
  margin-top: 24px;
  background: var(--ref-gold);
  content: "";
}

.auth-promise p {
  max-width: 38ch;
  margin: 23px 0 0;
  color: var(--ref-copy);
  font-size: clamp(0.98rem, 1.28vw, 1.18rem);
  line-height: 1.95;
  text-wrap: pretty;
}

.auth-features {
  position: absolute;
  right: auto;
  bottom: clamp(38px, 7vh, 72px);
  left: clamp(34px, 4.7vw, 72px);
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  width: min(57%, 610px);
  margin: 0;
  color: var(--ref-copy);
  font-size: 0.78rem;
}

.auth-features span {
  justify-content: center;
  min-height: 50px;
  padding: 8px 18px;
  text-align: center;
}

.auth-features span + span {
  border-right: 1px solid var(--ref-line-strong);
}

.auth-features svg {
  width: 19px;
  height: 19px;
  color: var(--ref-blue-bright);
}

.auth-panel {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100dvh;
  padding: clamp(42px, 4.6vw, 72px) clamp(34px, 4.3vw, 68px);
  border: 0;
  border-left: 1px solid var(--ref-line);
  background:
    radial-gradient(circle at 100% 0%, rgb(36 108 242 / 0.11), transparent 30rem),
    linear-gradient(180deg, #081424 0%, #06101e 100%);
}

.auth-panel::before {
  display: none;
}

.auth-panel > .auth-loading {
  margin: auto;
}

.auth-loader {
  border-color: var(--ref-line-strong);
  border-top-color: var(--ref-blue-bright);
}

.auth-content {
  display: flex;
  flex-direction: column;
  width: min(100%, 480px);
  min-height: calc(100dvh - clamp(84px, 9.2vw, 144px));
  margin: 0 auto;
}

.auth-language {
  display: inline-flex;
  order: 5;
  align-self: flex-start;
  margin-top: 14px;
}

.auth-tabs {
  order: 0;
  margin: 0;
  border-bottom-color: var(--ref-line);
}

.auth-tabs button {
  min-height: 58px;
  padding: 8px 10px 15px;
  color: var(--ref-muted);
  font-size: 0.91rem;
  font-weight: 720;
}

.auth-tabs button:hover {
  color: var(--ref-ink);
}

.auth-tabs button.is-active {
  border-bottom-color: transparent;
  color: var(--ref-blue-bright);
}

.auth-tabs button.is-active::after {
  height: 3px;
  background: var(--ref-blue-bright);
}

.auth-heading {
  order: 1;
  margin: clamp(48px, 7.2vh, 76px) 0 39px;
  text-align: right;
}

.auth-heading p,
.auth-mobile-mark {
  display: none;
}

.auth-heading h2 {
  margin: 0 0 12px;
  color: var(--ref-ink);
  font-size: clamp(2.15rem, 3vw, 2.85rem);
  font-weight: 850;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.auth-heading > span:last-child {
  color: var(--ref-muted);
  font-size: 0.94rem;
}

.auth-form {
  order: 2;
  gap: 11px;
}

.auth-contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.auth-field {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.auth-field-wide {
  grid-column: 1 / -1;
}

.auth-field label {
  margin-top: 10px;
}

.auth-field small {
  padding-inline: 2px;
  color: var(--ref-muted);
  font-size: 0.7rem;
}

.auth-form label {
  margin-top: 10px;
  color: var(--ref-copy);
  font-size: 0.82rem;
  font-weight: 680;
}

.auth-form input,
.auth-form select,
.phone-number-field,
.password-field {
  border-color: var(--ref-line-strong);
  border-radius: var(--ref-radius);
  background: var(--ref-input);
}

.auth-form input,
.auth-form select {
  min-height: 64px;
  padding-inline: 18px;
  color: var(--ref-ink);
  caret-color: var(--ref-blue-bright);
}

.auth-form select {
  width: 100%;
  border: 1px solid var(--ref-line-strong);
  color-scheme: dark;
  cursor: pointer;
  font: inherit;
}

.auth-form input::placeholder {
  color: transparent;
}

.auth-form input:hover,
.auth-form select:hover,
.phone-number-field:hover {
  border-color: rgb(125 178 255 / 0.66);
}

.auth-form input:focus,
.auth-form select:focus,
.phone-number-field:focus-within {
  border-color: var(--ref-blue-bright);
  background: #0a1728;
  box-shadow: 0 0 0 3px rgb(60 134 255 / 0.13);
}

.phone-number-field {
  display: flex;
  min-width: 0;
  min-height: 64px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--ref-line-strong);
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.phone-number-field > span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding-inline: 16px;
  border-inline-end: 1px solid var(--ref-line);
  color: var(--ref-blue-pale);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
  white-space: nowrap;
}

.phone-number-field input {
  min-width: 0;
  min-height: 62px;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
}

.password-field {
  border: 1px solid var(--ref-line-strong);
  overflow: visible;
}

.password-field input {
  border: 0;
}

.password-field:focus-within {
  border-color: var(--ref-blue-bright);
  box-shadow: 0 0 0 3px rgb(60 134 255 / 0.13);
}

.password-toggle {
  color: var(--ref-muted);
}

.password-toggle:hover {
  background: var(--ref-panel-active);
  color: var(--ref-ink);
}

.auth-submit {
  min-height: 62px;
  margin-top: 21px;
  border-radius: var(--ref-radius);
  background: linear-gradient(135deg, #1760e9, #276fe3);
  color: #fff;
  font-size: 0.98rem;
  font-weight: 820;
}

.auth-submit:hover {
  background: linear-gradient(135deg, #246cf2, #236ee8);
  transform: translateY(-1px);
}

.auth-submit:active {
  transform: translateY(0) scale(0.99);
}

.auth-feedback {
  order: 3;
  border-color: rgb(255 123 123 / 0.45);
  color: #ffb0b0;
}

.auth-feedback.is-success {
  border-color: rgb(54 201 111 / 0.46);
  color: #8be3ac;
}

.auth-privacy {
  order: 4;
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--ref-line);
  color: var(--ref-faint);
  font-size: 0.72rem;
}

.auth-privacy svg {
  color: var(--ref-blue-soft);
}

/* -------------------------------------------------------------------------- */
/* Desktop application shell and conversation                                */
/* -------------------------------------------------------------------------- */

.app-shell {
  grid-template-columns: minmax(0, 1fr) var(--ref-sidebar);
  grid-template-areas: "workspace sidebar";
  height: 100dvh;
  background: var(--ref-bg);
}

.side-nav {
  grid-area: sidebar;
  width: auto;
  height: 100dvh;
  padding: 32px 26px 21px;
  border: 0;
  border-left: 1px solid var(--ref-line);
  background:
    radial-gradient(circle at 100% 0%, rgb(36 108 242 / 0.11), transparent 24rem),
    linear-gradient(180deg, #071322 0%, #050e1a 100%);
}

.side-nav::before {
  display: none;
}

.side-nav > .brand {
  order: 0;
}

.side-nav > .new-chat-button {
  order: 1;
}

.side-nav > .conversation-history {
  order: 2;
}

.side-nav > .nav-list {
  order: 3;
}

.side-nav > .product-tools {
  order: 4;
}

.side-nav > .side-foot {
  order: 5;
}

.brand {
  min-height: 70px;
  gap: 15px;
  padding: 2px 0 24px;
  border: 0;
}

.brand-avatar {
  position: relative;
  width: 58px;
  height: 48px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.brand-avatar img {
  display: none;
}

.brand-avatar .shark-sail {
  width: 58px;
}

.brand-copy {
  gap: 1px;
}

.brand-name {
  color: var(--ref-ink);
  font-size: 1.28rem;
  letter-spacing: -0.025em;
}

.brand-name b {
  color: var(--ref-blue-bright);
}

.brand-copy small {
  display: none;
}

.side-nav > .new-chat-button,
.new-chat-button {
  min-height: 54px;
  margin-top: 25px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1760e9, #276fe3);
  color: #fff;
  box-shadow: none;
}

.new-chat-button:hover {
  background: linear-gradient(135deg, #246cf2, #236ee8);
  transform: translateY(-1px);
}

.new-chat-button:active {
  transform: translateY(0) scale(0.99);
}

.conversation-history {
  flex: 1 1 auto;
  min-height: 132px;
  margin-top: 29px;
}

.conversation-history > header,
.mobile-conversations-head {
  min-height: 34px;
  padding: 0 4px 11px;
}

.conversation-history h2,
.mobile-conversations-head strong {
  color: var(--ref-copy);
  font-size: 0.78rem;
}

.conversation-history header span,
.mobile-conversations-head span {
  color: var(--ref-faint);
  font-size: 0.63rem;
}

.conversation-list {
  gap: 3px;
  scrollbar-color: rgb(125 178 255 / 0.32) transparent;
  scrollbar-width: thin;
}

.conversation-item {
  position: relative;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--ref-muted);
}

.conversation-item:hover {
  background: rgb(18 37 64 / 0.72);
  color: var(--ref-ink);
}

.conversation-item.is-active {
  background: var(--ref-panel-active);
  color: var(--ref-ink);
}

.conversation-item.is-active::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -26px;
  width: 1px;
  background: var(--ref-blue-bright);
  content: "";
}

.conversation-item.is-active::after {
  width: 6px;
  height: 6px;
  grid-column: 3;
  border-radius: 50%;
  background: var(--ref-blue-bright);
  content: "";
}

.conversation-item strong {
  min-width: 0;
  color: inherit;
  font-size: 0.78rem;
}

.conversation-item small {
  color: var(--ref-faint);
  font-size: 0.61rem;
}

.side-nav .nav-list {
  flex: 0 0 auto;
  gap: 4px;
  margin-top: 16px;
  padding-top: 17px;
  border-top-color: var(--ref-line);
}

.nav-item {
  min-height: 48px;
  border-radius: 8px;
  color: var(--ref-muted);
  font-size: 0.84rem;
}

.nav-item:hover {
  background: rgb(18 37 64 / 0.62);
  color: var(--ref-ink);
}

.nav-item.is-active {
  background: transparent;
  color: var(--ref-ink);
}

.nav-item.is-active::before {
  inset-block: 10px;
  inset-inline-start: auto;
  inset-inline-end: -26px;
  width: 1px;
  background: var(--ref-blue-bright);
}

.nav-item.is-active svg {
  color: var(--ref-blue-bright);
}

.product-tools {
  flex: 0 0 auto;
  gap: 8px;
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--ref-line);
}

.language-switch {
  border-color: var(--ref-line);
  border-radius: 9px;
  background: var(--ref-input);
}

.language-switch button,
.install-app-button {
  min-height: 32px;
  color: var(--ref-muted);
}

.language-switch button:hover,
.language-switch button.is-active {
  background: var(--ref-panel-active);
  color: var(--ref-ink);
}

.side-nav .side-foot {
  margin-top: 11px;
  padding: 15px 3px 0;
  border-top-color: var(--ref-line);
}

.online-dot {
  color: var(--ref-copy);
}

.side-foot p {
  color: var(--ref-faint);
}

.workspace {
  grid-area: workspace;
  background:
    radial-gradient(circle at 16% 14%, rgb(36 108 242 / 0.12), transparent 34rem),
    radial-gradient(circle at 76% 54%, rgb(31 72 133 / 0.1), transparent 40rem),
    linear-gradient(135deg, #071426 0%, #050e1b 64%, #040b16 100%);
}

.workspace::before {
  display: none;
}

.workspace::after {
  inset: 0;
  background:
    linear-gradient(180deg, rgb(126 167 224 / 0.025), transparent 22%),
    radial-gradient(circle at 50% 100%, rgb(21 58 112 / 0.18), transparent 31rem);
}

.chat-layout,
.chat-panel {
  width: 100%;
  max-width: none;
  height: 100%;
}

.chat-panel {
  margin: 0;
  padding: 0 0 24px;
}

.match-context-bar {
  flex: 0 0 auto;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 58px;
  padding: 9px clamp(28px, 4vw, 58px);
  border-bottom-color: var(--ref-line);
  background: rgb(5 14 27 / 0.76);
  color: var(--ref-copy);
}

.match-context-live {
  color: #7fda9e;
}

.match-context-live i {
  background: var(--ref-success);
  box-shadow: 0 0 0 4px rgb(54 201 111 / 0.12);
}

.match-context-bar strong {
  color: var(--ref-ink);
}

.match-context-bar small {
  color: var(--ref-muted);
}

.chat-intro,
.conversation-status,
.conversation,
.composer {
  width: min(calc(100% - clamp(64px, 11vw, 168px)), var(--ref-content));
  max-width: var(--ref-content);
  margin-right: auto;
  margin-left: auto;
}

.chat-intro {
  min-height: clamp(285px, 44vh, 455px);
  padding: clamp(54px, 8vh, 92px) 0 38px;
}

.chat-intro > div:first-child {
  max-width: 720px;
}

.welcome-line {
  color: var(--ref-gold);
}

.welcome-line::before {
  background: var(--ref-blue-bright);
}

.chat-intro h1 {
  max-width: 14ch;
  color: var(--ref-ink);
  font-size: clamp(2.75rem, 5vw, 4.75rem);
  letter-spacing: -0.035em;
}

.chat-intro > div:first-child > p:last-child {
  max-width: 54ch;
  color: var(--ref-copy);
}

.mascot-frame {
  width: 136px;
  height: 136px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  opacity: 0.72;
}

.conversation-status {
  padding: 12px 0;
  border-block-color: var(--ref-line);
  color: var(--ref-faint);
}

.conversation-status span {
  color: var(--ref-copy);
}

.conversation-status i {
  background: var(--ref-success);
}

.conversation {
  flex: 1 1 auto;
  gap: 24px;
  min-height: 0;
  padding: 30px 0 21px;
  scrollbar-color: rgb(125 178 255 / 0.32) transparent;
  scrollbar-width: thin;
}

body.has-conversation .conversation {
  padding-top: clamp(35px, 6.5vh, 70px);
}

.message {
  max-width: none;
}

.assistant-message {
  position: relative;
  display: grid;
  grid-template-columns: 43px minmax(0, 1fr);
  gap: 15px;
  padding: 0 0 29px;
  direction: ltr;
}

.assistant-message::after {
  display: none;
  content: none;
}

.assistant-message .message-avatar {
  position: relative;
  display: block;
  width: 43px;
  height: 43px;
  margin-top: 2px;
  overflow: hidden;
  border: 1px solid rgb(125 178 255 / 0.42);
  border-radius: 50%;
  background: #0a1930;
}

.assistant-message .message-avatar img {
  display: none;
}

.assistant-message .message-avatar .shark-sail {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 29px;
  transform: translate(-50%, -50%);
}

.assistant-message .message-content,
.assistant-message.is-streaming .message-content {
  width: 100%;
  max-width: none;
  padding: 0;
  direction: rtl;
}

.assistant-message .message-content > p {
  max-width: 70ch;
  color: #dbe3ef;
  font-size: 1.02rem;
  line-height: 1.98;
}

.assistant-message .message-meta {
  justify-content: flex-start;
  direction: ltr;
  margin-bottom: 12px;
}

.assistant-message .message-meta strong {
  color: var(--ref-ink);
  font-size: 0.79rem;
}

.assistant-message .message-meta span {
  color: var(--ref-faint);
}

.user-message {
  align-self: auto;
  width: fit-content;
  max-width: min(72%, 560px);
  margin-right: 0;
  margin-left: auto;
}

.user-message .message-content {
  max-width: 100%;
  padding: 14px 19px;
  border-radius: 12px 12px 3px 12px;
  background: linear-gradient(135deg, #1760e9, #276fe3);
}

.user-message .message-content p {
  color: #fff;
  font-size: 0.98rem;
  line-height: 1.72;
}

.inline-actions {
  gap: 8px;
}

.inline-actions button {
  border-color: var(--ref-line-strong);
  border-radius: 8px;
  color: var(--ref-copy);
}

.inline-actions button:hover {
  border-color: var(--ref-blue-bright);
  background: var(--ref-panel-active);
  color: var(--ref-ink);
}

.suggestions {
  padding-right: 58px;
}

.suggestions button,
.suggestions button:last-child {
  color: var(--ref-muted);
}

.suggestions button:hover {
  border-color: var(--ref-blue-bright);
  color: var(--ref-ink);
}

.suggestions svg {
  color: var(--ref-blue-bright);
}

.composer {
  flex: 0 0 auto;
  min-height: 66px;
  padding: 8px 9px;
  border-color: var(--ref-line-strong);
  border-radius: 16px;
  background: rgb(8 19 35 / 0.98);
  box-shadow: 0 -8px 8px rgb(2 8 17 / 0.22);
}

.composer:hover {
  border-color: rgb(125 178 255 / 0.58);
}

.composer:focus-within {
  border-color: var(--ref-blue-bright);
  background: #0a1728;
  box-shadow: 0 0 0 3px rgb(60 134 255 / 0.12);
}

.composer textarea {
  min-height: 48px;
  padding: 12px 14px 8px;
  color: var(--ref-ink);
  caret-color: var(--ref-blue-bright);
}

.composer textarea::placeholder {
  color: var(--ref-muted);
}

.send-button {
  width: 49px;
  height: 49px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1760e9, #276fe3);
}

.send-button:hover {
  background: linear-gradient(135deg, #246cf2, #236ee8);
}

.send-button:active {
  transform: translateY(0) scale(0.96);
}

.attachment-button {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #a9b8cb;
  background: transparent;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease;
}

.attachment-button:hover,
.attachment-button:focus-visible {
  color: #fff;
  background: rgb(56 133 255 / 0.13);
}

.attachment-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-image-preview {
  position: absolute;
  inset-inline: 10px;
  bottom: calc(100% + 9px);
  width: min(360px, calc(100% - 20px));
  min-height: 70px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 11px;
  padding: 8px;
  border: 1px solid rgb(78 150 255 / 0.42);
  border-radius: 14px;
  background: rgb(7 18 33 / 0.98);
  box-shadow: 0 14px 34px rgb(0 0 0 / 0.34);
  z-index: 3;
}

.chat-image-preview[hidden] { display: none; }

.chat-image-preview img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 10px;
}

.chat-image-preview span {
  min-width: 0;
  overflow: hidden;
  color: #dbe7f7;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-image-preview button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgb(255 255 255 / 0.09);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.message-attachment {
  display: block;
  width: min(420px, 100%);
  max-height: 420px;
  margin-bottom: 10px;
  object-fit: contain;
  border-radius: 14px;
  background: #050b14;
}

/* Keep generated tactical output visually native to the conversation layer. */
.match-analysis {
  width: 100%;
  max-width: none;
  border-block-color: var(--ref-line);
}

.analysis-head,
.analysis-topline,
.analysis-strip,
.form-visual,
.xg-visual,
.advanced-metrics,
.reason-list,
.analysis-disclaimer {
  border-color: var(--ref-line);
}

/* -------------------------------------------------------------------------- */
/* Mobile and compact layouts                                                 */
/* -------------------------------------------------------------------------- */

@media (max-width: 1100px) and (min-width: 821px) {
  :root {
    --ref-sidebar: 258px;
    --ref-content: 790px;
  }

  .side-nav {
    padding-inline: 20px;
  }

  .conversation-item.is-active::before {
    left: -20px;
  }

  .nav-item.is-active::before {
    inset-inline-end: -20px;
  }

  .brand-name {
    font-size: 1.08rem;
  }

  .auth-stage {
    grid-template-columns: minmax(0, 1.3fr) minmax(400px, 0.9fr);
  }

  .auth-promise h1 {
    font-size: clamp(2.75rem, 4.8vw, 4rem);
  }
}

@media (max-width: 820px) {
  :root {
    --mobile-topbar-height: calc(72px + env(safe-area-inset-top));
    --mobile-nav-height: 0px;
  }

  .auth-stage {
    display: flex;
    flex-direction: column;
    min-height: var(--app-visible-height, 100dvh);
    direction: rtl;
  }

  .auth-story {
    min-height: 220px;
    justify-content: flex-end;
    padding: 72px 20px 23px;
    background:
      linear-gradient(90deg, rgb(3 9 20 / 0.08), rgb(3 9 20 / 0.77) 74%),
      linear-gradient(0deg, var(--ref-bg-deep), transparent 58%),
      url("/shark-assets/shark-stadium-hero-v4.png") right top / auto 155% no-repeat,
      var(--ref-bg-deep);
  }

  .auth-story::before {
    background:
      linear-gradient(90deg, transparent 0 26%, rgb(3 9 20 / 0.43) 68%),
      linear-gradient(0deg, var(--ref-bg-deep), transparent 56%);
    filter: none;
  }

  .auth-story::after {
    background: linear-gradient(0deg, var(--ref-bg-deep), transparent 61%);
  }

  .auth-brand {
    top: max(16px, env(safe-area-inset-top));
    right: auto;
    left: 18px;
    font-size: 1rem;
  }

  .auth-brand .shark-sail {
    width: 31px;
  }

  .auth-promise {
    width: min(58%, 310px);
    margin: 0 0 0 auto;
    text-align: right;
  }

  .auth-promise h1 {
    max-width: 11ch;
    font-size: 1.55rem;
    line-height: 1.22;
  }

  .auth-promise h1::after {
    width: 48px;
    height: 3px;
    margin-top: 12px;
  }

  .auth-promise p,
  .auth-features {
    display: none;
  }

  .auth-panel {
    display: flex;
    flex: 1 0 auto;
    min-height: 0;
    padding: 26px 20px max(34px, env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--ref-line);
  }

  .auth-content {
    width: min(100%, 480px);
    min-height: 0;
  }

  .auth-tabs button {
    min-height: 50px;
  }

  .auth-heading {
    margin: 32px 0 24px;
  }

  .auth-heading h2 {
    font-size: 1.9rem;
  }

  .auth-heading > span:last-child {
    font-size: 0.82rem;
  }

  .auth-form input,
  .auth-form select,
  .phone-number-field,
  .auth-submit {
    min-height: 56px;
    font-size: 16px;
  }

  .phone-number-field input {
    min-height: 54px;
    font-size: 16px;
  }

  .auth-form label {
    font-size: 0.78rem;
  }

  .auth-privacy {
    margin-top: 23px;
    padding-top: 18px;
  }

  .app-shell {
    display: flex;
    height: var(--app-visible-height, 100dvh);
    max-height: var(--app-visible-height, 100dvh);
  }

  .side-nav {
    display: none;
  }

  .workspace {
    background:
      radial-gradient(circle at 8% 9%, rgb(36 108 242 / 0.14), transparent 22rem),
      linear-gradient(160deg, #071426 0%, #050e1b 70%, #040b16 100%);
  }

  .mobile-topbar {
    direction: ltr;
    min-height: var(--mobile-topbar-height);
    padding: max(8px, env(safe-area-inset-top)) 20px 8px;
    border-bottom-color: var(--ref-line);
    background: rgb(4 12 23 / 0.96);
  }

  .mobile-brand {
    position: relative;
    gap: 11px;
    direction: ltr;
  }

  .mobile-brand img {
    display: none;
  }

  .mobile-brand > .shark-sail {
    width: 42px;
  }

  .mobile-brand-copy {
    direction: ltr;
  }

  .mobile-brand-copy > span {
    color: var(--ref-ink);
    font-size: 1.05rem;
  }

  .mobile-brand-copy > span b {
    color: var(--ref-blue-bright);
  }

  .mobile-brand-copy small {
    display: none;
  }

  .icon-button {
    border-radius: 8px;
    color: var(--ref-ink);
  }

  .icon-button:hover {
    background: var(--ref-panel-active);
  }

  .mobile-menu {
    top: var(--mobile-topbar-height);
    right: 0;
    bottom: 0;
    left: auto;
    width: min(90vw, 360px);
    border-left: 1px solid var(--ref-line);
    border-right: 0;
    background: #06111f;
    box-shadow: -8px 0 8px rgb(1 5 12 / 0.34);
    direction: rtl;
  }

  .mobile-menu-links {
    border-top-color: var(--ref-line);
  }

  .mobile-menu-links button {
    color: var(--ref-muted);
  }

  .mobile-menu-links button:hover {
    background: var(--ref-panel-active);
    color: var(--ref-ink);
  }

  .chat-panel {
    padding: 0;
  }

  .match-context-bar {
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 54px;
    padding: 8px 20px;
  }

  .match-context-bar small {
    grid-column: 1 / -1;
  }

  .chat-intro,
  .conversation-status,
  .conversation,
  .composer {
    width: auto;
    max-width: none;
  }

  .chat-intro {
    min-height: 218px;
    margin: 0;
    padding: 36px 24px 27px;
  }

  .chat-intro > div:first-child {
    width: min(78%, 340px);
    margin-right: 0;
    margin-left: auto;
  }

  .chat-intro h1 {
    font-size: 2.15rem;
  }

  .conversation-status {
    margin: 0 22px;
  }

  .conversation {
    gap: 25px;
    margin: 0;
    padding: 24px clamp(20px, 5vw, 36px) 18px;
  }

  body.has-conversation .conversation {
    padding-top: 28px;
  }

  .assistant-message {
    grid-template-columns: 43px minmax(0, 1fr);
    gap: 15px;
    width: 100%;
    padding-bottom: 22px;
  }

  .assistant-message .message-avatar {
    display: block;
  }

  .assistant-message .message-content,
  .assistant-message.is-streaming .message-content {
    width: 100%;
    max-width: none;
  }

  .assistant-message .message-content > p {
    color: #dbe3ef;
    font-size: 1rem;
    line-height: 1.9;
  }

  .assistant-message .message-meta {
    margin-bottom: 9px;
  }

  .user-message {
    width: fit-content;
    max-width: 82%;
    margin-right: 0;
    margin-left: auto;
  }

  .user-message .message-content {
    padding: 12px 15px;
  }

  .suggestions {
    padding-right: 0;
  }

  .composer {
    min-height: 60px;
    margin: 8px clamp(16px, 4vw, 32px) max(14px, env(safe-area-inset-bottom));
    padding: 7px 8px;
    border-radius: 15px;
    box-shadow: none;
  }

  .composer textarea {
    min-height: 44px;
    max-height: 118px;
    padding: 10px 11px 7px;
    font-size: 16px;
  }

  .send-button {
    width: 46px;
    height: 46px;
  }

  .attachment-button {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
  }

  .chat-image-preview {
    inset-inline: 0;
    width: 100%;
    bottom: calc(100% + 7px);
  }

  .message-attachment {
    max-height: 52vh;
    border-radius: 12px;
  }

  .bottom-nav {
    display: none !important;
  }

  body.keyboard-open .mobile-menu {
    display: none;
  }

  .match-analysis {
    width: 100%;
    padding: 25px 0 32px;
  }
}

@media (max-width: 520px) {
  .auth-contact-grid {
    grid-template-columns: 1fr;
  }

  .auth-story {
    min-height: 196px;
    padding-top: 64px;
  }

  .auth-promise h1 {
    font-size: 1.38rem;
  }

  .auth-panel {
    padding-inline: 16px;
  }

  .auth-heading h2 {
    font-size: 1.72rem;
  }

  .mobile-topbar {
    padding-inline: 16px;
  }

  .conversation {
    padding-inline: 18px;
  }

  .assistant-message {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 12px;
  }

  .assistant-message .message-avatar {
    width: 38px;
    height: 38px;
  }

  .user-message {
    max-width: 88%;
  }

  .composer {
    margin-inline: 12px;
  }
}

@media (max-height: 760px) and (min-width: 821px) {
  .auth-panel {
    padding-block: 28px;
  }

  .auth-content {
    min-height: calc(100dvh - 56px);
  }

  .auth-heading {
    margin-block: 24px 18px;
  }

  .auth-form input,
  .auth-form select,
  .phone-number-field,
  .auth-submit {
    min-height: 52px;
  }

  .auth-privacy {
    margin-top: 18px;
    padding-top: 15px;
  }

  .chat-intro {
    min-height: 245px;
    padding-top: 42px;
  }

  .conversation {
    gap: 18px;
    padding-block: 22px 14px;
  }

  body.has-conversation .conversation {
    padding-top: 31px;
  }

  .side-nav {
    padding-block: 22px 17px;
  }

  .brand {
    min-height: 58px;
    padding-bottom: 16px;
  }

  .side-nav > .new-chat-button {
    margin-top: 16px;
  }

  .conversation-history {
    margin-top: 18px;
  }

  .product-tools {
    margin-top: 7px;
    padding-top: 7px;
  }

  .side-nav .side-foot {
    padding-top: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-submit,
  .new-chat-button,
  .send-button,
  .conversation-item,
  .nav-item,
  .composer,
  .auth-form input,
  .auth-form select,
  .phone-number-field {
    transition-duration: 1ms !important;
  }

  .auth-submit:hover,
  .new-chat-button:hover,
  .send-button:hover {
    transform: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --ref-copy: #e2e8f2;
    --ref-muted: #c3cede;
    --ref-faint: #aab7cb;
    --ref-line: rgb(194 211 235 / 0.48);
    --ref-line-strong: rgb(210 224 244 / 0.68);
  }
}

@media (forced-colors: active) {
  .auth-panel,
  .side-nav,
  .mobile-topbar,
  .mobile-menu,
  .composer,
  .auth-form input,
  .auth-form select,
  .phone-number-field,
  .password-field {
    border: 1px solid CanvasText;
  }

  .nav-item.is-active,
  .conversation-item.is-active,
  .auth-tabs button.is-active {
    color: Highlight;
  }
}

/* Sponsor offer: one clear, reliable link instead of a collapsed banner. */
.sponsor-card {
  display: block;
  width: min(100%, 820px);
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgb(49 139 255 / 0.46);
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 0%, rgb(37 126 255 / 0.19), transparent 44%),
    linear-gradient(135deg, rgb(5 20 43 / 0.98), rgb(3 10 22 / 0.98));
  box-shadow: 0 18px 48px rgb(0 0 0 / 0.24);
}

.sponsor-card-link {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 146px minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  min-height: 118px;
  padding: 14px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.sponsor-card-link:hover {
  background: rgb(41 126 255 / 0.06);
}

.sponsor-card-link:focus-visible {
  outline: 3px solid rgb(71 160 255 / 0.9);
  outline-offset: -3px;
}

.sponsor-card .sponsor-visual {
  display: block;
  width: 146px;
  min-height: 90px;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 12px;
  background: #07162b;
}

.sponsor-card .sponsor-visual img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 90px;
  object-fit: cover;
}

.sponsor-card .sponsor-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.sponsor-card .sponsor-badge {
  color: #53a9ff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.sponsor-card .sponsor-copy strong {
  color: #f6f9ff;
  font-size: 1rem;
  line-height: 1.55;
}

.sponsor-card .sponsor-copy small {
  color: #8190a7;
  font-size: 0.67rem;
}

.sponsor-card .sponsor-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 17px;
  border: 1px solid #2c8dff;
  border-radius: 10px;
  background: #1478ed;
  color: white;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.sponsor-card .sponsor-cta svg {
  width: 16px;
  height: 16px;
}

.sponsor-gate-primary {
  position: relative;
  z-index: 2;
  box-shadow: 0 8px 24px rgb(17 119 239 / 0.25);
}

.send-button.is-stop {
  border-color: rgb(233 239 248 / 0.82);
  background: #f0f4fa;
  color: #07111f;
  box-shadow: 0 0 0 5px rgb(238 244 252 / 0.08);
}

.send-button.is-stop svg {
  fill: currentColor;
  stroke: none;
}

.assistant-message.is-stopped {
  opacity: 0.86;
}

@media (max-width: 760px) {
  .sponsor-card {
    border-radius: 15px;
  }

  .sponsor-card-link {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 12px;
    min-height: 108px;
    padding: 11px;
  }

  .sponsor-card .sponsor-visual {
    width: 88px;
    min-height: 82px;
    aspect-ratio: 1;
  }

  .sponsor-card .sponsor-visual img {
    min-height: 82px;
  }

  .sponsor-card .sponsor-copy strong {
    font-size: 0.88rem;
  }

  .sponsor-card .sponsor-cta {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 45px;
  }
}
