/* --- Splash screen --- */
#splash-screen {
  position: fixed;
  inset: 0;
  background-image: url("./img/bricks.png");
  background-repeat: repeat;
  background-size: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-y: auto;
  padding: 24px 16px;
  z-index: 100;
  transition: opacity 0.5s ease;
}

#splash-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

#splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin: auto;
  width: 100%;
}

#splash-columns {
  display: flex;
  flex-direction: row;
  gap: 16px;
  align-items: stretch;
  width: min(860px, 94vw);
}

#splash-options {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background-color: rgba(22, 33, 62, 0.88);
  border: 1px solid #333;
  border-radius: 12px;
  padding: 16px 20px;
  flex: 1;
}

#splash-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 0 0 260px;
}

#splash-play-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: min(860px, 94vw);
}

#splash-private {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background-color: rgba(22, 33, 62, 0.88);
  border: 1px solid #333;
  border-radius: 12px;
  padding: 16px 20px;
  flex: 1;
}

.splash-options-header {
  font-size: 1rem;
  font-weight: 700;
  color: #e0e0e0;
  letter-spacing: 0.5px;
  margin: 0 0 2px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #333;
}

.splash-divider {
  border-top: 1px solid #333;
  margin: 0;
}

#splash-create-section,
#splash-join-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.splash-private-btn {
  padding: 9px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  background-color: #2a2a4a;
  color: #e0e0e0;
  border: 1px solid #555;
  border-radius: 7px;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
  text-align: center;
}

.splash-private-btn:hover {
  background-color: #3a3a60;
  border-color: #e94560;
}

#splash-name-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#splash-name-section label {
  font-size: 0.85rem;
  color: #aaa;
  letter-spacing: 0.5px;
}

#splashNameInput {
  width: 100%;
  padding: 8px 12px;
  font-size: 1rem;
  background-color: #1a1a2e;
  border: 1px solid #555;
  border-radius: 6px;
  color: #e0e0e0;
  box-sizing: border-box;
}

#splashNameInput:focus {
  outline: none;
  border-color: #e94560;
}

#splash-character-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.splash-section-label {
  font-size: 0.85rem;
  color: #aaa;
  letter-spacing: 0.5px;
  margin: 0;
}

#splash-character-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.splash-char-btn {
  margin: 0;
  padding: 8px 0;
  font-size: 1.6rem;
  line-height: 1;
  background-color: #1a1a2e;
  border: 2px solid #444;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.splash-char-btn:hover {
  background-color: #222244;
  border-color: #888;
}

.splash-char-btn.selected {
  border-color: #e94560;
  background-color: #2a1a2e;
}

#splash-toggles {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px solid #2a2a4e;
}

.splash-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
}

.splash-toggle-label {
  color: #aaa;
  flex-shrink: 0;
  min-width: 80px;
}

.splash-radio-group {
  display: flex;
  gap: 16px;
}

.splash-radio-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.9rem;
  color: #e0e0e0;
  cursor: pointer;
}

#splashPrivateCodeInput {
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid #555;
  background: #1a1a2e;
  color: #e0e0e0;
  font-size: 1rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  width: 100%;
}

#splash-private-code-error {
  color: #e94560;
  font-size: 0.85rem;
  font-weight: 600;
}

#private-code-display {
  margin-top: 12px;
  padding: 10px 12px;
  background: #1a1a2e;
  border: 1px solid #444;
  border-radius: 8px;
  text-align: center;
}

.options-label {
  font-size: 0.75rem;
  color: #aaa;
  margin-bottom: 4px;
}

#private-code-value {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 4px;
  color: #e0e0e0;
  font-family: monospace;
}

#splash-logo {
  max-width: min(520px, 80vw);
  width: 100%;
  height: auto;
  filter: drop-shadow(0 4px 24px rgba(0,0,0,0.7));
}

#playNowBtn {
  width: 280px;
  padding: 14px 48px;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 1px;
  background-color: #e94560;
  color: #fff;
  border: 2px solid rgba(22, 33, 62, 0.88);
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.15s;
  margin-top: 0;
  box-shadow: 0 4px 16px rgba(233, 69, 96, 0.5);
}

