:root {
  --parchment-0: #f7ecc8;
  --parchment-1: #f0e2b1;
  --parchment-2: #e5d29a;
  --ink: #3a2817;
  --ink-soft: #6a4e2e;
  --gold: #c9a227;
  --gold-deep: #9a7a1c;
  --bronze: #a27538;
  --wine: #7a1f28;
  --wine-bright: #b8313b;
  --forest: #3a6a3a;
  --border: #8a6a2a;
  --border-soft: #b89656;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: 'Cormorant Garamond', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  font-size: 16px;
  color: var(--ink);
  background:
    radial-gradient(ellipse at center, #fff4d2 0%, #e8d4a0 50%, #c2a06a 100%);
  overflow: hidden;
  user-select: none;
}

body.steering, body.steering * { cursor: none !important; }

#wrap {
  display: flex;
  height: 100vh;
  width: 100vw;
  align-items: stretch;
}

#stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  position: relative;
  touch-action: none;
  background:
    repeating-linear-gradient(45deg, rgba(138,106,42,0.04) 0 2px, transparent 2px 20px),
    radial-gradient(ellipse at center, #fbe9ba 0%, #d8b87a 100%);
}

canvas {
  display: block;
  border-radius: 6px;
  touch-action: none;
  aspect-ratio: 1 / 1;
  max-width: min(86vmin, 720px);
  max-height: min(calc(100vh - 180px), 720px);
  width: auto;
  height: auto;
  box-shadow:
    0 0 0 2px var(--gold),
    0 0 0 6px var(--border),
    0 0 0 7px var(--gold-deep),
    0 20px 60px rgba(60,40,10,0.5);
}
canvas.slowtime {
  animation: slowtime-halo 1.4s ease-in-out infinite;
  filter: saturate(1.15) brightness(1.04) contrast(1.05);
}
@keyframes slowtime-halo {
  0%, 100% {
    box-shadow:
      0 0 0 2px var(--gold),
      0 0 0 6px var(--border),
      0 0 0 7px var(--gold-deep),
      0 0 40px 6px rgba(255,255,255,0.7),
      0 0 80px 20px rgba(170,220,255,0.65),
      0 0 130px 40px rgba(220,180,255,0.45),
      0 0 190px 70px rgba(150,255,220,0.3),
      0 20px 60px rgba(60,40,10,0.5);
  }
  50% {
    box-shadow:
      0 0 0 2px var(--gold),
      0 0 0 6px var(--border),
      0 0 0 7px var(--gold-deep),
      0 0 70px 16px rgba(255,255,255,0.95),
      0 0 130px 36px rgba(170,220,255,0.85),
      0 0 200px 65px rgba(220,180,255,0.6),
      0 0 270px 100px rgba(150,255,220,0.4),
      0 20px 60px rgba(60,40,10,0.5);
  }
}

/* ---------- Top HUD bar (above canvas) ---------- */
.top-hud {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 16px;
  width: min(86vmin, 720px);
  max-width: 100%;
  background:
    repeating-linear-gradient(135deg, rgba(138,106,42,0.03) 0 3px, transparent 3px 14px),
    linear-gradient(180deg, rgba(255,246,214,0.95), rgba(234,214,160,0.95));
  border: 2px solid var(--gold-deep);
  border-radius: 8px;
  box-shadow:
    inset 0 1px 0 rgba(255,250,220,0.8),
    0 4px 14px rgba(60,30,10,0.35);
  font-family: 'Cinzel', 'Palatino Linotype', Georgia, serif;
}
.hud-level { flex: 1; min-width: 0; overflow: hidden; }
.hud-level-name {
  display: block;
  font-weight: 700;
  color: var(--wine);
  font-size: 15px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hud-theme-name {
  display: block;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: -2px;
}
.hud-hp-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.hud-hp-bar {
  width: 150px;
  height: 14px;
  border-radius: 4px;
  background: rgba(30,10,0,0.35);
  border: 1px solid var(--bronze);
  overflow: hidden;
}
.hud-hp-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #c8252f, #ffa040, #ffe060);
  transition: width 0.25s ease;
}
#hudHpText {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  min-width: 60px;
  text-align: right;
}
.hud-lives {
  display: flex;
  gap: 2px;
  font-size: 18px;
  min-width: 24px;
}
.hud-lives span { filter: drop-shadow(0 1px 1px rgba(60,30,10,0.5)); }
.hud-pause, .hud-music {
  position: static !important;
  width: 38px !important;
  height: 38px !important;
  font-size: 16px !important;
}
.hud-music.muted { opacity: 0.55; filter: grayscale(0.6); }

