:root {
  --parchment: #e9dcb8;
  --parchment-dark: #d8c69a;
  --ink: #2b1f14;
  --wood: #4a3220;
  --wood-dark: #2f1f14;
  --gold: #c9a227;
  --erwin: #7a3b2e;
  --martin: #2e5a4a;
  --danger: #7a1f1f;
  --shadow-purple: #2a1a33;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: radial-gradient(ellipse at center, #1c1410 0%, #0a0705 100%);
  color: var(--parchment);
  font-family: Georgia, 'Times New Roman', serif;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 8px;
}

#stage {
  position: relative;
  width: 960px;
  height: 624px;
  border: 6px solid var(--wood);
  border-radius: 6px;
  box-shadow: 0 0 0 3px var(--gold), 0 20px 60px rgba(0,0,0,0.8);
  background: #000;
}

canvas#game {
  display: block;
  width: 960px;
  height: 624px;
  image-rendering: pixelated;
}

.hidden { display: none !important; }

/* HUD */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: linear-gradient(to bottom, rgba(15,10,5,0.85), rgba(15,10,5,0));
  pointer-events: none;
  z-index: 5;
}

.hud-player {
  width: 260px;
  pointer-events: auto;
}

.hud-name {
  font-weight: bold;
  font-size: 15px;
  text-shadow: 0 1px 2px #000;
  margin-bottom: 3px;
}

.hud-erwin .hud-name { color: #e8b98a; }
.hud-martin .hud-name { color: #a9d8c4; text-align: right; }
.hud-martin { text-align: right; }

.hp-bar {
  height: 14px;
  background: #1a1210;
  border: 2px solid var(--gold);
  border-radius: 4px;
  overflow: hidden;
}

.hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(to right, #8f2020, #d84a4a);
  transition: width 0.2s ease;
}

.hud-martin .hp-fill { background: linear-gradient(to right, #1f6b52, #4ad89a); float: right; }

.hud-sub {
  font-size: 11px;
  margin-top: 2px;
  opacity: 0.85;
  min-height: 14px;
}

.hud-center {
  text-align: center;
  pointer-events: none;
}
#level-name {
  font-size: 16px;
  font-weight: bold;
  color: var(--gold);
  text-shadow: 0 1px 2px #000;
}
#ring-counter {
  font-size: 13px;
  margin-top: 2px;
}

#mute-btn, #pause-btn {
  pointer-events: auto;
  background: rgba(20,14,8,0.7);
  border: 2px solid var(--gold);
  color: var(--parchment);
  border-radius: 6px;
  font-size: 16px;
  padding: 4px 8px;
  cursor: pointer;
  margin-left: 6px;
}
#mute-btn:hover, #pause-btn:hover { background: rgba(60,40,20,0.9); }

/* Overlays */
.overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(30,20,12,0.96) 0%, rgba(5,3,2,0.98) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px 60px;
  z-index: 10;
}

.overlay h1 {
  font-size: 42px;
  color: var(--gold);
  margin: 0 0 4px 0;
  text-shadow: 0 2px 6px #000;
  letter-spacing: 2px;
}

.overlay h2 {
  font-size: 22px;
  color: var(--parchment);
  margin: 0 0 14px 0;
  font-style: italic;
  font-weight: normal;
}

.lore {
  max-width: 620px;
  line-height: 1.6;
  font-size: 15px;
  color: var(--parchment-dark);
  margin-bottom: 18px;
}

.big-btn {
  font-family: inherit;
  font-size: 17px;
  padding: 10px 28px;
  margin: 6px;
  background: linear-gradient(to bottom, #7a5a2a, #4a3212);
  color: var(--parchment);
  border: 2px solid var(--gold);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 3px 0 #1a1006, 0 4px 10px rgba(0,0,0,0.5);
}
.big-btn:hover { background: linear-gradient(to bottom, #94702f, #5a3d16); }
.big-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #1a1006; }
.big-btn.secondary {
  background: linear-gradient(to bottom, #2e2620, #1a1512);
  color: var(--parchment-dark);
}

.controls-info {
  display: flex;
  gap: 50px;
  margin-top: 12px;
}
.ctrl-col h3 { margin: 0 0 6px 0; color: var(--gold); font-size: 15px; }
.ctrl-col p { margin: 3px 0; font-size: 13px; }

kbd {
  display: inline-block;
  background: #1a130d;
  border: 1px solid #6b5230;
  border-bottom-width: 3px;
  border-radius: 4px;
  padding: 2px 7px;
  margin: 0 2px;
  font-size: 12px;
  color: var(--gold);
}

.hint {
  margin-top: 16px;
  font-size: 12px;
  color: #8a7a5f;
}

.level-list {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 700px;
  margin-bottom: 18px;
}
.level-card {
  width: 150px;
  padding: 12px;
  border: 2px solid var(--gold);
  border-radius: 8px;
  background: rgba(60,40,20,0.35);
  cursor: pointer;
}
.level-card:hover { background: rgba(90,60,30,0.5); }
.level-card.locked {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(1);
}
.level-card h4 { margin: 0 0 4px 0; color: var(--gold); font-size: 14px; }
.level-card p { margin: 0; font-size: 11px; color: var(--parchment-dark); }

.footer {
  color: #6b5a42;
  font-size: 12px;
  margin: 0;
}

/* floating combat text */
.hidden-canvas-note { display: none; }