#playNowBtn:hover {
  background-color: #c73652;
  transform: scale(1.05);
}


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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-image: url("./img/bricks.png");
  background-repeat: repeat;
  background-size: auto;
  background-attachment: fixed;
  color: #e0e0e0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0 20px;
}

#game-container {
  text-align: center;
  width: 100%;
  max-width: calc(100vw - 40px);
  height: 93vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background-image: url("./img/bricks.png");
  background-repeat: repeat;
  background-size: auto;
}

h1 {
  margin-bottom: 10px;
  font-size: 0;
  flex: 0 0 auto;
  text-align: center;
  padding: 10px 20px 0 20px;
  background: none;
  border-radius: 0;
  min-height: 80px;
}

h1::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background-image: url("./img/maze-runner-horizontal.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* --- Main area: leaderboard + canvas + side panel --- */
#game-area {
  flex: 1 1 auto;
  display: flex;
  flex-direction: row;
  min-height: 0;
  gap: 12px;
}

canvas {
  border: 4px solid #000000;
  border-radius: 8px;
  background-color: #16213e;
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

/* --- Leaderboard panel (left) --- */
#leaderboard-panel {
  flex: 0 0 170px;
  background-color: #16213e;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
}

#leaderboard-panel h2 {
  font-size: 1.1rem;
  color: #e94560;
  text-align: center;
  margin: 0 0 6px 0;
  flex-shrink: 0;
}

#leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#leaderboard-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  padding: 5px 6px;
  background-color: #1a1a2e;
  border-radius: 5px;
  border: 1px solid #2a2a4e;
}

#leaderboard-list li.me {
  border-color: #e94560;
  background-color: #2a1a2e;
}

.lb-rank {
  color: #aaa;
  font-size: 0.75rem;
  width: 16px;
  flex-shrink: 0;
  text-align: right;
}

@keyframes lbRankUp {
  0%   { color: #4caf50; transform: scale(1.4); }
  60%  { color: #4caf50; transform: scale(1.1); }
  100% { color: #aaa;    transform: scale(1);   }
}

@keyframes lbRankDown {
  0%   { color: #e94560; transform: scale(1.3); }
  60%  { color: #e94560; transform: scale(1.05); }
  100% { color: #aaa;    transform: scale(1);    }
}

.lb-rank-up {
  display: inline-block;
  animation: lbRankUp 0.7s ease-out forwards;
}

.lb-rank-down {
  display: inline-block;
  animation: lbRankDown 0.7s ease-out forwards;
}

.lb-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #ddd;
}

.lb-coins {
  color: #ffd700;
  font-weight: bold;
  font-size: 0.82rem;
  flex-shrink: 0;
}

/* --- All-time leaderboard section --- */
#alltime-lb-section {
  margin-top: 14px;
  flex-shrink: 0;
}

#alltime-lb-heading {
  font-size: 0.85rem;
  color: #f0c040;
  text-align: center;
  margin: 0 0 6px 0;
  font-weight: 700;
  letter-spacing: 0.3px;
}

#alltime-lb-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#alltime-lb-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  padding: 4px 6px;
  background-color: #1a1a2e;
  border-radius: 5px;
  border: 1px solid #2a2a3e;
}

#alltime-lb-list .atl-rank {
  color: #888;
  font-size: 0.72rem;
  width: 16px;
  flex-shrink: 0;
  text-align: right;
}

#alltime-lb-list .atl-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #ccc;
}

#alltime-lb-list .atl-coins {
  color: #f0c040;
  font-weight: bold;
  font-size: 0.78rem;
  flex-shrink: 0;
}

/* --- Side panel (right: inventory + store + options) --- */
#side-panel {
  flex: 0 0 200px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
}

/* --- Inventory panel --- */
#items-panel {
  background-color: #16213e;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 14px 16px;
  text-align: left;
  flex-shrink: 0;
}

#items-panel h2 {
  font-size: 1.1rem;
  color: #e94560;
  text-align: center;
  margin: 0 0 10px 0;
}

#item-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
}

.item-icon {
  font-size: 1.3rem;
  width: 28px;
  text-align: center;
}

.item-row span:last-child {
  font-weight: bold;
  font-size: 1.05rem;
}

#level-display {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #333;
  font-size: 0.9rem;
  color: #aaa;
  text-align: center;
}

