/* =====================================================================
   MAISON PROFONDEUR – Brettspiel-Noblesse
   Cremefarbene Karten, kräftige Farbbänder, Gold, gut lesbare Schrift
   ===================================================================== */
:root {
  --cream: #f7f1e3;
  --cream-2: #efe6cf;
  --ink: #1b1b1b;
  --ink-2: #4a4538;
  --felt: #17543a;
  --felt-dark: #0e3a27;
  --gold: #d4a63a;
  --gold-dark: #9c7420;
  --red: #c8352b;
  --green: #1f8a4c;
  --font: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --display: "Playfair Display", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d0d0f; font-family: var(--font); color: var(--ink); }
canvas { display: block; width: 100vw; height: 100vh; }

/* ---------- Karten (Besitzurkunde) ---------- */
.card {
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 5px 5px 0 rgba(0,0,0,.45);
  overflow: hidden;
}
.card-head {
  background: var(--felt);
  color: #fff;
  text-align: center;
  padding: 8px 12px;
  border-bottom: 3px solid var(--ink);
}
.kicker { font-size: 11px; font-weight: 700; letter-spacing: .14em; opacity: .85; }
.card-title { font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: .02em; line-height: 1.15; }

/* ---------- HUD im 16-Bit-Stil (Super-Metroid-Statusleiste, nobel) ---------- */
:root {
  --px: "Silkscreen", "Courier New", monospace;      /* Beschriftungen */
  --pxn: "Chakra Petch", "Segoe UI", "Helvetica Neue", Arial, sans-serif;  /* Zahlen: klar lesbare Ziffern, technischer Look */
  --night: #120c20; --night-2: #1d1530; --night-3: #2b2145;
}
/* Pixelrahmen: Tinte – Gold – Tinte, harte Stufen statt runder Ecken */
.px-frame, .hud, #toast, #help, #hint, .gslot {
  border: none; border-radius: 0;
  box-shadow:
    0 0 0 2px #000, 0 0 0 4px var(--gold), 0 0 0 6px #000,
    6px 6px 0 4px rgba(0,0,0,.45);
}
.hud {
  position: fixed; top: 16px; width: 336px;
  background: var(--night); color: #f3ead2; image-rendering: pixelated;
  font-family: var(--px);
}
#hud1 { left: 16px; }
#hud2 { right: 16px; }
.hud-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  background: var(--pc, var(--green)); padding: 5px 10px 4px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.28), inset 0 -2px 0 rgba(0,0,0,.35);
  border-bottom: 2px solid #000;
}
.hud .card-title { font-family: var(--px); font-weight: 700; font-size: 15px; letter-spacing: .04em; text-transform: uppercase; color: #fff; text-shadow: 2px 2px 0 #000; }
.hud .kicker { font-family: var(--px); font-size: 9px; letter-spacing: .06em; color: #fff; opacity: .9; text-shadow: 1px 1px 0 #000; }
.hud-body { padding: 8px 10px 9px; }
.hud .lbl { font-family: var(--px); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: #b9a9d6; }
.hud-top { display: flex; gap: 6px; margin-bottom: 7px; }
.hud .box {
  background: var(--night-2); padding: 3px 7px 4px; display: flex; flex-direction: column;
  box-shadow: inset 2px 2px 0 #000, inset -2px -2px 0 var(--night-3);
}
.money-box { flex: 1.35; }
.depth-box { flex: 1; text-align: right; }
.hud .money { font-family: var(--pxn); font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: .02em; line-height: 1.05; color: #ffd23f; text-shadow: 2px 2px 0 #6b4a0e; white-space: nowrap; }
.hud .value { font-family: var(--pxn); font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; line-height: 1.2; color: #fff6e0; text-shadow: 2px 2px 0 #000; white-space: nowrap; }
.depth-box .value { font-size: 17px; }
.meter { display: grid; grid-template-columns: 74px 1fr; align-items: center; gap: 6px; margin: 4px 0; }
.love-lbl { color: #ff8fb8 !important; display: flex; align-items: center; gap: 3px; }
.hud img.pxi.heart { width: 14px; height: 12px; }
/* Energietanks: segmentierter Balken mit harten Pixelstufen */
.tanks {
  position: relative; overflow: hidden; height: 14px; background: #07040d;
  box-shadow: 0 0 0 2px #000, inset 0 2px 0 #241a38;
}
.tanks::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 14px, #000 14px 16px);
}
.fill { height: 100%; width: 100%; }   /* keine CSS-Transition: der Wert ändert sich jedes Bild, eine Transition würde nie fertig */
.fill.hull { background: linear-gradient(#b8f59a 0 3px, #3fbf55 3px 9px, #1d7a36 9px); }
.fill.fuel { background: linear-gradient(#fff0a0 0 3px, #f2b632 3px 9px, #a8701c 9px); }
.fill.love { background: linear-gradient(#ffc2da 0 3px, #e0508c 3px 9px, #8e2556 9px); width: 0; }
.fill.low  { background: linear-gradient(#ffb3a0 0 3px, #e8402e 3px 9px, #8a1a12 9px); animation: blink .5s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }
.hud-foot { display: flex; gap: 6px; margin-top: 7px; }
.chip {
  flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 6px;
  background: var(--night-2); padding: 3px 7px;
  box-shadow: inset 2px 2px 0 #000, inset -2px -2px 0 var(--night-3);
}
.chip .value { font-size: 15px; display: flex; align-items: center; gap: 4px; }
.chip img.pxi { width: 32px; height: 32px; margin: -8px 0; }

/* ---------- Hinweise ---------- */
#help {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  font-family: var(--px); font-size: 11px; letter-spacing: .04em; color: #f3ead2; text-transform: uppercase;
  background: var(--night); padding: 7px 14px; white-space: nowrap;
}
#help b { color: #ffd23f; font-weight: 700; }
#hint {
  position: fixed; top: 22%; left: 50%; transform: translateX(-50%);
  font-family: var(--px); font-size: 16px; font-weight: 700; color: #ffd23f; text-shadow: 2px 2px 0 #000;
  background: var(--night); padding: 10px 20px; display: none;
}

/* ---------- Ereigniskarten (Meldungen) ---------- */
#toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-12px);
  min-width: 300px; max-width: min(560px, 90vw); text-align: center;
  background: var(--night); color: #f3ead2;
  opacity: 0; transition: opacity .25s, transform .25s steps(3); pointer-events: none; overflow: hidden;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast-tag { display: block; background: var(--tc, var(--red)); color: #fff; font-family: var(--px); font-size: 10px; letter-spacing: .14em; padding: 4px 10px 3px; text-shadow: 1px 1px 0 #000; border-bottom: 2px solid #000; }
#toast-text { display: block; font-family: var(--pxn); font-size: 17px; font-weight: 500; padding: 8px 16px 9px; }

/* ---------- Panels ---------- */
#panel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(620px, 94vw); max-height: 90vh; overflow: auto;
}
#panel.hidden { display: none; }
#panel .card-head { padding: 12px 16px 14px; }
#panel .card-title { font-size: 28px; }
#panel .card-body { padding: 14px 20px 18px; }
#panel .tagline { text-align: center; font-family: var(--display); font-style: italic; font-size: 18px; color: var(--ink-2); margin-bottom: 10px; }
#panel .balance {
  display: flex; justify-content: space-between; align-items: center;
  background: #e7f0df; border: 2px dashed var(--felt); border-radius: 8px; padding: 8px 14px; margin-bottom: 12px;
  font-size: 14px; font-weight: 700; text-transform: uppercase; color: var(--ink-2);
}
#panel .balance b { font-size: 22px; color: var(--felt); text-transform: none; }
#panel table { width: 100%; border-collapse: collapse; margin: 4px 0 12px; font-size: 16px; }
#panel td { padding: 10px 4px; border-bottom: 2px solid var(--cream-2); vertical-align: middle; font-weight: 600; }
#panel td.num { text-align: right; white-space: nowrap; font-weight: 800; }
#panel .muted { color: #7a715c; font-size: 14px; font-weight: 600; }
#panel .swatch { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--ink); border-radius: 3px; vertical-align: -2px; margin-right: 6px; }
#panel .catbar { display: inline-block; width: 6px; height: 34px; border-radius: 3px; vertical-align: middle; margin-right: 10px; }
#panel .actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
#panel .keyhint { text-align: center; font-size: 13px; font-weight: 700; color: #7a715c; margin-top: 10px; }

kbd {
  display: inline-block; min-width: 22px; padding: 1px 6px; border: 2px solid currentColor; border-radius: 5px;
  font-family: var(--font); font-size: .85em; font-weight: 800; line-height: 1.3; text-align: center;
}

button {
  font-family: var(--font); font-size: 15px; font-weight: 800; letter-spacing: .02em;
  background: var(--green); color: #fff;
  border: 3px solid var(--ink); border-radius: 8px; padding: 9px 16px; cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink); transition: transform .06s, box-shadow .06s;
}
button:hover { filter: brightness(1.08); }
button:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
button.gold { background: var(--gold); color: var(--ink); }
button:disabled { background: #cfc6b0; color: #8a826d; cursor: not-allowed; box-shadow: none; filter: none; }
button.secondary { background: var(--cream); color: var(--ink); }

/* ---------- Intro ---------- */
#intro {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at center, #1f6b49 0%, var(--felt-dark) 75%);
  z-index: 10; transition: opacity .6s; padding: 16px;
}
#intro.gone { opacity: 0; pointer-events: none; }
#intro .card { width: min(560px, 94vw); text-align: center; }
#intro .card-head { background: var(--red); padding: 18px 16px; }
#intro .card-title { font-size: clamp(30px, 6vw, 46px); }
#intro .card-body { padding: 22px 26px 26px; }
#intro svg { width: 92px; height: auto; margin-bottom: 8px; }
#intro .quote { font-family: var(--display); font-style: italic; font-size: 21px; line-height: 1.4; margin: 6px 0 18px; }
#intro .rules { text-align: left; font-size: 15px; font-weight: 600; line-height: 1.6; background: var(--cream-2); border-radius: 8px; padding: 10px 16px; margin-bottom: 18px; }
#intro .press { display: inline-block; font-size: 16px; font-weight: 800; animation: pulse 1.6s ease-in-out infinite; }
#intro #cheat { display: block; margin: 14px auto 0; width: 150px; padding: 5px 10px; border: 1.5px solid var(--ink-2); border-radius: 6px; background: transparent; font: 600 13px var(--pxn, monospace); text-align: center; letter-spacing: 2px; color: var(--ink-2); opacity: .45; }
#intro #cheat:focus { opacity: 1; outline: 2px solid var(--gold, #c8962a); }
@keyframes pulse { 0%,100% { opacity: .5; } 50% { opacity: 1; } }

/* ---------- Modus-Auswahl ---------- */
#intro .modes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 520px) { #intro .modes { grid-template-columns: 1fr; } }
button.mode {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 12px 16px; text-align: center; font-weight: 600;
}
button.mode .mode-key {
  width: 34px; height: 34px; border: 3px solid currentColor; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800;
}
button.mode .mode-title { font-size: 19px; font-weight: 800; }
button.mode .mode-desc { font-size: 13px; font-weight: 600; line-height: 1.4; opacity: .9; letter-spacing: 0; }
#intro { overflow-y: auto; }
@media (max-height: 800px) { #intro svg { display: none; } #intro .quote { margin: 0 0 10px; font-size: 18px; } }

/* ---------- Atelier: Upgrade-Vorschau ---------- */
#panel.wide { width: min(900px, 96vw); }
.shop-grid { display: grid; grid-template-columns: 1fr 230px; gap: 16px; align-items: start; }
@media (max-width: 760px) { .shop-grid { grid-template-columns: 1fr; } .preview-box { order: -1; } }
.shop-table tr[data-preview] { cursor: default; transition: background .12s; }
.shop-table tr[data-preview]:hover { background: #f1e6c9; }
.preview-box {
  position: sticky; top: 0;
  border: 3px solid var(--ink); border-radius: 10px; overflow: hidden; background: var(--cream);
  box-shadow: 4px 4px 0 rgba(0,0,0,.35);
}
.preview-title { background: var(--ink); color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-align: center; padding: 5px; }
#shop-preview { display: block; width: 100%; height: 230px; }
.preview-caption { padding: 8px 10px 10px; font-size: 14px; line-height: 1.35; text-align: center; min-height: 72px; border-top: 2px solid var(--ink); }
.preview-caption .tag { display: block; width: fit-content; margin: 0 auto 4px; background: var(--green); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .12em; padding: 2px 8px; border-radius: 4px; }
.preview-caption .tag.grey { background: #7a715c; }

#intro .modes.single-only { grid-template-columns: 1fr; max-width: 320px; margin-left: auto; margin-right: auto; }

/* ---------- Musée de la Haute Couture ---------- */
.museum-offer { display: flex; align-items: center; gap: 12px; background: #fff6d8; border: 2px solid var(--gold); border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; }
.museum-offer > div { flex: 1; }
.museum-offer .big-icon { font-size: 40px; }
.museum-board { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 6px; }
.board-title { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 4px; }
.board-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.relic { border: 2px solid var(--ink); border-radius: 8px; padding: 6px 4px 7px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 76px; background: #fffaf0; }
.relic .big-icon { font-size: 28px; line-height: 1.2; }
.relic .nm { font-size: 11.5px; font-weight: 700; line-height: 1.2; }
.relic .val { font-size: 11px; font-weight: 800; color: var(--felt); }
.relic.unknown { background: #e9e0c8; color: #9a907a; border-style: dashed; }
.relic.unknown .big-icon { font-weight: 800; color: #b5aa8f; }
.relic.found { background: #f3ead2; opacity: .85; }
.relic.found .val { color: #a0703a; }
.relic.towed { background: #fff3c4; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,166,58,.35); }
.relic.done { background: #fffdf6; box-shadow: inset 0 0 0 2px var(--gold); }
@media (max-width: 640px) { .board-row { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Gadgets ---------- */
#gadgetbar {
  position: fixed; bottom: 60px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 12px; pointer-events: none;
}
.gslot {
  width: 48px; height: 58px; background: var(--night); color: #f3ead2; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.gslot .gk { position: absolute; top: 0; left: 3px; font-family: var(--pxn); font-weight: 700; font-size: 11px; color: #c9b9e6; }
.gslot .gi { line-height: 0; margin-top: 6px; }
.gslot .gn { font-family: var(--pxn); font-size: 14px; font-weight: 700; color: #ffd23f; font-variant-numeric: tabular-nums; }
.gslot.empty { opacity: .5; filter: grayscale(1); }
.gslot.active { background: #3a2c10; box-shadow: 0 0 0 2px #000, 0 0 0 4px #ffd23f, 0 0 0 6px #000, 0 0 14px 6px rgba(255,210,63,.55); }
.gadget-title { margin: 16px 0 4px; font-size: 13px; font-weight: 800; letter-spacing: .12em; border-top: 2px solid var(--ink); padding-top: 10px; }
.gadget-table td { padding: 7px 4px !important; }
.gadget-table .g-key { width: 28px; }
.gadget-table .g-icon { font-size: 24px; width: 34px; text-align: center; }
@media (max-width: 760px) { #gadgetbar { bottom: 100px; gap: 9px; } .gslot { width: 40px; height: 50px; } }

/* ---------- Pixel-Icons (aus sprites.js) ---------- */
img.pxi { image-rendering: pixelated; image-rendering: crisp-edges; width: 32px; height: 32px; vertical-align: middle; }
img.pxi.big { width: 64px; height: 64px; }
.relic img.pxi.big { width: 32px; height: 32px; }
.gslot img.pxi { width: 32px; height: 32px; }
.gadget-table .g-icon img.pxi { width: 32px; height: 32px; }
.rules img.pxi { width: 32px; height: 32px; margin: -6px 2px -6px -4px; }
.hud img.pxi.heart { width: 14px; height: 12px; }

/* ---------- Neue Entdeckung (Erz) ---------- */
#toast .disc { display: flex; align-items: center; gap: 12px; text-align: left; }
#toast .disc img.pxi.big { width: 64px; height: 64px; flex: none; }
#toast .disc i { font-family: var(--display); font-size: 15px; color: #e8dcc0; }
#toast .disc small { font-family: var(--px); font-size: 10px; color: #ffd23f; letter-spacing: .04em; }

/* ---------- Cabinet d'Histoire Naturelle ---------- */
.cabinet { margin-top: 16px; border-top: 2px solid var(--ink); padding-top: 10px; }
.cabinet-head { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--display); font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.cabinet-head span:last-child { font-family: var(--font); font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.ore-detail { display: flex; gap: 14px; align-items: center; background: #1d1530; color: #f3ead2; border: 3px solid var(--gold); border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; }
.ore-detail img.pxi.big { width: 96px; height: 96px; flex: none; background: radial-gradient(circle, #3a2c50 0%, #1d1530 70%); border-radius: 8px; }
.ore-name { font-family: var(--display); font-size: 22px; font-weight: 800; color: #ffd23f; }
.ore-facts { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.ore-facts span { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; background: #2b2145; border: 1px solid #5a4a7a; border-radius: 4px; padding: 2px 7px; }
.ore-desc { font-family: var(--display); font-style: italic; font-size: 16px; line-height: 1.35; }
.ore-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 8px; }
.ore-card { border: 2px solid var(--ink); border-radius: 8px; padding: 5px 4px 6px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1px; background: #1d1530; color: #f3ead2; cursor: pointer; min-height: 70px; }
.ore-card:hover { border-color: var(--gold); }
.ore-card.sel { box-shadow: 0 0 0 3px var(--gold); }
.ore-card .nm { font-size: 11.5px; font-weight: 700; line-height: 1.2; }
.ore-card .val { font-size: 11px; font-weight: 800; color: #ffd23f; }
.ore-card.unknown { background: #e9e0c8; color: #9a907a; border-style: dashed; cursor: default; }
.ore-card.unknown .q { font-size: 26px; font-weight: 800; color: #b5aa8f; line-height: 1.2; }
@media (max-width: 640px) { .ore-row { grid-template-columns: repeat(3, 1fr); } }

/* Slot 0: erbeutete Bomben */
.gslot.capt { box-shadow: 0 0 0 2px #000, 0 0 0 4px #c8352b, 0 0 0 6px #000, 6px 6px 0 4px rgba(0,0,0,.45); margin-left: 8px; }
.gslot .gtab { position: absolute; top: 1px; right: 3px; font-family: var(--px); font-size: 7px; color: #ff9a3a; }

/* Zahlen in Beschriftungen (z. B. Liter neben dem Brennstoff) */
.hud .lbl .num { font-family: var(--pxn); font-weight: 700; font-size: 13px; letter-spacing: 0; color: #fff0b0; text-transform: none; margin-left: 4px; font-variant-numeric: tabular-nums; }
#help b, #toast-tag { font-variant-numeric: tabular-nums; }
.meter { grid-template-columns: 92px 1fr !important; }

/* ---------- Startseite (schlank) ---------- */
#intro .goal { font-size: 16px; font-weight: 700; margin: -6px 0 18px; color: var(--ink-2); }

/* ---------- Dialoge (Storyline) ---------- */
#dialog {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 20;
  width: min(760px, 94vw); display: flex; gap: 16px; align-items: flex-start;
  background: var(--night); color: #f3ead2; padding: 14px 18px 12px;
  box-shadow: 0 0 0 2px #000, 0 0 0 4px var(--gold), 0 0 0 6px #000, 8px 8px 0 4px rgba(0,0,0,.5);
}
#dialog.hidden { display: none; }
#dlg-portrait { width: 96px; height: 96px; flex: none; image-rendering: pixelated; background: #1d1530; box-shadow: inset 0 0 0 2px #000, 0 0 0 2px #5a4a7a; }
.dlg-body { flex: 1; min-height: 96px; display: flex; flex-direction: column; }
#dlg-name { font-family: var(--px); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--dc, #ffd23f); text-shadow: 1px 1px 0 #000; margin-bottom: 6px; }
#dlg-text { font-family: var(--display); font-size: 19px; line-height: 1.4; flex: 1; min-height: 54px; }
#dlg-text.narr { font-style: italic; color: #e0d6f0; }
#dlg-hint { font-family: var(--px); font-size: 9px; color: #9a8ab8; text-align: right; margin-top: 6px; animation: pulse 1.6s ease-in-out infinite; }
