/* ============================================================
   HyveChain AI Assistant — design tokens & layout
   ============================================================ */
:root {
  --bg: #070605;
  --panel: #0e0d0a;
  --ink: #f2ede1;
  --ink-soft: #b3ab9c;
  --ink-faint: #857d6e;
  --ink-dim: #6b6355;
  --gold: #e8b23a;
  --gold-hi: #f5cd6b;
  --gold-lo: #d99a1e;
  --green: #6fce7e;
  --discord: #5865F2;
  --font-ui: 'Space Grotesk', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-ui); -webkit-font-smoothing: antialiased; overflow: hidden; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-hi); }
::selection { background: var(--gold); color: #0a0908; }
input::placeholder { color: var(--ink-dim); }

@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .2; } }
@keyframes pulse { 0%,100% { opacity: .45; transform: scale(1); } 50% { opacity: .85; transform: scale(1.06); } }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
@keyframes dots { 0%,60%,100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes drift { 0% { transform: translateY(30vh) rotate(0); opacity: 0; } 12% { opacity: var(--o, .5); } 85% { opacity: var(--o, .5); } 100% { transform: translateY(-110vh) rotate(160deg); opacity: 0; } }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes sweep { 0% { left: -30%; } 100% { left: 130%; } }

/* height:100dvh keeps the layout correct under the mobile URL bar; app.js also
   pins it to visualViewport.height so the composer stays above the keyboard. */
.app { position: fixed; top: 0; left: 0; right: 0; height: 100%; height: 100dvh;
  display: flex; flex-direction: column; overflow: hidden; }

/* ---- ambient background ---- */
.bg-grid { position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(232,178,58,.06) 1px, transparent 1px); background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black, transparent);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black, transparent); }
.bg-glow { position: absolute; border-radius: 50%; pointer-events: none; }
.bg-glow--top { top: -340px; left: 50%; margin-left: -420px; width: 840px; height: 840px;
  background: radial-gradient(circle, rgba(232,178,58,.13), rgba(232,178,58,.03) 45%, transparent 70%); animation: pulse 7s ease-in-out infinite; }
.bg-glow--bottom { bottom: -300px; right: -200px; width: 640px; height: 640px;
  background: radial-gradient(circle, rgba(232,178,58,.07), transparent 65%); }