#level-num {
  color: #e94560;
  font-weight: bold;
}

/* --- Store panel --- */
#store-panel {
  background-color: #16213e;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 14px 16px;
  text-align: left;
  flex-shrink: 0;
}

#store-panel h2 {
  font-size: 1.1rem;
  color: #e94560;
  text-align: center;
  margin: 0 0 10px 0;
}

.store-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
  font-size: 0.85rem;
}

.store-icon {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.store-name {
  flex: 1 1 auto;
  color: #ddd;
}

.store-price {
  color: #ffd700;
  font-size: 0.78rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.store-buy-btn {
  margin: 0;
  padding: 3px 8px;
  font-size: 0.75rem;
  width: auto;
  flex-shrink: 0;
  background-color: #e94560;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.store-buy-btn:hover:not(:disabled) {
  background-color: #c73652;
}

.store-buy-btn:disabled {
  background-color: #444;
  color: #888;
  cursor: not-allowed;
}

/* Use button (in inventory) */
.use-btn {
  margin: 0 0 0 auto;
  padding: 2px 7px;
  font-size: 0.72rem;
  width: auto;
  flex-shrink: 0;
  background-color: #2a6e2a;
  color: #cfc;
  border: 1px solid #3a9e3a;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s;
}

.use-btn:hover:not(:disabled) {
  background-color: #3a8e3a;
}

.use-btn:disabled {
  background-color: #333;
  color: #666;
  border-color: #444;
  cursor: not-allowed;
}

/* --- Options panel --- */
#options-panel {
  background-color: #16213e;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
  text-align: left;
  overflow: hidden;
  flex: 0 0 auto;
  transition: flex 0.3s ease;
}

#options-panel h2 {
  font-size: 1.1rem;
  color: #e94560;
  text-align: left;
  margin: 0 0 12px 0;
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 2px;
}

#options-chevron {
  font-style: normal;
  font-size: 0.9em;
  transition: transform 0.25s ease;
  display: inline-block;
}

#options-panel.collapsed #options-chevron {
  transform: rotate(-90deg);
}

#options-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  max-height: 750px;
  transition: max-height 0.3s ease, opacity 0.25s ease;
  opacity: 1;
}

#options-panel.collapsed #options-body {
  max-height: 0;
  opacity: 0;
}

/* --- Player name section --- */
#player-name-section {
  font-size: 0.85rem;
}

#player-name-display {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

#player-name-label {
  color: #ffd700;
  font-weight: bold;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#player-name-edit {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

#nameInput {
  flex: 1 1 auto;
  min-width: 0;
  padding: 3px 6px;
  font-size: 0.82rem;
  background-color: #1a1a2e;
  border: 1px solid #555;
  border-radius: 4px;
  color: #e0e0e0;
}

.inline-btn {
  margin: 0;
  padding: 3px 8px;
  font-size: 0.75rem;
  width: auto;
  flex-shrink: 0;
  background-color: #444;
  color: #ddd;
  border: 1px solid #666;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s;
}

.inline-btn:hover {
  background-color: #555;
}

.inline-btn:disabled {
  visibility: hidden;
}

fieldset {
  border: 1px solid #444;
  border-radius: 6px;
  padding: 10px;
}

legend {
  font-size: 0.85rem;
  color: #aaa;
  padding: 0 4px;
}

fieldset label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 0.9rem;
  cursor: pointer;
}

fieldset input[type="radio"] {
  accent-color: #e94560;
}

/* --- Night Mode toggle switch --- */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px 0;
}

.toggle-label input[type="checkbox"] {
  display: none;
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  background-color: #333;
  border-radius: 11px;
  transition: background-color 0.25s;
  flex-shrink: 0;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background-color: #888;
  border-radius: 50%;
  transition: transform 0.25s, background-color 0.25s;
}

.toggle-label input:checked + .toggle-switch {
  background-color: #e94560;
}

.toggle-label input:checked + .toggle-switch::after {
  transform: translateX(18px);
  background-color: #fff;
}

.toggle-text {
  user-select: none;
}

/* --- Character picker --- */
#character-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.char-btn {
  width: 100%;
  margin: 0;
  padding: 6px 0;
  font-size: 1.4rem;
  line-height: 1;
  background-color: #1a1a2e;
  border: 2px solid #444;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.char-btn:hover {
  background-color: #222244;
  border-color: #888;
}

