:root {
  --bg: #0b0f17; --panel: #131a26; --panel2: #1a2333; --line: #263248; --text: #d9e2f1; --muted: #7d8aa3;
  --accent: #4fd1c5; --accent2: #f6ad55; --bad: #fc8181; --good: #68d391; --warn: #f6e05e;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
.hidden { display: none !important; }
button { background: var(--accent); color: #062421; border: 0; border-radius: 6px; padding: 6px 10px; font-weight: 600; cursor: pointer; }
button:hover { filter: brightness(1.1); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.small { padding: 2px 8px; font-size: 12px; }
button.danger { background: var(--bad); color: #2a0b0b; }
input, select { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; font: inherit; }
input[type=number] { width: 80px; }
h1 { font-size: 40px; margin: 0 0 24px; letter-spacing: 1px; }
h1 span, .brand span { color: var(--accent); }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 12px 0 8px; }
h2:first-child { margin-top: 0; }
h3 { font-size: 13px; margin: 14px 0 6px; color: var(--accent2); }
.muted { color: var(--muted); font-size: 12px; }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }

/* logowanie */
#login { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px;
  background: radial-gradient(circle at 70% 30%, #1d3b4a 0, transparent 45%), var(--bg); }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 32px; width: 100%; max-width: 380px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; margin: 0; }
.error { color: var(--bad); min-height: 1em; margin: 0; }
.lang { display: flex; gap: 4px; margin-top: 12px; }
.lang button { background: var(--panel2); color: var(--muted); padding: 3px 8px; }
.lang button.active { background: var(--accent); color: #062421; }

/* gra */
.topbar { display: flex; align-items: center; gap: 16px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.topbar .lang { margin: 0; }
.brand { font-weight: 800; font-size: 18px; }
.spacer { flex: 1; }
#turn-info b { color: var(--accent2); font-variant-numeric: tabular-nums; }
.banner { padding: 8px 16px; background: var(--accent2); color: #2b1a05; font-weight: 700; text-align: center; }
.resbar { display: flex; gap: 8px; padding: 8px 16px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.res { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; min-width: 110px; }
.res .name { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.res .val { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.res .delta { font-size: 11px; margin-left: 4px; }
.res .cap { color: var(--muted); font-size: 11px; }
.layout { display: grid; grid-template-columns: minmax(300px, 1.1fr) minmax(280px, 1fr) minmax(320px, 1.1fr); gap: 12px; padding: 12px 16px; }
@media (max-width: 1100px) { .layout { grid-template-columns: 1fr; } }
.col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
table { width: 100%; border-collapse: collapse; }
td, th { padding: 4px 4px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cost { font-size: 11px; color: var(--muted); }
.cost .lack { color: var(--bad); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 13px; margin-bottom: 8px; }
.kv span:nth-child(odd) { color: var(--muted); }
.planet-panel { padding: 0; overflow: hidden; position: relative; }
#planet { height: 440px; position: relative; background: #02040a; cursor: grab; }
#planet canvas { display: block; width: 100%; height: 100%; }
.planet-fallback { display: flex; height: 100%; align-items: center; justify-content: center; color: var(--muted); }
.planet-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.planet-label { position: absolute; left: 0; top: 0; font-size: 11px; padding: 2px 6px; border-radius: 4px; background: rgba(11, 15, 23, .7);
  color: var(--text); white-space: nowrap; border: 1px solid rgba(255, 255, 255, .1); }
.planet-label.me { font-weight: 700; border-color: var(--accent); }
.planet-label .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.planet-tools { position: absolute; right: 8px; top: 8px; display: flex; gap: 4px; }
.planet-tools button { background: rgba(11, 15, 23, .7); }
.planet-panel.fullscreen { position: fixed; inset: 0; z-index: 15; border-radius: 0; }
.planet-panel.fullscreen #planet { height: 100vh; }
.tabs { display: flex; gap: 4px; }
.tabs button { background: var(--panel); color: var(--muted); border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; }
.tabs button.active { background: var(--panel2); color: var(--text); }
.row-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
#deal-form label, #raid-form label { display: block; margin: 6px 0; }
.feed { max-height: 220px; overflow-y: auto; font-size: 12px; }
.feed div { padding: 3px 0; border-bottom: 1px solid var(--line); }
.feed .turn { color: var(--muted); margin-right: 6px; }
.tag { font-size: 10px; padding: 1px 5px; border-radius: 4px; background: var(--panel2); color: var(--muted); margin-left: 4px; }
.tag.on { color: var(--good); } .tag.me { background: var(--accent); color: #062421; } .tag.shield { color: var(--warn); }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 6px; z-index: 10; }
.toast { background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 8px 12px; border-radius: 6px; max-width: 340px; }
.toast.err { border-left-color: var(--bad); }

.progress { height: 4px; background: var(--panel2); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.progress div { height: 100%; background: var(--accent2); }
.info { color: var(--muted); cursor: help; font-size: 12px; }
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 16px; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px 24px; max-width: 720px; max-height: 85vh; overflow-y: auto; position: relative; line-height: 1.5; }
.modal-card .close { position: absolute; right: 12px; top: 12px; }
.modal-card h3 { margin-top: 16px; }
.modal-card ul { padding-left: 20px; margin: 4px 0; }
#queue { margin-bottom: 10px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.tooltip { position: fixed; z-index: 30; max-width: 320px; background: #1c2638; border: 1px solid #35435e; border-radius: 8px;
  padding: 10px 12px; font-size: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .45); pointer-events: none; }
.tooltip.hidden { display: none; }
.tip-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; color: var(--text); }
.tip-desc { color: var(--muted); margin-bottom: 8px; line-height: 1.4; }
.tip-row { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; border-top: 1px solid rgba(255, 255, 255, .05); }
.tip-row span { color: var(--muted); }
.tip-row b { text-align: right; font-weight: 600; }
.tip-row .lack { color: var(--bad); }
.info { cursor: pointer; color: var(--accent); font-size: 13px; padding: 0 2px; }
.info:hover, .info:focus { color: var(--text); outline: none; }
.tipped { cursor: help; text-decoration: underline dotted rgba(255, 255, 255, .25); text-underline-offset: 3px; }

/* tryb widza (demo) */
.spectator .col-left, .spectator .col-right, .spectator .resbar, .spectator #ready-btn, .spectator .player-only { display: none !important; }
.spectator .layout { grid-template-columns: 1fr; }
.spectator .col-mid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr); grid-template-rows: auto 1fr; gap: 12px; align-items: start; }
.spectator .planet-panel { grid-row: span 2; }
.spectator #planet { height: calc(100vh - 140px); min-height: 420px; }
.spectator .feed { max-height: 40vh; }
.spec-table td { vertical-align: top; font-size: 12px; }
.spec-table .progress { width: 120px; }
@media (max-width: 1100px) { .spectator .col-mid { grid-template-columns: 1fr; } .spectator #planet { height: 60vh; } }

/* konta i ranking */
.auth-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.auth-tabs button { flex: 1; background: var(--panel2); color: var(--muted); }
.auth-tabs button.active { background: var(--accent); color: #062421; }
#auth-form, #login-form { display: flex; flex-direction: column; gap: 12px; }
#auth-form label, #login-form label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.account-box { background: var(--panel2); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.account-box button { margin-left: auto; }
.ranking-open { margin-top: 12px; width: 100%; }
.topbar .ranking-open { margin: 0; width: auto; }
.modal-card.wide { max-width: 900px; width: 100%; }
#ranking-body table td, #ranking-body table th { font-size: 13px; }
#ranking-body .match { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
#ranking-body .match .players { color: var(--muted); font-size: 12px; margin-top: 4px; }
#ranking-body .pts { color: var(--accent2); font-weight: 700; }
.medal { font-size: 15px; }
.home-link { color: inherit; text-decoration: none; }
.manual-link { display: block; text-align: center; margin-top: 8px; color: var(--muted); font-size: 13px; text-decoration: none; }
.manual-link:hover { color: var(--accent); }

/* zagrożenia */
.threats { display: flex; flex-direction: column; gap: 4px; padding: 0 16px; }
.threats:empty { display: none; }
.threat { margin-top: 6px; padding: 7px 12px; border-radius: 8px; background: #2a2414; border: 1px solid #6b5520; color: #f6e2a8; font-size: 13px; }
.threat.danger { background: #3a1616; border-color: #8a2b2b; color: #ffd0d0; }
.threat button { margin-left: 8px; }
#alien-defense { border: 1px solid #8a2b2b; border-radius: 8px; padding: 8px 10px; margin: 10px 0; background: #1f1214; }

.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand img { width: 30px; height: 30px; }
.emblem { display: block; width: 104px; height: 104px; margin: -8px auto 4px; filter: drop-shadow(0 6px 22px rgba(229, 138, 76, .35)); }
.login-card h1 { text-align: center; }
.emblem-link { display: block; }
.brand .wm { color: var(--text); }
.brand .wm span { color: var(--accent); }

.brand img { width: auto; height: 36px; }
.lockup { display: block; width: 100%; max-width: 320px; height: auto; margin: -6px auto 14px; filter: drop-shadow(0 6px 20px rgba(0, 0, 0, .5)); }
.lockup-link { display: block; }

/* dźwięk */
.audio-wrap { position: relative; }
.audio-panel { position: absolute; right: 0; top: 40px; z-index: 40; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
  display: flex; flex-direction: column; gap: 8px; min-width: 230px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); font-size: 13px; }
.audio-panel label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.audio-panel .vol { justify-content: space-between; }
.audio-panel hr { border: 0; border-top: 1px solid var(--line); width: 100%; margin: 2px 0; }
/* animacja nowej tury */
.turnfx { position: fixed; inset: 0; z-index: 50; background: rgba(3, 5, 10, .72); display: flex; align-items: center; justify-content: center; cursor: pointer;
  animation: fxIn .25s ease-out; }
.turnfx.hidden { display: none; }
@keyframes fxIn { from { opacity: 0; } to { opacity: 1; } }
.turnfx-card { position: relative; width: min(640px, 94vw); border-radius: 14px; overflow: hidden; border: 1px solid #2c3a55; box-shadow: 0 20px 60px rgba(0, 0, 0, .7); animation: cardIn .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes cardIn { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
.turnfx-card canvas { width: 100%; display: block; }
.turnfx-title { position: absolute; left: 20px; top: 14px; font-size: 30px; font-weight: 800; letter-spacing: 1px; text-shadow: 0 2px 10px #000; }
.turnfx-sub { position: absolute; left: 20px; bottom: 16px; right: 20px; font-size: 17px; text-shadow: 0 2px 8px #000; }
.turnfx-skip { position: absolute; right: 14px; top: 18px; font-size: 11px; color: rgba(255, 255, 255, .55); }
/* podsumowanie tury */
.turn-summary { position: fixed; right: 16px; bottom: 16px; z-index: 30; width: min(360px, 92vw); background: var(--panel2); border: 1px solid #2c3a55;
  border-radius: 12px; padding: 12px 14px; box-shadow: 0 14px 40px rgba(0, 0, 0, .6); font-size: 13px; animation: cardIn .3s ease-out; max-height: 70vh; overflow-y: auto; }
.turn-summary.hidden { display: none; }
.sum-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 15px; }
.sum-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 16px; margin-bottom: 8px; }
.sum-grid div { display: flex; justify-content: space-between; }
.sum-grid span { color: var(--muted); }
.sum-events { margin: 6px 0 10px; padding-left: 18px; }
.sum-events li { margin: 2px 0; }
.turn-summary .tips { margin: 8px 0 0; padding-left: 18px; color: #f6e2a8; }
.turn-summary .tips li { margin: 4px 0; }

/* podgląd graczy (tylko do odczytu) */
.follow-bar { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 45; background: rgba(23, 30, 44, .95); border: 1px solid var(--accent);
  border-radius: 12px; padding: 8px 14px; display: flex; gap: 8px; align-items: center; box-shadow: 0 10px 30px rgba(0, 0, 0, .6); font-size: 13px; white-space: nowrap; }
body.readonly .col-left button, body.readonly .col-right button, body.readonly .col-right input, body.readonly .col-right select,
body.readonly #ready-btn, body.readonly .threat button { pointer-events: none; opacity: .45; }
body.readonly .tabs button { pointer-events: auto; opacity: 1; }
.track-row { display: flex; align-items: center; gap: 6px; }
.track-name { flex: 1; text-align: center; font-size: 12px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* widzowie: statystyki */
.spark { width: 80px; height: 24px; display: block; }
.compare { display: flex; flex-direction: column; gap: 6px; }
.cmp-row { display: grid; grid-template-columns: 110px 1fr; gap: 8px; align-items: center; font-size: 12px; }
.cmp-bars { display: flex; flex-direction: column; gap: 2px; }
.cmp-bar { height: 6px; border-radius: 3px; min-width: 2px; }
.hl { padding-left: 18px; margin: 4px 0; font-size: 12px; }
.hl li { margin: 3px 0; }
#director-btn.on { color: var(--accent); border-color: var(--accent); }

/* powtórki */
.replay-bar input[type=range] { width: min(320px, 40vw); }
.replay-bar select { padding: 2px 4px; }
.replay-link { color: inherit; font-weight: 800; }

/* samouczek */
.tut { position: fixed; z-index: 60; width: min(340px, 90vw); background: #12324a; border: 1px solid var(--accent); border-radius: 12px; padding: 12px 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .6); font-size: 13px; line-height: 1.45; transition: top .25s, left .25s; }
.tut.hidden { display: none; }
.tut-step { float: right; color: var(--muted); font-size: 11px; }
.tut-title { font-weight: 800; font-size: 15px; margin-bottom: 4px; color: var(--accent); }
.tut-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 8px; }
.tut-focus { outline: 2px solid var(--accent) !important; outline-offset: 3px; border-radius: 8px; box-shadow: 0 0 0 6px rgba(79, 209, 197, .18) !important; animation: tutPulse 1.6s ease-in-out infinite; }
@keyframes tutPulse { 50% { box-shadow: 0 0 0 10px rgba(79, 209, 197, .05) !important; } }

/* pakty */
.pact { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; margin: 4px 0; font-size: 12px; }
.pact.in { border-color: var(--accent2); }
.pact.on { border-color: var(--good); }
/* czat */
.chat { position: fixed; left: 16px; bottom: 16px; z-index: 35; width: min(320px, 90vw); background: var(--panel2); border: 1px solid #2c3a55; border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5); font-size: 13px; }
.chat-head { display: flex; justify-content: space-between; padding: 8px 12px; cursor: pointer; font-weight: 700; }
.chat-unread:not(:empty) { background: var(--bad); color: #2a0b0b; border-radius: 10px; padding: 0 7px; font-size: 11px; }
.chat.collapsed .chat-body { display: none; }
.chat-list { height: 220px; overflow-y: auto; padding: 0 12px; }
.chat-msg { padding: 3px 0; border-bottom: 1px solid rgba(255, 255, 255, .04); word-wrap: break-word; }
.chat-msg.mine { opacity: .85; }
.chat-emotes { display: flex; gap: 2px; padding: 4px 8px; flex-wrap: wrap; }
.chat-emotes button { background: transparent; padding: 2px 4px; font-size: 16px; }
.chat-form { display: flex; gap: 4px; padding: 6px 8px 8px; }
.chat-form input { flex: 1; }
body.spectator .chat, body.readonly .chat { display: none; }

/* badania */
.tech { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 6px 0; }
.tech.done { border-color: rgba(104, 211, 145, .45); opacity: .85; }
.tech-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 2px; }
.rs-current { padding: 8px 10px; border-radius: 8px; background: rgba(246, 173, 85, .12); color: var(--accent2); margin-bottom: 6px; }

/* profil i sezony */
.season-pick { margin-bottom: 10px; color: var(--muted); }
.profile-link { color: var(--text); text-decoration: none; }
.profile-link:hover { color: var(--accent); }
.profile-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.profile-head h3 { margin: 0; font-size: 22px; color: var(--text); }
.avatar { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; font-weight: 800; color: #052320;
  background: linear-gradient(135deg, var(--accent), #e58a4c); }
.prof-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 8px; }
.prof-stats div { background: var(--panel2); border-radius: 8px; padding: 8px; text-align: center; }
.prof-stats b { display: block; font-size: 18px; }
.prof-stats span { color: var(--muted); font-size: 11px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.badge-card { border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; opacity: .55; filter: grayscale(.8); }
.badge-card.got { opacity: 1; filter: none; border-color: var(--accent2); background: rgba(246, 173, 85, .08); }
.b-ico { font-size: 28px; }
.b-name { font-size: 12px; font-weight: 700; margin: 2px 0; }
.b-ok { color: var(--good); font-weight: 800; }
.b-prog { height: 4px; background: var(--panel2); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.b-prog div { height: 100%; background: var(--accent2); }
.b-num { font-size: 10px; }
@media (max-width: 600px) { .prof-stats { grid-template-columns: repeat(2, 1fr); } }
.modal-card a { color: var(--accent); }

/* telefon */
.mobile-nav { display: none; }
@media (max-width: 760px) {
  .topbar { gap: 6px; padding: 6px 10px; }
  .topbar .brand img { height: 28px; }
  #room-info { font-size: 12px; }
  #turn-info { width: 100%; order: 10; font-size: 12px; }
  #ready-btn { padding: 6px 8px; font-size: 12px; }
  #leave-btn, #help-btn { padding: 4px 8px; }
  .resbar { flex-wrap: nowrap; overflow-x: auto; padding: 6px 10px; -webkit-overflow-scrolling: touch; }
  .res { min-width: 92px; padding: 4px 8px; }
  .res .val { font-size: 15px; }
  .layout { padding: 8px 10px 76px; }
  body:not(.spectator) .layout > .col { display: none; }
  body[data-mtab=left]:not(.spectator) .col-left, body[data-mtab=mid]:not(.spectator) .col-mid, body[data-mtab=right]:not(.spectator) .col-right { display: flex; }
  #planet { height: 52vh; }
  .mobile-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(16, 21, 31, .97); border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); gap: 6px; }
  .mobile-nav button { flex: 1; background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 8px 4px; font-size: 13px; }
  .mobile-nav button.active { background: var(--accent); color: #062421; border-color: var(--accent); }
  body.spectator .mobile-nav { display: none; }
  .chat { left: 8px; bottom: 70px; width: calc(100vw - 16px); }
  .chat.collapsed { width: auto; }
  .turn-summary { right: 8px; left: 8px; width: auto; bottom: 70px; }
  .follow-bar { bottom: 70px; max-width: calc(100vw - 16px); flex-wrap: wrap; white-space: normal; justify-content: center; }
  .audio-panel { right: -60px; }
  .tut { width: calc(100vw - 24px); }
  .spectator .col-mid { grid-template-columns: 1fr; }
}

/* wybór pokoju na ekranie wejścia */
.room-list-head { display: flex; justify-content: space-between; align-items: center; }
#room-select { width: 100%; }
#room-details { min-height: 1em; line-height: 1.5; }
.new-room-opts { display: flex; flex-direction: column; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
/* budynek, na który nie stać – przycisk przygaszony, klik mówi, czego brakuje */
button.cant { opacity: 0.5; }
/* napis nad lecącą flotą: skąd → dokąd */
.flight-label { position: absolute; left: 0; top: 0; font-size: 11px; padding: 2px 7px; border-radius: 10px; white-space: nowrap;
  background: rgba(11, 15, 23, .82); color: var(--text); border: 1px solid var(--line); box-shadow: 0 0 8px rgba(0, 0, 0, .5); }
.flight-label b { font-weight: 600; margin-right: 3px; }
/* rynek: wyraźne przyciski kupna i sprzedaży */
button.trade-buy { background: var(--good); color: #0b2a12; }
button.trade-sell { background: var(--accent2); color: #2e1a02; }
button.trade-buy:active, button.trade-sell:active { transform: scale(0.94); }
/* pulsowanie zasobu, który właśnie się zmienił (2 s) */
@keyframes pulse-up { 0%, 50%, 100% { box-shadow: 0 0 0 0 rgba(104, 211, 145, 0); } 25%, 75% { box-shadow: 0 0 0 3px rgba(104, 211, 145, .9); background-color: rgba(104, 211, 145, .18); } }
@keyframes pulse-down { 0%, 50%, 100% { box-shadow: 0 0 0 0 rgba(246, 173, 85, 0); } 25%, 75% { box-shadow: 0 0 0 3px rgba(246, 173, 85, .9); background-color: rgba(246, 173, 85, .18); } }
.pulse-up { animation: pulse-up 2s ease-in-out both; }
.pulse-down { animation: pulse-down 2s ease-in-out both; }
.pulse-up .val { color: var(--good); } .pulse-down .val { color: var(--accent2); }
/* straty po turze (napad, piraci, meteoryty, głód): miganie czerwono-pomarańczowe przez 6 s */
@keyframes pulse-loss {
  0%, 20%, 40%, 60%, 80% { box-shadow: 0 0 0 3px rgba(252, 129, 129, .95); background-color: rgba(252, 129, 129, .22); }
  10%, 30%, 50%, 70% { box-shadow: 0 0 0 3px rgba(246, 173, 85, .95); background-color: rgba(246, 173, 85, .2); }
  100% { box-shadow: 0 0 0 0 rgba(252, 129, 129, 0); }
}
.pulse-loss { animation: pulse-loss 6s linear both; position: relative; }
.pulse-loss .val { color: var(--bad); }
.loss-badge { position: absolute; right: -6px; top: -9px; z-index: 2; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); font-size: 12px; font-weight: 800; color: #fff; background: var(--bad);
  border-radius: 8px; padding: 0 6px; }
.res { position: relative; }
.loss-tile { max-width: 280px; border-color: var(--bad); }
.loss-tile .name { color: var(--bad); font-weight: 700; }
.loss-items { font-size: 12px; color: var(--text); }

/* ekran końca meczu */
.endgame { position: fixed; inset: 0; z-index: 60; background: rgba(3, 5, 10, .8); display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 24px 12px; }
.endgame.hidden { display: none; }
.eg-card { width: min(760px, 100%); background: var(--panel); border: 1px solid #2c3a55; border-radius: 14px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .7); animation: cardIn .45s cubic-bezier(.2, .8, .2, 1); }
.eg-hero { position: relative; }
.eg-hero canvas { width: 100%; display: block; }
.eg-title { position: absolute; left: 0; right: 0; top: 16px; text-align: center; font-size: 34px; font-weight: 800; letter-spacing: 1px; text-shadow: 0 2px 12px #000; }
.eg-sub { position: absolute; left: 0; right: 0; top: 60px; text-align: center; font-size: 16px; color: #e8eefc; text-shadow: 0 2px 8px #000; }
.eg-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.eg-reason { margin: 0; padding: 10px 12px; background: var(--panel2); border-left: 4px solid var(--accent2); border-radius: 6px; }
.eg-mine { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; gap: 3px; }
.eg-mine .big { font-size: 20px; font-weight: 800; color: var(--accent); }
.eg-table { width: 100%; border-collapse: collapse; }
.eg-table td { padding: 6px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.eg-table tr.me td { background: rgba(79, 209, 197, .08); }
.eg-table tr.win td { font-weight: 700; }
.eg-table .place { width: 36px; font-size: 18px; text-align: center; }
.eg-table .sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.eg-table .barcell { width: 38%; }
.eg-bar { position: relative; height: 8px; background: var(--panel2); border-radius: 4px; }
.eg-bar div { height: 100%; border-radius: 4px; }
.eg-bar i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--accent2); }
.eg-body h4 { margin: 4px 0 0; color: var(--accent2); font-size: 13px; }
.eg-chart { width: 100%; height: auto; display: block; }
.eg-chart .axis { stroke: var(--line); }
.eg-chart .threshold { stroke: var(--accent2); stroke-dasharray: 6 5; }
.eg-chart text { fill: var(--muted); font-size: 11px; }
.eg-chart .thlabel { fill: var(--accent2); }
.eg-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.eg-actions .btn { background: var(--accent2); color: #2e1a02; border-radius: 6px; padding: 6px 10px; font-weight: 600; text-decoration: none; }
@media (max-width: 600px) { .eg-hero canvas { height: 170px; object-fit: cover; } .eg-title { font-size: 24px; top: 10px; } .eg-sub { top: 42px; } .eg-table .barcell { display: none; } .eg-body { padding: 12px; } }
.tag .stars { color: var(--accent2); letter-spacing: -1px; }
/* zaproszenie znajomego */
.invite-card { max-width: 460px; width: 100%; display: flex; flex-direction: column; gap: 10px; }
.invite-card label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.invite-card h3 { margin: 0 24px 0 0; }
.invite-note { margin: 0 0 12px; padding: 8px 10px; border: 1px solid var(--accent); border-radius: 8px; background: rgba(79, 209, 197, .08); }
#pause-btn:not(.ghost) { background: var(--accent2); color: #2e1a02; }
.invite-modal { z-index: 70; }
/* brak zasobów na akcję: krótkie czerwono-pomarańczowe miganie licznika */
.pulse-lack { animation: pulse-loss 2.6s linear both; position: relative; }
.pulse-lack .val { color: var(--bad); }
/* decyzja (dylemat) */
.dilemma { border-color: var(--accent2); box-shadow: 0 0 0 1px rgba(246, 173, 85, .35), 0 0 18px rgba(246, 173, 85, .15); }
.dilemma h2 { color: var(--accent2); }
.dilemma p { margin: 4px 0 10px; }
.dl-opts { display: flex; flex-direction: column; gap: 6px; }
.dl-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
.dl-opt:hover:not(.cant) { border-color: var(--accent2); }
.dl-opt span { font-weight: 400; font-size: 12px; }
.anomaly-row { justify-content: space-between; }
.anomaly-label { border-color: #b070ff; color: #e2ccff; }
.eg-goal { font-size: 11px; margin-top: 2px; }

/* nastroje i konwoje */
.tax-btns { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.convoy { margin: 6px 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.convoy.mine { border-color: var(--accent2); }
.convoy .cost { margin: 2px 0 4px; }
#escort-form input { margin: 0 4px; }
.tech-head .pips { margin-right: auto; color: var(--accent2); letter-spacing: 1px; font-size: 11px; }
/* akceptacja regulaminu przy rejestracji */
.terms-chk { display: flex !important; flex-direction: row !important; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.45; }
.terms-chk.hidden { display: none !important; }
.terms-chk input { width: 16px; height: 16px; margin-top: 2px; flex: none; }
.terms-chk a { color: inherit; }
