/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
* { -webkit-tap-highlight-color: transparent; }

html {
  height: 100%;
  overflow: hidden;
}

/* ── Color tokens ───────────────────────────────────────────────── */
:root {
  --n-0:   #ffffff;
  --n-50:  #F8F7F4;
  --n-100: #EDECEA;
  --n-150: #E2E0DC;
  --n-200: #CFCDC8;
  --n-300: #B0ADA7;
  --n-400: #8E8B84;
  --n-500: #6B6861;
  --n-600: #4E4C46;
  --n-700: #353330;
  --n-800: #201E1C;
  --n-900: #131210;
  --n-950: #0C0B09;
}

/* ── Light theme ────────────────────────────────────────────────── */
:root {
  --bg:             var(--n-50);
  --dot:            var(--n-150);
  --surface:        var(--n-0);
  --surface-raised: var(--n-50);
  --border:         var(--n-150);
  --border-faint:   var(--n-100);
  --text:           var(--n-900);
  --text-secondary: var(--n-600);
  --text-muted:     var(--n-400);
  --hover-bg:       var(--n-50);

  --user-bg:        var(--n-900);
  --user-text:      var(--n-0);

  --bot-bg:         var(--n-0);
  --bot-text:       var(--n-800);
  --bot-border:     var(--n-150);
  --bot-shadow:     0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.05);

  --input-bg:       var(--n-0);
  --input-ring:     rgb(0 0 0 / 0.055);

  --btn-bg:         var(--n-900);
  --btn-hover:      var(--n-700);
  --btn-text:       var(--n-0);

  --chip-bg:        var(--n-0);
  --chip-border:    var(--n-200);
  --chip-text:      var(--n-500);
  --chip-hover-bg:  var(--n-50);
  --chip-text-hover:var(--n-900);
  --chip-border-hover: var(--n-300);

  --tag-bg:         var(--n-100);
  --tag-text:       var(--n-400);
  --tag-border:     var(--n-150);

  --typing-base:    var(--n-200);
  --typing-peak:    var(--n-400);
  --scroll-thumb:   var(--n-200);
  --scroll-hover:   var(--n-300);
}

/* ── Dark theme ─────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:             #0B0B0D;
  --dot:            #141416;
  --surface:        #101012;
  --surface-raised: #141416;
  --border:         #222226;
  --border-faint:   #1A1A1E;
  --text:           #EEEDF0;
  --text-secondary: #88888F;
  --text-muted:     #48484F;
  --hover-bg:       #18181C;

  --user-bg:        #EEEDF0;
  --user-text:      #101012;

  --bot-bg:         #141416;
  --bot-text:       #CCCAD0;
  --bot-border:     #222226;
  --bot-shadow:     0 1px 3px rgb(0 0 0 / 0.35), 0 4px 16px rgb(0 0 0 / 0.25);

  --input-bg:       #141416;
  --input-ring:     rgb(255 255 255 / 0.035);

  --btn-bg:         #EEEDF0;
  --btn-hover:      #D4D2D8;
  --btn-text:       #101012;

  --chip-bg:        #141416;
  --chip-border:    #28282C;
  --chip-text:      #5A5A62;
  --chip-hover-bg:  #1C1C20;
  --chip-text-hover:#EEEDF0;
  --chip-border-hover: #38383E;

  --tag-bg:         #1C1C20;
  --tag-text:       #48484F;
  --tag-border:     #222226;

  --typing-base:    #28282C;
  --typing-peak:    #58585F;
  --scroll-thumb:   #28282C;
  --scroll-hover:   #38383E;
}

/* ── Smooth theme transitions ───────────────────────────────────── */
body, .chat-container, header, .chat-window, .input-wrapper,
.input-row, .message, .theme-toggle, input, #send-btn,
.brand-icon, .brand-badge, .empty-tag, .suggestion-chip {
  transition:
    background-color 0.22s ease,
    border-color 0.22s ease,
    color 0.22s ease,
    box-shadow 0.22s ease;
}

