:root {
  --world-blue: oklch(0.64 0.23 257);
  --world-blue-soft: oklch(0.7 0.17 250);
  --world-gold: oklch(0.82 0.17 82);
  --world-bg: oklch(0.055 0.022 255);
  --world-panel: oklch(0.09 0.028 255);
  --world-line: oklch(0.38 0.04 255 / 0.34);
  --world-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

body {
  background:
    radial-gradient(circle at 14% 10%, oklch(0.2 0.08 251 / 0.28), transparent 30rem),
    var(--world-bg);
}

/* Brand shell */
.side-nav {
  width: 286px;
  padding: 28px 24px 22px;
  border-inline-start: 1px solid var(--world-line);
  background: oklch(0.045 0.016 255 / 0.98);
}

.side-nav::before {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--world-blue) 36%, var(--world-gold) 64%, transparent);
  opacity: 0.82;
}

.brand {
  min-height: 58px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--world-line);
}

.brand-avatar {
  width: 46px;
  height: 46px;
  border-color: oklch(0.8 0.14 82 / 0.5);
}

.brand-name {
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}

.brand-copy small {
  font-size: 0.68rem;
}

.product-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 14px;
}

.language-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--world-line);
  border-radius: 10px;
  background: oklch(0.08 0.022 255);
}

.language-switch button,
.install-app-button {
  min-height: 34px;
  padding: 6px 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--cin-muted);
  font-size: 0.72rem;
  font-weight: 760;
}

.language-switch button:hover,
.language-switch button.is-active {
  background: oklch(0.22 0.09 258);
  color: white;
}

.install-app-button {
  flex: 1;
  border: 1px solid var(--world-line);
}

.new-chat-button {
  min-height: 50px;
  border-radius: 10px;
  background: var(--world-blue);
  box-shadow: none;
}

.new-chat-button:hover {
  background: oklch(0.7 0.22 255);
  transform: translateY(-1px);
}

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

.conversation-list button,
.conversation-list .conversation-item {
  border-radius: 9px;
}

.nav-item {
  min-height: 48px;
  border-radius: 8px;
}

.nav-item.is-active {
  background: transparent;
  color: var(--world-blue-soft);
}

.nav-item.is-active::before {
  position: absolute;
  inset-block: 11px;
  inset-inline-start: -24px;
  width: 2px;
  border-radius: 2px;
  background: var(--world-blue);
  content: "";
}

/* Auth: editorial scene, familiar form */
.auth-stage {
  grid-template-columns: minmax(540px, 1.55fr) minmax(390px, 0.72fr);
}

.auth-story {
  justify-content: center;
  padding-inline: clamp(42px, 7vw, 110px);
  background:
    linear-gradient(90deg, oklch(0.045 0.018 255 / 0.97) 0 25%, transparent 56%),
    linear-gradient(0deg, oklch(0.045 0.02 255) 0, transparent 44%),
    radial-gradient(circle at 68% 35%, oklch(0.33 0.13 251 / 0.35), transparent 31rem),
    var(--world-bg);
}

.auth-story::before {
  background:
    linear-gradient(90deg, transparent 16%, oklch(0.05 0.022 255 / 0.08) 45%, oklch(0.04 0.018 255 / 0.22)),
    url("/shark-assets/shark-analyst-v2-720.png") 78% 48% / min(52vw, 720px) auto no-repeat;
  filter: saturate(0.82) contrast(1.08);
}

.auth-story::after {
  background:
    linear-gradient(0deg, var(--world-bg) 0, transparent 28%),
    radial-gradient(circle at 74% 45%, transparent 0 23%, oklch(0.04 0.016 255 / 0.54) 68%);
}

.auth-promise {
  max-width: 520px;
  margin-inline-end: auto;
}

.auth-promise h1 {
  max-width: 9ch;
  font-size: clamp(3.2rem, 5vw, 5.6rem);
  letter-spacing: -0.035em;
}

.auth-promise p {
  max-width: 42ch;
  color: oklch(0.84 0.025 255);
  font-size: 1.04rem;
}

