/* Navbar layout matches Typing Race; Typing War colors remain unchanged. */
.game-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  min-width: 0
}

.site-logo {
  width: 34px;
  height: 34px;
  display: block;
  object-fit: contain
}

.site-name {
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  white-space: nowrap
}

.game-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #777;
  font-size: 14px
}

.game-breadcrumbs a {
  color: #aaa;
  text-decoration: none
}

.game-breadcrumbs a:hover {
  color: #fff
}

.game-breadcrumbs strong {
  color: #ff9b72;
  white-space: nowrap
}

:root {
  --bg: #090b12;
  --card: #121722;
  --card2: #171d2a;
  --text: #f5f7fb;
  --muted: #9ba6b8;
  --border: #273043;
  --accent: #ff4d5a;
  --accent2: #ff8a3d;
  --green: #37d67a;
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  background: radial-gradient(circle at 50% -10%, #272035 0, #090b12 48%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  min-height: 100vh
}

button,
input {
  font: inherit
}

button {
  cursor: pointer
}

.app {
  width: min(920px, 100%);
  margin: auto;
  padding: 18px 14px 50px
}

.screen {
  display: none
}

.screen.active {
  display: block
}

.hero {
  text-align: center;
  padding: 36px 10px 24px
}

.badge {
  display: inline-block;
  border: 1px solid #5b3440;
  background: #24151d;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 800;
  color: #ff9b72
}

.hero h1 {
  font-size: clamp(42px, 10vw, 72px);
  margin: 12px 0 5px;
  letter-spacing: -3px
}

.hero p {
  color: var(--muted);
  margin: 0
}

.card {
  background: linear-gradient(180deg, var(--card2), var(--card));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 20px 60px #0007
}

.lobby-card {
  max-width: 560px;
  margin: auto
}

label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 7px
}

input {
  width: 100%;
  border: 1px solid var(--border);
  background: #0c1018;
  color: #fff;
  border-radius: 12px;
  padding: 13px 14px;
  outline: none
}

input:focus {
  border-color: #ff6c55;
  box-shadow: 0 0 0 3px #ff5b4420
}

.lobby-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px
}

.join-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 10px
}

button {
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  font-weight: 800;
  transition: .15s transform, .15s opacity
}

button:active {
  transform: scale(.98)
}

button:disabled {
  opacity: .45;
  cursor: not-allowed
}

.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff
}

.secondary {
  background: #202838;
  color: #fff;
  border: 1px solid #344057
}

.danger {
  background: #341a22;
  color: #ff8e98;
  border: 1px solid #65303b
}

.status {
  min-height: 20px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  margin: 16px 0 0
}

.center {
  text-align: center;
  max-width: 620px;
  margin: 40px auto
}

.spinner {
  width: 46px;
  height: 46px;
  border: 4px solid #333b4c;
  border-top-color: #ff654e;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 18px
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

.room-code-wrap {
  margin: 20px auto;
  padding: 13px;
  background: #0c1018;
  border: 1px dashed #465168;
  border-radius: 12px;
  max-width: 220px
}

.room-code-wrap span {
  display: block;
  color: var(--muted);
  font-size: 10px
}

.room-code-wrap strong {
  font-size: 28px;
  letter-spacing: 5px
}

.vs {
  font-size: 28px;
  margin-bottom: 10px
}

.ready-button {
  min-width: 190px;
  margin-top: 15px
}

.link-button {
  display: block;
  background: none;
  color: var(--muted);
  margin: 10px auto 0;
  padding: 8px
}

.battle-head {
  display: grid;
  grid-template-columns: 1fr 80px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px
}

.fighter {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 13px;
  border-radius: 15px
}

.fighter.opponent {
  text-align: right
}

.fighter-name {
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.hp {
  height: 11px;
  background: #2a1d26;
  border-radius: 99px;
  overflow: hidden;
  margin: 8px 0
}

.hp span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff3e52, #ff9a43);
  transition: width .25s
}

.opponent .hp span {
  margin-left: auto;
  background: linear-gradient(90deg, #ff9a43, #ff3e52)
}

.fighter-meta {
  font-size: 12px;
  color: var(--muted)
}

.fighter-meta b {
  color: #fff
}

.timer {
  text-align: center;
  font-size: 34px;
  font-weight: 900;
  background: #111724;
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 13px 5px
}

.battle-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px
}

.combat-line {
  display: flex;
  justify-content: space-between;
  color: #ffad7a;
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 16px
}

.prompt {
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.35;
  letter-spacing: .5px;
  min-height: 140px;
  user-select: none;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px;
  word-break: break-word
}

.prompt .correct {
  color: #54dc91
}

.prompt .current {
  background: #ff6a5540;
  border-bottom: 2px solid #ff8a67
}

.prompt .wrong {
  color: #ff5967
}

.typing-input {
  display: block;
  width: min(680px, 100%);
  margin: 22px auto 0;
  text-align: center;
  font-size: 20px;
  padding: 16px 18px;
  border-radius: 14px
}

.progress {
  height: 8px;
  background: #242c3a;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 13px
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #ff4d5a, #ff9a43);
  transition: width .1s
}

.battle-message {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 12px
}

.battle-leave {
  display: block;
  margin: 16px auto 0;
  background: #341a22;
  color: #ff8e98;
  border: 1px solid #65303b;
  padding: 9px 18px;
  font-size: 13px
}

.result-icon {
  font-size: 64px
}

.result-card h1 {
  margin: 5px 0
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 24px 0
}

.result-stats div {
  background: #0c1018;
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 14px
}

.result-stats strong {
  display: block;
  font-size: 24px
}

.result-stats span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px
}

