/* Leedy Colbergcoffee: warstwa gry. Ciemny motyw "espresso", akcent "crema". */
:root {
  --bg: #0e0a08;
  --bg2: #15100d;
  --card: #1d1612;
  --card2: #261d18;
  --line: #3a2d25;
  --text: #f4ece6;
  --muted: #a8968a;
  --crema: #e8b04b;
  --crema2: #f6d28b;
  --roast: #c8733a;
  --mint: #4fd1a5;
  --teal: #3cc6c1;
  --red: #ff6b4a;
  --violet: #a78bfa;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", var(--font);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 110% -10%, rgba(232, 176, 75, .10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(200, 115, 58, .10), transparent 60%),
    var(--bg);
}
a { color: var(--crema2); }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- układ ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; padding: 24px 16px;
  border-right: 1px solid var(--line); background: rgba(21, 16, 13, .7); backdrop-filter: blur(12px);
  display: flex; flex-direction: column; gap: 6px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 17px; margin: 0 4px 22px; white-space: nowrap; }
.brand-logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--crema), var(--roast)); display: grid; place-items: center; color: #1b120c; }
.nav-btn {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 0;
  background: transparent; color: var(--muted); cursor: pointer; text-align: left; font-weight: 600;
}
.nav-btn svg { width: 20px; height: 20px; }
.nav-btn:hover { background: var(--card); color: var(--text); }
.nav-btn.active { background: linear-gradient(90deg, rgba(232, 176, 75, .18), rgba(232, 176, 75, .04)); color: var(--crema2); }
.nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 12px; border-radius: 99px; padding: 1px 8px; }
.side-foot { margin-top: auto; font-size: 13px; color: var(--muted); padding: 8px; }
.side-foot a { color: var(--muted); }

.main { padding: 24px clamp(16px, 3vw, 40px) 110px; max-width: 1200px; width: 100%; min-width: 0; }
.grid > *, .hud-level, .hero > div { min-width: 0; }
textarea { font-family: inherit; }

/* ---------- górny pasek gracza ---------- */
.hud {
  display: flex; align-items: center; gap: 18px; padding: 14px 18px; margin-bottom: 22px;
  background: linear-gradient(135deg, var(--card2), var(--card)); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.avatar {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
  background: conic-gradient(var(--crema) var(--p, 0%), var(--line) 0); position: relative; flex: none;
}
.avatar span { width: 38px; height: 38px; border-radius: 50%; background: var(--bg2); display: grid; place-items: center; font-family: var(--display); }
.hud-level { min-width: 0; flex: 1; }
.hud-level b { font-family: var(--display); font-size: 16px; }
.hud-level small { color: var(--muted); }
.xpbar { height: 8px; background: var(--bg2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.xpbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--roast), var(--crema), var(--crema2)); border-radius: 99px; transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.hud-stat { text-align: center; padding: 0 6px; }
.hud-stat b { display: block; font-family: var(--display); font-size: 20px; }
.hud-stat small { color: var(--muted); font-size: 12px; }
.flame { color: var(--roast); }

/* ---------- karty ---------- */
h1, h2, h3 { font-family: var(--display); margin: 0; }
h1 { font-size: clamp(24px, 3vw, 32px); }
h2 { font-size: 20px; margin-bottom: 12px; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1.3fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow);
}
.hero {
  padding: 24px; background:
    radial-gradient(600px 200px at 100% 0, rgba(232, 176, 75, .22), transparent 70%),
    linear-gradient(135deg, #2a1f18, #1b1411);
  display: flex; gap: 24px; align-items: center;
}
.ring { --p: 0; width: 120px; height: 120px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--crema) calc(var(--p) * 1%), rgba(255, 255, 255, .07) 0); }
.ring > div { width: 96px; height: 96px; border-radius: 50%; background: #1d1612; display: grid; place-items: center; text-align: center; }
.ring b { font-family: var(--display); font-size: 30px; display: block; line-height: 1; }
.ring small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.goal { margin-top: 14px; }
.goal .xpbar { height: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--card2); border: 1px solid var(--line); }

/* misje */
.mission { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 14px; background: var(--card2); border: 1px solid var(--line); }
.mission + .mission { margin-top: 10px; }
.mission .ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: rgba(232, 176, 75, .12); color: var(--crema); flex: none; }
.mission.done { border-color: rgba(79, 209, 165, .5); background: linear-gradient(90deg, rgba(79, 209, 165, .12), var(--card2)); }
.mission.done .ico { background: rgba(79, 209, 165, .18); color: var(--mint); }
.mission .body { flex: 1; min-width: 0; }
.mission .xpbar { height: 6px; }
.reward { font-family: var(--display); font-weight: 700; color: var(--crema2); white-space: nowrap; }