/* ---------- Floating virtual joystick ---------- */
.floating-joystick {
  position: absolute;
  width: 110px; height: 110px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 6;
  display: none;
}
.fj-base {
  position: absolute;
  inset: 0;
  background: rgba(255,240,200,0.22);
  border: 2px solid var(--gold-deep);
  border-radius: 50%;
  box-shadow:
    inset 0 0 12px rgba(60,40,10,0.35),
    0 0 22px rgba(201,162,39,0.35);
}
.fj-handle {
  position: absolute;
  top: 50%; left: 50%;
  width: 46px; height: 46px;
  margin: -23px 0 0 -23px;
  background: linear-gradient(180deg, #f6dc8a, #b0841e);
  border: 2px solid var(--gold-deep);
  border-radius: 50%;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.55),
    inset 0 -2px 0 rgba(90,60,10,0.35),
    0 3px 8px rgba(60,30,10,0.4);
  transition: transform 0.04s linear;
}

/* ---------- Corner button (pause) ---------- */
.corner-btn {
  position: absolute;
  z-index: 11;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(246,220,138,0.92), rgba(176,132,30,0.92));
  border: 2px solid var(--gold-deep);
  color: #2a1a08;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  touch-action: none;
  user-select: none;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.55),
    inset 0 -2px 0 rgba(90,60,10,0.35),
    0 3px 8px rgba(60,30,10,0.45);
}
.corner-btn-bottom { bottom: 22px; right: 22px; }
.corner-btn-fixed {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 12;
}
.corner-btn-fixed .info-icon {
  font-family: 'Cinzel', 'Cormorant Garamond', Georgia, serif;
  font-weight: 700;
  font-size: 26px;
  line-height: 1;
  display: block;
  transform: translateY(-1px);
}
.corner-btn:hover { background: linear-gradient(180deg, #f8d884, #d49828); }
.corner-btn:active { transform: scale(0.94); }

.corner-btn-volume {
  position: fixed;
  bottom: 22px;
  right: 82px;
  z-index: 12;
}
.corner-btn-volume .volume-icon {
  font-family: 'Cinzel', 'Cormorant Garamond', Georgia, serif;
  font-weight: 700;
  font-size: 24px;
  line-height: 1;
  display: block;
  transform: translateY(-1px);
}

.volume-panel {
  position: fixed;
  bottom: 82px;
  right: 22px;
  z-index: 12;
  padding: 12px 16px 10px;
  background: linear-gradient(180deg, rgba(255,245,215,0.97), rgba(232,210,160,0.97));
  border: 2px solid var(--gold-deep);
  border-radius: 8px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.6),
    0 4px 14px rgba(60,30,10,0.4);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
  font-family: 'Cinzel', 'Cormorant Garamond', Georgia, serif;
}
.volume-panel[hidden] { display: none; }
.volume-panel-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--wine);
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
}
.volume-panel-value {
  font-size: 13px;
  color: var(--ink);
  text-align: center;
  font-weight: 600;
}
#volumeSlider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  border: 1px solid var(--gold-deep);
  outline: none;
  cursor: pointer;
}
#volumeSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f8d884, #b88420);
  border: 2px solid var(--gold-deep);
  box-shadow: 0 1px 3px rgba(60,30,10,0.5);
  cursor: pointer;
}
#volumeSlider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f8d884, #b88420);
  border: 2px solid var(--gold-deep);
  box-shadow: 0 1px 3px rgba(60,30,10,0.5);
  cursor: pointer;
}
.volume-panel-mute {
  margin-top: 6px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Cinzel', 'Cormorant Garamond', Georgia, serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--wine);
  text-transform: uppercase;
  letter-spacing: 1px;
  background: linear-gradient(180deg, rgba(246,220,138,0.92), rgba(200,160,60,0.92));
  border: 1px solid var(--gold-deep);
  border-radius: 5px;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.55),
    inset 0 -1px 0 rgba(90,60,10,0.3);
}
.volume-panel-mute:hover { background: linear-gradient(180deg, #f8d884, #d49828); }
.volume-panel-mute:active { transform: scale(0.97); }
.volume-panel-mute.muted {
  color: var(--ink-soft, #6b5a3a);
  background: linear-gradient(180deg, rgba(220,210,190,0.92), rgba(170,155,130,0.92));
}

/* ---------- Ability bar (below canvas) ---------- */
.ability-bar {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: flex-start;
  min-height: 84px;
  padding-top: 4px;
  pointer-events: none;
}
.ability-btn-top {
  pointer-events: all;
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(246,220,138,0.95), rgba(176,132,30,0.95));
  border: 2px solid var(--gold-deep);
  color: #2a1a08;
  cursor: pointer;
  padding: 0;
  overflow: visible;
  touch-action: none;
  user-select: none;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.55),
    inset 0 -2px 0 rgba(90,60,10,0.35),
    0 3px 10px rgba(60,30,10,0.5);
  transition: transform 0.1s;
}
.ability-btn-top:active { transform: scale(0.94); }
.ability-btn-top .ability-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  filter: drop-shadow(0 1px 2px rgba(60,40,10,0.4));
  pointer-events: none;
}
.ability-btn-top .cd-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(rgba(20,10,0,0.72) var(--cd-angle, 0deg), transparent 0deg);
  pointer-events: none;
  transition: none;
}
.ability-btn-top .cd-overlay {
  overflow: hidden;
}
.ability-btn-top .cd-text {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 17px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.95);
  pointer-events: none;
  letter-spacing: 0.5px;
}
.ability-btn-top .key-badge {
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--wine);
  color: #fff4d2;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--gold-deep);
  font-weight: 700;
  line-height: 1.3;
  pointer-events: none;
  letter-spacing: 0.5px;
}
.ability-btn-top.cooling .cd-text { display: flex; }
.ability-btn-top.cooling .ability-icon { opacity: 0.55; }

