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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #0c0e10;
  color: #d8d6d0;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 12px;
  gap: 12px;
}

.ui {
  width: 960px;
  max-width: 100%;
}

.title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 6px;
  color: #b8b4ac;
  text-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.95),
    1px 1px 0 rgba(0, 0, 0, 0.9);
}

.title .accent {
  color: #6a7a5a;
  text-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.95),
    1px 1px 0 rgba(0, 0, 0, 0.9);
}

.hud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 2px;
  background: #14181a;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.9),
    0 2px 0 rgba(0, 0, 0, 0.6);
  border: 1px solid #1e2428;
}

.hud-section {
  min-width: 140px;
  flex: 1;
}

.hud-section.compact {
  max-width: 90px;
  text-align: center;
}

.label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #5a5e58;
  margin-bottom: 3px;
}

.bar-shell {
  width: 100%;
  height: 14px;
  border-radius: 0;
  background: #0a0c0e;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px #1a1e22;
}

.bar-shell.demons {
  background: #0e0c0a;
  box-shadow: inset 0 0 0 1px #1a1816;
}

.bar-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3a4a38, #2a3828);
  transition: width 120ms ease-out;
}

.bar-fill.demons {
  background: linear-gradient(90deg, #4a3028, #2a1812);
}

.value {
  font-size: 18px;
  font-weight: 700;
  color: #b8b4ac;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9);
}

.help {
  margin-top: 4px;
  font-size: 11px;
  text-align: center;
  color: #4a4e48;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-touch-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}

.game-touch-actions.hidden {
  display: none;
}

.game-action-btn {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 2px;
  border: 1px solid #2a3028;
  background: #1e2620;
  color: #b8b4ac;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
}

.game-action-btn:hover,
.game-action-btn:focus {
  background: #2a3228;
  color: #d8d6d0;
}

.game-action-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}

/* ---------- Title screen ---------- */
.title-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0600;
}

.title-screen.hidden {
  display: none;
}

.title-screen canvas#title-flames {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.title-screen-filters {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.title-screen-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 24px;
  pointer-events: none;
}

.title-music-toggle {
  position: absolute;
  bottom: 24px;
  right: 24px;
  z-index: 10;
  pointer-events: auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(200, 180, 120, 0.4);
  border-radius: 6px;
  background: rgba(20, 18, 14, 0.85);
  color: #c8b478;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.title-music-toggle:hover {
  background: rgba(40, 36, 28, 0.95);
  border-color: rgba(200, 180, 120, 0.6);
  color: #e0d0a0;
}

.title-music-toggle:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(200, 180, 120, 0.5);
}

.title-music-toggle.is-muted .title-music-toggle-icon {
  opacity: 0.6;
}

.title-music-toggle .title-music-toggle-icon {
  line-height: 1;
}

/* Crusader name screen (after "press any key") */
.title-screen .title-name-screen {
  display: none;
}

.title-screen.show-name .title-screen-content {
  display: none;
}

.title-screen.show-name .title-name-screen {
  display: flex;
}

/* Main menu (after name selected) */
.title-screen .title-main-menu {
  display: none;
}

.title-screen.show-menu .title-screen-content,
.title-screen.show-menu .title-name-screen {
  display: none;
}

.title-screen.show-menu .title-main-menu {
  display: flex;
}

.title-name-screen {
  position: absolute;
  inset: 0;
  z-index: 2;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  pointer-events: auto;
  padding: 24px;
}

.title-name-heading {
  font-family: "Cinzel", "Times New Roman", serif;
  font-weight: 700;
  font-size: clamp(20px, 4vw, 26px);
  letter-spacing: 0.12em;
  color: #c8b478;
  margin: 0 0 8px 0;
}

.title-name-list-wrap {
  max-height: 200px;
  overflow-y: auto;
  min-width: 260px;
  max-width: 90vw;
}

.title-name-list-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #908870;
  margin: 0 0 8px 0;
}

