/* ============================================
   SHACKBOT - The AI That Hates Visitors
   Theme: Dark rage with fun angry accents
   ============================================ */

:root {
  --bg-dark: #0d0d0d;
  --bg-surface: #1a1a1a;
  --bg-elevated: #242424;
  --bg-hover: #2e2e2e;
  --rage-red: #FF4444;
  --rage-red-dark: #CC0000;
  --rage-orange: #FF6B35;
  --rage-yellow: #FFD23F;
  --text-primary: #f0f0f0;
  --text-secondary: #999;
  --text-muted: #666;
  --user-bubble: #2563eb;
  --user-bubble-hover: #1d4ed8;
  --border: #333;
  --radius: 12px;
  --font-display: 'Bangers', cursive;
  --font-body: 'Inter', -apple-system, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-body);
  background: var(--bg-dark);
  color: var(--text-primary);
}

/* ---- App Layout ---- */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
}

/* ---- Visitor Counter Bar ---- */
.visitor-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 16px;
  background: linear-gradient(90deg, rgba(255, 68, 68, 0.08), rgba(255, 107, 53, 0.08));
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
}

.visitor-label {
  color: var(--text-muted);
}

.visitor-count {
  color: var(--rage-orange);
  font-weight: 700;
  font-size: 0.8rem;
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
}

/* ---- Header ---- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-surface);
  border-bottom: 2px solid var(--rage-red);
  position: relative;
  z-index: 10;
}

.header::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--rage-red), var(--rage-orange), var(--rage-yellow), var(--rage-orange), var(--rage-red));
  background-size: 200% 100%;
  animation: rage-gradient 3s ease infinite;
}

@keyframes rage-gradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ShackBot Robot Avatar */
.angry-face {
  width: 48px;
  height: 48px;
  position: relative;
  animation: face-shake 4s ease-in-out infinite;
  cursor: pointer;
  flex-shrink: 0;
}

.shackbot-icon {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 6px rgba(255, 68, 68, 0.4));
}

.antenna-light {
  animation: antenna-pulse 1.5s ease-in-out infinite;
}

@keyframes antenna-pulse {
  0%, 100% { fill: #FF6B35; opacity: 1; }
  50% { fill: #FFD23F; opacity: 0.6; }
}

.steam-left-small, .steam-right-small {
  animation: steam-float 2s ease-in-out infinite;
}
.steam-right-small { animation-delay: 0.5s; }

.angry-face:hover {
  animation: face-shake 0.3s ease-in-out infinite;
}

@keyframes face-shake {
  0%, 90%, 100% { transform: rotate(0deg); }
  92% { transform: rotate(-2deg); }
  94% { transform: rotate(2deg); }
  96% { transform: rotate(-1deg); }
  98% { transform: rotate(1deg); }
}

.face-inner {
  position: relative;
  width: 100%;
  height: 100%;
}

.eyebrow {
  position: absolute;
  width: 14px;
  height: 3px;
  background: #1a1a1a;
  top: 14px;
  border-radius: 2px;
}
.eyebrow.left { left: 8px; transform: rotate(-25deg); }
.eyebrow.right { right: 8px; transform: rotate(25deg); }

.eye {
  position: absolute;
  width: 10px;
  height: 10px;
  background: white;
  border-radius: 50%;
  top: 18px;
}
.eye.left { left: 11px; }
.eye.right { right: 11px; }

.pupil {
  width: 5px;
  height: 5px;
  background: #1a1a1a;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
}

.mouth {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 8px;
  border-top: 3px solid #1a1a1a;
  border-radius: 0;
}

.header-text h1 {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 3px;
  color: var(--rage-red);
  text-shadow: 2px 2px 0 rgba(255, 68, 68, 0.3);
  line-height: 1;
}

.subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-elevated);
  border-radius: 20px;
  font-size: 11px;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--rage-red);
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.rage-meter-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 10px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.rage-meter-btn:hover {
  border-color: var(--rage-orange);
  background: var(--bg-hover);
}

.rage-level {
  font-weight: 600;
  font-size: 12px;
  color: var(--rage-orange);
}

/* ---- Provider Toggle ---- */
.provider-toggle {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
}

.provider-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 11px;
  transition: all 0.2s;
  white-space: nowrap;
}

.provider-btn:hover {
  color: var(--text-secondary);
  background: var(--bg-hover);
}

.provider-btn.active {
  background: var(--rage-red);
  color: white;
}

.provider-btn.active[data-provider="ollama"] {
  background: #7c3aed;
}

.provider-icon {
  font-size: 14px;
}

.provider-label {
  font-weight: 500;
}

/* ---- User Menu ---- */
.user-menu {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg-elevated);
  border-radius: 20px;
  font-size: 12px;
}

