:root {
  --bg: #1a0606;
  --bg-2: #160404;
  --ink: #f5f0e6;
  --ink-dim: #b8a888;
  --red: #d40000;
  --red-bright: #ff1a1a;
  --red-deep: #5a0e0e;
  --gold: #d4a017;
  --gold-dim: #c9a04a;
  --stripe: #f5f0e6;
  --bubble-bot: #1f0808;
  --bubble-user: #d40000;
  --border: #4a1818;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --composer-h: 92px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
html { height: 100%; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg);
  background-image:
    /* dim vignette so carpet is moody, not gaudy */
    linear-gradient(180deg, rgba(10, 2, 2, 0.55) 0%, rgba(10, 2, 2, 0.78) 100%),
    /* Soviet wall carpet (ковёр) tile */
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120'><rect width='120' height='120' fill='%233d0a0a'/><rect x='3' y='3' width='114' height='114' fill='none' stroke='%23c9a04a' stroke-width='0.8'/><rect x='10' y='10' width='100' height='100' fill='none' stroke='%23c9a04a' stroke-width='0.5'/><path d='M60 14 L106 60 L60 106 L14 60 Z' fill='none' stroke='%23d4a017' stroke-width='1.3'/><path d='M60 26 L94 60 L60 94 L26 60 Z' fill='%235a1414' stroke='%23c9a04a' stroke-width='0.6'/><circle cx='60' cy='60' r='4' fill='%23d4a017'/><circle cx='60' cy='44' r='2' fill='%23d4a017'/><circle cx='60' cy='76' r='2' fill='%23d4a017'/><circle cx='44' cy='60' r='2' fill='%23d4a017'/><circle cx='76' cy='60' r='2' fill='%23d4a017'/><path d='M14 14 L20 14 L20 20 L14 20 Z' fill='%23c9a04a'/><path d='M100 14 L106 14 L106 20 L100 20 Z' fill='%23c9a04a'/><path d='M14 100 L20 100 L20 106 L14 106 Z' fill='%23c9a04a'/><path d='M100 100 L106 100 L106 106 L100 106 Z' fill='%23c9a04a'/><path d='M60 4 L62 8 L60 14 L58 8 Z' fill='%23d4a017' opacity='0.7'/><path d='M60 106 L62 110 L60 116 L58 110 Z' fill='%23d4a017' opacity='0.7'/><path d='M4 60 L8 58 L14 60 L8 62 Z' fill='%23d4a017' opacity='0.7'/><path d='M106 60 L110 58 L116 60 L110 62 Z' fill='%23d4a017' opacity='0.7'/></svg>"),
    /* film grain */
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.05 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-repeat: no-repeat, repeat, repeat;
  background-size: auto, 120px 120px, 200px 200px;
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  overscroll-behavior-y: none;
}

/* === Top Adidas-stripe band === */
.stripes-top {
  height: 14px;
  width: 100%;
  background:
    linear-gradient(180deg,
      var(--red)   0 3px,
      var(--stripe) 3px 4px,
      var(--red)   4px 7px,
      var(--stripe) 7px 8px,
      var(--red)   8px 11px,
      var(--stripe) 11px 12px,
      var(--red)  12px 14px);
  border-bottom: 3px solid #000;
  padding-top: var(--safe-top);
}

/* === Header === */
.header {
  padding: 14px 16px 0;
  position: relative;
  background: linear-gradient(180deg, rgba(10,2,2,0.95) 0%, rgba(10,2,2,0.78) 100%);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.header-inner {
  max-width: 720px;
  margin: 0 auto;
}

.header-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding-bottom: 12px;
}

