* {
  box-sizing: border-box;
  user-select: none;
}

html,
body {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #111827;
  color: #f8fafc;
  font-family: 'Courier New', monospace;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  touch-action: none;
}

canvas {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #0f172a;
}

.cover-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background:
    radial-gradient(circle at center, rgba(30, 41, 59, 0.65), transparent 62%),
    #020617;
  display: grid;
  place-items: center;
  cursor: pointer;
  overflow: hidden;
}

.cover-overlay img {
  width: min(100vw, 177.78vh);
  height: auto;
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
  box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.18), 0 0 48px rgba(0, 0, 0, 0.55);
}

.cover-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 58%, rgba(2,6,23,0.28) 100%);
}

.cover-tip {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  color: #ffffff;
  font-size: clamp(14px, 1.5vw, 24px);
  text-shadow: 4px 4px 0 #000;
  padding: 10px 18px;
  background: rgba(2, 10, 35, 0.55);
  border: 3px solid rgba(250, 204, 21, 0.75);
  box-shadow: 6px 6px 0 #000;
  animation: blinkCover 1.2s steps(2, end) infinite;
}

@keyframes blinkCover {
  50% { opacity: 0.45; }
}


.hidden {
  display: none !important;
}

.hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  padding: 18px;
  text-shadow: 3px 3px 0 #000;
}