.user-name {
  color: var(--text-secondary);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-plan {
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.plan-free { background: var(--bg-hover); color: var(--text-muted); }
.plan-grumpy { background: var(--rage-orange); color: white; }
.plan-furious { background: var(--rage-red); color: white; }

.logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
  transition: color 0.2s;
}
.logout-btn:hover { color: var(--rage-red); }

/* ---- Usage Counter ---- */
.usage-counter {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 8px;
  background: var(--bg-elevated);
  border-radius: 12px;
  white-space: nowrap;
}
.usage-counter.usage-warning { color: var(--rage-orange); }
.usage-counter.usage-exhausted { color: var(--rage-red); font-weight: 600; }

/* ---- Chat Area ---- */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  scroll-behavior: smooth;
  background:
    radial-gradient(circle at 20% 80%, rgba(255, 68, 68, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 107, 53, 0.03) 0%, transparent 50%),
    var(--bg-dark);
}

.chat-area::-webkit-scrollbar {
  width: 6px;
}
.chat-area::-webkit-scrollbar-track {
  background: transparent;
}
.chat-area::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ---- Welcome Screen ---- */
.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  gap: 16px;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.welcome-face {
  width: 140px;
  height: 140px;
}

.big-angry-face {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 20px rgba(255, 68, 68, 0.3));
}

.steam-left, .steam-right {
  animation: steam-float 2s ease-in-out infinite;
}
.steam-right {
  animation-delay: 0.5s;
}

@keyframes steam-float {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(-8px); opacity: 0.5; }
}

.welcome-title {
  font-family: var(--font-display);
  font-size: 32px;
  color: var(--rage-red);
  letter-spacing: 2px;
}

.welcome-text {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.welcome-text em {
  color: var(--rage-orange);
  font-style: italic;
}

.small-text {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
  max-width: 500px;
}

.chip {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
}

.chip:hover {
  border-color: var(--rage-red);
  background: var(--bg-elevated);
  transform: translateY(-1px);
}

/* Game teaser banner */
.game-teaser {
  margin-bottom: 16px;
  width: 100%;
  max-width: 340px;
}

.game-teaser-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.12), rgba(255, 68, 68, 0.12));
  border: 1px solid rgba(255, 107, 53, 0.4);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.3s ease;
  animation: teaserGlow 3s ease-in-out infinite;
}

.game-teaser-link:hover {
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.25), rgba(255, 68, 68, 0.25));
  border-color: var(--rage-orange);
  transform: translateY(-2px);
}

.game-teaser-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.game-teaser-text {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.game-teaser-text strong {
  font-size: 0.85rem;
  color: var(--rage-yellow);
  letter-spacing: 0.3px;
}

.game-teaser-text small {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 1px;
}

.game-teaser-arrow {
  font-size: 1.4rem;
  color: var(--rage-orange);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.game-teaser-link:hover .game-teaser-arrow {
  transform: translateX(3px);
}

@keyframes teaserGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.2); }
  50% { box-shadow: 0 0 12px 0 rgba(255, 107, 53, 0.1); }
}

/* ---- Gatekeeper Challenge Prompt ---- */
.gatekeeper-challenge {
  margin: 16px 0;
  animation: challengeSlideIn 0.5s ease-out;
}

.challenge-inner {
  background: linear-gradient(135deg, rgba(255,68,68,0.15), rgba(255,107,53,0.1));
  border: 2px solid var(--rage-red);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.challenge-inner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(255,68,68,0.08) 0%, transparent 70%);
  animation: challengePulse 2s ease-in-out infinite;
}

.challenge-fire {
  font-size: 40px;
  margin-bottom: 8px;
  animation: challengeFireBounce 1s ease-in-out infinite;
}

.challenge-text {
  position: relative;
  margin-bottom: 16px;
}

.challenge-text strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--rage-red);
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.challenge-text span {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.challenge-btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--rage-red), var(--rage-orange));
  color: white;
  text-decoration: none;
  padding: 12px 28px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.2s;
  position: relative;
}

.challenge-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(255,68,68,0.4);
}

.challenge-dismiss {
  display: block;
  margin: 10px auto 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 4px 8px;
}

.challenge-dismiss:hover {
  color: var(--text-secondary);
}

@keyframes challengeSlideIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes challengePulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

@keyframes challengeFireBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* ---- Angry Gatekeeper Tease ---- */
.gatekeeper-tease {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0;
  animation: teaseSlam 0.3s ease-out;
}

.tease-face {
  width: 140px;
  height: 160px;
  animation: teaseShake 0.4s ease-in-out 0.3s 3;
}

.tease-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 20px rgba(255,68,68,0.5));
}

.tease-text {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--rage-red);
  margin-top: 12px;
  letter-spacing: 1px;
  animation: teaseTextPulse 0.5s ease-in-out infinite alternate;
}