.char-btn.selected {
  border-color: #e94560;
  background-color: #2a1a2e;
}

#controls {
  font-size: 0.82rem;
  color: #888;
}

#controls p {
  margin: 4px 0;
  line-height: 1.35;
}

.hidden {
  display: none !important;
}

button {
  margin-top: 10px;
  padding: 6px 18px;
  font-size: 0.95rem;
  background-color: #e94560;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
  width: 100%;
}

button:hover {
  background-color: #c73652;
}

/* --- Win overlay --- */
#winOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

#winOverlay.hidden {
  display: none;
}

#winMessage {
  background-color: #16213e;
  border: 2px solid #e94560;
  border-radius: 12px;
  padding: 40px 60px;
  text-align: center;
}

#winMessage h2 {
  font-size: 2.5rem;
  color: #4caf50;
  margin-bottom: 10px;
}

#winMessage p {
  font-size: 1.1rem;
  margin: 6px 0;
  color: #ccc;
}

#winMessage button {
  width: auto;
}

/* --- Coin count flash (inventory panel) --- */
@keyframes coinFlash {
  0%   { color: #ffd700; transform: scale(1.35); }
  60%  { color: #ffd700; transform: scale(1.2);  }
  100% { color: inherit;  transform: scale(1);    }
}

#coin-count.coin-flash {
  display: inline-block;
  animation: coinFlash 0.5s ease-out forwards;
}

/* --- Message banner (narrative, below game area) --- */

/* --- Kill feed (top-left overlay) --- */
#kill-feed {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
  max-width: 320px;
}

.kill-feed-entry {
  font-size: 0.78rem;
  font-weight: 600;
  color: #e0e0e0;
  background: rgba(0, 0, 0, 0.65);
  border-left: 3px solid #e94560;
  padding: 4px 10px;
  border-radius: 0 4px 4px 0;
  animation: killFeedFade 5s ease forwards;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes killFeedFade {
  0%   { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

/* --- Message banner (narrative, below game area) --- */
@keyframes bannerFadeOut {
  0%   { opacity: 1;   transform: translateY(0); }
  70%  { opacity: 1;   transform: translateY(0); }
  100% { opacity: 0;   transform: translateY(4px); }
}

#message-banner {
  flex-shrink: 0;
  text-align: center;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 7px 20px;
  margin-top: 6px;
  border-radius: 10px;
  letter-spacing: 0.3px;
  pointer-events: none;
  /* Always occupies space; invisible when idle */
  visibility: hidden;
  opacity: 0;
  border: 2px solid transparent;
  background: transparent;
  /* Explicit height so space is reserved before first activation */
  min-height: calc(0.92rem * 1.4 + 14px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

#message-banner.active {
  visibility: visible;
  animation: bannerFadeOut 3s ease forwards;
}

/* Colour themes — white base with colored accent border + text */
#message-banner.banner-coin    { background: #fffbe6; color: #7a5800; border-color: #f0c040; }
#message-banner.banner-chest   { background: #f0fff0; color: #1a6b1a; border-color: #4caf50; }
#message-banner.banner-bomb    { background: #fff0f0; color: #a01010; border-color: #e94560; }
#message-banner.banner-skull   { background: #f0f0ff; color: #3a3a9e; border-color: #8080e0; }
#message-banner.banner-store   { background: #f0f4ff; color: #1a3a8a; border-color: #4477cc; }
#message-banner.banner-battle  { background: #fff0ff; color: #7a0a7a; border-color: #cc44cc; }
#message-banner.banner-shield  { background: #f0faff; color: #0a4a6a; border-color: #44aadd; }
#message-banner.banner-info    { background: #f8f8f8; color: #333333; border-color: #aaaaaa; }

/* --- First-pickup hotkey hint --- */
#pickup-hint {
  flex-shrink: 0;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 5px 16px;
  border-radius: 8px;
  letter-spacing: 0.2px;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  border: 1px solid transparent;
  background: transparent;
  min-height: calc(0.82rem * 1.4 + 10px);
}

#pickup-hint.active {
  visibility: visible;
  animation: bannerFadeOut 4s ease forwards;
  background: #e8f8ff;
  color: #0a4a6a;
  border-color: #44aadd;
}

#pickup-hint kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid #44aadd;
  border-radius: 4px;
  background: #c8e8f8;
  font-family: monospace;
  font-size: 0.85em;
}