/* priorytety */
.prio { display: inline-grid; place-items: center; min-width: 30px; height: 26px; padding: 0 8px; border-radius: 8px; font-weight: 800; font-size: 13px; }
.prio.A { background: rgba(255, 107, 74, .18); color: var(--red); box-shadow: 0 0 0 1px rgba(255, 107, 74, .4) inset; }
.prio.B { background: rgba(232, 176, 75, .16); color: var(--crema2); box-shadow: 0 0 0 1px rgba(232, 176, 75, .35) inset; }
.prio.OBSERWUJ { background: rgba(60, 198, 193, .14); color: var(--teal); }
.prio.C { background: rgba(168, 150, 138, .12); color: var(--muted); }

/* lista leadów */
.row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; cursor: pointer; border: 1px solid transparent; }
.row:hover { background: var(--card2); border-color: var(--line); }
.row .name { font-weight: 700; }
.row .meta { color: var(--muted); font-size: 13px; }
.row .grow { flex: 1; min-width: 0; }
.row .grow > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--card2); border: 1px solid var(--line); color: var(--muted); margin: 2px 4px 2px 0; }
.chip.sig { color: var(--crema2); border-color: rgba(232, 176, 75, .35); }
.rynek { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 6px; margin-right: 6px; vertical-align: 1px; }
.rynek.HORECA { background: rgba(232, 176, 75, .18); color: var(--crema2); }
.rynek.BIURA { background: rgba(167, 139, 250, .18); color: var(--violet); }
.rynek.INNE { background: var(--card2); color: var(--muted); }
.chip.warn { color: var(--red); border-color: rgba(255, 107, 74, .4); }
.alert { margin: 14px 0; padding: 14px; border-radius: 14px; background: rgba(255, 107, 74, .08); border: 1px solid rgba(255, 107, 74, .35); font-size: 14px; line-height: 1.5; }
.proposal { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: rgba(79, 209, 165, .08); border: 1px solid rgba(79, 209, 165, .35); }
.err-pill { color: var(--red); border-color: rgba(255, 107, 74, .5); }
.proposal.ok-box { border-color: rgba(79, 209, 165, .45); background: rgba(79, 209, 165, .08); }
.proposal.google { border-color: rgba(66, 133, 244, .45); background: rgba(66, 133, 244, .08); }
.toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; padding: 0 6px; cursor: pointer; }
.status { font-size: 12px; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters input, .filters select, .field input, .field select, .field textarea {
  background: var(--bg2); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 10px 12px; font: inherit;
}
.filters input { flex: 1; min-width: 180px; }
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--card2); color: var(--text); }

