:root {
  --orange: #ff9c00;
  --peach: #ffcc99;
  --lilac: #cc99cc;
  --blue: #9999ff;
  --red: #cc4444;
  --gold: #ffaa00;
  --green: #3ddc84;
  --bg: #000000;
  --panel: #0b0c12;
  --text: #f4e9dc;
  --muted: #a49c90;
  --font: 'Antonio', 'Arial Narrow', 'Roboto Condensed', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); overflow: hidden; }
button { font-family: var(--font); cursor: pointer; }
input { font-family: var(--font); }
.hidden { display: none !important; }

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- LCARS-Bausteine ---------- */
.pill { display: inline-block; height: 18px; width: 60px; border-radius: 9px; }
.pill.grow { flex: 1; }
.orange { background: var(--orange); } .lilac { background: var(--lilac); } .blue { background: var(--blue); }
.red { background: var(--red); } .peach { background: var(--peach); } .green { background: var(--green); }

.lcars-btn {
  background: var(--peach); color: #000; border: 0; border-radius: 22px; padding: 10px 22px;
  font-size: 18px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; transition: filter .15s, transform .05s;
}
.lcars-btn:hover:not(:disabled) { filter: brightness(1.12); }
.lcars-btn:active:not(:disabled) { transform: scale(.98); }
.lcars-btn:disabled { opacity: .35; cursor: not-allowed; }
.lcars-btn.big { font-size: 22px; padding: 14px 28px; width: 100%; }
.lcars-btn.orange { background: var(--orange); }
.lcars-btn.red { background: var(--red); color: #fff; }
.lcars-btn.sel { outline: 3px solid #fff; }

.lcars-header { display: flex; align-items: center; gap: 12px; height: 44px; }
.lcars-header .cap { width: 70px; height: 44px; background: var(--orange); border-radius: 22px 0 0 22px; }
.lcars-header .cap.red { background: var(--red); }
.lcars-header .label { flex: 1; background: var(--lilac); color: #000; height: 44px; line-height: 44px; padding: 0 18px; font-size: 24px; font-weight: 700; letter-spacing: 2px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lcars-header .count { background: var(--blue); color: #000; height: 44px; line-height: 44px; padding: 0 20px; border-radius: 0 22px 22px 0; font-size: 22px; font-weight: 700; min-width: 90px; text-align: center; }

.msg { color: var(--peach); min-height: 1.2em; font-size: 17px; }

/* ---------- Bildschirme ---------- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto; }
.lcars-card { width: min(560px, 100%); background: rgba(5, 6, 12, .88); border: 2px solid #2b2d3a; border-radius: 24px; padding: 22px 28px; box-shadow: 0 0 60px rgba(153, 153, 255, .15); }
.lcars-top, .lcars-bottom { display: flex; gap: 8px; }
.lcars-card h1 { font-size: clamp(40px, 9vw, 64px); margin: 18px 0 0; letter-spacing: 3px; color: var(--orange); line-height: 1; }
.lcars-card h2 { color: var(--orange); letter-spacing: 2px; }
.lcars-card .sub { margin: 4px 0 14px; color: var(--blue); letter-spacing: 4px; font-size: 18px; }
.lcars-card .story { color: var(--text); font-size: 18px; line-height: 1.35; }
#joinForm { display: flex; flex-direction: column; gap: 10px; margin: 18px 0 8px; }
#joinForm label { color: var(--lilac); letter-spacing: 2px; font-size: 16px; }
#joinForm input, #chatInput {
  background: #000; border: 2px solid var(--blue); color: var(--text); font-size: 22px; padding: 10px 14px; border-radius: 12px; outline: none;
}
#joinForm input:focus, #chatInput:focus { border-color: var(--orange); }

/* ---------- Lobby ---------- */
.lobby { width: min(1100px, 100%); max-height: 100%; display: flex; flex-direction: column; gap: 14px; padding-right: 330px; }
.lobby-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; min-height: 0; }
.panel { background: rgba(8, 9, 16, .9); border-left: 10px solid var(--lilac); border-radius: 0 16px 16px 0; padding: 12px 16px; overflow: auto; }
.panel h3 { margin: 6px 0 10px; color: var(--orange); letter-spacing: 2px; font-size: 20px; }
#charGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.char-btn { background: #12131c; border: 2px solid #2c2f40; border-radius: 14px; padding: 4px 2px 6px; color: var(--text); display: flex; flex-direction: column; align-items: center; font-size: 15px; }
.char-btn img { width: 68px; height: 90px; image-rendering: auto; }
.char-btn small { color: var(--muted); font-size: 12px; }
.char-btn:hover:not(:disabled) { border-color: var(--blue); }
.char-btn.mine { border-color: var(--orange); background: #241a08; }
.char-btn:disabled { opacity: .3; cursor: not-allowed; }
#playerList { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }
#playerList li { display: flex; align-items: center; gap: 10px; background: #12131c; border-radius: 20px; padding: 2px 12px 2px 2px; font-size: 18px; }
#playerList img { width: 36px; height: 36px; border-radius: 50%; background: #1e2030; }
#playerList .tag { margin-left: auto; color: var(--orange); font-size: 14px; }
#settingsBox { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; margin-bottom: 12px; font-size: 17px; }
#settingsBox select { background: #000; color: var(--text); border: 2px solid var(--blue); border-radius: 8px; font-family: var(--font); font-size: 16px; padding: 3px 6px; }
#settingsBox .val { color: var(--peach); text-align: right; }
#shareBox { margin-top: 10px; font-size: 16px; color: var(--muted); line-height: 1.4; }
#shareBox b { color: var(--blue); user-select: all; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
#taskPanel { position: absolute; left: 12px; top: 12px; width: 300px; max-width: calc(100vw - 24px); background: rgba(0, 0, 0, .72); border-left: 8px solid var(--orange); border-radius: 0 14px 14px 0; padding: 8px 12px 10px; }
.tp-head { font-size: 22px; font-weight: 700; letter-spacing: 2px; }
.tp-head .crew { color: var(--blue); } .tp-head .borg { color: var(--green); } .tp-head .ghost { color: #c9c9d6; }
.tp-bar-label { font-size: 12px; letter-spacing: 1px; color: var(--muted); margin-top: 4px; }
#taskBar { height: 14px; background: #1a1c26; border-radius: 7px; overflow: hidden; margin: 3px 0 6px; }
#taskFill { height: 100%; width: 0; background: linear-gradient(90deg, var(--green), #8ff0bd); transition: width .4s; }
#taskNote { font-size: 15px; color: var(--peach); }
#taskList { list-style: none; margin: 4px 0 0; padding: 0; font-size: 16px; line-height: 1.35; }
#taskList li.done { color: var(--green); text-decoration: line-through; opacity: .75; }
#taskList li span { color: var(--muted); font-size: 13px; }

#actions { position: absolute; right: 12px; bottom: 12px; display: grid; grid-template-columns: repeat(3, 104px); gap: 8px; }
.act { height: 64px; border: 0; border-radius: 16px; color: #000; font-weight: 700; font-size: 16px; letter-spacing: .5px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; }
.act i { font-style: normal; font-size: 12px; opacity: .65; margin-top: 3px; }
.act:disabled { filter: grayscale(.8) brightness(.45); cursor: default; }
.act.green { background: var(--green); } .act.red { background: var(--red); color: #fff; } .act.orange { background: var(--orange); }
.act.blue { background: var(--blue); } .act.lilac { background: var(--lilac); }
.act .cd { font-size: 22px; }
#help { position: absolute; left: 12px; bottom: 12px; font-size: 14px; color: var(--muted); background: rgba(0, 0, 0, .55); padding: 6px 10px; border-radius: 10px; max-width: calc(100vw - 370px); }
#sabAlert { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: rgba(120, 0, 0, .85); border: 2px solid #ff5555; color: #fff; padding: 8px 18px; border-radius: 14px; font-size: 19px; text-align: center; max-width: min(640px, calc(100vw - 340px)); animation: blink 1s infinite; }
@keyframes blink { 50% { background: rgba(200, 20, 20, .9); } }
#sabMenu { position: absolute; right: 12px; bottom: 152px; display: flex; flex-direction: column; gap: 8px; background: rgba(0, 0, 0, .8); padding: 12px; border-radius: 16px; border: 2px solid var(--red); width: 328px; }
.sm-title { color: var(--red); font-size: 20px; letter-spacing: 2px; }

/* ---------- Chat ---------- */
#chat { position: fixed; right: 12px; top: 12px; bottom: 12px; width: 310px; display: flex; flex-direction: column; background: rgba(4, 5, 10, .9); border: 2px solid #2b2d3a; border-radius: 16px; overflow: hidden; z-index: 30; }
#chat.ingame { top: auto; height: 300px; bottom: 160px; }
.chat-head { background: var(--blue); color: #000; font-weight: 700; padding: 6px 14px; letter-spacing: 2px; font-size: 18px; }
#chatLog { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; font-size: 16px; }
.cmsg { display: flex; gap: 6px; align-items: flex-start; }
.cmsg img { width: 30px; height: 30px; border-radius: 50%; background: #1e2030; flex: none; }
.cmsg b { color: var(--orange); }
.cmsg div { word-break: break-word; }
.cmsg.ghost { opacity: .7; } .cmsg.ghost b { color: #c9c9d6; }
.cmsg.sys { color: var(--muted); font-style: italic; font-size: 14px; }
#chatForm { display: flex; gap: 6px; padding: 8px; border-top: 1px solid #2b2d3a; }
#chatInput { flex: 1; font-size: 17px; padding: 6px 10px; min-width: 0; }
#chatForm button { background: var(--orange); border: 0; border-radius: 10px; width: 44px; font-size: 18px; }
#chatInput:disabled { opacity: .4; }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .82); overflow: auto; }
.big-title { font-size: clamp(38px, 8vw, 84px); font-weight: 700; letter-spacing: 4px; text-align: center; line-height: 1; }
.big-title.crew { color: var(--blue); text-shadow: 0 0 30px rgba(153, 153, 255, .6); }
.big-title.borg { color: var(--green); text-shadow: 0 0 30px rgba(61, 220, 132, .6); }
.big-title.red { color: #ff5a5a; text-shadow: 0 0 30px rgba(255, 60, 60, .6); }
.center-col { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; max-width: 900px; }
.center-col p { font-size: 22px; margin: 0; }
.portrait-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.portrait-row figure { margin: 0; display: flex; flex-direction: column; align-items: center; font-size: 16px; }
.portrait-row img { width: 86px; height: 86px; border-radius: 50%; background: #1b1d2a; border: 3px solid #333; }
.portrait-row figure.borg img { border-color: var(--green); }
.portrait-row figure.crew img { border-color: var(--blue); }
.portrait-row figure.dead img { filter: grayscale(1) brightness(.6); }
.portrait-row figure small { color: var(--muted); }

#intro { background: radial-gradient(circle, rgba(10, 10, 30, .9), rgba(0, 0, 0, .97)); }

/* Besprechung */
#meeting { align-items: stretch; justify-content: flex-start; padding: 12px 336px 12px 12px; }
.mtg { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
#mtgReason { display: flex; align-items: center; gap: 14px; font-size: 20px; background: rgba(10, 10, 20, .8); border-radius: 14px; padding: 8px 14px; }
#mtgReason img { width: 56px; height: 56px; border-radius: 50%; background: #1b1d2a; }
#mtgGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; align-content: start; overflow-y: auto; }
.vote-card { display: flex; align-items: center; gap: 10px; background: #12131c; border: 3px solid #2c2f40; border-radius: 40px 14px 14px 40px; padding: 4px 10px 4px 4px; color: var(--text); font-size: 20px; text-align: left; position: relative; min-height: 70px; }
.vote-card img { width: 60px; height: 60px; border-radius: 50%; background: #1b1d2a; }
.vote-card .vn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vote-card .vs { font-size: 13px; color: var(--green); display: block; }
.vote-card.sel { border-color: var(--orange); background: #2a1c05; }
.vote-card.dead { opacity: .45; cursor: default; }
.vote-card.dead img { filter: grayscale(1); }
.vote-card.me { border-color: var(--blue); }
.vote-card.borgmate .vn { color: var(--green); }
.vote-card:disabled { cursor: default; }
.mtg-bottom { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#mtgSplash { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(60, 0, 0, .92); z-index: 40; animation: splash 2.6s forwards; pointer-events: none; }
#mtgSplash img { width: 140px; height: 140px; border-radius: 50%; background: #1b1d2a; border: 4px solid #ff5a5a; }
@keyframes splash { 0% { opacity: 0; transform: scale(1.2); } 10% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }

/* Von Bord beamen */
#eject { background: #000; flex-direction: column; gap: 24px; }
.beam-wrap { position: relative; width: 180px; height: 180px; }
.beam-wrap img { width: 180px; height: 180px; border-radius: 50%; animation: beam 4s forwards; }
.beam-wrap::after { content: ''; position: absolute; inset: -20px; border-radius: 50%; background: repeating-linear-gradient(180deg, rgba(180, 200, 255, 0) 0 6px, rgba(180, 200, 255, .55) 6px 8px); animation: shimmer 4s forwards; }
@keyframes beam { 0% { opacity: 1; filter: brightness(1); } 40% { filter: brightness(2.2); } 85% { opacity: .05; filter: brightness(3); } 100% { opacity: 0; } }
@keyframes shimmer { 0% { opacity: 0; } 25% { opacity: 1; } 80% { opacity: .8; } 100% { opacity: 0; } }
.eject-text { font-size: clamp(26px, 5vw, 44px); text-align: center; min-height: 1.3em; }
.eject-sub { font-size: 22px; color: var(--peach); text-align: center; min-height: 1.3em; }
.tally { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; font-size: 17px; color: var(--muted); max-width: 800px; }

/* Assimiliert */
#killed { background: radial-gradient(circle, rgba(0, 60, 20, .95), rgba(0, 0, 0, .98)); z-index: 45; }

/* ---------- Minispiele ---------- */
#minigame { position: fixed; inset: 0; z-index: 35; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .55); padding: 16px; }
.mg-box { width: min(520px, 100%); background: #07080d; border: 3px solid var(--orange); border-radius: 24px; overflow: hidden; }
.mg-head { display: flex; align-items: center; background: var(--orange); color: #000; padding: 6px 8px 6px 18px; font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.mg-head span { flex: 1; }
.mg-head button { background: #000; color: var(--orange); border: 0; border-radius: 50%; width: 34px; height: 34px; font-size: 18px; }
#mgBody { padding: 16px 20px 22px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.mg-hint { margin: 0; font-size: 18px; color: var(--peach); text-align: center; }
.mg-bar { width: 100%; height: 26px; background: #1a1c26; border-radius: 13px; overflow: hidden; border: 2px solid var(--blue); }
.mg-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--lilac)); }
.mg-hold { width: 100%; padding: 22px; font-size: 24px; font-weight: 700; border: 0; border-radius: 30px; background: var(--lilac); color: #000; user-select: none; touch-action: none; }
.mg-hold.on { background: var(--green); }
.mg-seq { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: 100%; }
.mg-key { padding: 14px 0; font-size: 24px; font-weight: 700; border: 0; border-radius: 14px; background: var(--blue); color: #000; }
.mg-key.ok { background: var(--green); }
.mg-key.go { background: var(--orange); }
.mg-wrong { animation: wrong .4s; }
@keyframes wrong { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.mg-sliders { width: 100%; display: flex; flex-direction: column; gap: 16px; }
.mg-slider { display: flex; align-items: center; gap: 10px; }
.mg-lbl { width: 90px; color: var(--lilac); font-size: 16px; }
.mg-track { position: relative; flex: 1; height: 34px; display: flex; align-items: center; }
.mg-mark { position: absolute; top: 0; bottom: 0; width: 18px; margin-left: -9px; background: rgba(255, 220, 60, .35); border: 2px solid #ffdc3c; border-radius: 6px; pointer-events: none; }
.mg-slider.ok .mg-mark { background: rgba(61, 220, 132, .5); border-color: var(--green); }
.mg-track input { width: 100%; accent-color: var(--orange); position: relative; }
.mg-wires { display: grid; grid-template-columns: 60px 1fr 60px; width: 100%; height: 240px; }
.mg-col { display: flex; flex-direction: column; justify-content: space-around; }
.mg-col.right { align-items: flex-end; }
.mg-svg { width: 100%; height: 100%; overflow: visible; }
.mg-node { width: 48px; height: 36px; border: 3px solid #000; border-radius: 10px; }
.mg-node.sel { outline: 4px solid #fff; }
.mg-node:disabled { opacity: .55; }
.mg-padd { background: #1b1640; border: 2px solid var(--lilac); border-radius: 12px; padding: 8px 18px; text-align: center; color: var(--lilac); font-size: 16px; letter-spacing: 2px; }
.mg-padd b { font-size: 30px; color: #fff; }
.mg-display { font-size: 34px; letter-spacing: 6px; color: var(--orange); background: #000; border: 2px solid var(--orange); border-radius: 10px; padding: 4px 18px; }
.mg-pad { display: grid; grid-template-columns: repeat(3, 80px); gap: 8px; }
.mg-switches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; width: 100%; }
.mg-switch { height: 90px; border: 3px solid #333; border-radius: 16px; background: #2a0f0f; position: relative; }
.mg-switch span { position: absolute; left: 50%; width: 34px; height: 34px; margin-left: -17px; top: 44px; border-radius: 8px; background: #ff5555; transition: top .15s; }
.mg-switch.on { background: #0e2a18; }
.mg-switch.on span { top: 8px; background: var(--green); }
.mg-done { font-size: 40px; color: var(--green); padding: 40px; }

/* ---------- Karte ---------- */
#mapOverlay { position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 10, .88); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
#mapCanvas { width: min(1300px, 100%); aspect-ratio: 26 / 17; max-height: calc(100vh - 70px); border: 3px solid var(--blue); border-radius: 18px; background: #000; }
#mapOverlay p { color: var(--muted); margin: 8px 0 0; }

#toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: rgba(0, 0, 0, .9); border: 2px solid var(--orange); color: var(--text); padding: 10px 18px; border-radius: 14px; font-size: 18px; z-index: 60; opacity: 0; transition: opacity .25s; pointer-events: none; max-width: calc(100vw - 32px); text-align: center; }
#toast.show { opacity: 1; }

/* ---------- Minikarte, Fähigkeiten, Handbuch ---------- */
#minimap { position: absolute; right: 12px; top: 12px; width: 230px; height: 150px; border: 2px solid var(--blue); border-radius: 14px; background: rgba(0, 0, 8, .8); cursor: pointer; }
.act.peach { background: var(--peach); }
#sabMenu { bottom: 232px; }
#chat.ingame { bottom: 232px; top: 176px; height: auto; }
#abilityBox { margin-top: 8px; padding-top: 6px; border-top: 1px solid #2b2d3a; font-size: 15px; color: var(--muted); }
#abilityBox b { color: var(--peach); font-size: 16px; }
#abilityBox .who { color: var(--text); }
.hb-note { margin: -4px 0 10px; color: var(--muted); font-size: 15px; }
#charGrid.handbook { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.hb-card { display: flex; gap: 8px; align-items: center; background: #12131c; border: 2px solid #2c2f40; border-radius: 14px; padding: 4px 10px 4px 4px; }
.hb-card img { width: 60px; height: 85px; flex: none; }
.hb-card b { color: var(--orange); font-size: 17px; }
.hb-card .ab { color: var(--peach); font-size: 14px; }
.hb-card .ab i { font-style: normal; color: var(--lilac); }
.hb-card p { margin: 2px 0 0; font-size: 13px; color: var(--muted); line-height: 1.25; }
.intro-me { display: flex; gap: 18px; align-items: center; background: rgba(20, 22, 34, .8); border-radius: 18px; padding: 10px 22px 10px 10px; text-align: left; }
.intro-me img { width: 120px; height: 170px; }
.intro-me b { color: var(--orange); font-size: 26px; }
.intro-me .ab { color: var(--peach); font-size: 20px; margin-top: 6px; }
.intro-me p { font-size: 18px; color: var(--muted); margin: 4px 0 0; }

/* ---------- Touch-Steuerung (iPad, Handy) ---------- */
#joystick { display: none; }
body.touch #joystick {
  display: block; position: absolute; left: 28px; bottom: 28px; width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle, rgba(153, 153, 255, .10), rgba(153, 153, 255, .25));
  border: 3px solid rgba(153, 153, 255, .55); touch-action: none;
}
#joyKnob { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 16px rgba(255, 156, 0, .5); pointer-events: none; }
body.touch #help { display: none; }
body.touch { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body.touch input { -webkit-user-select: text; user-select: text; }
#game { touch-action: none; }
button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
body.touch .act { height: 72px; font-size: 16px; }

/* ---------- Kleine Bildschirme ---------- */
@media (max-width: 900px) {
  .lobby { padding-right: 0; }
  .lobby-cols { grid-template-columns: 1fr; }
  #chat { top: auto; height: 34vh; left: 12px; right: 12px; width: auto; }
  #meeting { padding: 12px 12px 38vh; }
  #actions { grid-template-columns: repeat(3, 84px); }
  .act { height: 54px; font-size: 13px; }
  #help { display: none; }
  #sabMenu { width: auto; left: 12px; bottom: 200px; }
  #chat.ingame { bottom: 200px; top: auto; height: 24vh; }
  #minimap { width: 150px; height: 98px; }
}
@media (max-width: 900px) and (min-height: 0) {
  #lobby.screen { align-items: flex-start; padding-bottom: 38vh; }
}