@media(max-width:600px) {
  .app {
    padding: 12px 10px
  }

  .lobby-grid,
  .result-actions {
    grid-template-columns: 1fr
  }

  .join-row {
    grid-template-columns: 1fr
  }

  .battle-head {
    grid-template-columns: 1fr 58px 1fr;
    gap: 6px
  }

  .fighter {
    padding: 9px
  }

  .timer {
    font-size: 25px;
    padding: 11px 3px
  }

  .prompt {
    font-size: 28px;
    min-height: 150px;
    padding: 20px 8px
  }

  .typing-input {
    width: 100%;
    font-size: 18px;
    padding: 15px 14px
  }

  .battle-card {
    padding: 15px
  }

  .hero {
    padding-top: 22px
  }

  .hero h1 {
    letter-spacing: -2px
  }

  .result-stats strong {
    font-size: 20px
  }
}

.game-info {
  max-width: 760px;
  margin: 34px auto 0;
  display: grid;
  gap: 14px
}

.info-card {
  background: linear-gradient(180deg, #171d2a, #121722);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 14px 40px #0005
}

.info-card h2 {
  font-size: 22px;
  margin: 0 0 10px
}

.info-card>p {
  color: var(--muted);
  line-height: 1.65;
  margin: 0
}

.steps {
  display: grid;
  gap: 12px;
  margin-top: 18px
}

.step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start
}

.step>span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #2a2029;
  border: 1px solid #59323c;
  color: #ff9b72;
  font-weight: 900
}

.step strong {
  display: block;
  margin: 3px 0 3px
}

.step p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  margin: 0
}

.tips-card ul {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.8
}

.faq-card details {
  border-top: 1px solid var(--border);
  padding: 14px 0
}

.faq-card details:first-of-type {
  margin-top: 10px
}

.faq-card summary {
  cursor: pointer;
  font-weight: 800;
  list-style: none;
  padding-right: 24px;
  position: relative
}

.faq-card summary::-webkit-details-marker {
  display: none
}

.faq-card summary::after {
  content: '+';
  position: absolute;
  right: 0;
  color: #ff9b72;
  font-size: 20px;
  line-height: 1
}

.faq-card details[open] summary::after {
  content: '−'
}

.faq-card details p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  margin: 10px 0 0
}

@media(max-width:600px) {
  .topbar {
    align-items: flex-start;
    gap: 10px
  }

  .breadcrumb {
    font-size: 12px;
    gap: 5px;
    flex-wrap: wrap
  }

  .game-name {
    font-size: 13px;
    white-space: nowrap
  }

  .game-info {
    margin-top: 26px
  }

  .info-card {
    padding: 18px
  }

  .info-card h2 {
    font-size: 20px
  }
}

@media(max-width:600px) {
  .game-page-header {
    align-items: flex-start;
    gap: 10px
  }

  .site-logo {
    width: 30px;
    height: 30px
  }

  .site-name {
    font-size: 17px
  }

  .game-breadcrumbs {
    font-size: 12px;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: flex-end;
    text-align: right
  }
}