/* ── Base ───────────────────────────────────────────────────────── */
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 20px 20px;
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Chat container ─────────────────────────────────────────────── */
.chat-container {
  width: 100%;
  max-width: 700px;
  height: 90vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow:
    0 0 0 1px var(--border-faint),
    0 8px 20px -4px rgb(0 0 0 / 0.08),
    0 32px 80px -12px rgb(0 0 0 / 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────────────── */
header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-faint);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  background: var(--surface-raised);
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.brand-text h1 {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 1.0625rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1;
}

.brand-badge {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.025em;
  color: var(--tag-text);
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.6;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
  animation: pulse-status 2.6s ease-in-out infinite;
}

@keyframes pulse-status {
  0%, 100% { box-shadow: 0 0 0 0 rgb(34 197 94 / 0.45); }
  50%       { box-shadow: 0 0 0 4px rgb(34 197 94 / 0); }
}

.status-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Theme toggle ───────────────────────────────────────────────── */
.theme-toggle {
  width: 30px;
  height: 30px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  padding: 0;
}

.theme-toggle:hover  { background: var(--hover-bg); color: var(--text); }
.theme-toggle:active { transform: scale(0.9); }

/* ── Toggle icon fix: show exactly one icon at a time ── */
.icon-moon { display: block; }
.icon-sun  { display: none;  }
[data-theme="dark"] .icon-sun  { display: block; }
[data-theme="dark"] .icon-moon { display: none;  }

/* ── Chat window ────────────────────────────────────────────────── */
.chat-window {
  flex: 1;
  padding: 24px 22px 16px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  min-height: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.chat-window.is-empty {
  justify-content: center;
  align-items: center;
}

.chat-window::-webkit-scrollbar        { width: 3px; }
.chat-window::-webkit-scrollbar-track  { background: transparent; }
.chat-window::-webkit-scrollbar-thumb  { background: var(--scroll-thumb); border-radius: 999px; }
.chat-window::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); }

/* ── Empty state ────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 360px;
  animation: fade-up 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.empty-icon {
  width: 54px;
  height: 54px;
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 22px;
  background: var(--surface-raised);
}

.empty-heading {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 1.75rem;
  font-weight: 400;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 10px;
}

.empty-sub {
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--text-muted);
  margin-bottom: 22px;
}

.empty-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.empty-tag {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--tag-text);
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  padding: 4px 10px;
  border-radius: 999px;
}

/* ── Message entrance ───────────────────────────────────────────── */
@keyframes message-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Messages ───────────────────────────────────────────────────── */
.message {
  max-width: 86%;
  border-radius: 14px;
  font-size: 0.875rem;
  line-height: 1.7;
  animation: message-in 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.user-msg {
  background: var(--user-bg);
  color: var(--user-text);
  align-self: flex-end;
  padding: 10px 15px;
  border-bottom-right-radius: 4px;
  font-weight: 500;
  letter-spacing: -0.005em;
}

.bot-msg {
  background: var(--bot-bg);
  color: var(--bot-text);
  border: 1px solid var(--bot-border);
  align-self: flex-start;
  padding: 14px 17px;
  border-bottom-left-radius: 4px;
  box-shadow: var(--bot-shadow);
}

/* ── Markdown inside bot messages ───────────────────────────────── */
.bot-msg > *:first-child { margin-top: 0 !important; }
.bot-msg > *:last-child  { margin-bottom: 0 !important; }

.bot-msg p {
  margin: 0 0 0.6em;
  font-size: 0.875rem;
}

.bot-msg h2 {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 1.0625rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 1.1em 0 0.4em;
  line-height: 1.3;
}

.bot-msg h3 {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 1.1em 0 0.35em;
}

.bot-msg h4 {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text);
  margin: 0.85em 0 0.3em;
}

.bot-msg strong {
  font-weight: 600;
  color: var(--text);
}

.bot-msg em {
  font-style: italic;
  color: var(--text-secondary);
}

.bot-msg ul, .bot-msg ol {
  padding-left: 1.3em;
  margin: 0 0 0.6em;
}

.bot-msg li {
  margin-bottom: 0.25em;
  font-size: 0.875rem;
  line-height: 1.65;
}

.bot-msg li:last-child { margin-bottom: 0; }

.bot-msg hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1em 0;
}

.bot-msg code {
  font-family: ui-monospace, 'Cascadia Code', 'Fira Code', monospace;
  font-size: 0.775rem;
  background: var(--hover-bg);
  color: var(--text);
  padding: 0.15em 0.45em;
  border-radius: 5px;
  border: 1px solid var(--border-faint);
}

.bot-msg a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--border);
}
.bot-msg a:hover { text-decoration-color: var(--text-muted); }

/* ── Player cards ───────────────────────────────────────────────── */
.cards-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: stretch;
  animation: message-in 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.player-card {
  background: var(--bot-bg);
  border: 1px solid var(--bot-border);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--bot-shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.player-card.is-query {
  background: var(--surface-raised);
  border-style: dashed;
  border-color: var(--border);
}

.card-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: flex-start;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.card-id { min-width: 0; }

.card-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rank-pill {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--n-900);
  color: var(--n-0);
  line-height: 1.4;
}

[data-theme="dark"] .rank-pill {
  background: #EEEDF0;
  color: #101012;
}

.rank-pill.rank-top {
  background: #16a34a;
  color: #fff;
  letter-spacing: 0.08em;
}

[data-theme="dark"] .rank-pill.rank-top {
  background: #22c55e;
  color: #0B0B0D;
}

.card-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
}

