/* PokeLearn — kid-friendly UI */

:root {
  --bg-top: #6c5ce7;
  --bg-bottom: #00cec9;
  --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  --text-dark: #2d3436;
  --text-muted: #636e72;
  --white: #ffffff;
  --yellow: #ffe066;
  --yellow-dark: #f9ca24;
  --green: #b8e994;
  --green-dark: #6ab04c;
  --purple: #dfe6ff;
  --purple-dark: #a29bfe;
  --mic: #ff6b6b;
  --mic-active: #ee5a24;
  --star-gold: #fdcb6e;
  --radius: 20px;
  --radius-sm: 12px;
  --font: "Fredoka", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  font-family: var(--font);
  color: var(--text-dark);
  min-height: 100vh;
  overflow-x: hidden;
  background: linear-gradient(160deg, var(--bg-top) 0%, #74b9ff 45%, var(--bg-bottom) 100%);
  background-attachment: fixed;
}

/* Floating background shapes */
.bg-shapes {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.2;
  animation: float 8s ease-in-out infinite;
}

.shape-1 {
  width: 120px;
  height: 120px;
  background: #fdcb6e;
  top: 10%;
  left: 5%;
  animation-delay: 0s;
}

.shape-2 {
  width: 80px;
  height: 80px;
  background: #ff7675;
  top: 60%;
  right: 8%;
  animation-delay: -2s;
}

.shape-3 {
  width: 100px;
  height: 100px;
  background: #55efc4;
  bottom: 15%;
  left: 15%;
  animation-delay: -4s;
}

.shape-4 {
  width: 60px;
  height: 60px;
  background: #ffeaa7;
  top: 25%;
  right: 20%;
  animation-delay: -1s;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(10deg);
  }
}

.app {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.title {
  font-size: clamp(1.35rem, 4.5vw, 1.85rem);
  font-weight: 700;
  color: var(--white);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.2);
  line-height: 1.2;
  flex: 1;
}

.star-counter {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--white);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  box-shadow: var(--card-shadow);
  border: 3px solid var(--star-gold);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.star-counter.bump {
  animation: star-bump 0.4s ease;
}

@keyframes star-bump {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

.star-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.star-count {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-dark);
  min-width: 1.25rem;
  text-align: center;
}

/* Section labels */
.section-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.6rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Auto-detected subject badge */
.subject-badge {
  display: inline-block;
  align-self: center;
  margin: 0 auto 0.85rem;
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-dark);
  background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
  border: 3px solid #fff;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(253, 203, 110, 0.55), 0 0 0 0 rgba(253, 203, 110, 0.6);
  animation: subject-badge-glow 2.4s ease-in-out infinite;
  text-align: center;
}

.chat-area {
  display: flex;
  flex-direction: column;
}

@keyframes subject-badge-glow {
  0%,
  100% {
    box-shadow: 0 4px 14px rgba(253, 203, 110, 0.55), 0 0 0 0 rgba(253, 203, 110, 0.6);
  }
  50% {
    box-shadow: 0 4px 18px rgba(253, 203, 110, 0.7), 0 0 0 10px rgba(253, 203, 110, 0);
  }
}

/* Progress panel */
.progress-panel {
  margin-bottom: 1.25rem;
}

.progress-card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius);
  border: 4px solid var(--white);
  box-shadow: var(--card-shadow);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.progress-stat {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-dark);
  margin: 0;
}

.progress-stat strong {
  font-weight: 700;
}

.progress-subjects {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.progress-badge {
  font-size: 0.8rem;
  font-weight: 600;
  background: #f1f2f6;
  color: var(--text-dark);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 2px solid #dfe6e9;
}

.progress-badge.empty {
  color: var(--text-muted);
  font-style: italic;
}

/* Pokémon browser */
.pokemon-browser {
  margin-bottom: 1.5rem;
}

.companion-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius);
  padding: 1rem 1.25rem 0.85rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--card-shadow);
  border: 4px solid var(--white);
}

.hero-sprite-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}

.hero-sprite {
  width: 120px;
  height: 120px;
  image-rendering: pixelated;
  object-fit: contain;
}

.hero-sprite.bounce {
  animation: companion-bounce 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes companion-bounce {
  0% {
    transform: scale(0.6) translateY(12px);
    opacity: 0.5;
  }
  55% {
    transform: scale(1.12) translateY(-8px);
    opacity: 1;
  }
  100% {
    transform: scale(1) translateY(0);
  }
}

.hero-name {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-dark);
}

.hero-id {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.browser-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  align-items: stretch;
}

.search-wrap {
  flex: 1;
  min-width: 0;
}

