:root {
  --bg: oklch(0.115 0.025 264);
  --bg-deep: oklch(0.085 0.022 264);
  --surface: oklch(0.155 0.028 264);
  --surface-raised: oklch(0.19 0.034 264);
  --surface-active: oklch(0.24 0.072 264);
  --primary: oklch(0.61 0.19 257);
  --primary-bright: oklch(0.75 0.14 251);
  --gold: oklch(0.82 0.16 83);
  --gold-strong: oklch(0.76 0.17 77);
  --ink: oklch(0.97 0.008 260);
  --muted: oklch(0.78 0.025 260);
  --faint: oklch(0.63 0.026 260);
  --line: oklch(0.39 0.045 262 / 0.68);
  --line-soft: oklch(0.31 0.035 262 / 0.72);
  --sidebar-width: 216px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 15px;
}

[hidden] {
  display: none !important;
}

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

body {
  background:
    radial-gradient(circle at 62% -8%, oklch(0.31 0.1 257 / 0.24), transparent 35rem),
    var(--bg);
}

/* Name entry */
.auth-gate {
  background: var(--bg-deep);
}

.auth-stage {
  grid-template-columns: minmax(440px, 1.12fr) minmax(420px, 0.88fr);
}

.auth-story {
  isolation: isolate;
  padding: clamp(30px, 4vw, 64px);
  background:
    linear-gradient(180deg, transparent 45%, oklch(0.1 0.055 264 / 0.88)),
    radial-gradient(circle at 52% 42%, oklch(0.51 0.18 252 / 0.58), transparent 19rem),
    oklch(0.17 0.075 264);
}

.auth-story::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(oklch(0.8 0.08 253 / 0.045) 1px, transparent 1px),
    linear-gradient(90deg, oklch(0.8 0.08 253 / 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
  content: "";
}

.auth-story::after {
  inset: auto -12rem -17rem auto;
  width: 38rem;
  border-color: oklch(0.82 0.16 83 / 0.2);
}

.auth-brand {
  font-size: 1rem;
  letter-spacing: 0;
}

.auth-brand img {
  width: 54px;
  height: 48px;
  border: 1px solid oklch(0.82 0.16 83 / 0.52);
  object-position: 50% 34%;
}

.auth-mascot {
  width: min(34rem, 82%);
  margin-block: clamp(24px, 4vh, 54px);
  border: 1px solid oklch(0.75 0.12 252 / 0.22);
  border-radius: 14px;
  background: oklch(0.15 0.052 264);
  box-shadow: 0 8px 8px oklch(0 0 0 / 0.18);
}

.auth-mascot img {
  width: 100%;
  height: 100%;
  object-position: 50% 32%;
}

.auth-promise {
  max-width: 610px;
}

.auth-promise > span {
  color: var(--gold);
  font-size: 0.8rem;
}

.auth-promise h1 {
  max-width: 16ch;
  margin: 8px 0 12px;
  font-size: clamp(2.25rem, 4vw, 4.5rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.auth-promise p {
  max-width: 51ch;
  color: oklch(0.88 0.025 258);
  font-size: 0.95rem;
  line-height: 1.9;
}

.auth-features {
  margin-top: 22px;
  color: oklch(0.9 0.02 260);
  font-size: 0.77rem;
}

.auth-panel {
  position: relative;
  padding: clamp(32px, 6vw, 88px);
  background: oklch(0.105 0.018 264);
}

.auth-panel::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--primary), var(--gold));
  content: "";
}

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

.auth-heading {
  margin-bottom: 30px;
}

.auth-heading h2 {
  max-width: 15ch;
  font-size: 2rem;
  line-height: 1.35;
  letter-spacing: -0.025em;
}

.auth-form {
  gap: 10px;
}

.auth-form label {
  color: var(--muted);
  font-size: 0.78rem;
}