@keyframes ability-ready-flash {
  0%   {
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.55),
      inset 0 -2px 0 rgba(90,60,10,0.35),
      0 0 0 0 rgba(255,215,100,0.95);
    transform: scale(1);
  }
  40%  {
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.8),
      inset 0 -2px 0 rgba(90,60,10,0.35),
      0 0 24px 10px rgba(255,215,100,0.9);
    transform: scale(1.15);
  }
  100% {
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.55),
      inset 0 -2px 0 rgba(90,60,10,0.35),
      0 3px 10px rgba(60,30,10,0.5);
    transform: scale(1);
  }
}
.ability-btn-top.ready { animation: ability-ready-flash 0.7s ease-out; }

/* ---------- Sidebar ---------- */
#side {
  width: 340px;
  padding: 22px 22px;
  background:
    repeating-linear-gradient(135deg, rgba(138,106,42,0.04) 0 3px, transparent 3px 18px),
    linear-gradient(180deg, var(--parchment-0), var(--parchment-2));
  border-left: 3px double var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

h1 {
  font-family: 'MedievalSharp', 'Cinzel', Georgia, serif;
  font-size: 28px;
  font-weight: 400;
  letter-spacing: 1px;
  text-align: center;
  color: var(--wine);
  text-shadow: 1px 1px 0 rgba(255,230,180,0.6);
}
.motto {
  text-align: center;
  font-style: italic;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.panel {
  background: linear-gradient(180deg, rgba(255,250,230,0.7), rgba(230,210,160,0.4));
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 10px 14px;
  box-shadow: inset 0 0 0 1px rgba(255,245,210,0.5);
}
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 15px;
}
.row .label { color: var(--ink-soft); }
.row .val { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.label-head { color: var(--wine) !important; font-weight: 700; font-family: 'Cinzel', Georgia, serif; font-size: 13px; letter-spacing: 1px; }
.hint-small { font-size: 11px !important; color: var(--ink-soft) !important; font-weight: 400 !important; font-style: italic; }

.bar {
  height: 8px;
  border-radius: 4px;
  background: rgba(60,40,10,0.2);
  overflow: hidden;
  margin-top: 6px;
  border: 1px solid var(--bronze);
}
.bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--wine-bright));
  transition: width 0.25s ease;
}
.bar-hp > span {
  background: linear-gradient(90deg, #c8252f, #ffa040, #ffe060);
}

/* ---------- Passive ability grid (sidebar) ---------- */
.abilities {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 12px;
  margin-top: 10px;
  padding: 4px 4px 22px;
}
.ability {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--gold-deep);
  background: linear-gradient(180deg, rgba(246,220,138,0.95), rgba(176,132,30,0.95));
  color: #2a1a08;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.55),
    inset 0 -2px 0 rgba(90,60,10,0.35),
    0 3px 10px rgba(60,30,10,0.45);
  transition: transform 0.12s;
  cursor: default;
}
.ability .ability-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  filter: drop-shadow(0 1px 2px rgba(60,40,10,0.45));
  pointer-events: none;
}
.ability.locked {
  filter: grayscale(0.8) brightness(0.85);
  opacity: 0.55;
}
.ability .cd-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(rgba(20,10,0,0.72) var(--cd-angle, 0deg), transparent 0deg);
  pointer-events: none;
}
.ability .cd-text {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.95);
  pointer-events: none;
}
.ability.cooling .cd-text { display: flex; }
.ability.cooling .ability-icon { opacity: 0.5; }
.ability .ability-label {
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Cinzel', serif;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink);
  background: rgba(255,240,200,0.95);
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--gold-deep);
  white-space: nowrap;
  letter-spacing: 0.3px;
  pointer-events: none;
}
.ability.ready { animation: ability-ready-flash 0.7s ease-out; }

