* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #1b1f3b 0%, #0a0c1a 70%);
  color: #f0f0f5;
  font-family: 'Segoe UI', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 12px;
}

.screen {
  width: 100%;
  max-width: 720px;
}

.hidden { display: none !important; }

.title {
  text-align: center;
  font-size: 2.2rem;
  margin-bottom: 4px;
  text-shadow: 0 0 12px #6c8cff;
}

.subtitle {
  text-align: center;
  color: #a9b0d6;
  margin-top: 0;
  margin-bottom: 24px;
}

.panel {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
}

.panel h2 {
  margin-top: 0;
  font-size: 1.05rem;
  color: #8fb3ff;
}

.mono {
  font-family: 'Consolas', monospace;
  color: #7CFC9C;
  font-weight: bold;
}

.status {
  color: #ffd166;
}

.hint {
  color: #9aa0c3;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* --- battle screen --- */

.hp-area {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 40px;
}

.hp-block { flex: 1; }

.vs {
  font-weight: bold;
  color: #ff6b6b;
  font-size: 1.1rem;
}

.hp-label {
  font-size: 0.85rem;
  margin-bottom: 4px;
  color: #cfd4ff;
}

.hp-bar-outer {
  width: 100%;
  height: 22px;
  background: #1e2140;
  border-radius: 11px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.15);
}

.hp-bar-inner {
  height: 100%;
  width: 100%;
  transition: width 0.25s ease-out;
}

.hp-bar-inner.me {
  background: linear-gradient(90deg, #2ecc71, #7CFC9C);
}

.hp-bar-inner.opp {
  background: linear-gradient(90deg, #ff5e5e, #ff8f8f);
}

.hp-bar-inner.low {
  background: linear-gradient(90deg, #b71c1c, #ff5252);
  animation: pulse 0.6s infinite alternate;
}

@keyframes pulse {
  from { filter: brightness(1); }
  to { filter: brightness(1.4); }
}

.word-area {
  text-align: center;
  padding: 40px 20px;
  background: rgba(255,255,255,0.03);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
}

.kana-display {
  font-size: 2.2rem;
  margin-bottom: 14px;
  letter-spacing: 2px;
}

.romaji-display {
  font-size: 2.4rem;
  font-family: 'Consolas', monospace;
  letter-spacing: 3px;
}

.romaji-display .done {
  color: #7CFC9C;
}

.romaji-display .next {
  color: #ffd166;
  text-decoration: underline;
}

.romaji-display .pending {
  color: #565b8c;
}

.feedback-area {
  text-align: center;
  margin-top: 20px;
  min-height: 2rem;
  font-size: 1.2rem;
  font-weight: bold;
}

.feedback-hit { color: #7CFC9C; }
.feedback-miss { color: #ff6b6b; animation: shake 0.25s; }

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

/* --- result screen --- */

.result-title {
  text-align: center;
  font-size: 2.8rem;
  margin-top: 80px;
  margin-bottom: 30px;
}

.result-title.win { color: #7CFC9C; text-shadow: 0 0 20px #2ecc71; }
.result-title.lose { color: #ff6b6b; text-shadow: 0 0 20px #ff3b3b; }
.result-title.draw { color: #ffd166; }

.btn-primary {
  display: block;
  margin: 0 auto;
  padding: 12px 28px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #5b7bff, #8f5bff);
  color: white;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
}

.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- ready screen --- */

.ready-panel {
  text-align: center;
  padding: 36px 20px;
}

.ready-panel .status {
  margin-top: 16px;
  margin-bottom: 0;
}

.countdown-overlay {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 40px;
}

.countdown-number {
  font-size: 6rem;
  font-weight: bold;
  color: #ffd166;
  text-shadow: 0 0 30px #ff9f1c;
}

.countdown-number.pulse {
  animation: countdown-pop 0.9s ease-out;
}

@keyframes countdown-pop {
  0% { transform: scale(1.6); opacity: 0; }
  30% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* --- lobby / login --- */

.auth-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-bar .nickname {
  color: #7CFC9C;
  font-weight: bold;
}

.btn-secondary {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  background: transparent;
  color: #f0f0f5;
  font-size: 0.9rem;
  cursor: pointer;
}
.btn-secondary:hover { background: rgba(255,255,255,0.08); }

.mode-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  text-align: left;
  color: #f0f0f5;
  font: inherit;
}
.mode-card:hover { background: rgba(255,255,255,0.07); border-color: #5b7bff; }
.mode-card:disabled { opacity: 0.4; cursor: not-allowed; }

.mode-card .mode-title { font-weight: bold; font-size: 1.05rem; color: #8fb3ff; }
.mode-card .mode-desc { font-size: 0.82rem; color: #9aa0c3; }

.room-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.room-row input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #444a7a;
  background: #10132a;
  color: #fff;
  font-size: 1rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.room-code-display {
  font-family: 'Consolas', monospace;
  font-size: 1.8rem;
  letter-spacing: 4px;
  color: #ffd166;
  text-align: center;
  margin: 8px 0;
}

.error-text {
  color: #ff6b6b;
  min-height: 1.2em;
  font-size: 0.85rem;
}

/* --- 広告枠(ロビー・結果画面のみ。対戦中には表示しない) --- */
.ad-slot {
  margin-top: 18px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px dashed rgba(255,255,255,0.12);
  color: #565b8c;
  font-size: 0.75rem;
}

.footer-links {
  text-align: center;
  margin-top: 20px;
  font-size: 0.75rem;
}
.footer-links a { color: #7d8ac0; }