.auth-form input {
  min-height: 58px;
  padding: 0 16px;
  border-color: var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.auth-form input:hover {
  border-color: oklch(0.55 0.07 260);
}

.auth-submit {
  min-height: 56px;
  margin-top: 8px;
  border-radius: 10px;
  background: var(--gold);
  box-shadow: 0 5px 8px oklch(0 0 0 / 0.22);
  font-size: 0.92rem;
}

.auth-submit:hover {
  background: var(--gold-strong);
  transform: translateY(-1px);
}

.auth-privacy {
  justify-content: flex-start;
  margin-top: 18px;
  color: var(--faint);
}

.auth-tabs {
  border: 1px solid var(--line-soft);
  background: var(--bg-deep);
}

.auth-tabs button.is-active {
  background: var(--surface-active);
  color: var(--ink);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-left: 52px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  left: 7px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  transform: translateY(-50%);
  transition:
    background var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.password-toggle:hover {
  background: var(--surface-raised);
  color: var(--ink);
}

.password-toggle svg {
  width: 19px;
  height: 19px;
}

bdi,
[dir="ltr"] {
  unicode-bidi: isolate;
}

.message-content p[dir="auto"],
.suggestions span,
.inline-actions button {
  unicode-bidi: plaintext;
}

.message-content p,
.suggestions span,
.inline-actions button,
.team-names bdi,
.match-clubs bdi {
  overflow-wrap: anywhere;
}

/* Application shell */
.app-shell {
  grid-template-columns: minmax(0, 1fr) var(--sidebar-width);
  background: transparent;
}

.side-nav {
  min-height: 100dvh;
  padding: 26px 16px 20px;
  border-inline-start: 1px solid var(--line-soft);
  background: oklch(0.095 0.021 264 / 0.98);
}

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

.brand {
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 0 7px 22px;
  border-bottom: 1px solid var(--line-soft);
}

.brand-avatar {
  width: 50px;
  height: 46px;
  border: 1px solid oklch(0.82 0.16 83 / 0.48);
  border-radius: 50%;
  background: var(--surface-raised);
}

.brand-avatar img,
.mobile-brand img,
.message-avatar img,
.mascot-frame img,
.auth-mobile-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 31%;
  transform: none;
}

.brand-copy {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}

.brand-copy small {
  color: var(--faint);
  font-size: 0.66rem;
  font-weight: 600;
}

.brand-name {
  font-size: 0.97rem;
  letter-spacing: -0.01em;
}

.nav-list {
  gap: 6px;
  padding-top: 22px;
}

.nav-item {
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 680;
}

.nav-item:hover {
  border-color: var(--line-soft);
  background: var(--surface);
  color: var(--ink);
}

.nav-item.is-active {
  border-color: oklch(0.54 0.12 258 / 0.45);
  background: oklch(0.22 0.07 260);
  color: var(--ink);
}

.nav-item.is-active svg {
  color: var(--gold);
}

.side-foot {
  padding: 16px 8px 2px;
  border-top: 1px solid var(--line-soft);
}

.side-foot p {
  margin: 7px 0 0;
  color: var(--faint);
  font-size: 0.68rem;
  line-height: 1.6;
}

.online-dot {
  color: var(--muted);
  font-size: 0.71rem;
}

.workspace,
.view,
.chat-layout,
.chat-panel,
.match-rail {
  min-height: 100dvh;
}

.chat-layout {
  grid-template-columns: 310px minmax(0, 1fr);
  background: transparent;
}

.chat-panel {
  padding: 30px clamp(24px, 4vw, 58px) 24px;
}

.chat-intro {
  justify-content: space-between;
  gap: 28px;
  max-width: 920px;
  padding: 6px 0 18px;
}

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

.welcome-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  color: var(--gold);
  font-size: 0.8rem;
}

.welcome-line::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  content: "";
}

.chat-intro h1 {
  font-size: 2.35rem;
  line-height: 1.22;
  letter-spacing: -0.03em;
}

.chat-intro > div:first-child > p:last-child {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.mascot-frame {
  width: 112px;
  border: 1px solid oklch(0.45 0.08 257 / 0.62);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 6px 8px oklch(0 0 0 / 0.18);
}

.conversation-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(920px, 100%);
  margin: 0 auto 12px;
  padding: 10px 0;
  border-block: 1px solid var(--line-soft);
  color: var(--faint);
  font-size: 0.71rem;
}