.auth-panel {
  border-inline-start: 1px solid var(--world-line);
  background: oklch(0.065 0.024 255);
}

.auth-content {
  position: relative;
  width: min(100%, 440px);
}

.auth-language {
  position: absolute;
  inset-block-start: -58px;
  inset-inline-end: 0;
}

.auth-tabs {
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--world-line);
  border-radius: 0;
  background: transparent;
}

.auth-tabs button {
  border-radius: 0;
  background: transparent;
}

.auth-tabs button.is-active {
  border-bottom: 2px solid var(--world-blue);
  background: transparent;
  color: var(--cin-ink);
}

.auth-form input,
.password-field {
  border-color: oklch(0.41 0.045 255 / 0.62);
  border-radius: 10px;
  background: oklch(0.08 0.027 255);
}

.auth-submit {
  border-radius: 10px;
  background: var(--world-blue);
  color: white;
}

/* Chat: one clear scrollport and open assistant typography */
.workspace {
  background:
    radial-gradient(circle at 22% 14%, oklch(0.18 0.065 250 / 0.2), transparent 26rem),
    oklch(0.055 0.02 255);
}

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

.chat-panel {
  width: min(100%, 980px);
  margin-inline: auto;
  padding-inline: clamp(28px, 5vw, 72px);
}

.match-context-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 48px;
  padding: 8px 0 10px;
  border-bottom: 1px solid var(--world-line);
  color: var(--cin-copy);
  font-size: 0.74rem;
}

.match-context-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: oklch(0.77 0.14 145);
}

.match-context-live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px oklch(0.77 0.14 145 / 0.12);
}

.match-context-bar strong {
  color: var(--cin-ink);
  font-size: 0.82rem;
}

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

.chat-intro {
  min-height: 44vh;
  padding: clamp(50px, 8vh, 92px) 0 36px;
}

.chat-intro h1 {
  max-width: 14ch;
  font-size: clamp(2.6rem, 5vw, 4.9rem);
  letter-spacing: -0.035em;
}

.chat-intro > div:first-child > p:last-child {
  max-width: 52ch;
}

.mascot-frame {
  width: 148px;
  height: 148px;
  border: 0;
  border-radius: 12px;
  opacity: 0.72;
  filter: saturate(0.78);
}

.conversation-status {
  border-block: 1px solid var(--world-line);
  background: transparent;
}

.conversation {
  width: 100%;
  max-width: 780px;
  margin-inline: auto;
  padding-inline: 0;
}

.assistant-message {
  position: relative;
  gap: 16px;
  padding-block: 18px 30px;
}

.assistant-message::after {
  position: absolute;
  inset-block: 28px 16px;
  inset-inline-start: 21px;
  width: 1px;
  background: linear-gradient(var(--world-blue), transparent 92%);
  content: "";
  opacity: 0.5;
}

.assistant-message .message-avatar {
  width: 42px;
  height: 42px;
  border-color: oklch(0.58 0.14 257 / 0.6);
  background: oklch(0.12 0.05 255);
}

.assistant-message .message-content {
  padding: 0;
  border: 0;
  background: transparent;
}

.assistant-message .message-content > p {
  max-width: 68ch;
  color: oklch(0.91 0.014 255);
  font-size: 1.02rem;
  line-height: 1.95;
}

.user-message .message-content {
  max-width: min(78%, 610px);
  padding: 13px 18px;
  border: 0;
  border-radius: 11px 11px 3px 11px;
  background: var(--world-blue);
}

.composer {
  width: min(calc(100% - clamp(56px, 10vw, 144px)), 780px);
  min-height: 64px;
  margin-inline: auto;
  padding: 7px 8px;
  border-color: oklch(0.54 0.13 255 / 0.62);
  border-radius: 12px;
  background: oklch(0.075 0.025 255 / 0.98);
  box-shadow: 0 -8px 8px oklch(0.04 0.02 255 / 0.28);
}

.composer:focus-within {
  border-color: var(--world-blue);
}