.controls {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.55;
}
.controls b { color: var(--ink); }

/* ---------- Overlays / Cards ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(80,50,20,0.55);
  backdrop-filter: blur(4px);
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}
.overlay.show { opacity: 1; pointer-events: all; }

.card {
  position: relative;
  background:
    repeating-linear-gradient(135deg, rgba(138,106,42,0.03) 0 3px, transparent 3px 18px),
    linear-gradient(180deg, var(--parchment-0), var(--parchment-2));
  border: 3px double var(--border);
  border-radius: 6px;
  padding: 30px 38px;
  min-width: 460px;
  max-width: 620px;
  text-align: center;
  color: var(--ink);
  box-shadow:
    0 0 0 1px var(--gold) inset,
    0 20px 80px rgba(60,30,10,0.6);
}

.card-flourish {
  font-size: 28px;
  color: var(--gold-deep);
  margin-bottom: 6px;
  line-height: 1;
}

.card h2 {
  font-family: 'MedievalSharp', 'Cinzel', Georgia, serif;
  font-weight: 400;
  font-size: 34px;
  color: var(--wine);
  letter-spacing: 1px;
  margin-bottom: 4px;
  text-shadow: 1px 1px 0 rgba(255,240,200,0.7);
}
.card h2.h-dark { color: #6a1420; }
.tagline {
  font-style: italic;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.card p { color: var(--ink); margin: 8px 0; line-height: 1.5; }
.accent-text { color: var(--gold-deep); font-weight: 600; }

.card .reward {
  margin: 16px 0;
  padding: 14px 18px;
  border-radius: 4px;
  background: rgba(255,240,200,0.6);
  border: 1px solid var(--border-soft);
  font-size: 15px;
  box-shadow: inset 0 0 0 1px rgba(255,250,220,0.8);
}
.card .reward .icon { font-size: 36px; display: block; margin-bottom: 6px; color: var(--gold-deep); }
.card .reward .row { font-size: 15px; }

/* ---------- Buttons ---------- */
.btn {
  margin-top: 12px;
  padding: 11px 28px;
  border: 2px solid var(--gold-deep);
  border-radius: 4px;
  background:
    linear-gradient(180deg, #f6dc8a 0%, #d4a941 40%, #b0841e 100%);
  color: #2a1a08;
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.5),
    inset 0 -2px 0 rgba(90,60,10,0.35),
    0 3px 0 var(--bronze),
    0 6px 14px rgba(60,30,10,0.3);
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.6),
    inset 0 -2px 0 rgba(90,60,10,0.35),
    0 4px 0 var(--bronze),
    0 8px 18px rgba(60,30,10,0.35);
}
.btn:active { transform: translateY(1px); box-shadow: inset 0 1px 0 rgba(0,0,0,0.1), 0 1px 0 var(--bronze); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--border);
  box-shadow: none;
  margin-left: 8px;
}