.conversation-status span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.conversation-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px oklch(0.72 0.16 148 / 0.1);
}

.conversation {
  gap: 16px;
  width: min(920px, 100%);
  padding: 4px 0 24px;
}

.message {
  gap: 11px;
  max-width: 800px;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-color: oklch(0.82 0.16 83 / 0.42);
}

.message-content {
  padding: 15px 17px;
  border-color: var(--line-soft);
  border-radius: 13px 5px 13px 13px;
  background: var(--surface);
}

.message-content p {
  color: oklch(0.92 0.015 260);
  font-size: 0.9rem;
  line-height: 1.85;
}

.message-meta {
  margin-bottom: 5px;
}

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

.user-message .message-content {
  border-radius: 13px 13px 5px 13px;
  background: oklch(0.55 0.19 258);
}

.user-avatar {
  background: var(--surface-active);
}

.suggestions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding-inline-start: 51px;
}

.suggestions button {
  min-height: 54px;
  padding: 9px 12px;
  border-color: var(--line-soft);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
}

.suggestions button:hover {
  border-color: oklch(0.58 0.15 258 / 0.72);
  background: var(--surface);
}

.composer {
  bottom: 18px;
  width: min(920px, 100%);
  padding: 8px;
  border-color: oklch(0.47 0.08 258 / 0.82);
  border-radius: 14px;
  background: oklch(0.15 0.03 264 / 0.98);
  box-shadow: 0 8px 8px oklch(0 0 0 / 0.16);
}

.composer:focus-within {
  border-color: var(--primary-bright);
}

.composer textarea {
  min-height: 46px;
  padding: 11px 10px 8px;
  font-size: 0.9rem;
}

.composer textarea::placeholder {
  color: oklch(0.7 0.026 260);
}

.send-button {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  box-shadow: none;
}

.match-rail {
  gap: 12px;
  padding: 30px 18px 22px;
  border-inline-end: 1px solid var(--line-soft);
  background: oklch(0.105 0.02 264 / 0.86);
}

.rail-heading {
  min-height: 52px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.rail-heading p {
  color: var(--faint);
  font-size: 0.69rem;
}

.rail-heading h2 {
  font-size: 1.02rem;
}

.rail-match-list {
  gap: 9px;
  max-height: min(740px, calc(100vh - 240px));
  padding-inline-end: 0;
}

.mini-match {
  gap: 9px;
  padding: 14px;
  border-color: var(--line-soft);
  border-radius: 11px;
  background: oklch(0.135 0.025 264 / 0.76);
}

.mini-match:hover {
  border-color: oklch(0.58 0.14 258 / 0.64);
  background: var(--surface);
}

.competition {
  color: var(--faint);
  font-size: 0.69rem;
}

.mini-teams {
  justify-content: space-between;
}

.mini-teams > span {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-deep);
  font-size: 0.75rem;
}

.team-orb {
  width: 40px;
  height: 40px;
}

.team-names {
  font-size: 0.73rem;
}

.analyze-link {
  font-size: 0.7rem;
}

.all-matches-link {
  min-height: 42px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  color: var(--ink);
  font-size: 0.77rem;
}

.all-matches-link:hover {
  border-color: var(--primary);
  background: var(--surface);
}

/* Secondary views */
.page-heading {
  align-items: center;
  max-width: 1120px;
  padding: 42px clamp(24px, 5vw, 64px) 28px;
}

.page-heading p {
  color: var(--gold);
  font-size: 0.76rem;
}

.page-heading h1 {
  font-size: 2rem;
  letter-spacing: -0.025em;
}

.matches-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  max-width: 1050px;
  margin: 0 auto 16px;
  padding: 0 clamp(24px, 5vw, 64px);
}

.match-search {
  display: flex;
  flex: 1 1 420px;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--surface);
  transition:
    border-color var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out);
}

.match-search:focus-within {
  border-color: var(--primary-bright);
  background: var(--surface-raised);
}

.match-search svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  color: var(--muted);
}