/* Emoji mascot replacing the SVG */
.mascot {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
  padding: 6px 10px;
  border: 2px solid var(--gold-dim);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 3px 3px 0 #000, inset 0 0 0 2px rgba(212, 0, 0, 0.2);
}
.mascot span {
  display: inline-block;
  filter: drop-shadow(2px 2px 0 #000);
}
.mascot-1 { animation: bob1 3.6s ease-in-out infinite; transform-origin: 50% 100%; }
.mascot-2 { animation: bob2 4.2s ease-in-out infinite; transform-origin: 50% 100%; }
.mascot-3 { animation: bob3 3.9s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes bob1 { 0%,100% { transform: rotate(-12deg) translateY(0); } 50% { transform: rotate(-16deg) translateY(-2px); } }
@keyframes bob2 { 0%,100% { transform: rotate(2deg)   translateY(0); } 50% { transform: rotate(-2deg)  translateY(-1px); } }
@keyframes bob3 { 0%,100% { transform: rotate(10deg)  translateY(0); } 50% { transform: rotate(14deg)  translateY(-2px); } }

.header-text { min-width: 0; }

.title {
  font-family: "Oswald", "Impact", sans-serif;
  font-weight: 700;
  font-size: clamp(28px, 7vw, 56px);
  letter-spacing: 1.5px;
  margin: 0;
  color: var(--ink);
  text-shadow: 3px 3px 0 var(--red), 6px 6px 0 #000;
  text-transform: uppercase;
  line-height: 1;
}
.title-ai {
  color: var(--gold);
  text-shadow: 3px 3px 0 #000;
}

.subtitle {
  margin: 8px 0 0;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gold-dim);
  font-weight: 700;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  width: 38px;
  height: 38px;
  background: rgba(0,0,0,0.5);
  border: 2px solid var(--gold-dim);
  color: var(--ink-dim);
  font-size: 16px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, transform 0.05s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 2px 2px 0 #000;
}
.icon-btn:hover { border-color: var(--red); color: var(--red); }
.icon-btn:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 #000; }

#voice .icon-off { display: inline; }
#voice .icon-on { display: none; }
#voice[aria-pressed="true"] {
  border-color: var(--red);
  background: rgba(212, 0, 0, 0.25);
}
#voice[aria-pressed="true"] .icon-off { display: none; }
#voice[aria-pressed="true"] .icon-on { display: inline; }

/* Adidas-stripe band under header — three crisp white stripes on red */
.adidas-band {
  height: 16px;
  background:
    linear-gradient(180deg,
      var(--red)   0 3px,
      var(--stripe) 3px 4px,
      var(--red)   4px 7px,
      var(--stripe) 7px 8px,
      var(--red)   8px 11px,
      var(--stripe) 11px 12px,
      var(--red)  12px 16px);
  border-top: 2px solid #000;
  border-bottom: 2px solid #000;
  position: relative;
  margin: 0 -16px;
}
.adidas-band::before, .adidas-band::after {
  content: "👟";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  line-height: 1;
  filter: drop-shadow(0 1px 0 #000);
}
.adidas-band::before { left: 8px; }
.adidas-band::after  { right: 8px; }

/* === Chat area === */
.chat {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 14px calc(var(--composer-h) + var(--safe-bottom) + 28px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.transcript {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble {
  max-width: 85%;
  padding: 12px 16px;
  border: 2px solid #000;
  border-radius: 14px;
  font-size: 16px;
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
  box-shadow: 4px 4px 0 #000;
  animation: pop-in 0.18s ease-out;
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.bubble-bot {
  align-self: flex-start;
  background: var(--bubble-bot);
  color: var(--ink);
  border-left: 6px solid var(--gold);
  position: relative;
  padding-right: 44px;
}

.bubble-user {
  align-self: flex-end;
  background: var(--bubble-user);
  color: #fff;
  /* three Adidas-style stripes on the right edge */
  border-right: none;
  background-image:
    repeating-linear-gradient(180deg,
      transparent 0 6px,
      rgba(245,240,230,0.85) 6px 8px);
  background-position: right;
  background-size: 14px 100%;
  background-repeat: no-repeat;
  padding-right: 22px;
  font-weight: 700;
}

.bubble-loading {
  font-style: italic;
  color: var(--ink-dim);
  opacity: 0.85;
}
.bubble-loading::after {
  content: " …";
  animation: dots 1.2s steps(4, end) infinite;
}
@keyframes dots {
  0%, 20% { content: " "; }
  40%     { content: " ."; }
  60%     { content: " .."; }
  80%, 100% { content: " ..."; }
}

.bubble-error {
  align-self: stretch;
  background: #2a0000;
  color: #ffcccc;
  border: 2px dashed var(--red);
  box-shadow: none;
}

.speak-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  border: 1.5px solid var(--gold-dim);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: var(--gold-dim);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.05s;
  -webkit-tap-highlight-color: transparent;
}
.speak-btn:hover { color: var(--red); border-color: var(--red); }
.speak-btn:active { transform: scale(0.9); }
.speak-btn.playing {
  color: var(--red);
  border-color: var(--red);
  background: rgba(212, 0, 0, 0.2);
  animation: pulse 1.2s ease-in-out infinite;
}
.speak-btn.loading {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(212, 160, 23, 0.15);
}
.speak-btn.loading::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--gold);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.speak-btn.loading { color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212, 0, 0, 0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(212, 0, 0, 0); }
}

/* === Quick-start chips === */
.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  transition: opacity 0.2s, max-height 0.3s;
}
.suggestions.hidden {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  margin: 0;
  pointer-events: none;
}

.chip {
  background: rgba(20, 8, 8, 0.85);
  color: var(--ink);
  border: 2px solid var(--gold-dim);
  border-radius: 999px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.05s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 2px 2px 0 #000;
}
.chip:hover { border-color: var(--red); background: rgba(212, 0, 0, 0.15); color: var(--ink); }
.chip:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 #000; }

/* === Composer (fixed at bottom) === */
.composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  padding: 10px 14px calc(10px + var(--safe-bottom));
  background:
    linear-gradient(180deg, rgba(10,2,2,0.5) 0%, rgba(10,2,2,0.96) 30%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 3px solid #000;
}
.composer::before {
  /* mini adidas band on top of composer */
  content: "";
  position: absolute;
  left: 0; right: 0; top: -3px;
  height: 3px;
  background:
    repeating-linear-gradient(90deg,
      var(--red)    0 30px,
      var(--stripe) 30px 32px,
      var(--red)   32px 62px,
      var(--stripe) 62px 64px,
      var(--red)   64px 94px,
      var(--stripe) 94px 96px);
}

.composer-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: stretch;
  background: var(--bg-2);
  padding: 8px;
  border: 2px solid var(--gold-dim);
  border-radius: 14px;
  box-shadow: 4px 4px 0 #000;
}