.tease-fade {
  animation: teaseFadeOut 0.4s ease-in forwards;
}

.tease-antenna-glow {
  animation: antennaFlash 0.3s ease-in-out infinite alternate;
}

.tease-eye-flash {
  animation: eyeFlash 0.2s ease-in-out infinite alternate;
}

.smoke-puff-anim {
  animation: smokePuffRise 2s ease-out infinite;
}
.smoke-puff-anim.s1 { animation-delay: 0s; }
.smoke-puff-anim.s2 { animation-delay: 0.3s; }
.smoke-puff-anim.s3 { animation-delay: 0.1s; }
.smoke-puff-anim.s4 { animation-delay: 0.4s; }
.smoke-puff-anim.s5 { animation-delay: 0.2s; }
.smoke-puff-anim.s6 { animation-delay: 0.5s; }

@keyframes teaseSlam {
  0% { transform: scale(1.5); opacity: 0; }
  60% { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes teaseShake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  25% { transform: translateX(-6px) rotate(-2deg); }
  75% { transform: translateX(6px) rotate(2deg); }
}

@keyframes teaseTextPulse {
  from { color: var(--rage-red); transform: scale(1); }
  to { color: var(--rage-orange); transform: scale(1.03); }
}

@keyframes teaseFadeOut {
  to { opacity: 0; transform: scale(0.8) translateY(-20px); }
}

@keyframes antennaFlash {
  from { fill: #FF6B35; }
  to { fill: #FFD23F; }
}

@keyframes eyeFlash {
  from { fill: #CC0000; }
  to { fill: #FF4444; }
}

@keyframes smokePuffRise {
  0% { opacity: 0.5; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-30px) scale(1.8); }
}

/* ---- Messages ---- */
.messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: msg-appear 0.3s ease;
}

@keyframes msg-appear {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message.assistant {
  align-self: flex-start;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.message.assistant .msg-avatar {
  background: var(--rage-red);
  font-size: 14px;
}

.message.user .msg-avatar {
  background: var(--user-bubble);
}

.msg-bubble {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.message.assistant .msg-bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
  color: var(--text-primary);
}

.message.user .msg-bubble {
  background: var(--user-bubble);
  border-top-right-radius: 4px;
  color: white;
}

/* Italic text in grumpy responses */
.msg-bubble em, .msg-bubble i {
  color: var(--text-muted);
  font-style: italic;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 85%;
  animation: msg-appear 0.3s ease;
}

.typing-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--rage-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  animation: face-shake 0.5s ease-in-out infinite;
}

.typing-bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-top-left-radius: 4px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.typing-text {
  font-size: 12px;
  color: var(--rage-orange);
  font-style: italic;
  animation: grumble 1.5s ease-in-out infinite;
}

@keyframes grumble {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--rage-red);
  border-radius: 50%;
  animation: bounce-dot 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce-dot {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ---- Input Area ---- */
.input-area {
  padding: 12px 20px 16px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
}

.input-container {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 8px 8px 14px;
  transition: border-color 0.2s;
  position: relative;
  overflow: hidden;
}

.input-container:focus-within {
  border-color: var(--rage-red);
}

.anger-sparks {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  overflow: hidden;
}

.spark {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--rage-orange);
  border-radius: 50%;
  animation: spark-fly 0.6s ease-out forwards;
}

@keyframes spark-fly {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0) translateY(-20px); }
}

textarea {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  resize: none;
  outline: none;
  max-height: 120px;
  line-height: 1.5;
}

textarea::placeholder {
  color: var(--text-muted);
}

.send-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: var(--rage-red);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.send-btn:hover {
  background: var(--rage-red-dark);
  transform: scale(1.05);
}

.send-btn:active {
  transform: scale(0.95);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.send-btn svg {
  width: 18px;
  height: 18px;
}

.input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 4px 0;
}

.angry-tip {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.char-count {
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- Rage mode (activated at high rage levels) ---- */
.app.rage-mode .header {
  border-bottom-color: var(--rage-orange);
}

.app.rage-mode .header::after {
  animation-duration: 1s;
}

.app.rage-mode .angry-face {
  animation: face-shake 0.3s ease-in-out infinite;
}

.app.rage-mode .status-dot {
  background: var(--rage-orange);
  animation-duration: 0.5s;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .header {
    padding: 10px 14px;
  }

  .header-text h1 {
    font-size: 22px;
    letter-spacing: 2px;
  }

  .status-badge .status-text {
    display: none;
  }

  .chat-area {
    padding: 14px;
  }

  .message {
    max-width: 92%;
  }

  .welcome-title {
    font-size: 24px;
  }

  .suggestion-chips {
    flex-direction: column;
    align-items: center;
  }

  .input-area {
    padding: 10px 14px 12px;
  }
}