.pokemon-search {
  font-family: var(--font);
  width: 100%;
  height: 100%;
  font-size: 1rem;
  font-weight: 500;
  padding: 0.65rem 1rem;
  border: 3px solid var(--white);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text-dark);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  outline: none;
}

.pokemon-search:focus {
  border-color: #fdcb6e;
  box-shadow: 0 0 0 3px rgba(253, 203, 110, 0.5);
}

.pokemon-search::placeholder {
  color: #b2bec3;
}

.shiny-toggle {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.65rem 1rem;
  border: 3px solid var(--white);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-dark);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.shiny-toggle:hover {
  transform: translateY(-2px);
  background: var(--white);
}

.shiny-toggle.active {
  background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
  border-color: #f9ca24;
  box-shadow: 0 4px 0 #e17055, 0 6px 14px rgba(0, 0, 0, 0.12);
}

.browser-status {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 0.5rem;
  min-height: 1.2em;
}

.pokemon-grid-scroll {
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius);
  border: 4px solid var(--white);
  box-shadow: var(--card-shadow);
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem;
  scroll-behavior: smooth;
}

.pokemon-grid-scroll::-webkit-scrollbar {
  width: 10px;
}

.pokemon-grid-scroll::-webkit-scrollbar-thumb {
  background: #dfe6e9;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.pokemon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 0.4rem;
}

.pokemon-cell {
  font-family: var(--font);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.35rem 0.25rem 0.45rem;
  border: 3px solid transparent;
  border-radius: var(--radius-sm);
  background: #f8f9fa;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.pokemon-cell:hover {
  transform: translateY(-2px);
  background: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.pokemon-cell.selected {
  border-color: #f9ca24;
  background: #fff9e6;
  box-shadow: 0 4px 0 #f9ca24, 0 6px 14px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px) scale(1.04);
}

.pokemon-cell img {
  width: 56px;
  height: 56px;
  image-rendering: pixelated;
  object-fit: contain;
}

.pokemon-cell-name {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-dark);
  text-align: center;
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Chat area */
.chat-area {
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--card-shadow);
  border: 4px solid var(--white);
}

.speech-bubble {
  position: relative;
  background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
  border: 3px solid #dfe6e9;
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  min-height: 100px;
}

.speech-bubble::after {
  content: "";
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  border: 12px solid transparent;
  border-top-color: #dfe6e9;
}

.speech-bubble::before {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border: 10px solid transparent;
  border-top-color: #fff;
  z-index: 1;
}

.bubble-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bubble-text {
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-dark);
}

.speech-bubble .bubble-label {
  color: #6c5ce7;
}

/* Transcript */
.transcript-box {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
  background: #f1f2f6;
  border: 2px dashed #b2bec3;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  margin-bottom: 1.5rem;
  min-height: 2.75rem;
}

.transcript-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.transcript-text {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-dark);
  flex: 1;
}

.transcript-text.listening {
  color: #e17055;
  font-style: italic;
}