.match-search input {
  width: 100%;
  min-width: 0;
  padding: 9px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
}

.match-search input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.matches-toolbar > p {
  flex: 0 0 auto;
  margin: 0;
  color: var(--faint);
  font-size: 0.74rem;
}

.fixtures-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: calc(100% - clamp(48px, 10vw, 128px));
  max-width: 922px;
  margin: 0 auto 14px;
  padding: 12px 14px;
  border: 1px solid oklch(0.65 0.12 80 / 0.45);
  border-radius: 10px;
  background: oklch(0.2 0.035 80 / 0.48);
}

.fixtures-status[hidden] {
  display: none;
}

.fixtures-status > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.fixtures-status strong {
  color: var(--ink);
  font-size: 0.82rem;
}

.fixtures-status small {
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.6;
}

.fixtures-status button,
.fixture-recovery button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--primary-bright);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
  cursor: pointer;
}

.fixtures-status button:hover,
.fixture-recovery button:hover {
  background: oklch(0.55 0.12 258 / 0.18);
}

.fixtures-status button:focus-visible,
.fixture-recovery button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.fixtures-status button:disabled,
.fixture-recovery button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 96px;
  padding: 22px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.loading-state::before {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  border: 2px solid var(--line);
  border-top-color: var(--primary-bright);
  border-radius: 50%;
  animation: auth-spin 760ms linear infinite;
  content: "";
}

.rail-match-list .loading-state {
  min-height: 180px;
}

.matches-list > .loading-state {
  min-height: 220px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: oklch(0.145 0.025 264);
}

.empty-state {
  min-height: 220px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: oklch(0.145 0.025 264);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.8;
}

.fixture-empty-state {
  align-content: center;
  gap: 4px;
}

.fixture-empty-state strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.fixture-empty-state p {
  max-width: 52ch;
  margin: 0;
}

.fixture-recovery {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 180px;
  padding: 24px;
  border: 1px solid oklch(0.52 0.14 25 / 0.5);
  border-radius: 12px;
  background: oklch(0.145 0.025 264);
}

.fixture-recovery > div {
  display: grid;
  gap: 5px;
}

.fixture-recovery strong {
  color: var(--ink);
  font-size: 1rem;
}

.fixture-recovery p {
  max-width: 52ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.7;
}

.fixture-recovery.is-compact {
  display: grid;
  min-height: 176px;
  padding: 18px;
  text-align: center;
}

.fixture-recovery.is-compact button {
  justify-self: center;
}

.date-switcher {
  padding: 3px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--surface);
}

.date-switcher button {
  border-radius: 7px;
}

.matches-list,
.saved-grid,
.settings-layout {
  max-width: 1050px;
}

.match-row,
.saved-prediction,
.settings-section {
  border-color: var(--line-soft);
  border-radius: 13px;
  background: oklch(0.145 0.025 264);
}

.match-row {
  padding: 18px 20px;
}

.match-row.featured-match {
  border-color: oklch(0.55 0.12 258 / 0.65);
  background: var(--surface);
}

.primary-action,
.secondary-action {
  min-height: 42px;
  border-radius: 8px;
}

.saved-prediction {
  padding: 22px;
}

.save-toggle {
  border-radius: 8px;
}

.settings-section {
  padding: 22px;
}

.trust-note {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--surface-raised);
}

/* Analysis output */
.match-analysis {
  padding: 20px;
  border-color: oklch(0.54 0.13 258 / 0.7);
  border-radius: 14px;
  background: oklch(0.14 0.028 264);
}

.analysis-head {
  padding-bottom: 16px;
}

.analysis-head h2 {
  font-size: 1.18rem;
}

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

.forecast-copy strong {
  font-size: 2.25rem;
}

.ordered-result,
.forecast-copy strong.ordered-result,
.metric-card strong.ordered-result {
  display: inline-flex;
  direction: rtl;
  align-items: baseline;
  justify-content: flex-start;
  gap: 0.18em;
  unicode-bidi: isolate;
}

.ordered-result i {
  font-style: normal;
}

.advanced-metrics {
  gap: 8px;
}