/* --- Death overlay --- */
#deathOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

#deathOverlay.hidden {
  display: none;
}

#deathMessage {
  background-color: #16213e;
  border: 2px solid #e94560;
  border-radius: 12px;
  padding: 30px 40px;
  text-align: center;
  max-height: 90vh;
  overflow-y: auto;
  min-width: 340px;
}

/* Stats card */
#death-stats-card {
  margin: 16px 0;
  text-align: left;
}

.death-stats-section h3 {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e94560;
  margin: 0 0 8px 0;
}

.death-stats-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.95rem;
  color: #aaa;
}

.stat-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  text-align: right;
}

.stat-value.pb-new {
  color: #f0c040;
}

.death-stats-divider {
  height: 1px;
  background: rgba(233, 69, 96, 0.3);
  margin: 12px 0;
}

.death-loot-hint {
  font-size: 0.9rem !important;
  color: #888 !important;
  margin-bottom: 4px !important;
}

#deathMessage h2 {
  font-size: 2.5rem;
  color: #e94560;
  margin-bottom: 10px;
}

#deathCauseHeader {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 4px 0 8px;
}
#deathCauseHeader.cause-pvp    { color: #e94560; }
#deathCauseHeader.cause-monster { color: #ff8c00; }
#deathCauseHeader.cause-bomb   { color: #f0e040; }
#deathCauseHeader.cause-other  { color: #ccc; }

#deathMessage p {
  font-size: 1.1rem;
  margin: 6px 0;
  color: #ccc;
}

#deathMessage button {
  width: auto;
}

/* ── How to Play button on splash ── */
#howToPlayBtn {
  width: 100%;
  padding: 14px 20px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background-color: #2ecc71;
  color: #fff;
  border: 2px solid rgba(22, 33, 62, 0.88);
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.15s;
  margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(46, 204, 113, 0.5);
}

#howToPlayBtn:hover {
  background-color: #27ae60;
  transform: scale(1.02);
}

/* ── How to Play Modal ── */
#how-to-play-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#how-to-play-modal.hidden {
  display: none;
}

#htp-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

#htp-box {
  position: relative;
  background-color: #16213e;
  border: 2px solid #e94560;
  border-radius: 12px;
  padding: 36px 40px 32px;
  max-width: 580px;
  width: 90vw;
  max-height: 82vh;
  overflow-y: auto;
  z-index: 1;
  scrollbar-width: thin;
  scrollbar-color: #e94560 #0f3460;
}

#htp-box::-webkit-scrollbar {
  width: 6px;
}
#htp-box::-webkit-scrollbar-track {
  background: #0f3460;
  border-radius: 3px;
}
#htp-box::-webkit-scrollbar-thumb {
  background: #e94560;
  border-radius: 3px;
}

#htp-close {
  background: none;
  border: none;
  color: #aaa;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
  flex-shrink: 0;
  min-width: 30px;
  text-align: right;
}

#htp-close:hover {
  color: #e94560;
}

#htp-title {
  font-size: 1.6rem;
  color: #e94560;
  margin: 0;
  text-align: center;
  flex: 1;
}

.htp-section {
  margin-bottom: 20px;
}

.htp-section h3 {
  font-size: 1.05rem;
  color: #f0c040;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(240, 192, 64, 0.25);
  padding-bottom: 4px;
}

.htp-section p {
  font-size: 0.92rem;
  color: #ccc;
  line-height: 1.55;
  margin-bottom: 6px;
}

.htp-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.htp-section ul li {
  font-size: 0.92rem;
  color: #ccc;
  line-height: 1.55;
  padding: 3px 0 3px 14px;
  position: relative;
}

.htp-section ul li::before {
  content: "›";
  position: absolute;
  left: 0;
  color: #e94560;
}

.htp-section kbd {
  display: inline-block;
  background: #0f3460;
  border: 1px solid #4a6fa5;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.8rem;
  font-family: monospace;
  color: #e0e0e0;
  vertical-align: middle;
}
