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

:root {
  --black: #111;
  --white: #fff;
  --red: #e02020;
  --yellow: #f5c518;
  --gray: #888;
  --light: #f4f4f4;
}

html, body {
  width: 100%; height: 100%;
  background: var(--white);
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--black);
  overflow: hidden;
}

#app {
  width: 100%; height: 100%;
  position: relative;
}

.screen {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}

.screen.active {
  opacity: 1; pointer-events: all;
}

/* TITLE */
#title-content {
  text-align: center;
  padding: 2rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.8rem;
}

#title-badge {
  font-size: 3rem;
  animation: pulse 1.2s infinite alternate;
}

@keyframes pulse {
  from { transform: scale(1); }
  to { transform: scale(1.15); }
}

#title-main {
  font-size: clamp(1.6rem, 7vw, 2.4rem);
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: 0.02em;
}

#title-sub {
  font-size: clamp(0.95rem, 4vw, 1.1rem);
  font-weight: 700;
  color: var(--red);
}

#title-desc {
  font-size: 0.85rem;
  color: var(--gray);
}

#how-to {
  font-size: 0.78rem;
  color: var(--gray);
  line-height: 1.7;
  margin-top: 0.4rem;
}

.action-btn {
  background: var(--black);
  color: var(--white);
  border: none;
  padding: 0.9rem 2.5rem;
  font-size: 1.1rem;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: background 0.15s;
  min-width: 200px;
  min-height: 52px;
}

.action-btn:active { background: #333; }

/* GAME */
#game-screen {
  flex-direction: column;
  justify-content: flex-start;
  background: var(--white);
}

#hud {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-bottom: 2px solid var(--black);
  background: var(--white);
  z-index: 10;
}

#score-box, #timer-box {
  font-size: 0.9rem;
  font-weight: 700;
}

#timer-box {
  font-size: 1rem;
  font-weight: 900;
  min-width: 4rem;
  text-align: right;
}

#timer-box.urgent { color: var(--red); animation: shake 0.3s infinite; }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

#lives-box { display: flex; gap: 4px; font-size: 1.2rem; }

#stage-label {
  font-size: 0.75rem;
  color: var(--gray);
  text-align: center;
  padding: 0.3rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  min-height: 1.5rem;
}

#lineup {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(4px, 2vw, 16px);
  padding: 0 0.5rem 0.5rem;
  width: 100%;
  overflow: hidden;
}

.character-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  flex: 1;
  max-width: 130px;
  min-width: 0;
  position: relative;
  transition: transform 0.1s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.character-card:active { transform: scale(0.95); }

.character-card img {
  width: 100%;
  aspect-ratio: 1/1.4;
  object-fit: contain;
  object-position: bottom;
  border-radius: 8px 8px 0 0;
  display: block;
}

.character-card .card-label {
  width: 100%;
  background: var(--black);
  color: var(--white);
  text-align: center;
  font-size: clamp(0.6rem, 2.5vw, 0.8rem);
  font-weight: 700;
  padding: 0.25rem 0.1rem;
  border-radius: 0 0 6px 6px;
  letter-spacing: 0.02em;
}

.character-card.correct img { outline: 4px solid #00aa44; border-radius: 8px 8px 0 0; }
.character-card.wrong img { outline: 4px solid var(--red); border-radius: 8px 8px 0 0; }
.character-card.reveal img { outline: 4px solid var(--yellow); border-radius: 8px 8px 0 0; }

#speech-bubble {
  position: relative;
  background: var(--black);
  color: var(--white);
  font-size: clamp(0.8rem, 3.5vw, 1rem);
  font-weight: 700;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  margin: 0.4rem 1rem;
  text-align: center;
  letter-spacing: 0.03em;
}

#speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--black);
}

#speech-bubble.hidden { display: none; }

#result-flash {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2rem, 10vw, 4rem);
  font-weight: 900;
  pointer-events: none;
  z-index: 100;
  opacity: 0;
}

#result-flash.show {
  animation: flash-anim 0.6s ease forwards;
}

@keyframes flash-anim {
  0% { opacity: 1; transform: scale(0.7); }
  50% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0; transform: scale(1.3); }
}

/* GAME OVER */
#gameover-content {
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 0.8rem;
  padding: 2rem;
}

#go-icon { font-size: 3rem; }

#gameover-content h2 {
  font-size: clamp(1.6rem, 7vw, 2.2rem);
  font-weight: 900;
}

#go-score-label { font-size: 0.85rem; color: var(--gray); font-weight: 700; letter-spacing: 0.1em; }

#go-score {
  font-size: clamp(3rem, 15vw, 5rem);
  font-weight: 900;
  line-height: 1;
}

#go-rank {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gray);
  min-height: 1.8rem;
}