/* przyciski */
.btn { border: 1px solid var(--line); background: var(--card2); padding: 11px 16px; border-radius: 12px; cursor: pointer; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { border-color: var(--crema); }
.btn.primary { background: linear-gradient(135deg, var(--crema), var(--roast)); color: #1b120c; border: 0; }
.btn.good { background: rgba(79, 209, 165, .15); border-color: rgba(79, 209, 165, .5); color: var(--mint); }
.btn.bad { background: rgba(255, 107, 74, .1); border-color: rgba(255, 107, 74, .4); color: var(--red); }
.btn.teal { background: rgba(60, 198, 193, .12); border-color: rgba(60, 198, 193, .45); color: var(--teal); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn kbd { font-size: 11px; opacity: .7; border: 1px solid currentColor; border-radius: 5px; padding: 0 5px; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; }

/* kolejka */
.queue-wrap { max-width: 720px; margin: 0 auto; }
.qcard { position: relative; padding: 26px; border-radius: 24px; background: linear-gradient(160deg, #2a1f18, #1a1310); border: 1px solid var(--line); box-shadow: var(--shadow); animation: pop .35s cubic-bezier(.2, .9, .3, 1.2); }
.qcard.out-right { animation: outR .35s forwards; }
.qcard.out-left { animation: outL .35s forwards; }
.qcard.out-up { animation: outU .35s forwards; }
@keyframes pop { from { transform: translateY(16px) scale(.97); opacity: 0; } }
@keyframes outR { to { transform: translateX(120%) rotate(8deg); opacity: 0; } }
@keyframes outL { to { transform: translateX(-120%) rotate(-8deg); opacity: 0; } }
@keyframes outU { to { transform: translateY(-60px); opacity: 0; } }
.qhead { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.qtitle { font-size: 26px; }
.bars { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0; }
.bar { cursor: pointer; }
.powody { margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.powody div { padding: 2px 0; border-bottom: 1px dashed var(--line); }
.bar label { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.bar .xpbar i { background: linear-gradient(90deg, var(--teal), var(--mint)); }
.bar.m .xpbar i { background: linear-gradient(90deg, var(--roast), var(--red)); }
.note { background: var(--bg2); border-radius: 14px; padding: 12px 14px; color: #d9cbc0; font-size: 14px; line-height: 1.5; white-space: pre-wrap; max-height: 180px; overflow: auto; }
.progress-q { text-align: center; color: var(--muted); margin: 14px 0; font-size: 13px; }

/* szuflada leada */
.drawer-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: min(620px, 100%); background: var(--bg2); border-left: 1px solid var(--line); z-index: 41; overflow-y: auto; padding: 24px; animation: slide .3s ease; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.drawer .close { position: absolute; right: 16px; top: 16px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.section { margin-top: 20px; }
.timeline { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 14px; }
.timeline div { position: relative; font-size: 14px; margin-bottom: 10px; }
.timeline div::before { content: ""; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--crema); }
.msg { width: 100%; min-height: 190px; resize: vertical; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); }

/* ranking */
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: end; }
.pod { text-align: center; padding: 16px 10px; border-radius: 16px; background: var(--card2); border: 1px solid var(--line); }
.pod.p1 { padding-top: 30px; border-color: rgba(232, 176, 75, .6); background: linear-gradient(180deg, rgba(232, 176, 75, .18), var(--card2)); }
.pod b { font-family: var(--display); font-size: 22px; display: block; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badge { text-align: center; padding: 16px 10px; border-radius: 16px; background: var(--card2); border: 1px solid var(--line); }
.badge .medal { width: 54px; height: 54px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 30% 30%, var(--crema2), var(--roast)); color: #1b120c; box-shadow: 0 0 24px rgba(232, 176, 75, .35); }
.badge.locked { opacity: .45; filter: grayscale(1); }
.badge.locked .medal { box-shadow: none; }
.badge small { color: var(--muted); display: block; font-size: 12px; margin-top: 4px; }

/* powiadomienia o punktach */
.toast-zone { position: fixed; right: 20px; bottom: 90px; z-index: 60; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast { background: var(--card2); border: 1px solid var(--line); padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow); animation: toastIn .3s ease, toastOut .4s ease 3.2s forwards; font-weight: 600; }
.toast.xp { font-family: var(--display); font-size: 22px; color: var(--crema2); border-color: rgba(232, 176, 75, .5); }
.toast.err { border-color: rgba(255, 107, 74, .5); color: var(--red); }
.toast.big { font-size: 18px; background: linear-gradient(135deg, var(--crema), var(--roast)); color: #1b120c; border: 0; }
@keyframes toastIn { from { transform: translateY(20px) scale(.9); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(-20px); opacity: 0; } }
canvas#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; }

.fab { position: fixed; right: 22px; bottom: 24px; z-index: 30; width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer; background: linear-gradient(135deg, var(--crema), var(--roast)); color: #1b120c; box-shadow: 0 10px 30px rgba(232, 176, 75, .35); display: grid; place-items: center; }
.fab svg { width: 26px; height: 26px; }

.jobs td { padding: 6px 10px 6px 0; font-size: 13px; vertical-align: top; }
.ok { color: var(--mint); }
.fail { color: var(--red); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty b { display: block; font-family: var(--display); font-size: 20px; color: var(--text); margin-bottom: 6px; }

/* logowanie */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: min(400px, 100%); }
.login .brand { justify-content: center; margin-bottom: 18px; font-size: 24px; }
.login .field input { width: 100%; }
.err { color: var(--red); margin-bottom: 10px; }

/* ---------- telefon ---------- */
.bottom-nav { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 16px 16px 110px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .hero { flex-direction: column; text-align: center; }
  .hud { gap: 10px; padding: 12px; }
  .hud-stat small { font-size: 11px; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    background: rgba(21, 16, 13, .92); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav .nav-btn { flex-direction: column; gap: 3px; font-size: 11px; padding: 8px 2px; justify-content: center; align-items: center; }
  .bottom-nav .nav-badge { position: absolute; margin: -6px 0 0 18px; font-size: 10px; }
  .fab { bottom: 84px; }
  .toast-zone { right: 12px; left: 12px; bottom: 150px; align-items: stretch; }
  .qcard { padding: 18px; }
  .qtitle { font-size: 21px; }
  .kv { grid-template-columns: 90px 1fr; }
}

/* ---------- tryb rozmowy ---------- */
.btn.dzwon { background: linear-gradient(135deg, var(--mint), var(--teal)); color: #06231b; border: 0; font-size: 16px; padding: 14px 20px; }
.btn.dzwon .dzwon-ikona { display: inline-flex; width: 20px; animation: dzwoni 1.6s ease-in-out infinite; }
.btn.dzwon svg { width: 20px; height: 20px; }
@keyframes dzwoni { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-14deg); } 85% { transform: rotate(14deg); } }
.rozmowa { margin: 12px 0; padding: 16px; border-radius: 16px; background: linear-gradient(160deg, #15241f, #131a18); border: 1px solid rgba(79, 209, 165, .35); }
.rozmowa-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rozmowa-head .zegar { margin-left: auto; font-family: var(--display); font-size: 22px; color: var(--mint); }
.puls { width: 12px; height: 12px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 0 rgba(79, 209, 165, .7); animation: puls 1.4s infinite; }
@keyframes puls { 70% { box-shadow: 0 0 0 12px rgba(79, 209, 165, 0); } 100% { box-shadow: 0 0 0 0 rgba(79, 209, 165, 0); } }
.rozmowa .cel { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.krok { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid rgba(255, 255, 255, .06); }
.krok .nr { width: 26px; height: 26px; border-radius: 50%; background: rgba(79, 209, 165, .16); color: var(--mint); display: grid; place-items: center; font-weight: 800; flex: none; }
.krok .tekst { font-size: 16px; line-height: 1.5; }
.uwagi { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(232, 176, 75, .1); color: var(--crema2); font-size: 14px; }
.obiekcje { margin-top: 10px; font-size: 14px; }
.obiekcje summary { cursor: pointer; color: var(--muted); padding: 6px 0; }
.obiekcja { padding: 8px 0; border-top: 1px dashed var(--line); }
.obiekcja b { color: var(--crema2); }
.btn.chip-btn { font-size: 12px; padding: 6px 10px; font-weight: 600; color: var(--muted); }

/* ---------- szeroki ekran: karta leada jako panel obok listy, nie na wierzchu ---------- */
@media (min-width: 1200px) {
  .drawer-bg { display: none; }
  .drawer {
    width: 560px; box-shadow: -18px 0 40px rgba(0, 0, 0, .35);
    animation: wsuw .25s ease;
  }
  body.z-panelem .main { padding-right: 600px; }
  @keyframes wsuw { from { transform: translateX(24px); opacity: .4; } }
}
@media (min-width: 1700px) {
  .drawer { width: 640px; }
  body.z-panelem .main { padding-right: 680px; }
}

/* ---------- tablica rozmowy na środku ekranu ---------- */
.tablica {
  position: fixed; z-index: 38; top: 84px; left: 264px; right: 620px; max-height: calc(100vh - 110px); overflow-y: auto;
}
.tablica .rozmowa { margin: 0; padding: 22px; }
.tablica .rozmowa-head .zegar { font-size: 30px; }
.tablica .krok .tekst { font-size: 19px; line-height: 1.55; }
.rozmowa-kolumny { display: grid; grid-template-columns: 1.35fr 1fr; gap: 20px; align-items: start; }
.pomoc { background: rgba(0, 0, 0, .2); border-radius: 14px; padding: 14px 16px; }
.pomoc h4 { font-family: var(--display); margin: 4px 0 8px; font-size: 14px; color: var(--crema2); }
.pomoc h4 + .obiekcja { border-top: 0; }
.wskaz { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.rozmowa-head .btn { padding: 6px 10px; margin-left: 8px; }
@media (max-width: 1500px) { .rozmowa-kolumny { grid-template-columns: 1fr; } .tablica { right: 600px; } }
@media (max-width: 1199px) { .tablica { position: static; } }

/* Przyciemnienie z rozmyciem pod tablicą rozmowy: tło nie rozprasza, karta leada zostaje czytelna.
   Celowo nie reaguje na kliknięcia, żeby nikt nie zamknął skryptu w trakcie rozmowy. */
body.z-rozmowa::before {
  content: ""; position: fixed; inset: 0; z-index: 36; pointer-events: none;
  background: rgba(6, 4, 3, .55); backdrop-filter: blur(5px);
  animation: przyciemnij .25s ease;
}
@keyframes przyciemnij { from { opacity: 0; } }

/* asystent rozmowy: to, co masz powiedzieć teraz */
.mow-teraz { padding: 18px; border-radius: 16px; background: rgba(79, 209, 165, .1); border: 1px solid rgba(79, 209, 165, .4); }
.mow-teraz .tekst { font-size: 21px; line-height: 1.5; margin-top: 4px; }
.po-co { font-size: 12px; color: var(--muted); margin-top: 8px; }
.obiekcja.klik { cursor: pointer; border-radius: 10px; padding: 8px; }
.obiekcja.klik:hover { background: rgba(255, 255, 255, .04); }
.btn.wybrany { outline: 2px solid var(--crema); }