.hint { font-size: 12px; color: var(--ink-soft); margin-top: 12px; font-style: italic; }
.level-chip {
  display: inline-block;
  padding: 3px 14px;
  background: rgba(201,162,39,0.18);
  border: 1px solid var(--gold-deep);
  border-radius: 999px;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  color: var(--gold-deep);
  letter-spacing: 3px;
  font-weight: 700;
  margin-bottom: 8px;
}

/* ---------- Shop ---------- */
.shop-card {
  min-width: 720px;
  max-width: 840px;
  padding: 24px 30px 20px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.shop-card > * { flex: 0 0 auto; }
.shop-card .shop-grid {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
}
#btnShopNext { margin-top: 14px; align-self: center; }

/* ---------- Cheat menu ---------- */
.cheat-card {
  min-width: 640px;
  max-width: 820px;
  padding: 24px 30px 20px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cheat-card > * { flex: 0 0 auto; }
.cheat-section-title {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  color: var(--wine);
  letter-spacing: 2px;
  text-align: left;
  font-weight: 700;
  margin: 14px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--border-soft);
}
.cheat-abilities {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  flex: 0 1 auto;
  overflow-y: auto;
  padding: 2px;
}
.cheat-ability-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px 6px;
  background: linear-gradient(180deg, #fff6d6, #ead6a0);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  cursor: pointer;
  font-family: 'Cormorant Garamond', serif;
  transition: transform 0.1s;
}
.cheat-ability-btn:hover { transform: translateY(-2px); box-shadow: 0 3px 8px rgba(60,30,10,0.3); }
.cheat-ability-btn.off {
  opacity: 0.75;
  background: linear-gradient(180deg, #f0e6d0, #c8b890);
}
.cheat-ability-btn.full {
  background: linear-gradient(180deg, #d8ecb8, #8dbe66);
  border-color: var(--forest);
}
.cheat-ability-btn.full .cheat-tier { color: var(--forest); }
.cheat-ability-btn .cheat-icon { font-size: 24px; line-height: 1; }
.cheat-ability-btn .cheat-name {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--wine);
  text-align: center;
}
.cheat-ability-btn .cheat-tier {
  font-size: 10px;
  font-family: 'Cinzel', serif;
  color: var(--gold-deep);
  font-weight: 700;
}

.cheat-resources {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.cheat-res-btn {
  padding: 6px 14px;
  background: linear-gradient(180deg, #f0c868, #c08818);
  border: 1px solid var(--gold-deep);
  border-radius: 4px;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #2a1a08;
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45);
}
.cheat-res-btn:hover { background: linear-gradient(180deg, #f8d884, #d49828); }
.cheat-res-btn.cheat-active {
  background: linear-gradient(180deg, #b8e080, #4a8030);
  border-color: var(--forest);
  color: #0a1a00;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 0 10px rgba(80,160,40,0.5);
}

.cheat-levels {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  max-height: 140px;
  overflow-y: auto;
  padding: 2px;
}
.cheat-level-btn {
  padding: 5px 0;
  background: linear-gradient(180deg, #f6dc8a, #b0841e);
  border: 1px solid var(--gold-deep);
  border-radius: 3px;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 700;
  color: #2a1a08;
  cursor: pointer;
  text-align: center;
}
.cheat-level-btn:hover { background: linear-gradient(180deg, #f8d884, #d49828); transform: translateY(-1px); }
.cheat-level-btn.current {
  border-color: var(--wine);
  background: linear-gradient(180deg, #c84040, #8a1010);
  color: #fff4d2;
}
#btnCheatClose { margin-top: 14px; align-self: center; }

.shop-summary {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 10px 0 14px;
}
.pill {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: rgba(255,245,210,0.6);
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
}
.pill-gold {
  background: rgba(201,162,39,0.2);
  border-color: var(--gold-deep);
  color: var(--gold-deep);
}
.pill-crimson {
  background: rgba(122,31,40,0.15);
  border-color: var(--wine);
  color: var(--wine);
}

.shop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0 6px;
  margin-top: 10px;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}
.shop-decor {
  font-family: 'MedievalSharp', serif;
  font-size: 20px;
  color: var(--wine);
  letter-spacing: 2px;
}
.shop-purse {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  color: var(--gold-deep);
  font-weight: 700;
}
.shop-purse b { font-size: 18px; }

.shop-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 14px 0 6px;
}
.shop-section-title {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  color: var(--wine);
  letter-spacing: 2px;
  text-align: left;
  font-weight: 600;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--border-soft);
}
.shop-section-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.shop-item {
  position: relative;
  padding: 10px 10px 8px;
  background: linear-gradient(180deg, #fff6d6, #ead6a0);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(255,250,220,0.7);
  display: flex;
  flex-direction: column;
  text-align: center;
  transition: transform 0.15s, box-shadow 0.15s;
}
.shop-item:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(60,40,10,0.25); }
.shop-item.owned {
  border-color: var(--forest);
  background: linear-gradient(180deg, #d8ecb8, #a8c888);
  opacity: 0.85;
}
.shop-item.owned:hover { transform: none; }
.shop-item.disabled { opacity: 0.45; }
.shop-item.poor .shop-price { color: var(--wine); }
.shop-icon { font-size: 30px; line-height: 1; margin-bottom: 4px; filter: drop-shadow(0 1px 2px rgba(60,40,10,0.4)); }
.shop-name {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--wine);
  margin-bottom: 4px;
}
.shop-tier {
  display: inline-block;
  margin: 0 auto 4px;
  padding: 2px 8px;
  font-family: 'Cinzel', serif;
  font-size: 10px;
  color: var(--gold-deep);
  background: rgba(201,162,39,0.15);
  border: 1px solid var(--gold-deep);
  border-radius: 999px;
  letter-spacing: 1px;
  font-weight: 700;
}
.shop-desc {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.35;
  margin-bottom: 8px;
  min-height: 34px;
  font-style: italic;
}
.shop-price {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  color: var(--gold-deep);
  font-size: 14px;
  margin-bottom: 6px;
}
.shop-buy {
  padding: 5px 10px;
  border: 1px solid var(--gold-deep);
  border-radius: 3px;
  background: linear-gradient(180deg, #f0c868, #c08818);
  color: #2a1a08;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4);
}
.shop-buy:hover:not(:disabled) { background: linear-gradient(180deg, #f8d884, #d49828); }
.shop-buy:disabled {
  cursor: not-allowed;
  background: linear-gradient(180deg, #d8cca4, #a89774);
  color: rgba(60,40,10,0.5);
  border-color: var(--border-soft);
}

/* ---------- Impressum ---------- */
.impressum-card {
  min-width: 560px;
  max-width: 720px;
  padding: 24px 30px 20px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-align: left;
}
.impressum-card > * { flex: 0 0 auto; }
.impressum-card .card-flourish,
.impressum-card h2,
.impressum-card .tagline {
  text-align: center;
}
.impressum-body {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding: 6px 10px 4px 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
}
.impressum-body p {
  margin: 6px 0 10px;
}
.impressum-body a {
  color: var(--wine);
  text-decoration: underline;
  text-decoration-color: var(--gold-deep);
  text-underline-offset: 2px;
}
.impressum-body a:hover { color: var(--gold-deep); }
.impressum-section-title {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  color: var(--wine);
  letter-spacing: 2px;
  text-align: left;
  font-weight: 700;
  margin: 18px 0 4px;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--border-soft);
  text-transform: uppercase;
}
.impressum-music-intro {
  font-style: italic;
  color: var(--ink-soft);
}
.impressum-songs {
  list-style: none;
  margin: 8px 0 6px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.impressum-songs li {
  background: rgba(255,245,215,0.55);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 8px 12px;
  box-shadow: inset 0 0 0 1px rgba(255,250,220,0.6);
}
.impressum-song-title {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  color: var(--wine);
  font-size: 14px;
  letter-spacing: 0.5px;
}
.impressum-song-artist {
  display: block;
  color: var(--ink);
  font-size: 14px;
  margin-top: 2px;
}
.impressum-song-link {
  display: block;
  font-size: 13px;
  margin-top: 3px;
  word-break: break-all;
}
#btnImpressumClose { margin-top: 14px; align-self: center; }

/* ---------- Animations ---------- */
.fade-in { animation: fadein 0.4s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(10px); } }

@media (max-width: 1040px) {
  #wrap { flex-direction: column; }
  #side { width: 100%; border-left: none; border-top: 3px double var(--border); }
  .shop-card { min-width: auto; max-width: 95vw; }
  .shop-section-grid { grid-template-columns: repeat(2, 1fr); }
}
