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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  background: #2a1d17;
  color: #fef3c7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #2a1d17;
}

#game-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#overlay-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 58%, rgba(36, 20, 12, 0.42) 100%);
  z-index: 5;
}

.hidden {
  display: none !important;
}

#hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 10;
}

.hud-left {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.hud-right {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(32, 20, 15, 0.78);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 6px;
  backdrop-filter: blur(4px);
}

.hud-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #e7cbb0;
}

.hud-value {
  font-size: 15px;
  font-weight: 800;
  color: #facc15;
}

.hud-value.cyan {
  color: #38bdf8;
}

.hud-value.amber {
  color: #fbbf24;
}

.hp-pips {
  display: inline-flex;
  gap: 4px;
}

.pip {
  width: 12px;
  height: 8px;
  border-radius: 2px;
  background: rgba(254, 243, 199, 0.2);
  border: 1px solid rgba(251, 191, 36, 0.35);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.pip.active {
  background: #facc15;
  border-color: #fef08a;
  box-shadow: 0 0 6px rgba(250, 204, 21, 0.7);
}

.hud-combo {
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(255, 90, 95, 0.9);
  border: 1px solid #fef08a;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  box-shadow: 0 0 12px rgba(255, 90, 95, 0.55);
}

.hud-btn {
  width: 36px;
  height: 34px;
  border-radius: 6px;
  background: rgba(32, 20, 15, 0.82);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: #fef3c7;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.hud-btn:hover {
  border-color: #38bdf8;
  background: rgba(48, 30, 22, 0.94);
}

.screen-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(28, 17, 12, 0.48);
  z-index: 20;
}

.card {
  width: 100%;
  max-width: 420px;
  padding: 26px 24px;
  border-radius: 10px;
  background: rgba(32, 20, 15, 0.92);
  border: 2px solid rgba(250, 204, 21, 0.45);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.6);
  text-align: center;
}

.gameover-card {
  border-color: rgba(255, 90, 95, 0.6);
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  margin-bottom: 12px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: #7dd3fc;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.badge.danger {
  background: rgba(255, 90, 95, 0.2);
  border-color: rgba(255, 90, 95, 0.55);
  color: #fca5a5;
}

.title {
  font-size: 36px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.09em;
  color: #fef3c7;
  text-shadow: 0 3px 0 #991b1b, 0 0 18px rgba(250, 204, 21, 0.35);
}

.subtitle {
  margin-top: 6px;
  margin-bottom: 16px;
  font-size: 14px;
  letter-spacing: 0.26em;
  color: #ff5a5f;
  font-weight: 800;
}

.controls-hint {
  font-size: 13px;
  line-height: 1.65;
  color: #fde68a;
  margin-bottom: 10px;
}

.touch-hint {
  font-size: 11px;
  color: #d6b89c;
  margin-bottom: 20px;
}

.primary-btn {
  width: 100%;
  padding: 13px 18px;
  border: none;
  border-radius: 6px;
  background: #ff5a5f;
  color: #fffbeb;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 4px 0 #991b1b;
  transition: transform 0.08s ease, background 0.15s ease;
}

.primary-btn:hover {
  background: #ff7075;
}

.primary-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #991b1b;
}

.gameover-title {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #fef3c7;
  margin-bottom: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-box {
  padding: 10px;
  border-radius: 6px;
  background: rgba(45, 29, 22, 0.9);
  border: 1px solid rgba(251, 191, 36, 0.25);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #d6b89c;
}

.stat-value {
  font-size: 20px;
  font-weight: 800;
  color: #facc15;
}

.card > .lang-toggle {
  display: flex;
  width: fit-content;
  margin: 0 auto 14px;
}

.lang-toggle {
  display: inline-flex;
  align-items: stretch;
  margin: 0 0 14px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 6px;
  overflow: hidden;
  background: rgba(45, 29, 22, 0.9);
}

.lang-btn {
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 5px 11px;
  border: 0;
  background: transparent;
  color: #fde68a;
}

.lang-btn + .lang-btn {
  border-left: 1px solid rgba(251, 191, 36, 0.45);
}

.lang-btn[aria-pressed="true"] {
  background: rgba(250, 204, 21, 0.22);
  color: #fef3c7;
}