.card-pos {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 3px;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.meta-sep {
  color: var(--text-muted);
  opacity: 0.6;
}

.meta-nation {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  color: var(--text);
}

.flag {
  width: 18px;
  height: 13.5px;
  border-radius: 2px;
  border: 1px solid var(--border-faint);
  display: inline-block;
  object-fit: cover;
}

.meta-league {
  color: var(--text-muted);
}

.card-sub {
  margin-top: 4px;
  font-size: 0.7125rem;
  color: var(--text-muted);
  letter-spacing: 0.005em;
}

/* ── Match badge (top-right) ────────────────────────────────────── */
.match-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  flex-shrink: 0;
  text-align: center;
}

.badge-pct {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text);
}

.badge-label {
  font-size: 0.575rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.2;
}

.badge-exceptional { background: rgb(34 197 94 / 0.10); border-color: rgb(34 197 94 / 0.35); }
.badge-exceptional .badge-pct { color: #16a34a; }
[data-theme="dark"] .badge-exceptional { background: rgb(34 197 94 / 0.14); border-color: rgb(34 197 94 / 0.4); }
[data-theme="dark"] .badge-exceptional .badge-pct { color: #4ade80; }

.badge-strong { background: rgb(59 130 246 / 0.09); border-color: rgb(59 130 246 / 0.32); }
.badge-strong .badge-pct { color: #2563eb; }
[data-theme="dark"] .badge-strong { background: rgb(59 130 246 / 0.14); border-color: rgb(59 130 246 / 0.4); }
[data-theme="dark"] .badge-strong .badge-pct { color: #60a5fa; }

.badge-good { background: rgb(168 85 247 / 0.09); border-color: rgb(168 85 247 / 0.30); }
.badge-good .badge-pct { color: #9333ea; }
[data-theme="dark"] .badge-good { background: rgb(168 85 247 / 0.14); border-color: rgb(168 85 247 / 0.4); }
[data-theme="dark"] .badge-good .badge-pct { color: #c084fc; }

.badge-moderate { background: var(--tag-bg); border-color: var(--tag-border); }
.badge-moderate .badge-pct { color: var(--text-secondary); }

.badge-query .badge-pct {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* ── Stats grid ─────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 1px;
  background: var(--border-faint);
  border: 1px solid var(--border-faint);
  border-radius: 8px;
  overflow: hidden;
}

.stat-cell {
  background: var(--bot-bg);
  padding: 7px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.is-query .stat-cell { background: var(--surface-raised); }

.stat-key {
  font-size: 0.6125rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-val {
  font-family: ui-monospace, 'Cascadia Code', 'Fira Code', monospace;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ── Radar chart ────────────────────────────────────────────────── */
.radar-block {
  background: var(--bot-bg);
  border: 1px solid var(--bot-border);
  border-radius: 14px;
  padding: 14px 16px 6px;
  box-shadow: var(--bot-shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.radar-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 4px;
}

.radar-title {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.radar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.legend-item .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.dot-query { background: #94a3b8; }
.dot-clone { background: #16a34a; }
[data-theme="dark"] .dot-query { background: #64748b; }
[data-theme="dark"] .dot-clone { background: #22c55e; }

.radar-svg-wrap {
  display: flex;
  justify-content: center;
}

.radar-svg {
  width: 100%;
  max-width: 360px;
  height: auto;
}

.radar-ring {
  fill: none;
  stroke: var(--border-faint);
  stroke-width: 0.6;
}

.radar-axis {
  stroke: var(--border-faint);
  stroke-width: 0.5;
}

.radar-label {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  fill: var(--text-muted);
}

.radar-poly {
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.poly-query {
  fill: rgba(148, 163, 184, 0.14);
  stroke: #94a3b8;
}

.poly-clone {
  fill: rgba(22, 163, 74, 0.20);
  stroke: #16a34a;
}

[data-theme="dark"] .poly-query {
  fill: rgba(100, 116, 139, 0.18);
  stroke: #64748b;
}

[data-theme="dark"] .poly-clone {
  fill: rgba(34, 197, 94, 0.22);
  stroke: #22c55e;
}

/* ── Typing indicator ───────────────────────────────────────────── */
.typing-indicator {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 14px 18px;
}

.typing-indicator span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--typing-base);
  animation: dot-bounce 1.35s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.18s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.36s; }

@keyframes dot-bounce {
  0%, 60%, 100% { transform: translateY(0);    background: var(--typing-base); }
  30%           { transform: translateY(-4px); background: var(--typing-peak); }
}

/* ── Input wrapper ──────────────────────────────────────────────── */
.input-wrapper {
  padding: 12px 16px 13px;
  border-top: 1px solid var(--border-faint);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex-shrink: 0;
}

/* ── Suggestion chips ───────────────────────────────────────────── */
.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.suggestions.hidden { display: none; }

.suggestion-chip {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--chip-text);
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.14s ease,
    color 0.14s ease,
    border-color 0.14s ease,
    transform 0.12s ease;
}

.suggestion-chip:hover {
  background: var(--chip-hover-bg);
  color: var(--chip-text-hover);
  border-color: var(--chip-border-hover);
  transform: translateY(-1px);
}

.suggestion-chip:active { transform: translateY(0); }

/* ── Input row ──────────────────────────────────────────────────── */
.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 5px 5px 5px 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-row:focus-within {
  border-color: var(--text-muted);
  box-shadow: 0 0 0 3px var(--input-ring);
}

input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.875rem;
  color: var(--text);
  padding: 7px 0;
  min-width: 0;
}

input::placeholder { color: var(--text-muted); }

/* ── Send button ────────────────────────────────────────────────── */
#send-btn {
  width: 34px;
  height: 34px;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.14s ease, transform 0.1s ease;
}

#send-btn:hover  { background: var(--btn-hover); }
#send-btn:active { transform: scale(0.91); }

/* ── Disclaimer ─────────────────────────────────────────────────── */
.input-disclaimer {
  font-size: 0.6625rem;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.01em;
  opacity: 0.7;
}

/* ════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════════ */

/* ── Tablet (≤ 860px) ───────────────────────────────────────────── */
@media (max-width: 860px) {
  body { align-items: center; }

  .chat-container {
    /* max-width limits width; centering handled by body flex */
    max-width: calc(100% - 32px);   /* 16px breathing room each side — no overflow */
    height: 92dvh;
  }
}

/* ── Mobile (≤ 600px) ───────────────────────────────────────────── */
@media (max-width: 600px) {
  body {
    align-items: stretch;
    background-image: none;
    padding: 0;
  }

  .chat-container {
    max-width: 100%;
    height: 100dvh;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    box-shadow: none;
  }

  /* ── Header ── */
  header { padding: 10px 14px; }
  .brand-badge  { display: none; }
  .status-label { display: none; }

  /* ── Chat window ── */
  .chat-window {
    padding: 18px 14px 12px;
    gap: 10px;
  }

  /* ── Empty state ── */
  .empty-state {
    max-width: 300px;
    padding: 0 8px;
  }

  .empty-icon {
    width: 46px;
    height: 46px;
    margin-bottom: 16px;
    border-radius: 12px;
  }

  .empty-heading {
    font-size: 1.4375rem;
    margin-bottom: 8px;
  }

  .empty-sub {
    font-size: 0.75rem;
    margin-bottom: 16px;
  }

  .empty-tags { gap: 5px; }

  /* ── Messages ── */
  .message {
    max-width: 93%;
    font-size: 0.8375rem;
  }

  .bot-msg { padding: 12px 14px; }

  .bot-msg p,
  .bot-msg li { font-size: 0.8375rem; }

  /* ── Cards on mobile ── */
  .player-card { padding: 12px 13px; gap: 10px; }
  .card-top { gap: 10px; }
  .avatar { width: 38px; height: 38px; border-radius: 10px; font-size: 0.8125rem; }
  .card-name { font-size: 0.9rem; }
  .card-meta { font-size: 0.75rem; gap: 5px; }
  .card-sub { font-size: 0.6875rem; }

  .match-badge { min-width: 56px; padding: 5px 8px; }
  .badge-pct   { font-size: 0.85rem; }
  .badge-label { font-size: 0.55rem; }

  /* 8-col grid → 4-col on mobile */
  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stat-cell { padding: 6px 3px; }
  .stat-val  { font-size: 0.75rem; }

  /* Radar on mobile */
  .radar-block { padding: 12px 12px 4px; }
  .radar-svg   { max-width: 100%; }
  .radar-label { font-size: 9px; }
  .radar-legend { gap: 12px; font-size: 0.72rem; }

  /* ── Suggestions: scroll horizontally, no wrap ── */
  .suggestions {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 2px;
  }

  .suggestions::-webkit-scrollbar { display: none; }

  .suggestion-chip {
    flex-shrink: 0;
    font-size: 0.7rem;
    padding: 5px 11px;
  }

  /* ── Input ── */
  .input-wrapper {
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    gap: 8px;
  }

  .input-row {
    border-radius: 10px;
    padding: 4px 4px 4px 13px;
  }

  /* ≥ 16px prevents iOS auto-zoom on input focus */
  input { font-size: 1rem; }

  .input-disclaimer { display: none; }
}

/* ── Small phones (≤ 380px) ─────────────────────────────────────── */
@media (max-width: 380px) {
  .brand-text h1 { font-size: 0.9375rem; }
  .empty-heading { font-size: 1.25rem; }

  .empty-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    margin-bottom: 14px;
  }

  .empty-tag { font-size: 0.625rem; padding: 3px 8px; }
  .message   { max-width: 96%; }
}
