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

:root {
  --bg: #F5F0E8;
  --black: #1a1a1a;
  --border: 3px solid var(--black);
  --shadow: 4px 4px 0 var(--black);
  --accent: #FF6B6B;
  --accent2: #4ECDC4;
  --ai-color: #845EF7;
  --human-color: #FF922B;
  --success: #51CF66;
  --danger: #FF6B6B;
  --radius: 8px;
}

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

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--black);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
}

#app {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: #fff;
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

h1 {
  font-size: 2rem;
  font-weight: 900;
  text-align: center;
  line-height: 1.2;
}

h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
}

/* Loading screen */
#loading-screen {
  text-align: center;
  padding: 60px 20px;
}

#loading-screen h1 {
  margin-bottom: 16px;
}

.loading-dots {
  font-size: 2rem;
  font-weight: 900;
}

.loading-dots span {
  animation: blink 1.4s infinite;
  animation-fill-mode: both;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0; }
  40% { opacity: 1; }
}

.progress-bar-outer {
  width: 100%;
  height: 24px;
  border: var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 16px;
  background: #eee;
}

.progress-bar-inner {
  height: 100%;
  background: var(--ai-color);
  transition: width 0.3s ease;
  width: 0%;
}

/* Title screen */
#title-screen {
  text-align: center;
  padding: 40px 20px;
}

#title-screen h1 {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 1rem;
  color: #666;
  margin-bottom: 24px;
}

.score-display {
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.btn {
  display: inline-block;
  padding: 14px 32px;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  text-transform: uppercase;
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--black);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-buzz {
  background: var(--human-color);
  color: #fff;
  font-size: 1.4rem;
  padding: 18px 40px;
  width: 100%;
}

.btn-buzz:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--accent2);
  color: var(--black);
}

/* Game screen */
#game-screen { display: none; }

.round-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 700;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
  background: #ddd;
}

.canvas-wrapper canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.blur-meter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  font-weight: 700;
}

.blur-meter-bar {
  flex: 1;
  height: 12px;
  border: 2px solid var(--black);
  border-radius: 6px;
  overflow: hidden;
  background: #eee;
}

.blur-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ai-color), var(--accent2));
  transition: width 0.3s;
}

/* AI predictions panel */
.ai-panel {
  margin-bottom: 12px;
}

.ai-panel h2 {
  color: var(--ai-color);
  font-size: 1rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.prediction-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.prediction-label {
  width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.prediction-bar-outer {
  flex: 1;
  height: 18px;
  border: 2px solid var(--black);
  border-radius: 4px;
  overflow: hidden;
  background: #f0f0f0;
}

.prediction-bar-inner {
  height: 100%;
  background: var(--ai-color);
  transition: width 0.25s ease;
  border-radius: 2px;
}

.prediction-pct {
  width: 45px;
  text-align: right;
  font-family: 'Courier New', monospace;
  font-weight: 700;
}

/* Buzz area */
.buzz-area {
  text-align: center;
}

.answer-input-wrap {
  display: none;
  margin-top: 12px;
}

.answer-input-wrap input {
  width: 100%;
  padding: 12px;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1.1rem;
  border: var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  outline: none;
}

.answer-input-wrap input:focus {
  box-shadow: 0 0 0 3px var(--human-color);
}

.hint-text {
  font-size: 0.8rem;
  color: #888;
  margin-top: 4px;
}

/* Result screen */
#result-screen { display: none; }

.result-banner {
  text-align: center;
  padding: 20px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 1.5rem;
  font-weight: 900;
  border: var(--border);
}

.result-banner.human-win {
  background: var(--human-color);
  color: #fff;
}

.result-banner.ai-win {
  background: var(--ai-color);
  color: #fff;
}

.result-banner.wrong {
  background: var(--danger);
  color: #fff;
}

.result-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.result-details {
  font-size: 0.9rem;
  line-height: 1.8;
}

.result-details dt {
  font-weight: 700;
  display: inline;
}

.result-details dd {
  display: inline;
  margin-left: 4px;
}

.result-details dd::after {
  content: '';
  display: block;
}

.ai-journey {
  margin-top: 12px;
}

.ai-journey h3 {
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.journey-step {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  padding: 2px 0;
  border-bottom: 1px dashed #ddd;
}

.score-big {
  font-size: 3rem;
  font-weight: 900;
  font-family: 'Courier New', monospace;
  text-align: center;
  margin: 12px 0;
}

.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.btn-row .btn {
  flex: 1;
  text-align: center;
}

/* Scoreboard */
.scoreboard {
  display: flex;
  justify-content: space-around;
  text-align: center;
  font-weight: 700;
  margin-bottom: 8px;
}

.scoreboard .label {
  font-size: 0.8rem;
  text-transform: uppercase;
}

.scoreboard .score {
  font-size: 1.8rem;
  font-family: 'Courier New', monospace;
}

.scoreboard .human .score { color: var(--human-color); }
.scoreboard .ai .score { color: var(--ai-color); }

/* Countdown overlay */
.countdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  z-index: 10;
}

.countdown-num {
  font-size: 5rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 3px 3px 0 var(--black);
  animation: countPop 0.5s ease;
}

@keyframes countPop {
  0% { transform: scale(2); opacity: 0; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}

/* Mobile */
@media (max-width: 480px) {
  body { padding: 8px; }
  h1 { font-size: 1.8rem; }
  .btn-buzz { font-size: 1.2rem; padding: 14px; }
  .prediction-label { width: 90px; font-size: 0.78rem; }
}