.metric-card {
  min-height: 98px;
  border-radius: 10px;
  background: var(--surface-raised);
}

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

.sponsor-card {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: minmax(180px, 0.72fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  width: 100%;
  min-height: 150px;
  padding: 10px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: oklch(0.145 0.025 264);
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 220ms var(--ease-out),
    transform 220ms var(--ease-out);
}

.sponsor-card.is-entering {
  opacity: 0;
  transform: translateY(8px);
}

.sponsor-visual {
  display: block;
  align-self: stretch;
  min-height: 130px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--surface-raised);
}

.sponsor-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% center;
  transition: transform 220ms var(--ease-out);
}

.sponsor-visual:hover img {
  transform: scale(1.018);
}

.sponsor-badge {
  width: fit-content;
  padding: 3px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--faint);
  font-size: 0.62rem;
  font-weight: 700;
  white-space: nowrap;
}

.sponsor-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-width: 0;
}

.sponsor-copy strong {
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 720;
  line-height: 1.45;
  text-wrap: balance;
}

.sponsor-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid oklch(0.7 0.15 82 / 0.72);
  border-radius: 9px;
  background: oklch(0.74 0.16 82);
  color: oklch(0.16 0.025 264);
  font-size: 0.78rem;
  font-weight: 760;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.sponsor-cta:hover {
  background: oklch(0.79 0.15 82);
  transform: translateY(-1px);
}

.sponsor-visual:focus-visible,
.sponsor-cta:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* Account-backed conversation history */
.side-nav > .new-chat-button {
  margin-top: 16px;
}

.new-chat-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid oklch(0.57 0.12 258 / 0.58);
  border-radius: 10px;
  background: oklch(0.2 0.055 261);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 760;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out);
}

.new-chat-button:hover {
  border-color: oklch(0.68 0.14 255 / 0.82);
  background: oklch(0.24 0.068 260);
}

.new-chat-button svg {
  width: 18px;
  height: 18px;
  color: var(--gold);
}

.new-chat-button.is-loading {
  color: var(--muted);
}

.conversation-history {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 128px;
  margin-top: 17px;
  overflow: hidden;
}

.conversation-history > header,
.mobile-conversations-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 0 5px 7px;
}

.conversation-history h2,
.mobile-conversations-head strong {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 760;
}

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

.conversation-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
  padding-inline-end: 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.conversation-item {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 44px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: start;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.conversation-item:hover {
  border-color: var(--line-soft);
  background: var(--surface);
  color: var(--ink);
}

.conversation-item.is-active {
  border-color: oklch(0.52 0.11 258 / 0.42);
  background: oklch(0.2 0.05 261);
  color: var(--ink);
}

.conversation-item strong,
.conversation-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-item strong {
  font-size: 0.73rem;
  font-weight: 680;
}

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

.conversation-list-loading {
  display: grid;
  gap: 9px;
  padding: 8px 6px;
}

.conversation-list-loading i {
  display: block;
  width: 88%;
  height: 12px;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--surface) 28%, var(--surface-raised) 48%, var(--surface) 68%);
  background-size: 240% 100%;
  animation: conversation-skeleton 1.35s linear infinite;
}

.conversation-list-loading i:nth-child(2) { width: 73%; }
.conversation-list-loading i:nth-child(3) { width: 81%; }

@keyframes conversation-skeleton {
  to { background-position: -240% 0; }
}

.conversation-list-note {
  display: grid;
  justify-items: start;
  gap: 7px;
  padding: 10px 7px;
  color: var(--faint);
  font-size: 0.67rem;
  line-height: 1.6;
}

.conversation-list-note button {
  min-height: 36px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.67rem;
}