.title-name-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.title-name-list li {
  margin: 0;
}

.title-name-char-btn {
  font-family: "Cinzel", "Times New Roman", serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.08em;
  color: #c8b478;
  background: rgba(20, 18, 14, 0.8);
  border: 1px solid rgba(200, 180, 120, 0.35);
  padding: 10px 20px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.title-name-char-btn:hover {
  background: rgba(40, 36, 28, 0.9);
  border-color: rgba(200, 180, 120, 0.6);
  color: #e0d0a0;
}

.title-name-char-btn .char-score {
  font-size: 12px;
  color: #908870;
  font-weight: 600;
}

.title-name-new-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 260px;
}

.title-name-new-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #908870;
}

.title-name-input {
  font-family: "Cinzel", "Times New Roman", serif;
  font-size: 16px;
  padding: 10px 16px;
  width: 100%;
  max-width: 280px;
  background: rgba(20, 18, 14, 0.9);
  border: 1px solid rgba(200, 180, 120, 0.4);
  border-radius: 4px;
  color: #e0d0a0;
}

.title-name-input::placeholder {
  color: #6a6050;
}

.title-name-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(200, 180, 120, 0.4);
}

.title-name-erase-btn {
  font-family: "Cinzel", "Times New Roman", serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: #908870;
  background: transparent;
  border: 1px solid rgba(140, 120, 80, 0.35);
  padding: 8px 16px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
  margin-top: 8px;
}

.title-name-erase-btn:hover {
  color: #b09070;
  border-color: rgba(160, 120, 80, 0.5);
}

.title-name-erase-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.title-erase-confirm {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: rgba(10, 6, 0, 0.92);
  padding: 24px;
  pointer-events: auto;
}

.title-erase-confirm.hidden {
  display: none;
}

.title-erase-confirm-msg {
  font-family: "Cinzel", "Times New Roman", serif;
  font-size: 16px;
  color: #c8b478;
  text-align: center;
  margin: 0;
}