/* Signature analysis */
.match-analysis {
  max-width: 860px;
  padding-block: 34px 46px;
  border-block-color: var(--world-line);
}

.analysis-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.share-analysis,
.save-toggle {
  min-height: 40px;
  border: 1px solid var(--world-line);
  border-radius: 8px;
  background: transparent;
  color: var(--cin-copy);
}

.share-analysis {
  padding: 7px 14px;
  font-size: 0.72rem;
  font-weight: 760;
}

.share-analysis:hover,
.save-toggle:hover {
  border-color: oklch(0.55 0.13 257 / 0.72);
  background: oklch(0.13 0.045 255);
  color: white;
}

.analysis-topline {
  grid-template-columns: minmax(180px, 0.3fr) minmax(0, 1fr);
  padding-block: 34px;
}

.forecast-copy strong,
.forecast-copy strong.ordered-result {
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 22px oklch(0.82 0.17 82 / 0.16);
}

.probability-bar {
  height: 8px;
  border-radius: 0;
}

.probability-labels b {
  font-size: 1.18rem;
  font-variant-numeric: tabular-nums;
}

.analysis-strip > div {
  min-height: 124px;
}

.analysis-strip strong {
  font-size: 0.94rem;
  line-height: 1.55;
}

.form-visual,
.xg-visual {
  padding-block: 26px;
  border-bottom: 1px solid var(--world-line);
}

.visual-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.visual-section-heading span {
  color: var(--cin-muted);
  font-size: 0.7rem;
}

.visual-section-heading h3 {
  margin: 0;
  color: var(--cin-ink);
  font-size: 1rem;
}

.form-team-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.28fr) 1fr;
  align-items: center;
  gap: 20px;
  min-height: 44px;
}

.form-team-row + .form-team-row {
  border-top: 1px solid var(--world-line);
}

.form-team-row > strong {
  overflow: hidden;
  color: var(--cin-copy);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-dots {
  display: flex;
  gap: clamp(9px, 2vw, 22px);
  align-items: center;
}

.form-dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: white;
  font-size: 0.62rem;
  font-weight: 850;
}

.form-dot.is-win { background: oklch(0.63 0.18 146); }
.form-dot.is-draw { background: oklch(0.5 0.025 255); }
.form-dot.is-loss { background: oklch(0.62 0.21 28); }

.xg-comparison {
  display: grid;
  grid-template-columns: minmax(120px, 0.28fr) 1fr 50px;
  align-items: center;
  gap: 18px;
  min-height: 45px;
}

.xg-comparison > strong {
  color: var(--cin-copy);
  font-size: 0.78rem;
}

.xg-comparison > div {
  height: 7px;
  background: oklch(0.18 0.035 255);
}

.xg-comparison i {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--world-blue);
  transform: scaleX(var(--xg-progress, 0));
  transform-origin: right center;
  transition: transform 700ms var(--world-ease);
}

.is-english .xg-comparison i {
  transform-origin: left center;
}

.xg-comparison[data-xg-team="away"] i {
  background: oklch(0.78 0.08 225);
}

.xg-comparison b {
  color: var(--cin-ink);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.advanced-metrics {
  margin-top: 0;
}

.metric-card {
  min-height: 108px;
}

.reason-list h3 {
  font-size: 1.15rem;
}

.reason-row {
  min-height: 70px;
}

.analysis-disclaimer {
  max-width: 68ch;
}

.timezone-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  min-height: 72px;
  padding-block: 14px;
  border-bottom: 1px solid var(--world-line);
}

.timezone-setting span {
  display: grid;
  gap: 3px;
}

.timezone-setting small {
  color: var(--cin-muted);
}

.timezone-setting select {
  min-width: 170px;
  min-height: 42px;
  padding-inline: 12px;
  border: 1px solid var(--world-line);
  border-radius: 8px;
  background: oklch(0.08 0.025 255);
  color: var(--cin-ink);
  font: inherit;
}

/* Global states */
.loading-state,
.empty-state,
.conversation-load-state,
.conversation-open-error {
  background: transparent;
}