.bg-ring { position: absolute; top: 50%; left: 50%; border-radius: 50%; pointer-events: none; }
.bg-ring--inner { width: 760px; height: 760px; margin: -380px 0 0 -380px; border: 1px dashed rgba(232,178,58,.14); animation: spin 90s linear infinite; }
.bg-ring--outer { width: 980px; height: 980px; margin: -490px 0 0 -490px; border: 1px solid rgba(232,178,58,.07); animation: spin 140s linear infinite reverse; }
.hexfield { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.hexfield span { position: absolute; bottom: -60px; color: rgba(232,178,58,.45); animation: drift linear infinite; }

/* ---- nav ---- */
.nav { position: relative; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 10px 28px; background: rgba(10,9,7,.85); backdrop-filter: blur(14px); border-bottom: 1px solid rgba(232,178,58,.22); }
.nav__brand { display: flex; align-items: center; gap: 13px; }
.nav__title { font-size: 19px; font-weight: 700; letter-spacing: .02em; }
.nav__title span { color: var(--gold-hi); }
.nav__sub { font-family: var(--font-mono); font-size: 10px; letter-spacing: .3em; color: var(--ink-faint); margin-top: 3px; white-space: nowrap; }
.nav__links { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 600; }

.logo-glow { position: relative; width: 44px; height: 44px; }
.logo-glow::before { content: ''; position: absolute; inset: -7px; border-radius: 50%; background: radial-gradient(circle, rgba(232,178,58,.4), transparent 70%); }
.logo-glow img { position: relative; width: 100%; height: 100%; display: block; }
.logo-glow--pulse { width: 34px; height: 34px; }
.logo-glow--pulse::before { animation: pulse 4s ease-in-out infinite; }

.btn { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 10px 22px;
  transition: background .2s, border-color .2s, transform .15s, box-shadow .25s; }
.btn--ghost { color: #e8d9b8; background: rgba(232,178,58,.06); border: 1px solid rgba(232,178,58,.35); }
.btn--ghost:hover { background: rgba(232,178,58,.15); border-color: rgba(232,178,58,.75); color: var(--gold-hi); transform: translateY(-1px); box-shadow: 0 4px 20px rgba(232,178,58,.2); }
.btn--discord { gap: 10px; color: #fff; padding: 10px 24px; background: linear-gradient(135deg, #6473f4, var(--discord));
  border: 1px solid rgba(255,255,255,.18); box-shadow: 0 4px 22px rgba(88,101,242,.4); }
.btn--discord:hover { color: #fff; box-shadow: 0 6px 32px rgba(88,101,242,.65); transform: translateY(-1px); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.dot--green { background: var(--green); box-shadow: 0 0 8px rgba(111,206,126,.9); animation: blink 2.4s infinite; }

/* ---- panel ---- */
.main { position: relative; z-index: 5; flex: 1; display: flex; flex-direction: column; align-items: center; min-height: 0; padding: 14px 24px 16px; }
.panel { width: min(880px, 100%); flex: 1; display: flex; flex-direction: column; min-height: 0;
  border: 1px solid rgba(232,178,58,.2); border-radius: 20px;
  background: linear-gradient(180deg, rgba(18,16,11,.92), rgba(12,11,9,.94));
  box-shadow: 0 30px 80px rgba(0,0,0,.55), inset 0 1px 0 rgba(232,178,58,.12); overflow: hidden; }
.panel__header { position: relative; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 28px; border-bottom: 1px solid rgba(232,178,58,.16); background: rgba(232,178,58,.03); overflow: hidden; }
.panel__header::before { content: ''; position: absolute; top: 0; bottom: 0; left: -30%; width: 24%;
  background: linear-gradient(100deg, transparent, rgba(232,178,58,.06), transparent); animation: sweep 6s ease-in-out infinite; pointer-events: none; }
.panel__id { display: flex; align-items: center; gap: 12px; }
.panel__name { font-size: 15px; font-weight: 700; letter-spacing: .02em; }
.panel__status { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .18em; color: var(--green); }
.panel__tag { font-family: var(--font-mono); font-size: 11px; letter-spacing: .2em; color: var(--ink-faint); }

/* ---- messages ---- */
.messages { flex: 1; overflow-y: auto; padding: 26px 28px 10px; display: flex; flex-direction: column; gap: 18px;
  scrollbar-width: thin; scrollbar-color: rgba(232,178,58,.3) transparent; }
.msg { display: flex; gap: 12px; align-items: flex-end; animation: rise .35s ease both; }
.msg--user { justify-content: flex-end; }
.msg__avatar { position: relative; width: 38px; height: 38px; flex-shrink: 0; margin-bottom: 2px; }
.msg__avatar::before { content: ''; position: absolute; inset: -5px; border-radius: 50%; background: radial-gradient(circle, rgba(232,178,58,.35), transparent 70%); }
.msg__avatar img { position: relative; width: 100%; height: 100%; }
.msg__bubble { max-width: 72%; padding: 15px 19px; font-size: 15.5px; line-height: 1.62; white-space: pre-wrap;
  background: rgba(242,237,225,.05); color: #e9e2d2; border: 1px solid rgba(232,178,58,.18);
  border-radius: 16px 16px 16px 4px; box-shadow: 0 4px 18px rgba(0,0,0,.3); }
.msg--user .msg__bubble { background: linear-gradient(135deg, var(--gold-hi), var(--gold-lo)); color: #0a0908;
  border: none; border-radius: 16px 16px 4px 16px; box-shadow: 0 6px 24px rgba(232,178,58,.25); }
.typing { display: flex; gap: 6px; padding: 18px 20px; background: rgba(242,237,225,.05);
  border: 1px solid rgba(232,178,58,.18); border-radius: 16px 16px 16px 4px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); animation: dots 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }

/* ---- chips ---- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 28px 12px; }
.chip { font-family: var(--font-ui); font-size: 13px; font-weight: 600; color: #e8d9b8;
  background: rgba(232,178,58,.06); border: 1px solid rgba(232,178,58,.3); border-radius: 999px; padding: 8px 15px; cursor: pointer;
  transition: background .2s, border-color .2s, transform .15s, box-shadow .2s; }
.chip:hover { background: rgba(232,178,58,.16); border-color: rgba(232,178,58,.7); transform: translateY(-1px); box-shadow: 0 4px 18px rgba(232,178,58,.2); }

/* ---- composer ---- */
.composer { padding: 0 28px 16px; }
.composer__row { display: flex; gap: 12px; align-items: stretch; }
.composer__field { flex: 1; display: flex; align-items: center; background: rgba(7,6,5,.8);
  border: 1.5px solid rgba(232,178,58,.55); border-radius: 14px; padding: 0 20px;
  box-shadow: 0 0 0 4px rgba(232,178,58,.06), inset 0 2px 8px rgba(0,0,0,.4); }
.composer__field input { flex: 1; background: transparent; border: none; outline: none; color: var(--ink);
  font-family: var(--font-ui); font-size: 16px; padding: 14px 0; }
.composer__send { width: 58px; border: none; border-radius: 14px; background: linear-gradient(135deg, var(--gold-hi), var(--gold-lo));
  color: #0a0908; font-size: 22px; font-weight: 700; cursor: pointer; box-shadow: 0 6px 24px rgba(232,178,58,.35);
  transition: box-shadow .2s, transform .15s; display: flex; align-items: center; justify-content: center; }
.composer__send:hover { box-shadow: 0 8px 34px rgba(232,178,58,.55); transform: translateY(-1px); }
.composer__note { text-align: center; font-size: 11px; color: var(--ink-dim); margin-top: 8px; }

/* ---- ticker ---- */
.ticker { position: relative; z-index: 10; border-top: 1px solid rgba(232,178,58,.2); background: rgba(10,9,7,.9); overflow: hidden; padding: 7px 0; }
.ticker__track { display: flex; gap: 56px; width: max-content; animation: marquee 30s linear infinite;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .18em; color: #a08535; white-space: nowrap; }
.ticker__track em { font-style: normal; color: #4d4335; }

/* ============================================================
   Responsive / mobile   (appended — overrides the desktop rules above)
   ============================================================ */

/* Respect the OS "reduce motion" setting: stop the ambient + marquee loops. */
@media (prefers-reduced-motion: reduce) {
  .bg-glow--top, .bg-ring, .hexfield span, .panel__header::before,
  .ticker__track, .dot--green, .logo-glow--pulse::before, .msg { animation: none !important; }
}

/* ---- tablets & small laptops ---- */
@media (max-width: 760px) {
  .nav { padding: 10px 16px; }
  .main { padding: 12px 14px 14px; }
  .panel__header { padding: 10px 16px; }
  .messages { padding: 20px 16px 8px; }
  .chips { padding: 8px 16px 10px; }
  .composer { padding: 0 16px 14px; }
  .msg__bubble { max-width: 78%; }
}

/* ---- phones ---- */
@media (max-width: 560px) {
  /* lighten the ambient layer: fewer big animated elements = smoother + cleaner */
  .bg-ring, .hexfield, .bg-glow--bottom { display: none; }
  .bg-grid { background-size: 26px 26px; }

  /* nav: brand on the first line, links as a full-width evenly-spaced row below */
  .nav { flex-wrap: wrap; gap: 8px 10px;
    padding: 9px calc(13px + env(safe-area-inset-right, 0px)) 9px calc(13px + env(safe-area-inset-left, 0px)); }
  .nav__brand { gap: 10px; }
  .logo-glow { width: 36px; height: 36px; }
  .nav__title { font-size: 17px; }
  .nav__sub { font-size: 9px; letter-spacing: .25em; margin-top: 2px; }
  .nav__links { width: 100%; gap: 7px; justify-content: space-between; font-size: 12px; }
  .btn { padding: 8px 12px; gap: 6px; }
  .btn .dot { display: none; }
  .btn--discord { padding: 8px 14px; }
  .btn--discord svg { width: 16px; height: 13px; }

  .main { padding: 10px 10px 12px; }
  .panel { border-radius: 16px; }
  .panel__header { padding: 9px 14px; }
  .panel__tag { display: none; }
  .panel__name { font-size: 14px; }
  .panel__status { font-size: 10px; }

  .messages { padding: 16px 13px 6px; gap: 13px; }
  .msg { gap: 9px; }
  .msg__avatar { width: 30px; height: 30px; }
  .msg__bubble { max-width: 84%; font-size: 15px; padding: 12px 15px; line-height: 1.55; border-radius: 14px 14px 14px 4px; }
  .msg--user .msg__bubble { border-radius: 14px 14px 4px 14px; }

  /* chips: one swipeable row instead of stacking three rows on a phone */
  .chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 8px 13px 10px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; font-size: 12.5px; padding: 7px 13px; }

  .composer { padding: 0 13px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .composer__row { gap: 9px; }
  .composer__field { padding: 0 16px; border-radius: 13px; }
  .composer__field input { font-size: 16px; padding: 12px 0; } /* 16px keeps iOS from zooming on focus */
  .composer__send { width: 52px; font-size: 20px; border-radius: 13px; }
  .composer__note { font-size: 10.5px; margin-top: 6px; }

  .ticker { padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px)); }
  .ticker__track { gap: 40px; font-size: 11px; letter-spacing: .14em; }
}

/* ---- very small phones ---- */
@media (max-width: 380px) {
  .nav__links { font-size: 11px; gap: 5px; }
  .btn { padding: 7px 10px; }
  .btn--discord { padding: 7px 11px; }
  .nav__sub { display: none; }
  .msg__bubble { max-width: 88%; font-size: 14.5px; }
}

/* ---- short / landscape phones: reclaim vertical space ---- */
@media (max-height: 480px) and (max-width: 900px) {
  .ticker, .chips { display: none; }
  .messages { padding-top: 12px; }
  .nav { padding-top: 6px; padding-bottom: 6px; }
  .composer { padding-bottom: 8px; }
}