.title-erase-confirm-btns {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.title-erase-confirm-erase {
  border-color: rgba(180, 80, 60, 0.5);
  color: #d09080;
}

.title-erase-confirm-erase:hover {
  border-color: rgba(200, 90, 70, 0.7);
  color: #e0a090;
}

/* Campaign stage select */
.campaign-stage-select {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  pointer-events: auto;
  background: rgba(10, 6, 0, 0.9);
}

.campaign-stage-select.hidden {
  display: none;
}

.campaign-stage-select-heading {
  font-family: "Cinzel", "Times New Roman", serif;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.12em;
  color: #c8b478;
  margin: 0;
}

.campaign-stage-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.campaign-stage-list .campaign-stage-btn {
  min-width: 280px;
}

/* Campaign transition cinematic (between stages, full screen over game) */
.campaign-transition-cinematic {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: #1a1208;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.campaign-transition-cinematic.hidden {
  display: none;
}

.campaign-transition-inner {
  position: relative;
  width: 100%;
  max-width: 900px;
  height: 70%;
  max-height: 420px;
}

.campaign-transition-panel {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  justify-content: flex-end;
  background: #2a2012;
  border: 5px solid #0a0804;
  box-shadow:
    inset 0 0 0 2px #0a0804,
    4px 4px 0 #0a0804;
}

.campaign-transition-panel.active {
  display: flex;
  animation: campaign-panel-in 0.4s ease-out;
}

.campaign-transition-panel-border {
  position: absolute;
  inset: -3px;
  border: 3px solid #0a0804;
  pointer-events: none;
}

.campaign-transition-art {
  position: absolute;
  inset: 12px;
  background: #1a1410;
  border-radius: 2px;
}

.campaign-transition-approach {
  background: linear-gradient(to bottom, #2a3040 0%, #1a1820 50%, #0e0c08 100%);
}

.campaign-transition-sky {
  position: absolute;
  inset: 0 0 50% 0;
  background: linear-gradient(to bottom, #3a4050 0%, #2a3040 100%);
}

.campaign-transition-road {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 35%;
  background: linear-gradient(to top, #1a1612 0%, #2a2420 100%);
  clip-path: polygon(0 40%, 100% 30%, 100% 100%, 0 100%);
}

.campaign-transition-svg {
  position: absolute;
  bottom: 8%;
  left: 15%;
  width: 22%;
  height: auto;
  max-height: 75%;
  filter: drop-shadow(2px 4px 4px rgba(0,0,0,0.6));
}

.campaign-transition-city {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 45%;
  height: 50%;
  background: linear-gradient(to top, #1a1618 0%, #2a2430 40%, #3a3440 100%);
  clip-path: polygon(20% 100%, 0 60%, 0 100%, 25% 100%, 30% 70%, 40% 100%, 50% 55%, 60% 100%, 70% 65%, 80% 100%, 100% 50%, 100% 100%);
}

.campaign-transition-hordes {
  background: linear-gradient(to bottom, #301818 0%, #1a0c0c 100%);
}

.campaign-transition-demons-bg,
.campaign-transition-demons-fg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% 80%, rgba(80,20,20,0.3) 0%, transparent 60%);
}

.campaign-transition-demons-fg {
  background: radial-gradient(ellipse 60% 40% at 50% 90%, rgba(60,15,15,0.4) 0%, transparent 70%);
}

.crusader-center {
  left: 50%;
  transform: translateX(-50%);
  bottom: 5%;
  width: 18%;
}

.campaign-transition-victory {
  background: linear-gradient(to bottom, #2a2830 0%, #1a1820 50%, #0e0c08 100%);
}

.campaign-transition-light {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 30%, rgba(255,240,200,0.15) 0%, transparent 55%);
}

.crusader-victory {
  left: 38%;
  bottom: 5%;
  width: 24%;
}

.campaign-transition-cross {
  position: absolute;
  top: 15%;
  right: 20%;
  width: 12%;
  height: 35%;
  background: linear-gradient(to bottom, transparent 0%, rgba(200,180,120,0.2) 30%, rgba(200,180,120,0.2) 70%, transparent 100%);
  clip-path: polygon(45% 0%, 55% 0%, 55% 100%, 45% 100%, 45% 45%, 20% 45%, 20% 55%, 45% 55%);
}

.campaign-transition-caption {
  position: relative;
  z-index: 2;
  margin: 0;
  padding: 16px 24px;
  font-family: "Cinzel", "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.4;
  color: #c8b478;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.campaign-transition-cta {
  position: relative;
  z-index: 2;
  margin: 12px 0 0;
  font-size: 13px;
  color: #908870;
  letter-spacing: 0.1em;
}

.campaign-transition-halftone {
  position: absolute;
  inset: 0;
  background: repeating-conic-gradient(#0a0804 0% 25%, transparent 0% 50%) 50% / 2px 2px;
  opacity: 0.06;
  pointer-events: none;
}

/* Campaign cinematic – comic book style */
.campaign-cinematic {
  position: absolute;
  inset: 0;
  z-index: 25;
  background: #1a1208;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.campaign-cinematic.hidden {
  display: none;
}

.campaign-cinematic-inner {
  position: relative;
  width: 100%;
  height: 100%;
}

.campaign-panel {
  position: absolute;
  inset: 24px;
  display: none;
  flex-direction: column;
  justify-content: flex-end;
  background: #2a2012;
  border: 5px solid #0a0804;
  box-shadow:
    inset 0 0 0 2px #0a0804,
    4px 4px 0 #0a0804,
    8px 8px 0 rgba(0, 0, 0, 0.4);
}

.campaign-panel.active {
  display: flex;
  animation: campaign-panel-in 0.4s ease-out;
}

@keyframes campaign-panel-in {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.campaign-panel-border {
  position: absolute;
  inset: -3px;
  border: 3px solid #0a0804;
  pointer-events: none;
}

.campaign-panel-caption {
  position: relative;
  z-index: 2;
  font-family: "Cinzel", "Times New Roman", serif;
  font-weight: 700;
  font-size: clamp(14px, 2.8vw, 22px);
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #0a0804;
  background: #f0e0a0;
  padding: 14px 24px;
  margin: 20px;
  border: 4px solid #0a0804;
  box-shadow: 4px 4px 0 #0a0804;
}

.campaign-panel-cta {
  text-transform: none;
  letter-spacing: 0.08em;
  font-size: clamp(12px, 2.2vw, 18px);
  background: #fff8d0;
}

.campaign-panel-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.campaign-svg {
  position: absolute;
  height: 55%;
  max-height: 320px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(4px 6px 8px rgba(0, 0, 0, 0.5));
}

.campaign-panel-art-1 {
  background: linear-gradient(180deg, #3a3428 0%, #2a2418 50%, #1a1410 100%);
}

.campaign-sky {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 100% 60% at 50% 20%, rgba(60, 50, 35, 0.6) 0%, transparent 60%);
}

.campaign-crusader-walk {
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%);
  animation: campaign-walk 3s ease-in-out infinite;
}

.campaign-svg-cape {
  transform-origin: 70px 35px;
  animation: campaign-cape-sway 2.5s ease-in-out infinite;
}

@keyframes campaign-walk {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(4px); }
}

@keyframes campaign-cape-sway {
  0%, 100% { transform: skewX(0deg); }
  50% { transform: skewX(3deg); }
}

.campaign-panel-art-2 {
  background: linear-gradient(180deg, #4a4030 0%, #3a3020 40%, #2a2014 100%);
}

.campaign-sun {
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #f0e8c0, #e0c860 40%, #c89830 100%);
  box-shadow: 0 0 60px rgba(230, 180, 80, 0.6);
  animation: campaign-sun-pulse 4s ease-in-out infinite;
}

.campaign-sun-glow {
  animation: campaign-sun-pulse 4s ease-in-out infinite;
}

@keyframes campaign-sun-pulse {
  0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
  50% { opacity: 0.9; transform: translateX(-50%) scale(1.08); }
}

.campaign-road {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 28%;
  background: linear-gradient(180deg, transparent 0%, #2a2018 20%, #1a1410 100%);
  clip-path: polygon(15% 100%, 35% 40%, 65% 40%, 85% 100%);
  animation: campaign-road-shine 5s linear infinite;
}

@keyframes campaign-road-shine {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

.campaign-crusader-pilgrim {
  left: 28%;
  bottom: 20%;
  transform: translateX(0);
  animation: campaign-pilgrim-move 6s ease-in-out infinite;
}

@keyframes campaign-pilgrim-move {
  0%, 100% { transform: translateX(0) translateY(0); }
  50% { transform: translateX(8px) translateY(-2px); }
}

.campaign-cross-distant {
  right: 18%;
  bottom: 22%;
  left: auto;
  height: 35%;
  opacity: 0.9;
  animation: campaign-cross-glow 5s ease-in-out infinite;
}

@keyframes campaign-cross-glow {
  0%, 100% { opacity: 0.85; filter: drop-shadow(4px 6px 8px rgba(0,0,0,0.5)); }
  50% { opacity: 1; filter: drop-shadow(0 0 12px rgba(200,180,100,0.3)); }
}

.campaign-panel-art-3 {
  background: linear-gradient(180deg, #2a1512 0%, #1a0c08 50%, #0a0804 100%);
}

.campaign-demon-sky {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 100% 70% at 50% 20%, rgba(80, 20, 20, 0.4) 0%, transparent 55%);
  animation: campaign-demon-sky-pulse 3s ease-in-out infinite;
}

@keyframes campaign-demon-sky-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.campaign-demon {
  height: 42%;
  max-height: 200px;
}

.campaign-demon-1 { left: 18%; bottom: 22%; }
.campaign-demon-2 { left: 50%; bottom: 18%; transform: translateX(-50%); }
.campaign-demon-3 { right: 18%; bottom: 24%; left: auto; }

.campaign-demon .demon-eye {
  animation: campaign-demon-eye 1.5s ease-in-out infinite;
}

@keyframes campaign-demon-eye {
  0%, 100% { opacity: 1; fill: #5a2020; }
  50% { opacity: 0.6; fill: #8a3030; }
}

.campaign-demon-2 .demon-eye { animation-delay: 0.3s; }
.campaign-demon-3 .demon-eye { animation-delay: 0.6s; }

.campaign-panel-art-4 {
  background: linear-gradient(180deg, #1a1410 0%, #0a0804 100%);
}

.campaign-light-break {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% 30%, rgba(240, 220, 160, 0.15) 0%, transparent 50%);
  animation: campaign-light-break 3s ease-in-out infinite;
}

@keyframes campaign-light-break {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.campaign-crusader-hero {
  left: 50%;
  bottom: 15%;
  transform: translateX(-50%);
  animation: campaign-hero-hold 2.5s ease-in-out infinite;
}

@keyframes campaign-hero-hold {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.02); }
}

.campaign-panel-art-5 {
  background: linear-gradient(180deg, #2a2418 0%, #1a1008 100%);
}

.campaign-crusader-ready {
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%);
  animation: campaign-ready-idle 2s ease-in-out infinite;
}

@keyframes campaign-ready-idle {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(3px); }
}

.campaign-panel-last .campaign-panel-caption {
  animation: campaign-cta-pulse 1.5s ease-in-out infinite;
}

@keyframes campaign-cta-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.88; }
}

.campaign-cinematic-halftone {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.08;
  background-image: radial-gradient(circle at center, #0a0804 1px, transparent 1px);
  background-size: 4px 4px;
}

.title-main-menu {
  position: absolute;
  inset: 0;
  z-index: 2;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.title-menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.title-menu-btn {
  font-family: "Cinzel", "Times New Roman", serif;
  font-weight: 700;
  font-size: clamp(18px, 4vw, 24px);
  letter-spacing: 0.12em;
  color: #c8b478;
  background: transparent;
  border: 1px solid rgba(200, 180, 120, 0.35);
  padding: 12px 32px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  min-width: 200px;
}

.title-menu-btn:hover {
  background: rgba(40, 36, 28, 0.6);
  border-color: rgba(200, 180, 120, 0.6);
  color: #e0d0a0;
}

.title-menu-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(200, 180, 120, 0.5);
}

/* Options subpanel */
.title-options-panel {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  pointer-events: auto;
  background: rgba(10, 6, 0, 0.85);
}

.title-options-panel.hidden {
  display: none;
}

.title-options-heading {
  font-family: "Cinzel", "Times New Roman", serif;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: 0.12em;
  color: #c8b478;
  margin: 0;
}

.title-options-placeholder {
  color: #908870;
  font-size: 14px;
  margin: 0;
}

.title-metal-wrap {
  margin-bottom: 20px;
  filter: drop-shadow(0 12px 8px rgba(0, 0, 0, 0.55))
          drop-shadow(0 24px 32px rgba(0, 0, 0, 0.35));
}

/* Elden Ring–style title: SVG wordmark, two lines, art-directed */
.title-logo {
  display: block;
  width: min(94vw, 720px);
  height: auto;
  margin: 0 auto;
}

.title-logo-line {
  font-family: "Cinzel", "Times New Roman", serif;
  font-weight: 900;
  font-size: 36px;
  letter-spacing: 0.28em;
}

.title-orange-layer {
  animation: title-fire-reflection 9s linear infinite;
  animation-delay: -0.4s;
  pointer-events: none;
}

.title-white-layer {
  pointer-events: none;
}

.title-top-white {
  pointer-events: none;
}

@keyframes title-fire-reflection {
  0% { opacity: 0.9; }
  2% { opacity: 0.5; }
  3% { opacity: 0.92; }
  8% { opacity: 0.55; }
  9% { opacity: 0.88; }
  15% { opacity: 0.42; }
  18% { opacity: 0.78; }
  24% { opacity: 0.52; }
  27% { opacity: 1; }
  31% { opacity: 0.48; }
  35% { opacity: 0.82; }
  42% { opacity: 0.45; }
  44% { opacity: 0.95; }
  51% { opacity: 0.58; }
  56% { opacity: 0.72; }
  63% { opacity: 0.44; }
  67% { opacity: 0.9; }
  74% { opacity: 0.5; }
  78% { opacity: 0.85; }
  85% { opacity: 0.54; }
  89% { opacity: 0.78; }
  96% { opacity: 0.46; }
  100% { opacity: 0.88; }
}

.title-subtitle {
  font-size: clamp(12px, 2vw, 16px);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(255, 220, 180, 0.9);
  text-shadow: 0 0 8px rgba(240, 180, 60, 0.5), 0 2px 4px rgba(0, 0, 0, 0.9);
  margin: 0;
  animation: title-pulse 1.5s ease-in-out infinite;
}

@keyframes title-pulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

canvas#game {
  outline: none;
  border-radius: 0;
  background: #080a0c;
  box-shadow:
    0 0 0 2px #14181a,
    0 0 0 4px #0a0c0e,
    0 8px 0 rgba(0, 0, 0, 0.7),
    0 16px 40px rgba(0, 0, 0, 0.8);
  max-width: 100%;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.overlay.hidden {
  display: none;
}

.panel {
  width: 420px;
  max-width: 92vw;
  padding: 20px 22px;
  border-radius: 0;
  background: #14181a;
  box-shadow:
    inset 0 0 0 1px #1e2428,
    0 0 0 2px #0a0c0e,
    0 8px 0 rgba(0, 0, 0, 0.7),
    0 20px 48px rgba(0, 0, 0, 0.9);
  border: 1px solid #1e2428;
}

.panel h2 {
  margin: 0 0 4px 0;
  font-size: 24px;
  font-weight: 800;
  color: #b8b4ac;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9);
}

.panel h3 {
  margin-top: 14px;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 700;
  color: #5a5e58;
}

.panel p {
  margin-top: 0;
  margin-bottom: 12px;
  color: #7a7e78;
  font-size: 14px;
}

.pause-panel h2 {
  margin-bottom: 8px;
}

.pause-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.pause-buttons .primary {
  margin-top: 0;
}

.score-entry {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 4px;
}

.score-entry label {
  flex: 1;
  font-size: 12px;
  color: #5a5e58;
}

.score-entry input {
  margin-top: 3px;
  width: 100%;
  padding: 6px 8px;
  border-radius: 0;
  border: 1px solid #1e2428;
  background: #0a0c0e;
  color: #d8d6d0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5);
}

button {
  padding: 6px 12px;
  border-radius: 0;
  border: 1px solid #1e2428;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  background: #1a2024;
  color: #b8b4ac;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
  transition: transform 80ms ease-out, box-shadow 80ms ease-out, background 120ms ease-out;
}

button.primary {
  width: 100%;
  margin-top: 8px;
  background: #2a3830;
  border-color: #3a4840;
  color: #e0e4dc;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.7);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.75);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.65);
}

.leaderboard {
  max-height: 190px;
  overflow-y: auto;
  padding-right: 4px;
}

.leaderboard ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
}

.leaderboard li {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid #1e2428;
}

.leaderboard li span.name {
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #7a7e78;
}

.leaderboard li span.score {
  color: #6a7a5a;
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
}

@media (max-width: 768px) {
  .hud {
    flex-direction: column;
    align-items: stretch;
  }

  .hud-section.compact {
    max-width: none;
    text-align: left;
  }
}