@media (max-width: 1100px) {
  .auth-stage {
    grid-template-columns: 1.1fr 0.9fr;
  }

  .auth-story::before {
    background-position: 72% 43%;
    background-size: min(62vw, 650px) auto;
  }
}

@media (max-width: 820px) {
  .auth-stage {
    display: flex;
    flex-direction: column;
  }

  .auth-story {
    min-height: 32svh;
    justify-content: flex-end;
    padding: 82px 22px 28px;
  }

  .auth-story::before {
    background:
      linear-gradient(90deg, oklch(0.04 0.018 255 / 0.45), transparent 56%),
      url("/shark-assets/shark-analyst-v2-720.png") 16% 42% / 42vw auto no-repeat;
  }

  .auth-promise {
    width: 62%;
    margin-inline-start: auto;
    margin-inline-end: 0;
  }

  .auth-promise h1 {
    max-width: 11ch;
    margin-block: 5px 8px;
    font-size: 2rem;
  }

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

  .auth-panel {
    min-height: 68svh;
    border: 0;
    border-top: 1px solid var(--world-line);
  }

  .auth-content {
    padding-block: 32px calc(32px + env(safe-area-inset-bottom));
  }

  .auth-language {
    position: static;
    width: fit-content;
    margin: 0 0 18px;
  }

  .side-nav {
    width: min(88vw, 330px);
  }

  .product-tools {
    margin-bottom: 8px;
  }

  .chat-panel {
    width: 100%;
    padding-inline: 18px;
  }

  .match-context-bar {
    grid-template-columns: auto 1fr;
    gap: 8px 12px;
    min-height: 52px;
  }

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

  .chat-intro {
    min-height: auto;
    padding: 36px 0 28px;
  }

  .chat-intro h1 {
    max-width: 13ch;
    font-size: 2.15rem;
  }

  .mascot-frame {
    display: none;
  }

  .conversation {
    max-width: none;
  }

  .assistant-message {
    display: block;
    width: 100%;
    padding-block: 16px 24px;
  }

  .assistant-message::after,
  .assistant-message .message-avatar {
    display: none;
  }

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

  .assistant-message .message-content > p {
    font-size: 1rem;
    line-height: 1.85;
  }

  .user-message .message-content {
    max-width: 86%;
  }

  .composer {
    width: 100%;
    min-height: 58px;
    margin: 0;
    border-radius: 11px;
    box-shadow: none;
  }

  .match-analysis {
    width: 100%;
    padding-block: 26px 36px;
  }

  .analysis-head {
    align-items: center;
  }

  .analysis-actions {
    flex-direction: column-reverse;
  }

  .share-analysis {
    min-height: 34px;
    padding: 5px 9px;
  }

  .analysis-topline {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .forecast-copy strong,
  .forecast-copy strong.ordered-result {
    font-size: 3rem;
  }

  .analysis-strip {
    grid-template-columns: 1fr;
  }

  .analysis-strip > div {
    min-height: 82px;
    padding-inline: 0;
  }

  .analysis-strip > div + div {
    border-inline-start: 0;
    border-top: 1px solid var(--world-line);
  }

  .form-team-row,
  .xg-comparison {
    grid-template-columns: 96px 1fr;
    gap: 12px;
  }

  .xg-comparison b {
    grid-column: 2;
    justify-self: end;
    margin-top: -10px;
  }

  .advanced-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric-card:nth-child(3) {
    border-inline-start: 0;
  }

  .timezone-setting {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .timezone-setting select {
    width: 100%;
  }
}

@media (max-width: 430px) {
  .auth-story {
    min-height: 29svh;
  }

  .auth-panel {
    min-height: 71svh;
  }

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

  .chat-panel {
    padding-inline: 14px;
  }

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

  .probability-labels {
    gap: 8px;
  }

  .probability-labels span {
    font-size: 0.66rem;
  }

  .form-dots {
    gap: 7px;
  }

  .form-dot {
    width: 25px;
    height: 25px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .xg-comparison i,
  .new-chat-button,
  .send-button {
    transition-duration: 1ms !important;
  }
}
