:root {
  --ink: #0d1f2a;
  --paper: #f5fcef;
  --accent: #2fe0dc;
  --accent-2: #46d57a;
  --warn: #ffd861;
  --danger: #f0525f;
  --dark-bg: #082230;
  --dark-card: rgba(8, 28, 42, 0.95);
  --dark-card-2: rgba(12, 36, 52, 0.95);
  --text: #f5fcef;
  --text-dim: #c8e6d9;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", system-ui, sans-serif;
  background: radial-gradient(ellipse at top, #1a3140 0%, #0a1a23 100%);
  color: var(--text);
  letter-spacing: 0.01em;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image: radial-gradient(circle at 25% 25%, rgba(47,224,220,0.05) 1px, transparent 1px),
                    radial-gradient(circle at 75% 75%, rgba(70,213,122,0.05) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
}

.shell { width: 100%; max-width: 1300px; }
.game-frame {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  border: 4px solid #0d1f2a; border-radius: 20px; overflow: hidden;
  background: #082230;
  box-shadow: 0 0 0 4px rgba(47,224,220,0.25), 0 18px 40px rgba(0,0,0,0.5);
}
canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }

.title-screen {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(8,34,48,0.88) 0%, rgba(8,34,48,0.96) 100%);
  z-index: 6;
}
.title-screen.hidden { display: none; }
.title-copy { text-align: center; max-width: 720px; padding: 24px; }
.title-copy .eyebrow {
  letter-spacing: 0.3em; font-size: 12px; color: #2fe0dc;
  margin-bottom: 12px; font-weight: 700;
}
.title-copy h1 {
  font-size: clamp(32px, 5vw, 56px); margin: 0 0 16px;
  text-shadow: 0 4px 0 #082230, 0 0 24px rgba(47,224,220,0.5);
  color: #f5fcef;
}
.title-copy p { line-height: 1.7; color: #d0e8dc; font-size: 14px; font-weight: 600; }
.title-actions { margin-top: 24px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.game-button {
  font-family: inherit;
  font-size: 14px; font-weight: 800;
  padding: 10px 20px; cursor: pointer;
  border: 3px solid #0d1f2a; border-radius: 16px;
  background: #f5fcef; color: #0d1f2a;
  box-shadow: 0 4px 0 #0d1f2a;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.game-button:hover { transform: translateY(-1px); }
.game-button:active { transform: translateY(2px); box-shadow: 0 1px 0 #0d1f2a; }
.game-button.primary { background: linear-gradient(180deg, #2fe0dc 0%, #1bc1bd 100%); color: #062f2e; }
.game-button.quiet { background: linear-gradient(180deg, #4a6a7a 0%, #2a4a5a 100%); color: #ffd861; border-color: #0d1f2a; border-radius: 16px; padding: 8px 16px; font-weight: 800; box-shadow: 0 4px 0 #0d1f2a; }
.game-button.danger { background: linear-gradient(180deg, #f0525f 0%, #c83a45 100%); color: #f5fcef; }

.hidden { display: none !important; }

/* ====== HUD ====== */
.hud {
  position: absolute; top: 10px; left: 10px; right: 10px;
  z-index: 4;
  display: flex; align-items: flex-start; justify-content: space-between;
  pointer-events: none; gap: 10px;
}
.hud-left, .hud-right { display: flex; gap: 8px; pointer-events: auto; }

.vital-card, .resource-card {
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, var(--dark-card) 0%, var(--dark-card-2) 100%);
  border: 2px solid; border-radius: 14px;
  padding: 5px 10px 5px 5px;
  box-shadow: 0 3px 0 rgba(0,0,0,0.5);
  min-width: 88px;
}
.vital-card img, .resource-card img { width: 30px; height: 30px; image-rendering: pixelated; flex-shrink: 0; }

.vital-info, .resource-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vital-label, .resource-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  color: #2fe0dc; text-transform: uppercase;
}
.vital-info strong, .resource-info strong {
  font-size: 13px; font-weight: 800; color: #f5fcef;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.vital-bar { height: 6px; background: #04141e; border: 1px solid #2fe0dc; border-radius: 3px; overflow: hidden; min-width: 70px; }
.vital-bar i { display: block; height: 100%; transition: width 160ms ease; }

.hp-card { border-color: #f0525f; }
.hp-card .vital-bar i { background: linear-gradient(90deg, #f0525f 0%, #ffd861 60%, #46d57a 100%); }
.shield-card { border-color: #2d8dff; }
.shield-card .vital-bar i { background: linear-gradient(90deg, #2d8dff 0%, #2fe0dc 100%); }
.resource-card:nth-child(1) { border-color: #46d57a; background: linear-gradient(180deg, rgba(70,213,122,0.25) 0%, rgba(40,150,84,0.25) 100%); }
.resource-card:nth-child(1) .resource-label { color: #b8ffd0; }
.resource-card:nth-child(2) { border-color: #2fe0dc; background: linear-gradient(180deg, rgba(47,224,220,0.25) 0%, rgba(28,138,138,0.25) 100%); }
.resource-card:nth-child(2) .resource-label { color: #b8f0f0; }

/* ====== Coach ====== */
.coach-bubble {
  position: absolute; left: 50%; bottom: 80px; transform: translateX(-50%);
  z-index: 5; display: flex; gap: 10px; align-items: center;
  background: linear-gradient(180deg, rgba(8,28,42,0.97), rgba(4,18,28,0.97));
  border: 3px solid #2fe0dc; border-radius: 18px;
  padding: 10px 14px; max-width: 480px;
  box-shadow: 0 6px 0 #0d1f2a, 0 0 0 4px rgba(47,224,220,0.25);
  color: #f5fcef;
}
.coach-avatar { width: 48px; height: 48px; border-radius: 12px; background: rgba(47,224,220,0.2); border: 2px solid #2fe0dc; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.coach-avatar img { width: 44px; height: 44px; image-rendering: pixelated; }
.coach-copy { flex: 1; min-width: 0; }
.coach-copy strong { display: block; font-size: 13px; color: #2fe0dc; margin-bottom: 2px; font-weight: 800; }
.coach-copy p { margin: 0 0 6px; font-size: 12px; line-height: 1.4; color: #f5fcef; font-weight: 600; }
.coach-actions { display: flex; gap: 5px; }
.coach-actions .game-button { padding: 5px 10px; font-size: 11px; border-radius: 10px; box-shadow: 0 2px 0 #0d1f2a; }

/* ====== Synth ====== */
.synth-overlay {
  position: absolute; inset: 28px; z-index: 5;
  background: linear-gradient(180deg, rgba(8,28,42,0.97), rgba(2,12,20,0.97));
  border: 4px solid #2fe0dc; border-radius: 20px;
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 0 0 4px rgba(47,224,220,0.2);
}
.synth-stage { flex: 1; display: grid; grid-template-columns: 180px 1fr 280px; gap: 14px; min-height: 0; }
.synth-portrait {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(47,224,220,0.16), rgba(70,213,122,0.16));
  border: 3px solid #2fe0dc; border-radius: 16px;
  padding: 12px; box-shadow: 0 4px 0 #0d1f2a;
}
.synth-portrait img { width: 120px; height: 120px; image-rendering: pixelated; }
.synth-info { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.synth-info h2 { margin: 0; color: #2fe0dc; font-size: 20px; text-shadow: 0 2px 0 #0d1f2a; font-weight: 800; }
.synth-info p { margin: 0; color: #d0e8dc; font-size: 12px; line-height: 1.5; font-weight: 600; }
.synth-anvil {
  position: relative; flex: 1; min-height: 140px;
  background: linear-gradient(180deg, rgba(20,40,52,0.6), rgba(8,20,28,0.6));
  border: 3px solid #2fe0dc; border-radius: 16px; overflow: hidden;
}
.anvil-bowl {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  width: 140px; height: 50px; background: #1a3140; border: 3px solid #0d1f2a; border-radius: 0 0 70px 70px / 0 0 50px 50px;
}
.anvil-bowl::before {
  content: ""; position: absolute; inset: 5px 8px; background: linear-gradient(180deg, #2fe0dc, #1c8a8a); border-radius: inherit;
}
.anvil-hammer {
  position: absolute; right: 14px; top: 8px; width: 40px; height: 64px;
  background: linear-gradient(180deg, #6b4a2a, #3a2a1a); border: 2px solid #0d1f2a; border-radius: 6px 6px 4px 4px;
  transform-origin: 50% 100%; transition: transform 0.18s ease;
}
.anvil-hammer::after {
  content: ""; position: absolute; top: -6px; left: 5px; right: 5px; height: 10px;
  background: #d8d2c4; border: 2px solid #0d1f2a; border-radius: 4px 4px 0 0;
}
.anvil-hammer.strike { transform: rotate(-32deg) translateX(-10px); }
.anvil-spark {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle, #fff7c2 0%, #ffd861 40%, transparent 70%);
  opacity: 0; pointer-events: none;
}
.anvil-spark.active { opacity: 1; animation: spark 0.4s ease; }
@keyframes spark { 0% { transform: translate(-50%,-50%) scale(0.4); opacity: 0; } 50% { transform: translate(-50%,-50%) scale(1.6); opacity: 1; } 100% { transform: translate(-50%,-50%) scale(2.2); opacity: 0; } }
.synth-crafting {
  font-size: 12px; color: #ffd861; padding: 5px 8px; font-weight: 700;
  background: rgba(8,20,28,0.6); border: 2px solid #2fe0dc; border-radius: 10px;
  min-height: 18px;
}
.synth-recipes {
  background: linear-gradient(180deg, rgba(8,28,42,0.6), rgba(2,12,20,0.6));
  border: 3px solid #2fe0dc; border-radius: 16px;
  padding: 10px; overflow: auto;
}
.synth-recipes h3 { margin: 0 0 8px; font-size: 13px; color: #2fe0dc; font-weight: 800; }
.synth-recipe-list { display: flex; flex-direction: column; gap: 6px; }
.synth-recipe {
  display: flex; align-items: center; gap: 6px; padding: 6px;
  background: rgba(47,224,220,0.08); border: 2px solid rgba(47,224,220,0.3); border-radius: 12px;
  cursor: pointer; color: #f5fcef;
}
.synth-recipe img { width: 28px; height: 28px; image-rendering: pixelated; flex-shrink: 0; }
.synth-recipe-text { flex: 1; font-size: 13px; line-height: 1.4; font-weight: 700; min-width: 0; color: #f5fcef; }
.synth-recipe-text strong { display: block; color: #2fe0dc; font-size: 14px; font-weight: 800; margin-bottom: 4px; }
.synth-recipe.selected { background: rgba(47,224,220,0.25); border-color: #2fe0dc; box-shadow: 0 0 0 2px #2fe0dc; }
.synth-recipe .cost { background: rgba(255,216,97,0.95); border: 2px solid #b89530; border-radius: 8px; padding: 3px 8px; font-size: 12px; color: #2a1a00; display: inline-block; margin: 2px 3px 2px 0; font-weight: 800; text-shadow: 0 1px 0 #fff5d0; }

/* ====== Story / Quiz ====== */
.story-overlay {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  z-index: 5; width: min(780px, 92%);
  background: linear-gradient(180deg, rgba(8,28,42,0.97), rgba(2,12,20,0.97));
  border: 4px solid #2fe0dc; border-radius: 20px;
  box-shadow: 0 8px 0 #0d1f2a, 0 0 0 4px rgba(70,213,122,0.2);
  overflow: hidden;
}
.story-stage { display: grid; grid-template-columns: 160px 1fr; gap: 14px; padding: 16px; align-items: center; }
.story-portrait { text-align: center; }
.story-portrait img { width: 130px; height: 130px; image-rendering: pixelated; background: rgba(47,224,220,0.12); border: 3px solid #2fe0dc; border-radius: 14px; }
.story-portrait span { display: block; margin-top: 6px; color: #2fe0dc; font-size: 12px; font-weight: 800; }
.story-text p { color: #f5fcef; font-size: 14px; line-height: 1.6; margin: 0 0 8px; font-weight: 600; }
.story-text p.story-fact { color: #ffd861; font-size: 12px; font-weight: 700; background: rgba(255,216,97,0.1); border-left: 3px solid #ffd861; padding: 6px 10px; border-radius: 8px; }
.story-text p.story-fact span { color: #f5fcef; font-weight: 600; }
.story-choices { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

.quiz-options { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.quiz-option {
  text-align: left; padding: 10px 14px; cursor: pointer;
  background: rgba(47,224,220,0.08); border: 2px solid rgba(47,224,220,0.3); border-radius: 12px;
  color: #f5fcef; font-size: 13px; font-weight: 600;
  font-family: inherit; transition: all 0.15s;
}
.quiz-option:hover { background: rgba(47,224,220,0.2); border-color: #2fe0dc; }
.quiz-option.correct { background: rgba(70,213,122,0.3); border-color: #46d57a; color: #b8ffd0; }
.quiz-option.wrong { background: rgba(240,82,95,0.3); border-color: #f0525f; color: #ffd0d4; }
.quiz-option:disabled { cursor: default; }

/* ====== Modal (all other panels) ====== */
.modal {
  position: absolute; inset: 22px; z-index: 5;
  border: 4px solid #2fe0dc; border-radius: 20px;
  background: linear-gradient(180deg, rgba(8,28,42,0.97), rgba(2,12,20,0.97));
  color: #f5fcef;
  padding: 18px 20px; overflow: auto;
  box-shadow: 0 0 0 4px rgba(47,224,220,0.2);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 2px solid rgba(47,224,220,0.4); padding-bottom: 10px; margin-bottom: 14px; }
.modal-header h2 { margin: 0; color: #2fe0dc; font-size: 24px; text-shadow: 0 2px 0 #0d1f2a, 0 0 8px rgba(47,224,220,0.5); font-weight: 800; }
.modal-header h2 + p { color: #d0e8dc; font-size: 13px; margin: 4px 0 0; font-weight: 600; }
.modal h3 { margin: 14px 0 8px; color: #ffd861; font-size: 15px; font-weight: 800; }
.modal p { color: #e8f4ec; font-size: 14px; line-height: 1.6; font-weight: 600; }
.modal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.modal-footer { margin-top: 14px; color: #ffd861; font-size: 12px; font-weight: 700; padding: 8px 12px; background: rgba(255,216,97,0.1); border-radius: 10px; }

.card {
  background: linear-gradient(180deg, rgba(245,252,239,0.97), rgba(225,247,233,0.97));
  color: #0d1f2a; border: 3px solid #0d1f2a; border-radius: 16px; padding: 12px; box-shadow: 0 4px 0 #0d1f2a;
}
.card.good { border-color: #46d57a; }
.card.locked { opacity: 0.65; }
.card-title { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; color: #0d1f2a; margin-bottom: 6px; }
.card-title img { width: 32px; height: 32px; image-rendering: pixelated; }
.card p { color: #1a3140; font-weight: 600; margin: 4px 0; }
.cost-row { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.cost { background: #cfead6; border: 1px solid #0d1f2a; border-radius: 6px; padding: 2px 6px; font-size: 11px; color: #0d1f2a; font-weight: 700; }
.card .game-button { width: 100%; margin-top: 6px; font-size: 12px; padding: 6px 10px; }

/* ====== Equip Paperdoll ====== */
.equip-layout { display: grid; grid-template-columns: 200px 1fr; gap: 16px; }
.equip-paperdoll {
  background: linear-gradient(180deg, rgba(20,40,52,0.8), rgba(8,20,28,0.8));
  border: 3px solid #2fe0dc; border-radius: 16px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.paperdoll-stack { position: relative; width: 130px; height: 170px; background: rgba(47,224,220,0.08); border: 2px solid rgba(47,224,220,0.3); border-radius: 12px; overflow: hidden; }
.paperdoll-stack img { position: absolute; image-rendering: pixelated; }
.paperdoll-stack .hero-base { left: 50%; bottom: 6px; width: 70px; height: 90px; transform: translateX(-50%); opacity: 0.95; }
.paperdoll-stack .paper-helmet { left: 50%; top: 4px; width: 36px; height: 36px; transform: translateX(-50%); opacity: 0.9; }
.paperdoll-stack .paper-armor { left: 50%; top: 42px; width: 46px; height: 46px; transform: translateX(-50%); opacity: 0.85; }
.paperdoll-stack .paper-weapon { right: 4px; bottom: 36px; width: 28px; height: 28px; opacity: 0.9; }
.paperdoll-stack .paper-boots { left: 50%; bottom: 2px; width: 40px; height: 24px; transform: translateX(-50%); opacity: 0.85; }

.equip-slot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; width: 100%; }
.equip-slot-card { background: rgba(245,252,239,0.95); border: 2px solid #0d1f2a; border-radius: 10px; padding: 4px; font-size: 10px; color: #0d1f2a; font-weight: 700; text-align: center; }
.equip-slot-card img { width: 24px; height: 24px; image-rendering: pixelated; }
.equip-slot-card strong { display: block; margin: 2px 0; color: #0d1f2a; font-size: 10px; }
.stat-panel { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.stat-panel span { background: rgba(47,224,220,0.2); border: 1px solid #2fe0dc; border-radius: 6px; padding: 2px 6px; font-size: 10px; color: #f5fcef; font-weight: 700; }
.equip-theme-block { margin-bottom: 14px; }
.equip-theme-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.equip-theme-head h3 { color: #2fe0dc; margin: 0; font-size: 15px; }
.equip-theme-head p { color: #d0e8dc; font-size: 12px; margin: 0; font-weight: 600; }
.equip-theme-head .rarity { color: #ffd861; font-size: 12px; font-weight: 700; }

.theme-picker { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.theme-option { background: rgba(245,252,239,0.92); border: 2px solid #0d1f2a; border-radius: 10px; padding: 6px 10px; display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 700; color: #0d1f2a; }
.theme-option img { width: 24px; height: 24px; image-rendering: pixelated; }
.theme-option.active { background: #2fe0dc; color: #062f2e; }

.collect-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.collect-card { display: flex; gap: 8px; padding: 8px; background: linear-gradient(180deg, rgba(245,252,239,0.97), rgba(225,247,233,0.97)); color: #0d1f2a; border: 2px solid #0d1f2a; border-radius: 12px; box-shadow: 0 3px 0 #0d1f2a; }
.collect-art img { width: 64px; height: 64px; image-rendering: pixelated; }
.collect-copy { flex: 1; font-size: 12px; font-weight: 600; }
.collect-copy .rarity { color: #2fe0dc; font-size: 11px; font-weight: 700; }
.collect-copy h3 { margin: 2px 0; color: #0d1f2a; font-size: 14px; }

.story-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 6px; max-height: 360px; overflow: auto; padding: 4px; }
.story-entry { display: flex; align-items: center; gap: 6px; background: rgba(245,252,239,0.95); border: 2px solid #0d1f2a; border-radius: 10px; padding: 6px; cursor: pointer; color: #0d1f2a; font-weight: 700; font-size: 12px; }
.story-entry:hover { background: #2fe0dc; color: #062f2e; }
.story-entry img { width: 36px; height: 36px; image-rendering: pixelated; flex-shrink: 0; }
.story-entry small { color: #1a3140; font-weight: 600; }

.mobile-pad { position: absolute; right: 12px; bottom: 12px; display: none; z-index: 4; }
.pad-grid { display: grid; grid-template-columns: 36px 36px 36px; grid-template-rows: 36px 36px 36px; gap: 4px; }
.pad-grid button:nth-child(1) { grid-column: 2; grid-row: 1; }
.pad-grid button:nth-child(2) { grid-column: 1; grid-row: 2; }
.pad-grid button:nth-child(3) { grid-column: 2; grid-row: 3; }
.pad-grid button:nth-child(4) { grid-column: 3; grid-row: 2; }
.pad-grid button, .pad-actions button { font-family: inherit; font-size: 12px; padding: 6px; background: #f5fcef; border: 2px solid #0d1f2a; border-radius: 4px; cursor: pointer; color: #0d1f2a; }
.pad-actions { display: flex; gap: 4px; margin-top: 6px; justify-content: center; }
@media (max-width: 720px) { .mobile-pad { display: block; } }

.toast {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 8; max-width: min(680px, 92%);
  background: linear-gradient(180deg, rgba(8,28,42,0.97), rgba(2,12,20,0.97));
  color: #f5fcef; border: 3px solid #2fe0dc; border-radius: 16px;
  padding: 10px 16px; font-size: 13px; font-weight: 700;
  box-shadow: 0 4px 0 #0d1f2a;
}
.toast.hidden { display: none; }

.modal-header .game-button.quiet { background: linear-gradient(180deg, #2a4a5a 0%, #1a3540 100%); color: #ffd861; border: 2px solid #0d1f2a; border-radius: 14px; padding: 6px 14px; font-size: 12px; font-weight: 800; box-shadow: 0 3px 0 #0d1f2a; }
.recycler-option { background: rgba(47,224,220,0.12) !important; }
.recycler-option:hover { background: rgba(47,224,220,0.25) !important; border-color: #2fe0dc !important; }
.recycler-empty { padding: 20px; text-align: center; color: #ffd861; font-size: 14px; background: rgba(255,216,97,0.1); border: 2px solid rgba(255,216,97,0.3); border-radius: 12px; }
/* ====== v8 Contrast & Style Fixes ====== */

/* Brighter modal text for readability */
.modal p { color: #f0f8f4; font-weight: 700; }
.modal h3 { color: #ffd861; text-shadow: 0 1px 2px rgba(0,0,0,0.6); }
.modal-header h2 { text-shadow: 0 2px 0 #0d1f2a, 0 0 12px rgba(47,224,220,0.6); }
.modal-header h2 + p { color: #c8e6d9; font-weight: 700; }
.modal-footer { color: #ffd861; font-weight: 800; text-shadow: 0 1px 1px rgba(0,0,0,0.5); }

/* Light-bg cards inside modal: force dark text */
.card p, .card strong, .card span, .card b { color: #0d1f2a !important; }
.collect-card p, .collect-card strong, .collect-card span, .collect-card b, .collect-card h3 { color: #0d1f2a !important; }
.collect-card .rarity { color: #1a8a6a !important; }
.equip-slot-card, .equip-slot-card strong, .equip-slot-card span { color: #0d1f2a !important; }
.theme-option, .theme-option span, .theme-option strong { color: #0d1f2a !important; }
.story-entry, .story-entry b, .story-entry small, .story-entry span { color: #0d1f2a !important; }

/* Story section headers in showStory */
.story-section { margin-bottom: 14px; }
.story-section h3 { font-size: 14px; font-weight: 800; padding-bottom: 4px; margin: 10px 0 6px; }

/* Story actions bar */
.story-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

/* Esc/Close button: clearly rounded game-style */
.modal-header .game-button.quiet,
.modal-header button.quiet {
  border-radius: 20px !important;
  padding: 8px 18px !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  background: linear-gradient(180deg, #3a5a6a 0%, #1a3540 100%) !important;
  color: #ffd861 !important;
  border: 2px solid #0d1f2a !important;
  box-shadow: 0 3px 0 #0d1f2a !important;
  cursor: pointer;
  transition: transform 0.08s ease;
}
.modal-header .game-button.quiet:hover,
.modal-header button.quiet:hover { transform: translateY(-1px); }
.modal-header .game-button.quiet:active,
.modal-header button.quiet:active { transform: translateY(2px); box-shadow: 0 1px 0 #0d1f2a; }

/* Make modal buttons always game-styled */
.modal button:not(.game-button):not(.story-entry):not(.quiz-option) {
  font-family: inherit;
  font-size: 13px; font-weight: 800;
  padding: 8px 16px; cursor: pointer;
  border: 2px solid #0d1f2a; border-radius: 16px;
  background: #f5fcef; color: #0d1f2a;
  box-shadow: 0 3px 0 #0d1f2a;
  transition: transform 0.08s ease;
}
.modal button:not(.game-button):not(.story-entry):not(.quiz-option):hover { transform: translateY(-1px); }
.modal button:not(.game-button):not(.story-entry):not(.quiz-option):active { transform: translateY(2px); box-shadow: 0 1px 0 #0d1f2a; }
.modal button:not(.game-button):not(.story-entry):not(.quiz-option).primary {
  background: linear-gradient(180deg, #2fe0dc 0%, #1bc1bd 100%); color: #062f2e;
}
.modal button:not(.game-button):not(.story-entry):not(.quiz-option).quiet {
  background: linear-gradient(180deg, #3a5a6a 0%, #1a3540 100%); color: #ffd861;
  border-radius: 20px;
}
.modal button:not(.game-button):not(.story-entry):not(.quiz-option):disabled {
  opacity: 0.5; cursor: default; transform: none;
}

/* Inventory cost chips in synth panel: high contrast */
.synth-recipes .cost {
  background: rgba(255,216,97,0.95) !important;
  border: 2px solid #b89530 !important;
  color: #2a1a00 !important;
  font-weight: 800 !important;
  text-shadow: 0 1px 0 #fff5d0 !important;
}

/* Synth recipe text: brighter */
.synth-recipe-text strong { color: #2fe0dc; text-shadow: 0 1px 2px rgba(0,0,0,0.6); }
.synth-recipe-text span { color: #d0e8dc; font-weight: 600; }

/* Slot pills in inventory */
.slot-pill { background: rgba(47,224,220,0.15); border: 2px solid rgba(47,224,220,0.4); border-radius: 10px; padding: 6px 12px; font-size: 12px; color: #f0f8f4; font-weight: 700; display: inline-block; margin: 3px; }

/* Monster entry in museum */
.monster-entry { display: flex; gap: 8px; padding: 8px; background: rgba(47,224,220,0.08); border: 2px solid rgba(47,224,220,0.3); border-radius: 12px; margin-bottom: 6px; }
.monster-entry img { width: 48px; height: 48px; image-rendering: pixelated; flex-shrink: 0; }
.monster-entry strong { color: #2fe0dc; font-size: 13px; }
.monster-entry p { color: #d0e8dc; font-size: 12px; margin: 2px 0 0; }

/* Dialog card (legacy) */
.dialog-card { display: flex; gap: 8px; padding: 8px; background: rgba(47,224,220,0.08); border: 2px solid rgba(47,224,220,0.3); border-radius: 12px; margin-bottom: 6px; }
.dialog-card img { width: 48px; height: 48px; image-rendering: pixelated; flex-shrink: 0; }
.dialog-card strong { color: #2fe0dc; font-size: 13px; }
.dialog-card p { color: #d0e8dc; font-size: 12px; margin: 2px 0; }

/* Equip theme block */
.equip-theme-block { background: rgba(47,224,220,0.06); border: 2px solid rgba(47,224,220,0.25); border-radius: 14px; padding: 10px; margin-bottom: 12px; }
.equip-theme-block h3 { color: #2fe0dc; margin: 0 0 6px; font-size: 15px; font-weight: 800; }

/* Card detail (collectible story view) */
.card-detail { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: start; }
.card-detail .collect-art.large img { width: 100px; height: 100px; image-rendering: pixelated; }
.card-detail .rarity { color: #ffd861; font-size: 12px; font-weight: 700; }
.card-detail p { color: #f0f8f4; font-size: 13px; line-height: 1.6; }
.card-lore-note { margin-top: 10px; padding: 8px 12px; background: rgba(255,216,97,0.1); border-left: 3px solid #ffd861; border-radius: 8px; color: #ffd861; font-size: 12px; font-weight: 600; }

/* Museum layout */
.museum-layout { display: grid; grid-template-columns: 1fr 260px; gap: 14px; }
.museum-side h3 { color: #ffd861; font-size: 14px; font-weight: 800; margin: 10px 0 6px; }
.museum-side p { color: #d0e8dc; font-size: 12px; font-weight: 600; }
@media (max-width: 800px) { .museum-layout { grid-template-columns: 1fr; } }

/* Inventory grid */
.equip-layout { display: grid; grid-template-columns: 200px 1fr; gap: 16px; }
@media (max-width: 700px) { .equip-layout { grid-template-columns: 1fr; } }

/* HUD mini (scrap chips) */
.hud-mini { display: flex; gap: 4px; align-items: center; }
.scrap-chip { display: inline-flex; align-items: center; gap: 3px; background: rgba(8,28,42,0.85); border: 2px solid rgba(47,224,220,0.4); border-radius: 8px; padding: 2px 6px; font-size: 11px; color: #f0f8f4; font-weight: 700; }
.scrap-chip img { width: 16px; height: 16px; image-rendering: pixelated; }

/* ====== v8 Paperdoll Fix ====== */
.paperdoll-stack { position: relative; width: 130px; height: 180px; background: rgba(47,224,220,0.08); border: 2px solid rgba(47,224,220,0.3); border-radius: 12px; overflow: hidden; }
.paperdoll-stack .hero-base { left: 50%; bottom: 8px; width: 64px; height: 88px; transform: translateX(-50%); opacity: 1; z-index: 1; }
.paperdoll-stack .paper-helmet { left: 50%; top: 8px; width: 28px; height: 28px; transform: translateX(-50%); opacity: 0.9; z-index: 2; }
.paperdoll-stack .paper-armor { left: 50%; top: 38px; width: 36px; height: 36px; transform: translateX(-50%); opacity: 0.85; z-index: 3; }
.paperdoll-stack .paper-weapon { right: 6px; bottom: 40px; width: 24px; height: 24px; opacity: 0.9; z-index: 2; }
.paperdoll-stack .paper-boots { left: 50%; bottom: 4px; width: 32px; height: 20px; transform: translateX(-50%); opacity: 0.8; z-index: 4; }

/* equip theme list container */
.equip-theme-list { display: flex; flex-direction: column; gap: 12px; }
.slot-row { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