.input {
  flex: 1;
  resize: none;
  background: #000;
  color: var(--ink);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.4;
  outline: none;
  min-height: 44px;
  max-height: 140px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(212, 0, 0, 0.3);
}

.send {
  font-family: "Oswald", "Impact", sans-serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 1.5px;
  color: #fff;
  background: var(--red);
  border: 2px solid #000;
  border-radius: 8px;
  padding: 0 18px;
  min-width: 56px;
  cursor: pointer;
  text-transform: uppercase;
  position: relative;
  box-shadow: 3px 3px 0 #000;
  transition: transform 0.05s ease, box-shadow 0.05s ease, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  -webkit-tap-highlight-color: transparent;
  background-image:
    repeating-linear-gradient(180deg,
      transparent 0 8px,
      rgba(245,240,230,0.7) 8px 10px);
  background-size: 8px 100%;
  background-position: left;
  background-repeat: no-repeat;
}

.send-icon {
  width: 22px;
  height: 22px;
  display: none;
}

.send:hover { background-color: var(--red-bright); }
.send:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #000;
}
.send:disabled {
  background-color: #555;
  cursor: not-allowed;
  opacity: 0.7;
}

.composer-meta {
  max-width: 720px;
  margin: 6px auto 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--gold-dim);
  letter-spacing: 0.5px;
  padding: 0 4px;
}
.counter.warn { color: var(--gold); }
.counter.over { color: var(--red); }
.hint { opacity: 0.7; }

/* === Footer === */
.footer {
  text-align: center;
  font-size: 12px;
  color: var(--gold-dim);
  padding: 14px 14px;
  border-top: 2px solid #000;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: rgba(10,2,2,0.85);
  font-weight: 700;
}

/* === Mobile === */
@media (max-width: 640px) {
  :root { --composer-h: 96px; }

  .header { padding: 12px 12px 0; }
  .mascot { font-size: 24px; padding: 5px 8px; }
  .title { font-size: clamp(26px, 8vw, 40px); }
  .subtitle { font-size: 10px; letter-spacing: 0.8px; }
  .icon-btn { width: 34px; height: 34px; font-size: 14px; }
  .header-actions { gap: 6px; }
  .adidas-band { margin: 0 -12px; }

  .chat { padding: 14px 10px calc(var(--composer-h) + var(--safe-bottom) + 18px); }
  .bubble { font-size: 16px; max-width: 92%; padding: 10px 14px; }
  .bubble-bot { padding-right: 40px; }
  .speak-btn { width: 26px; height: 26px; font-size: 11px; }

  .send-text { display: none; }
  .send-icon { display: block; }
  .send { padding: 0 14px; min-width: 52px; background-image: none; }

  .composer { padding: 8px 10px calc(8px + var(--safe-bottom)); }
  .composer-meta .hint { display: none; }
  .chip { font-size: 13px; padding: 7px 12px; }

  .footer { font-size: 10px; padding: 10px; letter-spacing: 1px; }
}

@media (max-width: 380px) {
  .mascot { font-size: 20px; padding: 4px 6px; gap: 0; }
  .title { font-size: 24px; letter-spacing: 0.5px; }
  .header-row { gap: 8px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
