@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;700;900&family=Fredoka+One&display=swap');

:root {
  --bg: #0f0f1a;
  --card-bg: #16213e;
  --text: #ffffff;
  --replay-color: #FFD93D;
  --active-color: #FF6B35;
}

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

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  transition: background 0.7s ease;
}

.screen {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 700px;
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* ── Title ── */
.title {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(24px, 5vw, 38px);
  text-align: center;
  background: linear-gradient(135deg, #FF6B35, #FFD93D, #4ECDC4, #F72585);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Category banner ── */
.category-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  max-width: 500px;
}

.cat-pill {
  flex: 1;
  border-radius: 40px;
  padding: 10px 12px;
  text-align: center;
  font-family: 'Fredoka One', cursive;
  font-size: clamp(13px, 2.5vw, 17px);
  border: 2.5px solid transparent;
  opacity: 0.32;
  transition: all 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  color: #fff;
  user-select: none;
  letter-spacing: 0.5px;
  cursor: pointer;
}

.cat-pill.active          { opacity: 1; transform: scale(1.07); }
.cat-pill:not(.active):hover { opacity: 0.65; transform: scale(1.03); }
.cat-pill.eating          { border-color: #FF6B35; }
.cat-pill.help            { border-color: #4ECDC4; }
.cat-pill.friends         { border-color: #F72585; }
.cat-pill.eating.active   { background: rgba(255, 107, 53,  0.18); box-shadow: 0 0 18px #FF6B3566; }
.cat-pill.help.active     { background: rgba(78,  205, 196, 0.18); box-shadow: 0 0 18px #4ECDC466; }
.cat-pill.friends.active  { background: rgba(247, 37,  133, 0.18); box-shadow: 0 0 18px #F7258566; }

.cat-emoji { font-size: 20px; display: block; margin-bottom: 2px; }

.space-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.32);
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ── Sign card ── */
.sign-card {
  width: 100%;
  border-radius: 32px;
  padding: 28px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 0 60px var(--card-glow, #FF6B3544), 0 8px 32px rgba(0, 0, 0, 0.5);
  background: var(--card-bg);
  border: 3px solid var(--card-border, #FF6B35);
  min-height: 320px;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: border-color 0.5s, box-shadow 0.5s;
}

.sign-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, var(--card-top, #FF6B3510) 0%, transparent 55%);
  pointer-events: none;
}

.sign-card.pop        { animation: popIn     0.42s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.sign-card.cat-switch { animation: catSwitch 0.5s  ease; }

@keyframes popIn {
  0%   { transform: scale(0.87); opacity: 0.3; }
  65%  { transform: scale(1.05); }
  100% { transform: scale(1);    opacity: 1;   }
}

@keyframes catSwitch {
  0%   { transform: translateY(12px) scale(0.95); opacity: 0.2; }
  100% { transform: translateY(0)    scale(1);    opacity: 1;   }
}

.sign-label {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(36px, 9vw, 72px);
  color: var(--active-color);
  line-height: 1;
  text-align: center;
  letter-spacing: 1px;
  transition: color 0.4s;
}

.hand-display {
  width: 200px;
  height: 200px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.09);
}

.hand-display svg { width: 170px; height: 170px; }

.sign-desc {
  font-size: 16px;
  text-align: center;
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.5;
  max-width: 400px;
  font-weight: 700;
}

.idle-message {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(18px, 3.5vw, 26px);
  text-align: center;
  color: rgba(255, 255, 255, 0.38);
  line-height: 1.7;
}

/* ── Key guide ── */
.key-guide {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 460px;
}

.key-btn {
  border-radius: 18px;
  padding: 14px 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  border: 3px solid var(--btn-color, #888);
  background: rgba(255, 255, 255, 0.05);
  transition: all 0.2s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.key-btn:hover                     { filter: brightness(1.18); transform: translateY(-2px); }
.key-btn:active, .key-btn.active-key { transform: scale(0.93); filter: brightness(1.3); }

.key-arrow { font-size: 26px; line-height: 1; }

.key-name {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(13px, 2.5vw, 17px);
  color: var(--btn-color, #888);
  letter-spacing: 0.3px;
  text-align: center;
}

.key-hint {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Bottom row ── */
.bottom-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.replay-btn {
  background: rgba(255, 217, 61, 0.10);
  border: 3px solid var(--replay-color);
  border-radius: 16px;
  color: var(--replay-color);
  font-family: 'Fredoka One', cursive;
  font-size: 18px;
  padding: 12px 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.replay-btn:hover  { background: rgba(255, 217, 61, 0.22); transform: translateY(-2px); }
.replay-btn:active { transform: scale(0.95); }
.replay-btn.flash  { animation: flashReplay 0.38s ease; }

@keyframes flashReplay {
  0%,  100% { box-shadow: none; }
  50%        { box-shadow: 0 0 22px var(--replay-color); background: rgba(255, 217, 61, 0.28); }
}

/* ── Tactile dots ── */
.tactile-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.t-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.18);
  transition: all 0.35s;
}

.t-dot.on {
  background: var(--active-color);
  border-color: var(--active-color);
  box-shadow: 0 0 10px var(--active-color);
}

.small-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Audio pulse overlay ── */
.audio-pulse {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99;
}

.audio-pulse.playing {
  animation: ringOut 0.65s ease-out forwards;
}

@keyframes ringOut {
  0%   { box-shadow: inset 0 0 0 0px  var(--pulse-color, #FF6B35); opacity: 1; }
  100% { box-shadow: inset 0 0 0 30px var(--pulse-color, #FF6B35); opacity: 0; }
}

/* ── Category flash overlay ── */
.cat-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 98;
  opacity: 0;
}

.cat-flash.active {
  animation: catFlash 0.5s ease-out forwards;
}

@keyframes catFlash {
  0%   { opacity: 0.2; background: var(--flash-color, #fff); }
  100% { opacity: 0; }
}