.side-nav .nav-list {
  flex: 0 0 auto;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.side-nav .side-foot {
  flex: 0 0 auto;
  margin-top: 10px;
}

.conversation-load-state {
  display: grid;
  gap: 13px;
  width: min(720px, 100%);
  margin: auto;
  padding: 28px 0;
}

.conversation-load-state i {
  display: block;
  width: 82%;
  height: 14px;
  border-radius: 5px;
  background: var(--surface-raised);
}

.conversation-load-state i:nth-child(2) { width: 58%; }
.conversation-load-state i:nth-child(3) { width: 71%; }

.conversation-open-error {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: auto;
  padding: 30px 18px;
  color: var(--muted);
  text-align: center;
}

.conversation-open-error strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.conversation-open-error button {
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
}

.conversation-save-warning {
  margin-top: 9px;
  color: oklch(0.78 0.08 50);
  font-size: 0.68rem;
  line-height: 1.55;
}

.mobile-brand-copy {
  display: grid;
  min-width: 0;
  line-height: 1.18;
}

.mobile-brand-copy small {
  display: block;
  max-width: 38vw;
  overflow: hidden;
  color: var(--faint);
  font-size: 0.61rem;
  font-weight: 560;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .chat-layout {
    grid-template-columns: 1fr;
    grid-template-areas: "chat";
  }

  .match-rail {
    display: none;
  }

  .chat-panel {
    padding-inline: clamp(30px, 7vw, 90px);
  }
}

@media (max-width: 900px) and (min-width: 821px) {
  :root {
    --sidebar-width: 190px;
  }

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

@media (max-width: 820px) {
  body {
    background: var(--bg);
  }

  .auth-stage {
    display: flex;
    flex-direction: column;
  }

  .auth-story {
    display: grid;
    grid-template-columns: 1fr 132px;
    gap: 12px;
    min-height: 238px;
    padding: 20px;
  }

  .auth-brand {
    grid-column: 1 / -1;
  }

  .auth-mascot {
    grid-column: 2;
    grid-row: 2 / span 2;
    width: 132px;
    margin: 0;
  }

  .auth-promise {
    grid-column: 1;
    grid-row: 2;
  }

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

  .auth-promise p {
    display: none;
  }

  .auth-features {
    grid-column: 1;
    grid-row: 3;
    display: flex;
    gap: 8px;
    margin: 0;
    font-size: 0.67rem;
  }

  .auth-features span:not(:first-child) {
    display: none;
  }

  .auth-panel {
    flex: 1;
    min-height: calc(100svh - 238px);
    padding: 34px 20px max(30px, env(safe-area-inset-bottom));
  }

  .auth-content {
    margin: auto;
  }

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

  .app-shell {
    padding-bottom: 68px;
  }

  .mobile-topbar {
    height: 62px;
    padding: 6px 14px;
    background: oklch(0.095 0.02 264 / 0.98);
  }

  .mobile-brand img {
    width: 46px;
    height: 40px;
  }

  .icon-button {
    width: 40px;
    height: 40px;
    border-radius: 9px;
  }

  .mobile-menu {
    top: 58px;
  }

  .bottom-nav {
    height: 68px;
    background: oklch(0.095 0.02 264 / 0.99);
  }

  .workspace,
  .view {
    min-height: calc(100svh - 68px);
  }

  .chat-panel {
    min-height: calc(100svh - 130px);
    padding: 16px 14px 10px;
  }

  .chat-intro {
    gap: 14px;
    padding: 2px 2px 12px;
  }

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

  .chat-intro > div:first-child > p:last-child {
    display: block;
    max-width: 40ch;
    font-size: 0.77rem;
    line-height: 1.65;
  }

  .mascot-frame {
    width: 76px;
  }

  .conversation-status {
    margin-bottom: 9px;
  }

  .conversation-status small {
    display: none;
  }

  .conversation {
    gap: 13px;
    padding-bottom: 112px;
  }

  .suggestions {
    display: flex;
    gap: 8px;
    padding: 0 0 3px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  .suggestions button,
  .suggestions button:last-child {
    display: flex;
    min-width: min(260px, 76vw);
    min-height: 52px;
    scroll-snap-align: start;
  }

  .composer {
    right: 12px;
    bottom: 76px;
    left: 12px;
    padding: 7px;
  }

  .page-heading {
    padding: 24px 16px 20px;
  }

  .page-heading h1 {
    font-size: 1.75rem;
  }

  .matches-list,
  .saved-grid,
  .settings-layout {
    padding-inline: 14px;
  }
}

@media (max-width: 560px) {
  .auth-story {
    grid-template-columns: 1fr 100px;
    min-height: 205px;
    padding: 16px;
  }

  .auth-mascot {
    width: 100px;
  }

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

  .auth-panel {
    min-height: calc(100svh - 205px);
    padding: 26px 16px max(26px, env(safe-area-inset-bottom));
  }

  .auth-heading {
    margin-bottom: 22px;
  }

  .auth-heading h2 {
    max-width: 18ch;
    font-size: 1.35rem;
  }

  .auth-form input,
  .auth-submit {
    min-height: 54px;
  }

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

  .chat-intro > div:first-child > p:last-child {
    display: none;
  }

  .welcome-line {
    font-size: 0.72rem;
  }

  .mascot-frame {
    width: 68px;
  }

  .message-avatar {
    width: 34px;
    height: 34px;
  }

  .message-content {
    padding: 12px 13px;
  }

  .message-content p {
    font-size: 0.84rem;
  }

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

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

/* Mobile conversation shell — one viewport, one scrollport. */
@media (max-width: 820px) {
  :root {
    --mobile-nav-height: calc(64px + env(safe-area-inset-bottom));
  }

  body.keyboard-open {
    overflow: hidden;
  }

  .auth-gate {
    min-height: var(--app-visible-height, 100dvh);
    overflow-y: auto;
  }

  .auth-form input {
    font-size: 16px;
  }

  .app-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: var(--app-visible-height, 100dvh);
    min-height: 0;
    max-height: var(--app-visible-height, 100dvh);
    padding-bottom: 0;
    overflow: hidden;
  }

  .side-nav {
    display: none;
  }

  .workspace {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 0;
    overflow: hidden;
  }

  .mobile-topbar {
    position: static;
    top: auto;
    flex: 0 0 auto;
    min-height: 62px;
    height: auto;
    padding-top: max(6px, env(safe-area-inset-top));
  }

  .mobile-menu {
    top: calc(56px + env(safe-area-inset-top));
  }

  .workspace > .view {
    flex: 1 1 auto;
    width: 100%;
    height: auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  #view-analyzer {
    overflow: hidden;
  }

  .chat-layout,
  .chat-panel {
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .chat-layout {
    display: block;
  }

  .chat-panel {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
  }

  .chat-intro {
    flex: 0 0 auto;
    width: auto;
    margin: 0 14px;
    padding: 12px 2px 10px;
  }

  .conversation-status {
    flex: 0 0 auto;
    width: auto;
    margin: 0 14px 7px;
    padding-block: 8px;
  }

  body.has-conversation .chat-intro,
  body.has-conversation .conversation-status,
  body.keyboard-open .chat-intro,
  body.keyboard-open .conversation-status {
    display: none;
  }

  .conversation {
    flex: 1 1 auto;
    gap: 16px;
    width: 100%;
    min-height: 0;
    margin: 0;
    padding: 14px 16px 12px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scroll-padding-block: 14px;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  .message {
    width: 100%;
    max-width: none;
    gap: 0;
  }

  .assistant-message {
    display: block;
  }

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

  .assistant-message .message-content {
    width: 100%;
    max-width: none;
    padding: 7px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .assistant-message .message-content p {
    max-width: 72ch;
    color: var(--ink);
    font-size: 1rem;
    line-height: 1.82;
    text-align: start;
  }

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

  .assistant-message .message-meta strong {
    font-size: 0.76rem;
  }

  .assistant-message .message-meta span {
    display: none;
  }

  .user-message {
    display: block;
    width: fit-content;
    max-width: 84%;
  }

  .user-message .message-content {
    width: auto;
    padding: 9px 14px;
    border-radius: 18px 18px 5px 18px;
    background: oklch(0.55 0.19 258);
  }

  .user-message .message-content p {
    font-size: 1rem;
    line-height: 1.65;
    text-align: start;
  }

  .typing-message .message-content {
    width: auto;
    min-width: 54px;
    min-height: 34px;
    padding-block: 8px;
  }

  .inline-actions button {
    min-height: 44px;
    text-align: start;
  }

  .suggestions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
    padding: 0;
    overflow: visible;
    scroll-snap-type: none;
  }

  .suggestions button,
  .suggestions button:last-child {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 9px 12px;
    scroll-snap-align: none;
  }

  .suggestions button:last-child {
    display: none;
  }

  .composer {
    position: static;
    right: auto;
    bottom: auto;
    left: auto;
    z-index: 10;
    flex: 0 0 auto;
    width: auto;
    margin: 8px 12px 9px;
    padding: 7px;
    border-radius: 18px;
    box-shadow: none;
  }

  .composer textarea {
    min-height: 44px;
    max-height: 120px;
    padding: 10px 9px 7px;
    font-size: 16px;
    line-height: 1.5;
  }

  .send-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
  }

  .bottom-nav {
    position: static;
    right: auto;
    bottom: auto;
    left: auto;
    flex: 0 0 var(--mobile-nav-height);
    width: 100%;
    height: var(--mobile-nav-height);
    min-height: var(--mobile-nav-height);
    padding-bottom: max(4px, env(safe-area-inset-bottom));
  }

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

  .matches-toolbar {
    display: grid;
    gap: 8px;
    max-width: none;
    margin-bottom: 12px;
    padding: 0 14px;
  }

  .match-search {
    width: 100%;
    min-height: 48px;
  }

  .match-search input {
    font-size: 16px;
  }

  .matches-toolbar > p {
    padding-inline: 2px;
  }

  .fixtures-status {
    align-items: stretch;
    width: auto;
    margin: 0 14px 12px;
  }

  .fixtures-status button {
    min-height: 44px;
  }

  .fixture-recovery {
    display: grid;
    gap: 14px;
    min-height: 220px;
    text-align: center;
  }

  .fixture-recovery button {
    justify-self: center;
    min-height: 44px;
  }

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

  .sponsor-visual {
    min-height: 100px;
    aspect-ratio: 1 / 1;
  }

  .sponsor-copy {
    gap: 8px;
  }

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

  .sponsor-cta {
    grid-column: 1 / -1;
    width: 100%;
  }

  .team-names,
  .match-clubs,
  .suggestions span,
  .message-content p {
    unicode-bidi: plaintext;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-submit:hover,
  .send-button:hover,
  .primary-action:hover {
    transform: none;
  }

  .sponsor-card,
  .sponsor-visual img,
  .sponsor-cta {
    transition: none;
  }

  .sponsor-card.is-entering,
  .sponsor-cta:hover {
    transform: none;
  }

  .conversation-list-loading i {
    animation: none;
  }
}

@media (max-width: 820px) {
  .mobile-menu {
    position: fixed;
    top: calc(58px + env(safe-area-inset-top));
    right: 10px;
    bottom: calc(var(--mobile-nav-height) + 8px);
    left: auto;
    z-index: 50;
    width: min(352px, calc(100vw - 20px));
    max-height: none;
    padding: 14px;
    overflow: hidden;
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    background: oklch(0.105 0.022 264);
    box-shadow: 0 7px 8px oklch(0 0 0 / 0.34);
  }

  .mobile-menu:not([hidden]) {
    display: flex;
    flex-direction: column;
  }

  .mobile-menu > .new-chat-button {
    flex: 0 0 auto;
    margin-bottom: 10px;
    border: 1px solid oklch(0.57 0.12 258 / 0.58);
    background: oklch(0.2 0.055 261);
    text-align: center;
  }

  .mobile-menu .conversation-list {
    flex: 1 1 auto;
    min-height: 110px;
    padding-bottom: 10px;
  }

  .mobile-menu .conversation-item {
    min-height: 48px;
    padding: 8px 10px;
  }

  .mobile-menu .conversation-item strong {
    font-size: 0.78rem;
  }

  .mobile-menu-links {
    display: grid;
    flex: 0 0 auto;
    gap: 2px;
    padding-top: 10px;
    border-top: 1px solid var(--line-soft);
  }

  .mobile-menu-links button {
    min-height: 42px;
  }

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