/* Kolorystyka i typografia zgodne z redpin.agency */
:root {
  --red: #e32814;
  --red-dark: #c42110;
  --black: #161515;
  --dark: #181818;
  --text: #525252;
  --muted: #797979;
  --line: #d9d9de;
  --line-2: #c2c2c2;
  --bg: #f0f0f2;
  --white: #ffffff;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Familjen Grotesk", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--black); font-family: var(--font); }
button, input { font: inherit; }
h1, h2, h3 { font-family: var(--font-head); }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.screen { display: none; min-height: 100%; }
.screen.active { display: block; }
.dots { background-color: var(--bg); background-image: radial-gradient(#c9c9cf 1px, transparent 1.2px); background-size: 18px 18px; }

/* ── Przyciski i formularze ─────────────────────────────── */
.btn {
  border: 0; border-radius: 2px; padding: 12px 20px; cursor: pointer; font-weight: 600;
  background: var(--black); color: #fff; transition: transform .08s, background .15s; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { background: #2c2b2b; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--red); }
.btn.primary:hover { background: var(--red-dark); }
.btn.primary::before { content: '↗'; font-weight: 400; }
.btn.ghost { background: #f0f0f0; color: var(--black); }
.btn.ghost:hover { background: #e2e2e5; }
.btn.small { padding: 7px 12px; font-size: 14px; }
.btn.small::before { display: none; }

input:not([type=range]) {
  width: 100%; padding: 12px 14px; border-radius: 2px; border: 1px solid var(--line-2);
  background: #fff; color: var(--black); outline: none;
}
input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(227,40,20,.12); }
label { display: block; font-size: 14px; color: var(--text); margin-bottom: 12px; font-weight: 500; }
label input { margin-top: 6px; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: 4px; padding: 22px; }
.card h2 { margin: 0 0 8px; font-size: 22px; letter-spacing: -.3px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.error { color: var(--red); min-height: 1em; margin: 4px 0 10px; font-size: 14px; font-weight: 500; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 6px; }
.empty { color: var(--muted); padding: 14px 4px; font-size: 14px; }

/* „dymek” jak na redpin.agency */
.bubble { position: relative; display: inline-block; background: var(--black); color: #fff; font-weight: 600; padding: 8px 14px; font-size: 15px; margin-bottom: 26px; }
.bubble::after { content: ''; position: absolute; left: 0; top: 100%; border-left: 38px solid var(--black); border-bottom: 34px solid transparent; }
.bubble.red { background: var(--red); }
.bubble.red::after { border-left-color: var(--red); }

/* ── Ekran logowania ────────────────────────────────────── */
#screen-auth.active { display: flex; align-items: center; justify-content: center; padding: 24px 16px; min-height: 100vh; }
.auth-wrap { width: 100%; max-width: 440px; }
.brand { margin-bottom: 22px; }
.brand-logo { height: 46px; display: block; margin-bottom: 26px; }
.brand h1 { font-size: clamp(52px, 12vw, 76px); line-height: .95; letter-spacing: -2px; margin: 0 0 12px; color: var(--black); }
.brand h1 .scribble { position: relative; display: inline-block; }
.brand h1 .scribble::after { content: ''; position: absolute; left: -8px; right: -10px; top: 8%; bottom: -4%; border: 3px solid var(--red); border-radius: 50%; transform: rotate(-4deg); }
.tagline { color: var(--text); margin: 0; line-height: 1.55; font-size: 16px; }
.auth-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin: -4px 0 18px; }
.auth-tab { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 10px; cursor: pointer; font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.auth-tab.on { color: var(--black); border-bottom-color: var(--red); }
#auth-submit { width: 100%; }

/* ── Lobby ──────────────────────────────────────────────── */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 0 24px; height: 76px; background: #fff; border-bottom: 1px solid var(--line); gap: 12px; }
.topbar-brand { display: flex; align-items: center; gap: 14px; font-family: var(--font-head); font-weight: 700; font-size: 18px; }
.topbar-brand img { height: 30px; display: block; }
.topbar-brand .game-name { padding-left: 14px; border-left: 2px solid var(--line); letter-spacing: 1px; }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--text); }
.lobby { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; padding: 28px 24px; max-width: 1302px; margin: 0 auto; }
.lobby .col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.row { display: flex; gap: 10px; }
.row input { flex: 1; min-width: 0; }
.room-list { display: flex; flex-direction: column; gap: 8px; }
.room { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fafafb; border: 1px solid var(--line); border-left: 4px solid var(--red); padding: 12px 14px; }
.room-info { min-width: 0; }
.room-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0 18px; }
.stats div { background: var(--bg); padding: 12px 8px; text-align: center; }
.stats b { display: block; font-family: var(--font-head); font-size: 30px; color: var(--black); }
.stats span { font-size: 12px; color: var(--muted); }
.sens { display: flex; align-items: center; gap: 10px; }
.sens input { flex: 1; accent-color: var(--red); }
.controls { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 13px; color: var(--text); }
kbd { background: #fff; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 3px; padding: 1px 6px; font-family: inherit; font-size: 12px; margin-right: 2px; color: var(--black); }
.serp-card { padding: 0; overflow: hidden; }

@media (max-width: 860px) {
  .lobby { grid-template-columns: 1fr; padding: 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 0 16px; }
  .topbar-brand .game-name { display: none; }
}

/* ── Szatnia ─────────────────────────────────────────────── */
.creator { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: 20px; padding: 28px 24px; max-width: 1200px; margin: 0 auto; }
.creator-stage { position: relative; padding: 0; min-height: 520px; overflow: hidden; background: linear-gradient(#fff, #ececef); }
#creator-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.creator-spin { position: absolute; top: 12px; right: 12px; z-index: 1; }
.creator-hint { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; font-size: 13px; color: var(--muted); pointer-events: none; }
.creator-panel h2 { font-size: 30px; margin-bottom: 4px; }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #ededf0; }
.opt-label { font-weight: 600; font-size: 14px; flex: none; width: 110px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.seg button { border: 1px solid var(--line-2); background: #fff; padding: 6px 10px; font-size: 13px; cursor: pointer; border-radius: 2px; }
.seg button.on { background: var(--black); color: #fff; border-color: var(--black); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; padding: 0; }
.sw.on { box-shadow: 0 0 0 2px var(--red); }
.cycle { display: flex; align-items: center; gap: 6px; }
.cycle span { min-width: 170px; text-align: center; font-size: 14px; font-weight: 500; }
.cycle button { width: 32px; height: 32px; border: 1px solid var(--line-2); background: #fff; cursor: pointer; font-size: 18px; line-height: 1; border-radius: 2px; }
.cycle button:hover, .seg button:hover { border-color: var(--red); }
.creator-status { text-align: right; font-size: 13px; color: var(--muted); min-height: 1.2em; margin: 8px 0 0; }
.creator-status.error { color: var(--red); font-weight: 500; }
.creator-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.profile-head { display: flex; align-items: center; gap: 14px; }
.profile-head h2 { margin-bottom: 6px; }
#lobby-avatar { width: 96px; height: 96px; background: var(--bg); border-left: 4px solid var(--red); flex: none; }
@media (max-width: 860px) {
  .creator { grid-template-columns: 1fr; padding: 16px; }
  .creator-stage { min-height: 360px; }
  .cycle span { min-width: 120px; }
  .opt-label { width: auto; }
}

/* ── Łączenie ───────────────────────────────────────────── */
#screen-connecting.active { display: flex; align-items: center; justify-content: center; min-height: 100vh; text-align: center; padding: 16px; }
.spinner { width: 46px; height: 46px; border: 4px solid var(--line); border-top-color: var(--red); border-radius: 50%; margin: 0 auto 18px; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#connect-room { font-size: 28px; margin: 0 0 6px; }
#connect-status { color: var(--muted); }

/* ── Toast ──────────────────────────────────────────────── */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--black); color: #fff; padding: 12px 18px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--red); }

/* ── Gra / HUD ──────────────────────────────────────────── */
#screen-game.active { position: fixed; inset: 0; overflow: hidden; background: #000; }
#game-canvas, #game-canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#hud { position: absolute; inset: 0; pointer-events: none; user-select: none; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.panel { background: rgba(22,21,21,.78); border-left: 4px solid var(--red); }
#damage-vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 45%, rgba(227,40,20,.85) 100%); opacity: 0; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; transform: translate(-50%, -50%); }
#crosshair::before, #crosshair::after { content: ''; position: absolute; background: #fff; box-shadow: 0 0 2px #000; }
#crosshair::before { left: 8px; top: 0; width: 2px; height: 18px; }
#crosshair::after { top: 8px; left: 0; height: 2px; width: 18px; }
#hitmarker { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; transform: translate(-50%, -50%) rotate(45deg); opacity: 0; }
#hitmarker::before, #hitmarker::after { content: ''; position: absolute; background: #fff; }
#hitmarker::before { left: 14px; top: 0; width: 2px; height: 30px; }
#hitmarker::after { top: 14px; left: 0; height: 2px; width: 30px; }
#hitmarker.show { animation: hm .18s ease-out; }
#hitmarker.kill::before, #hitmarker.kill::after { background: var(--red); }
@keyframes hm { from { opacity: 1; transform: translate(-50%, -50%) rotate(45deg) scale(1.3); } to { opacity: 0; transform: translate(-50%, -50%) rotate(45deg) scale(1); } }

#hud-top { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); text-align: center; padding: 6px 18px; border-left: 0; border-bottom: 3px solid var(--red); }
#timer { font-family: var(--font-head); font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
#timer.urgent { color: #ff6a55; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
#timer-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: #cfcfd4; }

#killfeed { position: absolute; top: 14px; right: 14px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; max-width: min(520px, 60vw); }
.kf { background: rgba(22,21,21,.78); padding: 6px 12px; font-size: 14px; animation: slideIn .2s; }
.kf.mine { border-right: 4px solid var(--red); }
.kf-w { color: #aaa; font-size: 12px; }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }

#announce { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); font-family: var(--font-head); font-size: 30px; font-weight: 700; color: #fff;
  background: var(--red); padding: 10px 22px; text-shadow: none; opacity: 0; white-space: nowrap; }
#announce::after { content: ''; position: absolute; left: 0; top: 100%; border-left: 34px solid var(--red); border-bottom: 28px solid transparent; }
#announce.show { animation: ann 2.6s ease-out; }
@keyframes ann { 0% { opacity: 0; transform: translateX(-50%) scale(1.3); } 10%, 75% { opacity: 1; transform: translateX(-50%) scale(1); } 100% { opacity: 0; } }
#hud-toast { position: absolute; bottom: 120px; left: 50%; transform: translateX(-50%); background: var(--black); border-left: 4px solid var(--red); padding: 6px 14px; font-weight: 600; opacity: 0; }
#hud-toast.show { animation: ann 1.8s ease-out; }

#hud-hp { position: absolute; left: 20px; bottom: 20px; padding: 10px 14px; width: 280px; }
#hud-hp .label { font-size: 11px; letter-spacing: 2px; color: #cfcfd4; margin-bottom: 4px; font-weight: 600; }
.hp-row { display: flex; align-items: center; gap: 10px; }
#hp-bar { flex: 1; height: 12px; background: rgba(255,255,255,.15); overflow: hidden; }
#hp-fill { height: 100%; width: 100%; background: #fff; transition: width .15s; }
#hp-fill.low { background: var(--red); }
.stamina-label { margin-top: 8px; }
#stamina-bar { height: 5px; background: rgba(255,255,255,.15); overflow: hidden; }
#stamina-fill { height: 100%; width: 100%; background: #c8a27a; }
#stamina-fill.exhausted { background: var(--red); animation: pulse .6s infinite; }
#hp-num { font-family: var(--font-head); font-size: 28px; font-weight: 700; min-width: 48px; text-align: right; font-variant-numeric: tabular-nums; }

#hud-weapon { position: absolute; right: 20px; bottom: 20px; text-align: right; padding: 10px 14px; border-left: 0; border-right: 4px solid var(--red); }
#weapon-name { font-size: 12px; letter-spacing: 1.5px; color: #cfcfd4; text-transform: uppercase; font-weight: 600; }
#ammo { font-family: var(--font-head); font-size: 36px; font-weight: 700; font-variant-numeric: tabular-nums; }
#ammo span { font-size: 18px; color: #aaa; }
#ammo small { font-size: 16px; color: #ffb4a8; font-family: var(--font); }
#weapon-slots { display: flex; gap: 6px; justify-content: flex-end; margin-top: 4px; }
.slot { font-size: 11px; padding: 3px 7px; background: rgba(255,255,255,.1); color: #bbb; }
.slot.on { background: var(--red); color: #fff; }
.slot b { margin-right: 2px; }

#chat { position: absolute; left: 20px; bottom: 100px; width: min(420px, 60vw); }
#chat-log { display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; }
.chat-line { font-size: 14px; background: rgba(22,21,21,.6); padding: 3px 8px; transition: opacity 1s; }
.chat-line.sys { color: #dcdce2; }
.chat-line.fade { opacity: 0; }
#chat-input { pointer-events: auto; }

#death-screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(22,21,21,.55); text-align: center; padding: 16px; }
#death-screen .bubble { font-size: 14px; }
#death-screen h1 { font-size: clamp(36px, 7vw, 64px); margin: 0 0 10px; letter-spacing: -1px; color: #fff; text-shadow: none; }
#death-quote { font-size: 20px; margin: 0 0 8px; }
#death-by { color: #ddd; margin: 0 0 18px; }
#respawn-count { font-size: 16px; color: #ffb4a8; font-weight: 600; }

#pause-screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(22,21,21,.55); pointer-events: auto; padding: 16px; }
.pause-card { max-width: 380px; display: flex; flex-direction: column; gap: 10px; text-shadow: none; color: var(--black); }
.pause-card h2 { font-size: 30px; }
.pause-card p { margin: 0 0 6px; }

/* ── Tablica wyników w stylu wyszukiwarki ────────────────── */
.overlay-serp { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(22,21,21,.6); padding: 16px; text-shadow: none; }
.overlay-serp .serp { width: min(720px, 100%); max-height: calc(100vh - 150px); overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.end-head { text-align: center; margin-bottom: 16px; }
.end-head .bubble { margin-bottom: 30px; }
.end-head h1 { font-size: clamp(44px, 8vw, 72px); margin: 0; letter-spacing: -2px; color: #fff; line-height: 1; }
.end-head p { margin: 8px 0 0; font-size: 18px; color: #fff; }

.serp { background: #fff; color: var(--black); font-family: var(--font); padding: 20px 22px 10px; }
.serp-top { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.serp-logo { height: 28px; display: block; }
.serp-search { flex: 1; min-width: 200px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid #dfe1e5; border-radius: 24px; padding: 9px 16px; box-shadow: 0 1px 6px rgba(32,33,36,.16); font-size: 15px; }
.serp-search span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.serp-search svg path { fill: var(--red); }
.serp-tabs { display: flex; gap: 20px; font-size: 13px; color: var(--muted); border-bottom: 1px solid #ebebeb; margin: 12px -22px 0; padding: 0 22px; }
.serp-tabs span { padding: 8px 0 10px; }
.serp-tabs .on { color: var(--black); font-weight: 600; border-bottom: 3px solid var(--red); }
.serp-meta { color: var(--muted); font-size: 13px; margin: 10px 0 6px; }
.serp-item { padding: 10px 0 12px; max-width: 640px; }
.serp-item.featured { border: 1px solid var(--line); border-left: 4px solid var(--red); padding: 12px 14px; margin: 6px 0 10px; background: #fafafb; }
.serp-feat-label { font-size: 12px; color: var(--red); font-weight: 700; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.serp-item.mine .serp-title { background: #ffe9e5; }
.serp-site { display: flex; align-items: center; gap: 10px; }
.serp-fav { width: 28px; height: 28px; border-radius: 50%; color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 14px; flex: none; }
.serp-site-name { font-size: 14px; color: var(--black); }
.serp-site-name em { color: var(--muted); font-style: normal; }
.serp-url { font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.serp-pos { margin-left: auto; color: var(--muted); font-family: var(--font-head); font-size: 15px; font-weight: 700; }
.serp-title { color: #1a0dab; font-size: 19px; margin: 6px 0 3px; line-height: 1.3; }
.serp-item:first-child .serp-title { font-size: 21px; }
.serp-snippet { color: var(--text); font-size: 14px; line-height: 1.5; }
.serp-stars { color: var(--red); letter-spacing: 1px; }
.serp-empty { color: var(--muted); padding: 20px 0; }
.serp-pager { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 0 6px; color: var(--muted); font-size: 13px; }
.serp-pager-logo { font-family: var(--font-head); font-size: 28px; font-weight: 700; letter-spacing: -1px; color: var(--black); }
.serp-pager-logo i { color: var(--red); font-style: normal; }
.serp-pager-nums { display: flex; gap: 14px; color: #1a0dab; }
.serp-pager-nums b { color: var(--black); }

@media (max-width: 600px) {
  .serp { padding: 14px 16px 8px; }
  .serp-tabs { margin: 12px -16px 0; padding: 0 16px; gap: 14px; }
  .serp-title { font-size: 17px; }
}