.hud-top {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.stat-block {
  background: rgba(15, 23, 42, 0.82);
  border: 3px solid #f8fafc;
  box-shadow: 5px 5px 0 #000;
  padding: 10px 12px;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
}

.label {
  color: #facc15;
  font-size: 9px;
}

.bars {
  position: fixed;
  left: 18px;
  bottom: 18px;
  width: min(520px, calc(100vw - 36px));
  display: grid;
  gap: 10px;
}

.bar-wrap {
  background: rgba(15, 23, 42, 0.82);
  border: 3px solid #f8fafc;
  box-shadow: 5px 5px 0 #000;
  padding: 10px;
}

.bar-label {
  font-size: 10px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.bar {
  width: 100%;
  height: 18px;
  background: #020617;
  border: 3px solid #334155;
  overflow: hidden;
}

.fill {
  height: 100%;
  width: 50%;
  transition: width 0.12s linear;
}

.fill.hp {
  background: linear-gradient(90deg, #ef4444, #fb7185);
}

.fill.xp {
  background: linear-gradient(90deg, #22c55e, #84cc16);
}

.fill.stamina {
  background: linear-gradient(90deg, #f59e0b, #facc15);
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 23, 0.72);
  z-index: 10;
  padding: 20px;
}

.panel {
  width: min(880px, 94vw);
  background: #1e293b;
  border: 5px solid #f8fafc;
  box-shadow: 10px 10px 0 #000;
  padding: 28px;
  text-align: center;
}

.title-panel h1 {
  margin: 0 0 18px;
  font-size: clamp(22px, 5vw, 48px);
  color: #facc15;
  line-height: 1.25;
}

.subtitle {
  font-size: 13px;
  line-height: 1.8;
  color: #bae6fd;
}

.instructions {
  margin: 24px auto;
  width: min(600px, 100%);
  text-align: left;
  background: #0f172a;
  border: 3px solid #64748b;
  padding: 18px;
  line-height: 1.8;
  font-size: 11px;
}

.pixel-btn {
  font-family: inherit;
  font-size: 14px;
  color: #020617;
  background: #facc15;
  border: 4px solid #fff;
  box-shadow: 6px 6px 0 #000;
  padding: 16px 24px;
  cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}

.pixel-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 #000;
}

.pixel-btn:active {
  transform: translate(3px, 3px);
  box-shadow: 3px 3px 0 #000;
}

.upgrade-panel h2 {
  color: #facc15;
  font-size: 28px;
  margin: 0 0 12px;
}

.upgrade-panel p {
  color: #bae6fd;
  font-size: 11px;
  margin-bottom: 20px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.card {
  min-height: 225px;
  background: #0f172a;
  border: 4px solid #94a3b8;
  box-shadow: 6px 6px 0 #000;
  padding: 14px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.08s ease;
}

.card:hover {
  transform: translateY(-6px);
  border-color: #facc15;
}

.card .rarity {
  display: inline-block;
  font-size: 9px;
  padding: 6px;
  margin-bottom: 14px;
  color: #020617;
  background: #cbd5e1;
}

.card.rare .rarity { background: #38bdf8; }
.card.epic .rarity { background: #c084fc; }
.card.legendary .rarity { background: #facc15; }

.card.guaranteed-class-card {
  border-color: #facc15;
  box-shadow: 6px 6px 0 #000, 0 0 18px rgba(250, 204, 21, 0.25);
}

.card.guaranteed-class-card .rarity {
  background: #facc15;
}

.card h3 {
  font-size: 15px;
  line-height: 1.5;
  color: #f8fafc;
  margin: 0 0 14px;
}

.card p {
  color: #cbd5e1;
  font-size: 10px;
  line-height: 1.8;
  margin: 0;
}

#endSummary {
  line-height: 1.8;
  color: #bae6fd;
  font-size: 12px;
  margin-bottom: 24px;
}

@media (max-width: 980px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .cards {
    grid-template-columns: 1fr;
  }

  .panel {
    max-height: 90vh;
    overflow: auto;
  }

  .stat-block {
    min-width: 100px;
    font-size: 10px;
  }
}

/* New retro asset-inspired upgrade card styling */
.card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.98));
}

.card::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 2px solid rgba(248, 250, 252, 0.24);
  pointer-events: none;
}

.card.rare { border-color: #38bdf8; }
.card.epic { border-color: #c084fc; }
.card.legendary { border-color: #facc15; }

.upgrade-icon {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  margin: 2px auto 16px;
  font-size: 42px;
  line-height: 1;
  color: #f8fafc;
  background: #020617;
  border: 4px solid #475569;
  box-shadow: 5px 5px 0 #000;
  text-shadow: 3px 3px 0 #000;
}

.card.rare .upgrade-icon { border-color: #38bdf8; color: #bae6fd; }
.card.epic .upgrade-icon { border-color: #c084fc; color: #f0abfc; }
.card.legendary .upgrade-icon { border-color: #facc15; color: #fde68a; }

.upgrade-icon.heart,
.upgrade-icon.vampire { color: #fb7185; }
.upgrade-icon.speed { color: #d97706; }
.upgrade-icon.flame,
.upgrade-icon.explode { color: #fb923c; }
.upgrade-icon.magnet { color: #4ade80; }


/* Title screen, levels, and settings */
.main-title-panel {
  width: min(980px, 94vw);
  background:
    radial-gradient(circle at 30% 10%, rgba(56, 189, 248, 0.18), transparent 28%),
    radial-gradient(circle at 75% 15%, rgba(250, 204, 21, 0.14), transparent 24%),
    #1e293b;
}

.tiny-label {
  display: inline-block;
  color: #020617;
  background: #38bdf8;
  border: 3px solid #f8fafc;
  box-shadow: 4px 4px 0 #000;
  padding: 8px 12px;
  margin-bottom: 16px;
  font-size: 10px;
  letter-spacing: 2px;
}

.hero-preview {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 22px;
  margin: 24px auto 28px;
  min-height: 100px;
  padding: 18px;
  background: rgba(2, 6, 23, 0.55);
  border: 3px solid #64748b;
}

.preview-vs {
  align-self: center;
  color: #facc15;
  font-weight: bold;
  text-shadow: 3px 3px 0 #000;
  font-size: 20px;
}

.preview-sprite {
  position: relative;
  width: 54px;
  height: 64px;
  image-rendering: pixelated;
  filter: drop-shadow(5px 5px 0 #000);
}

.knight-preview::before,
.core-knight-preview::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 6px;
  width: 26px;
  height: 22px;
  background: #dbeafe;
  border: 4px solid #0f172a;
  box-shadow: inset 0 -7px 0 #64748b, 0 24px 0 -2px #2563eb;
}
.knight-preview::after,
.core-knight-preview::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 22px;
  width: 12px;
  height: 42px;
  background: #e5e7eb;
  border: 3px solid #0f172a;
  transform: rotate(-22deg);
}

.slime-preview {
  width: 58px;
  height: 42px;
  border-radius: 28px 28px 12px 12px;
  background: #22c55e;
  border: 4px solid #052e16;
  box-shadow: inset -8px -8px 0 #16a34a;
}
.slime-preview::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 20px;
  width: 7px;
  height: 7px;
  background: #052e16;
  box-shadow: 22px 0 0 #052e16;
}

.bat-preview::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 22px;
  width: 26px;
  height: 18px;
  background: #7f1d1d;
  border: 3px solid #111827;
}
.bat-preview::after {
  content: '';
  position: absolute;
  left: -2px;
  top: 16px;
  width: 58px;
  height: 24px;
  background: linear-gradient(135deg, transparent 35%, #dc2626 36% 65%, transparent 66%);
  border-bottom: 4px solid #111827;
}

.boss-preview {
  width: 76px;
  height: 58px;
  border-radius: 36px 36px 14px 14px;
  background: #22c55e;
  border: 5px solid #052e16;
  box-shadow: inset -10px -10px 0 #15803d;
}
.boss-preview::before {
  content: '♛';
  position: absolute;
  left: 17px;
  top: -29px;
  color: #facc15;
  font-size: 38px;
  text-shadow: 3px 3px 0 #78350f;
}
.boss-preview::after {
  content: '';
  position: absolute;
  left: 20px;
  top: 28px;
  width: 8px;
  height: 8px;
  background: #052e16;
  box-shadow: 28px 0 0 #052e16, 13px 16px 0 2px #052e16;
}

.menu-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.big-btn {
  min-width: 180px;
  font-size: 18px;
}

.secondary-btn {
  color: #f8fafc;
  background: #334155;
}

.compact-instructions {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 0;
  text-align: center;
}
.compact-instructions p {
  margin: 0;
}

.menu-panel {
  width: min(940px, 94vw);
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 26px 0;
}

.level-card {
  font-family: inherit;
  min-height: 210px;
  color: #f8fafc;
  background:
    linear-gradient(160deg, rgba(34, 197, 94, 0.22), rgba(15, 23, 42, 0.96)),
    #0f172a;
  border: 4px solid #94a3b8;
  box-shadow: 6px 6px 0 #000;
  padding: 18px;
  text-align: left;
  cursor: pointer;
}

.level-card.selected {
  border-color: #facc15;
  outline: 3px solid rgba(250, 204, 21, 0.35);
}

.level-card.locked {
  opacity: 0.55;
  cursor: not-allowed;
  background: #0f172a;
}

.level-card span,
.level-card strong,
.level-card small,
.level-card em {
  display: block;
}

.level-number {
  color: #facc15;
  font-size: 10px;
  margin-bottom: 14px;
}

.level-card strong {
  font-size: 18px;
  margin-bottom: 14px;
}

.level-card small {
  color: #bae6fd;
  line-height: 1.7;
  min-height: 50px;
}

.level-card em {
  margin-top: 18px;
  color: #86efac;
  font-style: normal;
  font-size: 10px;
}
.level-card.locked em { color: #cbd5e1; }

.small-menu-buttons {
  margin-top: 8px;
}

.settings-list {
  display: grid;
  gap: 16px;
  margin: 26px auto;
  width: min(700px, 100%);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: #0f172a;
  border: 3px solid #64748b;
  box-shadow: 5px 5px 0 #000;
  padding: 18px;
  text-align: left;
}

.setting-row strong,
.setting-row small {
  display: block;
}
.setting-row strong { color: #f8fafc; margin-bottom: 8px; }
.setting-row small { color: #bae6fd; line-height: 1.5; }

.toggle-btn,
.pixel-select {
  font-family: inherit;
  color: #020617;
  background: #facc15;
  border: 3px solid #f8fafc;
  box-shadow: 4px 4px 0 #000;
  padding: 12px 14px;
  min-width: 105px;
  cursor: pointer;
}

.toggle-btn:not(.active) {
  color: #f8fafc;
  background: #475569;
}

.pixel-select {
  appearance: none;
  text-align: center;
}


.volume-control {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 230px;
}

.pixel-range {
  width: 170px;
  accent-color: #facc15;
  cursor: pointer;
}

.volume-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  color: #f8fafc;
  background: #020617;
  border: 2px solid #94a3b8;
  box-shadow: 3px 3px 0 #000;
  padding: 8px 10px;
  font-size: 11px;
}

.audio-setting-row .toggle-btn {
  min-width: 120px;
}

@media (max-width: 760px) {
  .hero-preview { gap: 12px; transform: scale(0.88); transform-origin: center; }
  .level-grid { grid-template-columns: 1fr; }
  .setting-row { align-items: stretch; flex-direction: column; }
  .volume-control { width: 100%; justify-content: space-between; }
  .pixel-range { width: min(260px, 70vw); }
  .compact-instructions { display: block; }
  .compact-instructions p { margin: 8px 0; }
}

/* Character select and inventory */
.character-grid,
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 26px 0;
}

.character-card {
  font-family: inherit;
  min-height: 260px;
  color: #f8fafc;
  background: linear-gradient(160deg, rgba(56, 189, 248, 0.18), rgba(15, 23, 42, 0.96)), #0f172a;
  border: 4px solid #94a3b8;
  box-shadow: 6px 6px 0 #000;
  padding: 18px;
  text-align: center;
  cursor: pointer;
}

.character-card.selected {
  border-color: #facc15;
  outline: 3px solid rgba(250, 204, 21, 0.35);
}

.character-card.locked {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.character-card strong,
.character-card small,
.character-card em,
.character-card span {
  display: block;
}

.character-card strong {
  font-size: 18px;
  margin: 12px 0;
}

.character-card small {
  color: #bae6fd;
  line-height: 1.7;
  min-height: 54px;
}

.character-card em {
  margin-top: 16px;
  color: #86efac;
  font-style: normal;
  font-size: 10px;
}
.character-card.locked em { color: #cbd5e1; }

.character-sprite {
  position: relative;
  width: 74px;
  height: 82px;
  margin: 0 auto 12px;
  filter: drop-shadow(5px 5px 0 #000);
}

.mage-preview::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 12px;
  width: 42px;
  height: 54px;
  background: #581c87;
  border: 4px solid #111827;
  border-radius: 22px 22px 8px 8px;
  box-shadow: inset -8px -7px 0 #3b0764;
}
.mage-preview::after {
  content: '';
  position: absolute;
  left: 29px;
  top: 31px;
  width: 7px;
  height: 7px;
  background: #facc15;
  box-shadow: 10px 0 0 #facc15, 27px -23px 0 4px #38bdf8;
}

.robot-preview::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 18px;
  width: 42px;
  height: 34px;
  background: #64748b;
  border: 4px solid #0f172a;
  box-shadow: inset -7px -6px 0 #334155, 0 34px 0 -4px #475569;
}
.robot-preview::after {
  content: '';
  position: absolute;
  left: 31px;
  top: 31px;
  width: 10px;
  height: 10px;
  background: #38bdf8;
  box-shadow: 0 -22px 0 -2px #38bdf8;
}

.inventory-grid {
  grid-template-columns: repeat(4, 1fr);
}

.inventory-slot {
  min-height: 170px;
  background: #0f172a;
  border: 4px solid #64748b;
  box-shadow: 6px 6px 0 #000;
  padding: 16px;
  display: grid;
  place-items: center;
  gap: 8px;
}
.inventory-slot strong { color: #f8fafc; font-size: 13px; }
.inventory-slot span { color: #facc15; font-size: 24px; font-weight: bold; }

.inv-icon {
  position: relative;
  width: 54px;
  height: 54px;
  filter: drop-shadow(3px 3px 0 #000);
}
.coin-icon {
  border-radius: 50%;
  background: #facc15;
  border: 5px solid #92400e;
  box-shadow: inset -6px -6px 0 #d97706;
}
.coin-icon::after { content: '1'; position: absolute; inset: 9px 0 0; color: #92400e; font-weight: bold; font-size: 24px; }
.heart-icon::before {
  content: '♥'; position: absolute; inset: 0; color: #fb7185; font-size: 52px; line-height: 52px; text-shadow: 3px 3px 0 #7f1d1d;
}
.chest-icon::before {
  content: ''; position: absolute; left: 5px; top: 17px; width: 44px; height: 28px; background: #92400e; border: 4px solid #451a03; box-shadow: inset 0 -8px 0 #78350f;
}
.chest-icon::after { content: ''; position: absolute; left: 25px; top: 24px; width: 8px; height: 14px; background: #facc15; }
.gem-icon::before {
  content: ''; position: absolute; left: 14px; top: 6px; width: 26px; height: 38px; background: #38bdf8; border: 4px solid #075985; transform: rotate(45deg); box-shadow: inset -5px -5px 0 #0284c7;
}

.inventory-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 18px auto;
  text-align: left;
}
.inventory-stats div {
  background: #020617;
  border: 3px solid #475569;
  padding: 12px;
  font-size: 11px;
  box-shadow: 4px 4px 0 #000;
}
.inventory-stats span { color: #bae6fd; }


.archer-preview::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 12px;
  width: 38px;
  height: 52px;
  background: #166534;
  border: 4px solid #111827;
  border-radius: 18px 18px 8px 8px;
  box-shadow: inset -7px -7px 0 #14532d;
}
.archer-preview::after {
  content: '';
  position: absolute;
  left: 11px;
  top: 21px;
  width: 46px;
  height: 46px;
  border-right: 5px solid #92400e;
  border-radius: 50%;
  box-shadow: 16px 18px 0 -13px #facc15;
}

.necromancer-preview::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 11px;
  width: 42px;
  height: 56px;
  background: #581c87;
  border: 4px solid #111827;
  border-radius: 22px 22px 8px 8px;
  box-shadow: inset -8px -7px 0 #3b0764;
}
.necromancer-preview::after {
  content: '';
  position: absolute;
  left: 29px;
  top: 31px;
  width: 7px;
  height: 7px;
  background: #f0abfc;
  box-shadow: 10px 0 0 #f0abfc, 28px -23px 0 5px #c084fc;
}

@media (max-width: 900px) {
  .character-grid,
  .inventory-grid,
  .inventory-stats { grid-template-columns: 1fr; }
}


/* Intro cutscene */
.cutscene-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: #020617;
  display: grid;
  place-items: center;
  padding: 0;
}

.cutscene-frame {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #020617;
  image-rendering: pixelated;
  display: grid;
  place-items: center;
}

.cutscene-frame img {
  width: min(100vw, calc(100vh * 1.78));
  height: auto;
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: saturate(1.06) contrast(1.08);
}

.cutscene-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.035) 0px,
    rgba(255,255,255,0.035) 2px,
    transparent 2px,
    transparent 6px
  );
  mix-blend-mode: overlay;
}

.cutscene-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at center, transparent 46%, rgba(2,6,23,0.42) 100%),
    linear-gradient(to bottom, rgba(2,6,23,0.06), rgba(2,6,23,0.22));
}

.cutscene-glitch-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background:
    linear-gradient(90deg, transparent 0 12%, rgba(168,85,247,0.16) 12.4% 13%, transparent 13.2% 100%),
    linear-gradient(0deg, transparent 0 38%, rgba(56,189,248,0.15) 38.2% 38.8%, transparent 39% 100%);
  animation: cutsceneGlitch 2.6s steps(2, end) infinite;
}

@keyframes cutsceneGlitch {
  0%, 78%, 100% { transform: translate(0, 0); opacity: 0.16; }
  80% { transform: translate(9px, -4px); opacity: 0.34; }
  84% { transform: translate(-5px, 3px); opacity: 0.24; }
}

.cutscene-box {
  position: absolute;
  right: 24px;
  bottom: 24px;
  width: auto;
  min-height: 0;
  background: rgba(2, 10, 35, 0.9);
  border: 4px solid #d69a3a;
  outline: 3px solid #020617;
  box-shadow: 0 0 0 2px #f8fafc22, 7px 7px 0 #000;
  padding: 12px 14px;
  text-align: right;
}

.cutscene-box::before,
.cutscene-box::after {
  display: none;
}

#cutsceneText {
  display: none;
}

.cutscene-controls {
  margin-top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

#cutsceneProgress {
  color: #facc15;
  font-size: 13px;
  text-shadow: 3px 3px 0 #000;
  min-width: 42px;
  text-align: left;
}

.cutscene-buttons {
  display: flex;
  gap: 12px;
}

.cutscene-btn {
  padding: 10px 14px;
  font-size: 12px;
}

@media (max-width: 760px) {
  .cover-tip {
    width: calc(100vw - 24px);
    text-align: center;
    font-size: 14px;
    bottom: 14px;
  }
  .cutscene-box {
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    padding: 10px;
  }
  .cutscene-controls {
    gap: 10px;
  }
  .cutscene-btn {
    padding: 8px 10px;
    font-size: 11px;
  }
}


.card-level {
  display: block;
  color: #bae6fd;
  font-size: 8px;
  line-height: 1.4;
  margin: -6px 0 10px;
  letter-spacing: 0.6px;
}

/* Five level map selection update */
.map-level-grid {
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  gap: 14px;
}

.map-card {
  min-height: 310px;
  padding: 12px;
  overflow: hidden;
  background: #0f172a;
}

.level-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 3px solid #64748b;
  box-shadow: 4px 4px 0 #000;
  margin-bottom: 12px;
  background: #020617;
}

.level-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: saturate(1.05) contrast(1.05);
}

.map-card.selected .level-thumb {
  border-color: #facc15;
}

.map-card strong {
  font-size: 15px;
  line-height: 1.25;
}

.map-card small {
  font-size: 9px;
  min-height: 72px;
}

.map-card em {
  color: #facc15;
}

@media (max-width: 1200px) {
  .map-level-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 760px) {
  .map-level-grid {
    grid-template-columns: 1fr;
  }
}

.removed-feature { display: none !important; }


/* Game-like main menu art implementation */
.game-menu-overlay {
  background: radial-gradient(circle at center, rgba(5,10,25,0.35), rgba(2,6,23,0.78));
}

.game-menu-art {
  position: relative;
  width: min(95vw, calc(92vh * 1.3333));
  max-height: 92vh;
  aspect-ratio: 4 / 3;
}

.game-menu-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 16px 28px rgba(0,0,0,0.5));
}

.menu-hotspot,
.char-select-btn {
  position: absolute;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}

.char-select-btn {
  /* Invisible character click targets. Selecting a class starts the game immediately. */
  top: 43.05%;
  height: 17.65%;
  width: 13.25%;
  border-radius: 10px;
  box-shadow: none;
  transition: transform 0.15s ease;
  z-index: 4;
}

.char-select-btn:hover {
  transform: translateY(-1px);
}

.char-select-btn.selected {
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#knightSelectBtn { left: 26.70%; }
#archerSelectBtn { left: 41.85%; }
#necromancerSelectBtn { left: 57.05%; }

.play-hotspot {
  display: none;
  pointer-events: none;
}

.settings-hotspot {
  left: 35.25%;
  top: 63.20%;
  width: 29.50%;
  height: 7.10%;
  z-index: 3;
}

.hidden-play-btn {
  display: none;
  pointer-events: none;
}

.button-row-cover { display: none !important; }

.center-settings-visual { display: none !important; }

.selected-class-badge {
  display: none !important;
}

.menu-best-display {
  position: absolute;
  left: 34.20%;
  top: 82.55%;
  width: 30.45%;
  height: 7.95%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  color: #f3e8ff;
  line-height: 1;
  letter-spacing: 0.8px;
  white-space: nowrap;
  text-shadow: 2px 2px 0 #000, 0 0 6px rgba(168,85,247,0.45);
  background: linear-gradient(180deg, rgba(126,58,242,1) 0%, rgba(112,43,221,1) 45%, rgba(91,33,182,1) 100%);
  border: 1px solid rgba(233,213,255,0.48);
  border-radius: 16px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.24),
    inset 0 0 0 2px rgba(91,33,182,1),
    inset 0 0 0 4px rgba(59,7,100,0.96),
    0 0 0 1px rgba(17,24,39,0.35),
    0 4px 12px rgba(0,0,0,0.30);
  padding: 3px 0 2px;
  pointer-events: none;
  z-index: 8;
}

.menu-best-display .pb-label {
  font-size: clamp(11px, 1.02vw, 15px);
}

.menu-best-display .pb-value {
  font-size: clamp(8px, 0.78vw, 11px);
  opacity: 0.98;
}


.menu-shard-display {
  position: absolute;
  left: 2.4%;
  top: 2.6%;
  min-width: 22%;
  height: 6.8%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  color: #fde68a;
  line-height: 1;
  letter-spacing: 0.8px;
  white-space: nowrap;
  text-shadow: 2px 2px 0 #000, 0 0 8px rgba(250,204,21,0.35);
  background: linear-gradient(180deg, rgba(120,53,15,0.96) 0%, rgba(146,64,14,0.96) 48%, rgba(69,26,3,0.98) 100%);
  border: 1px solid rgba(254,243,199,0.62);
  border-radius: 14px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    inset 0 0 0 2px rgba(120,53,15,0.9),
    inset 0 0 0 4px rgba(69,26,3,0.88),
    0 0 0 1px rgba(17,24,39,0.35),
    0 4px 12px rgba(0,0,0,0.30);
  padding: 3px 10px 2px;
  pointer-events: none;
  z-index: 8;
}

.menu-shard-display .shard-label {
  font-size: clamp(8px, 0.78vw, 11px);
  color: #fef3c7;
}

.menu-shard-display .shard-value {
  font-size: clamp(12px, 1.12vw, 16px);
  color: #facc15;
}

@media (max-width: 900px) {
  .game-menu-art {
    width: min(98vw, calc(86vh * 1.3333));
    max-height: 86vh;
  }

  .menu-best-display {
    left: 34.20%;
    top: 82.55%;
    width: 30.45%;
    height: 7.95%;
  }

  .menu-best-display .pb-label {
    font-size: clamp(10px, 0.95vw, 14px);
  }

  .menu-best-display .pb-value {
    font-size: clamp(7px, 0.82vw, 10px);
  }

  .menu-shard-display {
    left: 2.2%;
    top: 2.2%;
    height: 6.6%;
  }

  .menu-shard-display .shard-label {
    font-size: clamp(7px, 0.78vw, 10px);
  }

  .menu-shard-display .shard-value {
    font-size: clamp(10px, 1vw, 14px);
  }
}


/* Implemented generated parchment upgrade card art */
.card.art-card {
  padding: 0;
  min-height: 0;
  aspect-ratio: 3 / 4;
  background: #e9dcc3;
  border-width: 4px;
  box-shadow: 6px 6px 0 #000;
}

.card.art-card::before {
  display: none;
}

.card.art-card .card-art-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.card.art-card .rarity-badge,
.card.art-card .card-level-badge {
  position: absolute;
  z-index: 2;
  margin: 0;
  box-shadow: 3px 3px 0 #000;
  border: 2px solid rgba(255,255,255,0.95);
}

.card.art-card .rarity-badge {
  top: 8px;
  left: 8px;
  font-size: 8px;
  padding: 4px 6px;
}

.card.art-card .card-level-badge {
  left: 8px;
  right: 8px;
  bottom: 8px;
  display: block;
  padding: 5px 7px;
  font-size: 8px;
  line-height: 1.35;
  text-align: center;
  color: #f8fafc;
  background: rgba(15, 23, 42, 0.90);
}

@media (max-width: 980px) {
  .card.art-card .card-level-badge {
    font-size: 7px;
  }
}



/* Step 1: unified readable upgrade card renderer
   The card frame/text is now drawn by CSS/HTML so every upgrade has one style and size.
   Existing generated cards are only cropped into the central art window for now. */
.upgrade-panel {
  width: min(980px, 96vw);
  padding: 20px;
}

.upgrade-panel h2 {
  margin-bottom: 6px;
}

.upgrade-panel > p {
  margin: 0 0 14px;
}

.cards {
  grid-template-columns: repeat(4, minmax(145px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.card.upgrade-template-card {
  --card-accent: #94a3b8;
  --card-ink: #3b2a18;
  --card-border: #7c5a31;
  --card-paper-light: #f3e7cb;
  --card-paper-mid: #e8d5ad;
  --card-paper-dark: #cdb58b;
  position: relative;
  display: block;
  min-height: 250px;
  aspect-ratio: 3 / 4;
  padding: 6px;
  color: var(--card-ink);
  text-align: center;
  font-family: 'Courier New', monospace;
  background:
    radial-gradient(circle at 50% 18%, rgba(255,255,255,0.44), transparent 36%),
    linear-gradient(135deg, var(--card-paper-light), var(--card-paper-mid) 62%, var(--card-paper-dark));
  border: 4px solid var(--card-accent);
  box-shadow: 6px 6px 0 #000;
  overflow: hidden;
  cursor: pointer;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.card.upgrade-template-card::before {
  display: none;
}

.card.upgrade-template-card.common {
  --card-accent: #cbd5e1;
}

.card.upgrade-template-card.rare {
  --card-accent: #38bdf8;
}

.card.upgrade-template-card.epic {
  --card-accent: #c084fc;
}

.card.upgrade-template-card.legendary {
  --card-accent: #facc15;
}

.card.upgrade-template-card.guaranteed-class-card {
  --card-accent: #facc15;
  box-shadow: 6px 6px 0 #000, 0 0 22px rgba(250, 204, 21, 0.24);
}

.card.upgrade-template-card:hover {
  transform: translateY(-6px);
  border-color: #facc15;
  box-shadow: 6px 10px 0 #000, 0 0 22px rgba(250, 204, 21, 0.20);
}

.upgrade-card-shell {
  position: relative;
  z-index: 1;
  height: 100%;
  min-height: 238px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7px 8px 8px;
  background:
    linear-gradient(rgba(255,255,255,0.16), rgba(255,255,255,0)),
    rgba(255, 248, 229, 0.58);
  border: 2px solid var(--card-border);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.25),
    inset 0 -8px 0 rgba(94, 59, 22, 0.08);
}

.upgrade-card-shell::before {
  content: '';
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(87, 62, 35, 0.32);
  pointer-events: none;
}

.upgrade-card-topline {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  min-height: 22px;
}

.card.upgrade-template-card .rarity,
.card.upgrade-template-card .rarity-badge {
  display: inline-block;
  margin: 0;
  padding: 4px 6px;
  font-size: 8px;
  line-height: 1;
  letter-spacing: 0.4px;
  color: #102033;
  background: #e2e8f0;
  border: 2px solid #ffffff;
  box-shadow: 2px 2px 0 #111827;
}

.card.upgrade-template-card.rare .rarity-badge { background: #38bdf8; }
.card.upgrade-template-card.epic .rarity-badge { background: #c084fc; color: #1e1233; }
.card.upgrade-template-card.legendary .rarity-badge,
.card.upgrade-template-card.guaranteed-class-card .rarity-badge { background: #facc15; color: #1f1400; }

.upgrade-card-title,
.card.upgrade-template-card h3.upgrade-card-title {
  width: 100%;
  margin: 2px 0 5px;
  min-height: 31px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--card-ink);
  font-size: 13px;
  line-height: 1.18;
  letter-spacing: 0.5px;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.55);
}

.upgrade-art-frame {
  position: relative;
  width: 100%;
  height: 88px;
  max-width: 126px;
  margin: 3px auto 5px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle, rgba(255,255,255,0.35), transparent 65%),
    rgba(238, 224, 190, 0.60);
  border: 2px solid rgba(92, 65, 34, 0.55);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.20);
}

.generated-card-crop img {
  position: absolute;
  left: 50%;
  top: 50.5%;
  width: 168%;
  height: auto;
  transform: translate(-50%, -50%);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}

.clean-icon-art {
  display: flex;
  align-items: center;
  justify-content: center;
}

.clean-icon-art img {
  display: block;
  width: 82px;
  height: 82px;
  max-width: calc(100% - 10px);
  max-height: calc(100% - 10px);
  object-fit: contain;
  object-position: center center;
  image-rendering: auto;
  pointer-events: none;
  filter: drop-shadow(3px 4px 0 rgba(47, 38, 26, 0.30));
}

.symbol-card-art .upgrade-icon {
  width: 74px;
  height: 74px;
  margin: 0;
  font-size: 40px;
  color: var(--card-accent);
  background: rgba(15, 23, 42, 0.94);
  border: 3px solid var(--card-accent);
  box-shadow: 4px 4px 0 #111827;
}

.upgrade-card-divider {
  width: 70%;
  height: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 3px;
}

.upgrade-card-divider::before,
.upgrade-card-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(83, 57, 31, 0.54);
}

.upgrade-card-divider span {
  width: 6px;
  height: 6px;
  margin: 0 6px;
  transform: rotate(45deg);
  border: 1px solid rgba(83, 57, 31, 0.70);
}

.upgrade-card-desc,
.card.upgrade-template-card p.upgrade-card-desc {
  width: 100%;
  min-height: 32px;
  margin: 0 0 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2f261a;
  font-size: 10px;
  line-height: 1.35;
  letter-spacing: 0;
}

.card.upgrade-template-card .card-level,
.card.upgrade-template-card .card-level-badge {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin: auto 0 0;
  padding: 6px 7px;
  color: #f8fafc;
  background: #1e293b;
  border: 2px solid #ffffff;
  box-shadow: 3px 3px 0 #111827;
  font-size: 8px;
  line-height: 1.1;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.card.upgrade-template-card .card-level strong {
  color: #facc15;
  font-size: 8px;
  font-weight: 900;
}

@media (max-width: 980px) {
  .upgrade-panel {
    width: min(760px, 96vw);
  }

  .cards {
    grid-template-columns: repeat(2, minmax(165px, 1fr));
  }

  .card.upgrade-template-card {
    min-height: 245px;
  }
}

@media (max-width: 760px) {
  .cards {
    grid-template-columns: 1fr;
  }

  .card.upgrade-template-card {
    width: min(260px, 100%);
    margin: 0 auto;
  }
}

/* Step 2: Main-page Permanent Upgrades menu */
.permanent-upgrades-menu-btn {
  position: absolute;
  right: 2.4%;
  top: 2.6%;
  min-width: 23%;
  height: 6.8%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: clamp(8px, 0.86vw, 12px);
  letter-spacing: 0.8px;
  color: #1f1400;
  text-shadow: 1px 1px 0 rgba(255,255,255,0.35);
  background:
    linear-gradient(180deg, rgba(254, 243, 199, 0.98) 0%, rgba(250, 204, 21, 0.96) 42%, rgba(180, 83, 9, 0.98) 100%);
  border: 2px solid rgba(255,255,255,0.72);
  border-radius: 14px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.42),
    inset 0 0 0 2px rgba(146,64,14,0.68),
    inset 0 0 0 4px rgba(69,26,3,0.55),
    0 5px 0 rgba(0,0,0,0.55),
    0 8px 16px rgba(0,0,0,0.34);
  cursor: pointer;
  z-index: 9;
}

.permanent-upgrades-menu-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.permanent-upgrades-menu-btn:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.35),
    inset 0 0 0 2px rgba(146,64,14,0.68),
    inset 0 0 0 4px rgba(69,26,3,0.55),
    0 2px 0 rgba(0,0,0,0.6),
    0 5px 10px rgba(0,0,0,0.28);
}

.permanent-upgrade-panel {
  width: min(1120px, 96vw);
  max-height: min(90vh, 780px);
  overflow-y: auto;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(88, 28, 135, 0.38), transparent 42%),
    linear-gradient(180deg, #172033 0%, #0f172a 100%);
  border-color: #facc15;
}

.perm-upgrade-header {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.perm-upgrade-heading {
  text-align: left;
}

.perm-upgrade-heading h1 {
  margin: 0 0 8px;
  color: #facc15;
  font-size: clamp(22px, 3.2vw, 42px);
  text-shadow: 3px 3px 0 #000;
}

.perm-upgrade-heading p {
  margin: 0;
  color: #bae6fd;
  font-size: 11px;
  line-height: 1.6;
  max-width: 650px;
}

.perm-shard-badge {
  min-width: 190px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #fef3c7;
  background: linear-gradient(180deg, rgba(120,53,15,0.98), rgba(69,26,3,0.98));
  border: 3px solid #facc15;
  box-shadow: 5px 5px 0 #000, inset 0 0 0 2px rgba(255,255,255,0.12);
}

.perm-shard-badge span {
  font-size: 10px;
  letter-spacing: 1px;
}

.perm-shard-badge strong {
  margin-top: 5px;
  color: #facc15;
  font-size: 22px;
  text-shadow: 2px 2px 0 #000;
}

.perm-upgrade-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.perm-upgrade-card {
  position: relative;
  min-height: 230px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: #3a2818;
  text-align: left;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.26), transparent 24%),
    linear-gradient(180deg, #ead8ae 0%, #d5b77c 100%);
  border: 4px solid #5b3a1c;
  box-shadow: 6px 6px 0 #000, inset 0 0 0 3px rgba(255,255,255,0.22);
}

.perm-upgrade-card.can-afford {
  border-color: #facc15;
  box-shadow: 6px 6px 0 #000, 0 0 18px rgba(250, 204, 21, 0.20), inset 0 0 0 3px rgba(255,255,255,0.22);
}

.perm-upgrade-card.cannot-afford {
  opacity: 0.78;
  filter: saturate(0.78);
}

.perm-upgrade-card.maxed {
  border-color: #22c55e;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.30), transparent 24%),
    linear-gradient(180deg, #e6d8ad 0%, #abc67a 100%);
}

.perm-upgrade-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.perm-upgrade-card h3 {
  margin: 0;
  color: #2a190e;
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: 0.4px;
  text-shadow: 1px 1px 0 rgba(255,255,255,0.48);
}

.perm-upgrade-level {
  flex: 0 0 auto;
  color: #fef3c7;
  background: #422006;
  border: 2px solid #92400e;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.55);
  padding: 5px 7px;
  font-size: 9px;
}

.perm-upgrade-icon {
  width: 74px;
  height: 74px;
  margin: 2px auto 0;
  display: grid;
  place-items: center;
  color: #facc15;
  font-size: 36px;
  background: radial-gradient(circle, #334155, #111827 72%);
  border: 3px solid #facc15;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.65), inset 0 0 0 3px rgba(255,255,255,0.08);
}

.perm-upgrade-desc {
  min-height: 42px;
  margin: 0;
  color: #4b2f1a;
  font-size: 10px;
  line-height: 1.45;
}

.perm-upgrade-next {
  display: inline-block;
  margin-top: 4px;
  color: #7c2d12;
}

.perm-upgrade-bar {
  width: 100%;
  height: 10px;
  background: rgba(66,32,6,0.35);
  border: 2px solid rgba(66,32,6,0.72);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
}

.perm-upgrade-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #facc15, #fb923c);
}

.perm-upgrade-cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.perm-upgrade-cost {
  color: #2a190e;
  font-size: 10px;
}

.perm-upgrade-cost strong {
  color: #92400e;
}

.perm-upgrade-buy {
  font-family: inherit;
  font-size: 10px;
  color: #020617;
  background: #facc15;
  border: 3px solid #fff;
  box-shadow: 3px 3px 0 #000;
  padding: 8px 10px;
  cursor: pointer;
}

.perm-upgrade-buy:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #000;
}

.perm-upgrade-buy:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #000;
}

.perm-upgrade-buy:disabled {
  cursor: not-allowed;
  opacity: 0.72;
  color: #1f2937;
  background: #94a3b8;
}

.perm-upgrade-card.maxed .perm-upgrade-buy:disabled {
  color: #052e16;
  background: #22c55e;
}

.perm-upgrade-footer {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.perm-upgrade-footer p {
  margin: 0;
  color: #cbd5e1;
  font-size: 10px;
  text-align: left;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .permanent-upgrades-menu-btn {
    right: 2.2%;
    top: 9.8%;
    min-width: 22%;
    height: 6.2%;
    font-size: clamp(7px, 0.92vw, 10px);
  }

  .perm-upgrade-header,
  .perm-upgrade-footer {
    flex-direction: column;
  }

  .perm-upgrade-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .perm-upgrade-grid {
    grid-template-columns: 1fr;
  }
}


.music-credits-row {
  display: block;
  padding: 0;
  overflow: hidden;
}

.music-credits-row[open] {
  border-color: #facc15;
}

.music-credits-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px;
  cursor: pointer;
  list-style: none;
}

.music-credits-summary::-webkit-details-marker {
  display: none;
}

.music-credits-summary strong,
.music-credits-summary small {
  display: block;
}

.music-credits-summary strong {
  color: #f8fafc;
  margin-bottom: 8px;
}

.music-credits-summary small {
  color: #bae6fd;
  line-height: 1.5;
}

.music-credits-arrow {
  color: #facc15;
  font-size: 16px;
  text-shadow: 2px 2px 0 #000;
  transition: transform 0.15s ease;
}

.music-credits-row[open] .music-credits-arrow {
  transform: rotate(90deg);
}

.music-credits-content {
  border-top: 2px solid #334155;
  padding: 16px 18px 18px;
  display: grid;
  gap: 12px;
  background: rgba(2, 6, 23, 0.55);
}

.music-credit-item {
  padding: 12px;
  border: 2px solid #334155;
  background: #020617;
  box-shadow: 3px 3px 0 #000;
}

.music-credit-item b,
.music-credit-item span,
.music-credit-item small {
  display: block;
}

.music-credit-item b {
  color: #facc15;
  margin-bottom: 6px;
}

.music-credit-item span {
  color: #f8fafc;
  margin-bottom: 5px;
}

.music-credit-item small {
  color: #bae6fd;
  line-height: 1.45;
}


/* Rebirth card for permanent upgrades */
.rebirth-upgrade-card {
  grid-column: 1 / -1;
  border-color: #facc15;
  background:
    radial-gradient(circle at top, rgba(250, 204, 21, 0.18), transparent 48%),
    linear-gradient(180deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
}

.rebirth-upgrade-card .perm-upgrade-icon {
  color: #facc15;
  text-shadow: 0 0 12px rgba(250, 204, 21, 0.75), 3px 3px 0 #000;
}

.rebirth-upgrade-card .perm-upgrade-bar-fill {
  background: linear-gradient(90deg, #f97316, #facc15, #fde68a);
}

.rebirth-buy:not(:disabled) {
  background: linear-gradient(180deg, #facc15, #f97316);
  color: #111827;
  border-color: #fde68a;
}


/* Settings menu iframe/website scroll fix */
#settingsOverlay {
  align-items: center;
  justify-items: center;
  overflow: hidden;
  padding: clamp(8px, 2vh, 20px);
}

.settings-panel {
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-top: clamp(18px, 3vh, 28px);
  padding-bottom: clamp(18px, 3vh, 28px);
  scrollbar-width: thin;
  scrollbar-color: #facc15 #0f172a;
}

.settings-panel::-webkit-scrollbar {
  width: 14px;
}

.settings-panel::-webkit-scrollbar-track {
  background: #0f172a;
  border-left: 2px solid #64748b;
}

.settings-panel::-webkit-scrollbar-thumb {
  background: #facc15;
  border: 3px solid #0f172a;
}

.settings-panel .subtitle {
  margin-bottom: 12px;
}

.settings-panel .settings-list {
  margin: 18px auto;
  gap: 12px;
}

.settings-panel .setting-row {
  padding: 14px 18px;
}

.settings-panel .instructions.compact-instructions {
  margin-top: 10px;
}

@media (max-height: 620px) {
  .settings-panel h1 {
    font-size: clamp(24px, 7vh, 42px);
    margin-bottom: 10px;
  }

  .settings-panel .subtitle {
    margin: 0 0 8px;
  }

  .settings-panel .settings-list {
    margin: 12px auto;
    gap: 10px;
  }

  .settings-panel .setting-row {
    padding: 12px 14px;
  }
}