/* Language selector */
.lang-toggle {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.lang-btn {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 2px solid #dfe6e9;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-dark);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.lang-btn:hover {
  transform: translateY(-1px);
}

.lang-btn.active {
  background: linear-gradient(145deg, #74b9ff, #0984e3);
  border-color: #0984e3;
  color: var(--white);
}

/* Microphone */
.mic-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.mic-btn {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 5px solid var(--white);
  background: linear-gradient(145deg, #ff8787, var(--mic));
  color: var(--white);
  cursor: pointer;
  box-shadow: 0 8px 0 #c0392b, 0 12px 32px rgba(238, 90, 36, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: mic-pulse 2s ease-in-out infinite;
}

.mic-btn:hover {
  transform: scale(1.05);
}

.mic-btn:active:not(.recording) {
  transform: scale(0.95);
}

.mic-btn.recording {
  background: linear-gradient(145deg, var(--mic-active), #d63031);
  animation: mic-recording-pulse 0.85s ease-in-out infinite;
}

.mic-btn.recording:hover {
  transform: scale(1.06);
}

.mic-btn.processing {
  background: linear-gradient(145deg, #fdcb6e, #f39c12);
  animation: mic-processing-pulse 1s ease-in-out infinite;
  cursor: wait;
}

.mic-btn.processing:hover {
  transform: none;
}

.mic-btn.processing .mic-content {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  padding: 0 0.35rem;
  filter: none;
}

@keyframes mic-processing-pulse {
  0%,
  100% {
    box-shadow: 0 8px 0 #d68910, 0 12px 28px rgba(243, 156, 18, 0.45), 0 0 0 0 rgba(253, 203, 110, 0.5);
  }
  50% {
    box-shadow: 0 8px 0 #d68910, 0 14px 32px rgba(243, 156, 18, 0.5), 0 0 0 16px rgba(253, 203, 110, 0);
  }
}

@keyframes mic-pulse {
  0%,
  100% {
    box-shadow: 0 8px 0 #c0392b, 0 12px 32px rgba(238, 90, 36, 0.45), 0 0 0 0 rgba(255, 107, 107, 0.5);
  }
  50% {
    box-shadow: 0 8px 0 #c0392b, 0 12px 32px rgba(238, 90, 36, 0.45), 0 0 0 18px rgba(255, 107, 107, 0);
  }
}

@keyframes mic-recording-pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 8px 0 #922b21, 0 12px 28px rgba(214, 48, 49, 0.55), 0 0 0 0 rgba(255, 107, 107, 0.65);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 8px 0 #922b21, 0 14px 36px rgba(214, 48, 49, 0.6), 0 0 0 24px rgba(255, 107, 107, 0);
  }
}

.mic-content {
  font-size: 2.75rem;
  line-height: 1;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
}

.mic-hint {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

/* Quiz card */
.quiz-card {
  background: linear-gradient(140deg, #ffeaa7 0%, #fab1a0 100%);
  border: 4px solid var(--white);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.1rem;
  box-shadow: 0 10px 24px rgba(225, 112, 85, 0.35);
  margin-bottom: 1.25rem;
  animation: quiz-pop-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes quiz-pop-in {
  0% {
    transform: scale(0.85) translateY(10px);
    opacity: 0;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.quiz-tag {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--white);
  color: #d63031;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  box-shadow: 0 3px 0 #e17055;
  animation: quiz-tag-pulse 2.2s ease-in-out infinite;
}

@keyframes quiz-tag-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}

.quiz-close {
  font-family: inherit;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--white);
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-dark);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.quiz-close:hover {
  background: var(--white);
}

.quiz-question {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.85rem;
  line-height: 1.4;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.quiz-option {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 3px solid var(--white);
  color: var(--text-dark);
  cursor: pointer;
  text-align: left;
  line-height: 1.3;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
  animation: option-pop-in 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.quiz-option:nth-child(1) { animation-delay: 0.06s; }
.quiz-option:nth-child(2) { animation-delay: 0.14s; }
.quiz-option:nth-child(3) { animation-delay: 0.22s; }
.quiz-option:nth-child(4) { animation-delay: 0.30s; }

@keyframes option-pop-in {
  0%   { transform: scale(0.72) translateY(14px); opacity: 0; }
  100% { transform: scale(1) translateY(0);       opacity: 1; }
}

.quiz-option:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.quiz-option:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
}

.quiz-option:disabled {
  cursor: default;
  opacity: 0.85;
}

.quiz-option[data-color="0"] {
  background: linear-gradient(135deg, #74b9ff, #0984e3);
  color: var(--white);
}

.quiz-option[data-color="1"] {
  background: linear-gradient(135deg, #55efc4, #00b894);
  color: var(--white);
}

.quiz-option[data-color="2"] {
  background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
  color: var(--text-dark);
}

.quiz-option[data-color="3"] {
  background: linear-gradient(135deg, #fd79a8, #e84393);
  color: var(--white);
}

.quiz-option.correct {
  background: linear-gradient(135deg, #b8e994, #6ab04c);
  color: var(--text-dark);
  box-shadow: 0 4px 0 #4a8a2c, 0 0 0 3px #fff inset;
  animation: correct-celebrate 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes correct-celebrate {
  0%   { transform: scale(1); }
  20%  { transform: scale(1.14) rotate(-3deg); }
  45%  { transform: scale(1.08) rotate(3deg); }
  65%  { transform: scale(1.12) rotate(-1.5deg); }
  85%  { transform: scale(1.06) rotate(1deg); }
  100% { transform: scale(1.04) rotate(0deg); }
}

.quiz-option.wrong {
  background: linear-gradient(135deg, #ff7675, #d63031);
  color: var(--white);
  box-shadow: 0 4px 0 #922b21, 0 0 0 3px #fff inset;
  animation: wrong-shake 0.48s ease forwards;
}

@keyframes wrong-shake {
  0%, 100% { transform: translateX(0); }
  15%      { transform: translateX(-9px); }
  30%      { transform: translateX(9px); }
  45%      { transform: translateX(-6px); }
  60%      { transform: translateX(6px); }
  75%      { transform: translateX(-3px); }
  90%      { transform: translateX(3px); }
}

.quiz-feedback {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-top: 0.75rem;
  text-align: center;
  min-height: 1.2em;
}

.quiz-feedback.feedback-reveal {
  animation: feedback-pop 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes feedback-pop {
  0%   { transform: scale(0.6) translateY(6px); opacity: 0; }
  100% { transform: scale(1) translateY(0);     opacity: 1; }
}

/* Floating chat FAB + panel */
.chat-fab {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 4px solid var(--white);
  background: linear-gradient(140deg, #a29bfe, #6c5ce7);
  color: var(--white);
  font-size: 1.7rem;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(108, 92, 231, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chat-fab:hover {
  transform: scale(1.07);
  box-shadow: 0 12px 26px rgba(108, 92, 231, 0.55);
}

.chat-fab:active {
  transform: scale(0.95);
}

.chat-panel {
  position: fixed;
  right: 1rem;
  bottom: 5.4rem;
  width: min(360px, calc(100vw - 2rem));
  background: linear-gradient(160deg, #ffffff 0%, #f8f9fa 100%);
  border: 4px solid var(--white);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
  padding: 1rem;
  z-index: 49;
  animation: chat-slide-up 0.28s ease;
}

@keyframes chat-slide-up {
  0% {
    transform: translateY(16px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.chat-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.7rem;
}

.chat-panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
}

.chat-panel-close {
  font-family: inherit;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #dfe6e9;
  background: var(--white);
  color: var(--text-dark);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}

.chat-panel-close:hover {
  background: #f1f2f6;
}

.chat-panel-form {
  display: flex;
  gap: 0.5rem;
}

.chat-panel-input {
  font-family: inherit;
  flex: 1;
  min-width: 0;
  font-size: 0.95rem;
  padding: 0.65rem 0.85rem;
  border-radius: 999px;
  border: 2px solid #dfe6e9;
  outline: none;
}

.chat-panel-input:focus {
  border-color: #6c5ce7;
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.25);
}

.chat-panel-send {
  font-family: inherit;
  font-weight: 700;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(140deg, #a29bfe, #6c5ce7);
  color: var(--white);
  cursor: pointer;
  box-shadow: 0 4px 0 #4834d4;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.chat-panel-send:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.chat-panel-send:disabled {
  opacity: 0.6;
  cursor: wait;
}

.chat-panel-status {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.55rem;
  text-align: center;
  min-height: 1em;
}

/* Star burst animation */
.star-burst {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
}

.star-burst .burst-star {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: 2rem;
  transform: translate(-50%, -50%);
  animation: burst-fly 0.9s ease-out forwards;
}

@keyframes burst-fly {
  0% {
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--dx, 0)), calc(-50% + var(--dy, 0))) scale(1.2) rotate(360deg);
    opacity: 0;
  }
}

/* ✨ Shiny mode */
body.shiny-mode .companion-hero {
  background: linear-gradient(135deg, #fff9e6, #ffeaa7, #e8f3ff, #fce4f0, #fff9e6);
  background-size: 400% 400%;
  animation: shiny-bg-flow 4s ease infinite;
  border-color: #fdcb6e;
  box-shadow: 0 0 0 3px #fdcb6e, var(--card-shadow);
}

@keyframes shiny-bg-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

body.shiny-mode .hero-name {
  background: linear-gradient(90deg, #e17055, #fdcb6e, #00b894, #74b9ff, #a29bfe, #fd79a8, #e17055);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: rainbow-slide 3s linear infinite;
}

@keyframes rainbow-slide {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

body.shiny-mode .hero-sprite-wrap {
  position: relative;
}

body.shiny-mode .hero-sprite-wrap::after {
  content: "✨";
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 1.4rem;
  animation: sparkle-bob 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes sparkle-bob {
  0%, 100% { transform: scale(1) rotate(-5deg); }
  50% { transform: scale(1.35) rotate(12deg); }
}

body.shiny-mode .speech-bubble {
  background: linear-gradient(135deg, #fff9e6 0%, #fef9e7 50%, #eff3ff 100%);
  border-color: #fdcb6e;
  box-shadow: 0 0 18px rgba(253, 203, 110, 0.35);
}

body.shiny-mode .speech-bubble::after {
  border-top-color: #fdcb6e;
}

body.shiny-mode .bubble-label {
  color: #e17055;
}

/* Responsive */
@media (max-width: 520px) {
  .browser-controls {
    flex-direction: column;
  }

  .pokemon-grid-scroll {
    max-height: 240px;
  }

  .header {
    flex-wrap: wrap;
  }

  .title {
    width: 100%;
    text-align: center;
  }

  .star-counter {
    margin: 0 auto;
  }

  .quiz-options {
    grid-template-columns: 1fr;
  }

  .chat-fab {
    right: 0.85rem;
    bottom: 0.85rem;
  }
}
