:root {
  --ink: #f4ecd8;
  --muted: #a89cb8;
  --panel: #120e1c;
  --panel2: #1c1630;
  --line: #3a2f5a;
  --accent: #d8b25a;
  --accent2: #3fd0e0;
  --hot: #ffb040;
  --font: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --fs: 12px;
  --speech-fs: 11px;
}
body.era-1986 {
  --panel: #1a0c0a;
  --panel2: #2a1410;
  --line: #5c2c20;
  --accent: #f0a030;
  --accent2: #30b8a8;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #050308; overflow: hidden; }
body { font-family: var(--font); color: var(--ink); -webkit-font-smoothing: antialiased; user-select: none; }
#app { position: fixed; inset: 0; display: grid; place-items: center; }
#stage {
  position: absolute; width: 640px; height: 440px; transform-origin: 0 0;
  background: #000; overflow: hidden; box-shadow: 0 0 0 1px #000;
}
#world { position: absolute; left: 0; top: 0; width: 640px; height: 360px; image-rendering: pixelated; image-rendering: crisp-edges; cursor: crosshair; }
#speech-layer, #labels-layer { position: absolute; left: 0; top: 0; width: 640px; height: 360px; pointer-events: none; }
.bubble {
  position: absolute; max-width: 300px; padding: 0 2px; text-align: center; font-size: var(--speech-fs); line-height: 1.25;
  font-weight: 700; letter-spacing: .01em;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, 0 2px 2px #000;
  transform: translateX(-50%);
}
.bubble .who { display: block; font-size: .8em; opacity: .75; font-weight: 600; }
.spot-label {
  position: absolute; transform: translate(-50%, -50%); font-size: 8px; font-weight: 700; padding: 1px 3px; border-radius: 2px;
  background: rgba(10, 6, 20, .78); color: var(--hot); border: 1px solid rgba(255, 176, 64, .6); white-space: nowrap;
}
.spot-label.exit { color: var(--accent2); border-color: rgba(63, 208, 224, .6); }
#notify {
  position: absolute; left: 50%; top: 8px; transform: translateX(-50%); max-width: 520px; pointer-events: none;
  display: flex; flex-direction: column; gap: 4px; align-items: center;
}
.toast {
  background: rgba(14, 10, 26, .9); border: 1px solid var(--accent2); color: var(--ink); font-size: 10px; padding: 4px 10px; border-radius: 3px;
  animation: toast-in .25s ease-out;
}
.toast.time { border-color: #c070ff; box-shadow: 0 0 8px rgba(192, 112, 255, .5); }
.toast.item { border-color: var(--accent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
#sentence {
  position: absolute; left: 0; top: 360px; width: 640px; height: 16px; background: var(--panel);
  color: var(--hot); font-size: 10px; line-height: 16px; text-align: center; font-weight: 600; border-top: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#panel { position: absolute; left: 0; top: 376px; width: 640px; height: 64px; background: var(--panel); display: flex; gap: 6px; padding: 4px 6px; }
#verbs { width: 196px; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 18px 18px 18px; gap: 2px; }
button { font-family: var(--font); cursor: pointer; }
.verb, #tools button {
  background: var(--panel2); color: var(--muted); border: 1px solid var(--line); font-size: 10px; font-weight: 600; padding: 0; border-radius: 2px;
}
.verb:hover, #tools button:hover { color: var(--ink); border-color: var(--accent); }
.verb.active { color: #1a1008; background: var(--accent); border-color: var(--accent); }
#tools { grid-column: 1 / 3; display: grid; grid-template-columns: 1fr 1fr 26px 26px; gap: 2px; }
#inv { flex: 1; display: grid; grid-template-columns: repeat(12, 1fr); grid-template-rows: 1fr 1fr; gap: 2px; }
.slot { background: var(--panel2); border: 1px solid var(--line); border-radius: 2px; display: grid; place-items: center; cursor: pointer; position: relative; }
.slot img { width: 24px; height: 24px; image-rendering: pixelated; }
.slot:hover { border-color: var(--accent); }
.slot.sel { border-color: var(--hot); box-shadow: inset 0 0 0 1px var(--hot); background: #2c2010; }
.slot.new { animation: pulse 1.2s ease-out 2; }
@keyframes pulse { 50% { box-shadow: 0 0 6px 1px var(--hot); } }
#choices {
  /* liegt im #panel (top 376) und überdeckt Statuszeile + Bedienfeld */
  position: absolute; left: 0; top: -16px; width: 640px; height: 80px; background: var(--panel); border-top: 1px solid var(--line);
  padding: 3px 10px; overflow-y: auto; z-index: 5;
}
#choices[hidden] { display: none; }
.choice { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--accent2); font-size: var(--fs); line-height: 1.3; padding: 1px 2px; }
.choice.seen { color: #7c8ca0; }
.choice:hover, .choice:focus { color: var(--hot); outline: none; }
.choice .n { opacity: .55; margin-right: 4px; font-size: .85em; }
#overlay {
  position: absolute; inset: 0; background: rgba(6, 4, 12, .9); z-index: 20; display: flex; align-items: center; justify-content: center;
}
#overlay[hidden] { display: none; }
.modal {
  width: 440px; max-height: 400px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 12px 16px;
  font-size: var(--fs); box-shadow: 0 0 24px rgba(0, 0, 0, .6);
}
.modal h2 { margin: 0 0 8px; font-size: 15px; color: var(--accent); letter-spacing: .04em; }
.modal h3 { margin: 10px 0 4px; font-size: 11px; color: var(--accent2); text-transform: uppercase; letter-spacing: .08em; }
.modal p { margin: 4px 0; line-height: 1.4; }
.modal ul { margin: 4px 0; padding-left: 16px; }
.modal li { margin: 3px 0; line-height: 1.35; }
.modal .row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.modal .muted { color: var(--muted); }
.btn {
  background: var(--panel2); color: var(--ink); border: 1px solid var(--line); padding: 4px 10px; font-size: 11px; border-radius: 3px;
}
.btn:hover, .btn:focus { border-color: var(--accent); color: var(--accent); outline: none; }
.btn.primary { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .4; cursor: default; }
.tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.tabs .btn.on { background: var(--accent); color: #140c08; border-color: var(--accent); }
.hint-box { border: 1px solid var(--line); border-radius: 3px; padding: 6px 8px; margin: 6px 0; }
.hint-box .lvl { color: var(--muted); font-size: .85em; }
.slots .save { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); padding: 4px 6px; margin: 4px 0; border-radius: 3px; gap: 6px; }
.slots .save .info { flex: 1; font-size: 10px; }
.settings label { display: flex; align-items: center; justify-content: space-between; margin: 5px 0; gap: 8px; }
.settings input[type=range] { width: 160px; }
.settings select { background: var(--panel2); color: var(--ink); border: 1px solid var(--line); font-size: 11px; }
#title-screen { position: absolute; inset: 0; background: #000; z-index: 30; }
#title-screen img { position: absolute; inset: 0; width: 640px; height: 360px; image-rendering: pixelated; }
#title-screen .menu { position: absolute; left: 0; right: 0; top: 230px; display: flex; flex-direction: column; align-items: center; gap: 5px; }
#title-screen .menu .btn { width: 180px; font-size: 12px; padding: 5px; background: rgba(18, 14, 28, .85); }
#title-screen .foot { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; font-size: 9px; color: var(--muted); }
#title-screen .msg { position: absolute; top: 200px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--hot); }
.card { text-align: center; }
.card .k { color: var(--muted); font-size: 12px; letter-spacing: .3em; text-transform: uppercase; }
.card .t { color: var(--accent); font-size: 22px; margin: 8px 0; font-weight: 700; }
.card .s { color: var(--ink); font-size: 12px; opacity: .8; }
.map-wrap { position: relative; width: 400px; height: 240px; }
.map-wrap img { width: 400px; height: 240px; image-rendering: pixelated; }
.map-wrap .dest { position: absolute; transform: translate(-50%, -50%); }
#fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .18s linear; z-index: 15; }
#fade.on { opacity: 1; }
#fade.white { background: #f4ecff; }
.credits { text-align: center; }
.credits img { image-rendering: pixelated; width: 80px; height: 152px; object-fit: none; }
.credits .who { font-size: 13px; color: var(--accent); margin-top: 4px; }
.credits .line { font-size: 11px; opacity: .85; margin: 2px 0 10px; }
#dev { position: fixed; right: 0; top: 0; width: 300px; max-height: 100vh; overflow: auto; background: rgba(0, 0, 0, .85); color: #9f9; font: 11px monospace; padding: 6px; z-index: 99; }
#dev select, #dev button, #dev textarea { font: 11px monospace; }
#dev textarea { width: 100%; height: 160px; }
body.big-text { --fs: 14px; --speech-fs: 13px; }
body.small-text { --fs: 11px; --speech-fs: 10px; }
body.reduced-motion .toast, body.reduced-motion .slot.new { animation: none; }
