/* Kroniki Lednicy — stylistyka w duchu RuneScape Classic:
   brązowe kamienne panele, żółty tekst, surowe krawędzie. */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #1a1410;
  color: #e8e2d0;
  font-family: "Lucida Console", Monaco, monospace;
  font-size: 13px;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  align-items: flex-start;
  padding: 8px;
}

.panel {
  background: #4a3b2a;
  background-image:
    radial-gradient(ellipse at 20% 30%, rgba(255,255,255,0.05), transparent 60%),
    radial-gradient(ellipse at 80% 70%, rgba(0,0,0,0.15), transparent 60%);
  border: 3px solid #2a2018;
  outline: 1px solid #6e5a40;
  box-shadow: inset 0 0 0 1px #3a2e20;
}

/* ── Logowanie ── */
#login { display: flex; align-items: center; justify-content: center; min-height: 95vh; width: 100%; }
#login[hidden] { display: none; }
#loginbox { width: 460px; padding: 26px; text-align: center; }
#loginbox h1 { color: #ffd24a; font-size: 26px; letter-spacing: 2px; text-shadow: 2px 2px 0 #000; }
#loginbox .sub { color: #b8a878; margin: 4px 0 14px; font-size: 11px; }
#loginbox .blurb { color: #d9cfb0; line-height: 1.5; margin-bottom: 18px; text-align: left; }
#loginbox input, #chatin {
  width: 100%; padding: 8px; background: #211a12; color: #ffd24a;
  border: 2px solid #6e5a40; font-family: inherit; font-size: 14px;
}
#loginbox button, #createbox button {
  margin-top: 10px; width: 100%; padding: 10px;
  background: #6e2a1a; color: #ffd24a; border: 2px outset #a05a3a;
  font-family: inherit; font-size: 15px; cursor: pointer; letter-spacing: 1px;
}
#loginbox button:hover, #createbox button:hover { background: #8a3a22; }
#loginbox button.alt, #createbox button.alt { background: #3a2e20; border-color: #6e5a40; color: #d9cfb0; }
#loginerr, #createerr { color: #ff6a4a; margin-top: 10px; min-height: 16px; }
#loginbox input { margin-top: 8px; }

/* ── Kreator postaci ── */
#create { display: flex; align-items: center; justify-content: center; min-height: 95vh; width: 100%; }
#create[hidden] { display: none; }
#createbox { width: 560px; padding: 24px; text-align: center; }
#createbox h1 { color: #ffd24a; font-size: 22px; text-shadow: 2px 2px 0 #000; margin-bottom: 14px; }
#createcols { display: flex; gap: 16px; align-items: flex-start; }
#prevcv { background: #211a12; border: 2px solid #6e5a40; flex: none; }
#pickers { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.pick { display: grid; grid-template-columns: 1fr 34px 70px 34px; align-items: center; gap: 4px; }
.pick .lbl { text-align: left; color: #d9cfb0; font-size: 12px; }
.pick .arr {
  background: #3a2e20; color: #ffd24a; border: 2px solid #2a2018;
  padding: 5px 0; cursor: pointer; font-family: inherit;
}
.pick .arr:hover { background: #6e5a40; }
.pick .val { color: #ffd24a; font-size: 11px; text-align: center; }
.pick .val.sw { height: 22px; border: 2px solid #2a2018; }
#pickers input {
  width: 100%; padding: 7px; background: #211a12; color: #ffd24a;
  border: 2px solid #6e5a40; font-family: inherit; font-size: 13px;
}

/* ── Układ gry ── */
#game { width: 1320px; max-width: 100%; }
#main { display: flex; gap: 8px; }
#viewport { position: relative; flex: 1; height: 560px; min-width: 0; }
#cv {
  display: block; width: 100%; height: 100%;
  border: 3px solid #2a2018; outline: 1px solid #6e5a40;
  image-rendering: pixelated; cursor: crosshair; touch-action: none;
}
#online { position: absolute; top: 34px; right: 12px; color: #8ad0ff; text-shadow: 1px 1px 0 #000; font-size: 11px; }
#compass {
  position: absolute; top: 10px; left: 76px; width: 46px; height: 46px;
  border-radius: 50%; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #6e5a40, #2a2018);
  border: 3px solid #2a2018; box-shadow: inset 0 0 0 1px #6e5a40;
}
#compass:hover { box-shadow: inset 0 0 0 1px #ffd24a; }
#needle { width: 100%; height: 100%; display: block; }
#camhint { position: absolute; bottom: 6px; right: 10px; color: #d9cfb066; font-size: 10px; pointer-events: none; }
#hoverinfo {
  position: absolute; bottom: 8px; left: 10px;
  color: #ffd24a; text-shadow: 1px 1px 0 #000; font-size: 13px;
  pointer-events: none; min-height: 16px;
}

#hporb {
  position: absolute; top: 10px; left: 10px; width: 56px; height: 56px;
  border-radius: 50%; background: radial-gradient(circle at 35% 30%, #c0392b, #5a0f0a);
  border: 3px solid #2a2018; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: bold; text-shadow: 1px 1px 0 #000; font-size: 14px;
}
#region {
  position: absolute; top: 12px; right: 12px; color: #ffd24a;
  text-shadow: 1px 1px 0 #000; font-size: 14px; letter-spacing: 1px;
}
/* Pasek „Stany": aktywne buffy/debuffy z odliczaniem */
#buffs {
  position: absolute; top: 72px; left: 10px;
  display: flex; flex-wrap: wrap; gap: 4px; max-width: 220px;
}
.buff {
  display: flex; align-items: center; gap: 4px;
  background: rgba(20, 16, 10, 0.72); border: 1px solid #5a4a32; border-radius: 3px;
  padding: 2px 6px; font-size: 11px; color: #e8e2d0; text-shadow: 1px 1px 0 #000;
}
.buff-bad { border-color: #7a3a3a; }
.buff-soon { border-color: #c0392b; animation: buffpulse 1s infinite; }
@keyframes buffpulse { 50% { opacity: 0.45; } }
.bdot { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 3px rgba(0, 0, 0, 0.6); }
.btime { color: #b8b2a4; font-variant-numeric: tabular-nums; }

/* Miernik przychylności wiar — w przewodniku gusł (Perun ✶ ←|→ ✝ Krzyż) */
.faithrow { display: flex; align-items: center; gap: 6px; margin: 2px 0 3px; }
.faithrow .fold { color: #ffd24a; font-size: 14px; }
.faithrow .fnew { color: #cfd8e0; font-size: 14px; }
.faithbar {
  position: relative; flex: 1; height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, #b88a2a, #6a6056, #8aa0b8); border: 1px solid #000;
}
.faithmark {
  position: absolute; top: -3px; left: 50%; width: 4px; height: 10px; margin-left: -2px;
  background: #9a8c6a; border: 1px solid #000; border-radius: 1px;
  transition: left 0.4s, background 0.4s;
}
.faithstanding { color: #b8b2a4; font-size: 11px; margin-bottom: 4px; }
#banner {
  position: absolute; top: 38%; left: 0; right: 0; text-align: center;
  color: #ffd24a; font-size: 22px; text-shadow: 2px 2px 0 #000;
  pointer-events: none; transition: opacity 1s; letter-spacing: 1px;
}

/* ── Dialog ── */
#dialog {
  position: absolute; left: 8px; right: 8px; bottom: 8px;
  background: #211a12ee; border: 3px solid #6e5a40; padding: 12px;
}
#dlgname { color: #ffd24a; font-weight: bold; margin-bottom: 6px; }
/* długie kwestie przewijają się, opcje zostają zawsze widoczne pod spodem */
#dlglines { color: #e8e2d0; line-height: 1.5; margin-bottom: 10px; white-space: pre-wrap; max-height: 300px; overflow-y: auto; }
#dlgopts div { color: #8ad0ff; cursor: pointer; padding: 3px 0; }
#dlgopts div:hover { color: #ffd24a; }

/* ── Panel boczny ── */
/* wysokość spięta z #viewport — dłuższa zawartość zakładek przewija się,
   zamiast rozpychać cały układ */
#side { flex: none; width: 280px; height: 560px; padding: 6px; display: flex; flex-direction: column; }
#tabs { display: flex; gap: 3px; margin-bottom: 6px; }
#tabs button {
  flex: 1; padding: 7px 2px; background: #3a2e20; color: #b8a878;
  border: 2px solid #2a2018; font-family: inherit; font-size: 11px; cursor: pointer;
}
#tabs button.on { background: #6e5a40; color: #ffd24a; }
#logout { flex: 0 0 30px !important; color: #ff6a4a !important; font-size: 13px; }
#logout:hover { background: #6e2a1a !important; color: #ffd24a !important; }
.tab { display: none; overflow-y: auto; flex: 1; min-height: 0; }
.tab.on { display: block; }

/* sakwa */
#tab-inv { display: none; grid-template-columns: repeat(4, 1fr); gap: 4px; align-content: start; }
#tab-inv.on { display: grid; }
.slot {
  aspect-ratio: 1; background: #3a2e20; border: 2px solid #2a2018;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  position: relative;
}
.pricetag {
  position: absolute; right: 1px; bottom: 1px;
  background: #211a12e6; color: #ffd24a; font-size: 9px; line-height: 1;
  padding: 1px 2px; pointer-events: none;
}
.pricetag.notag { color: #6e5a40; }
/* znacznik przedmiotu instancjonowanego (np. matka pszczela z cechami) */
.instdot {
  position: absolute; left: 2px; top: 2px;
  width: 6px; height: 6px; border-radius: 50%;
  background: #ffd24a; box-shadow: 0 0 3px #ffd24a; pointer-events: none;
}
.slot:hover { border-color: #ffd24a; }
.slot canvas { width: 80%; height: 80%; image-rendering: pixelated; }

/* umiejętności */
.skillrow { padding: 6px 4px; border-bottom: 1px solid #3a2e20; cursor: pointer; }
.skillrow:hover .nm { color: #ffd24a; }
.skillrow .top { display: flex; align-items: center; gap: 6px; }
.skillrow .top canvas { width: 18px; height: 18px; image-rendering: pixelated; flex: none; }
.skillrow .nm { color: #e8e2d0; flex: 1; }
.skillrow .lv { color: #ffd24a; font-weight: bold; }
.skillrow .bar { height: 5px; background: #211a12; margin-top: 4px; }
.skillrow .bar i { display: block; height: 100%; background: #7a9a3a; }
.skilldetail { padding: 6px 4px 8px 8px; border-bottom: 1px solid #3a2e20; background: #211a1280; font-size: 11px; }
.skilldetail .xpinfo { color: #8ad0ff; margin-bottom: 6px; }
.skilldetail h5 { color: #b8a878; font-size: 10px; margin: 5px 0 2px; letter-spacing: 1px; }
.skilldetail .unl { line-height: 1.6; }
.unl-done { color: #7ad05a; }
.unl-next { color: #d9cfb0; }
.unl-secret { color: #8a8378; font-style: italic; }

/* zadania */
.questrow { padding: 7px 4px; border-bottom: 1px solid #3a2e20; cursor: pointer; }
.questrow.q-avail { color: #ff6a4a; }
.questrow.q-prog { color: #ffd24a; }
.questrow.q-done { color: #7ad05a; }
.questrow.q-lock { color: #6a6254; }
.qchips { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 4px 8px; }
.qchip { font-size: 10px; padding: 2px 7px; border: 1px solid #3a2e20; border-radius: 9px; color: #8a8070; cursor: pointer; user-select: none; }
.qchip.on { color: #ffd24a; border-color: #8a7148; }
.queststage { color: #d9cfb0; font-size: 11px; line-height: 1.5; padding: 4px; }
#qp { color: #8ad0ff; padding: 6px 4px; font-size: 11px; }

/* ── Kram, handel i skrzynia depozytowa ── */
#shop, #trade, #bank, #apiary {
  position: absolute; left: 50%; top: 18%; transform: translateX(-50%);
  width: 330px; background: #211a12f2; border: 3px solid #6e5a40; padding: 10px;
}
#trade { width: 420px; }
/* pasieka: pasek napełnienia kłody miodem */
.hivebar { height: 14px; background: #2a2018; border: 1px solid #5a4426; margin: 8px 0 4px; border-radius: 2px; overflow: hidden; }
.hivebarfill { height: 100%; background: linear-gradient(#ffd24a, #d8a02a); transition: width .3s; }
.hivecount { color: #e8e2d0; font-size: 12px; margin-bottom: 8px; }
#apiarybody button { background: #3a5a2a; color: #fff; border: 2px solid #2a2018; cursor: pointer; font-family: inherit; padding: 4px 10px; margin-top: 4px; }
#apiarybody button:hover:not(:disabled) { background: #4a7a32; }
#apiarybody button:disabled { background: #3a342a; color: #8a8378; cursor: default; }
#apiarybody button.rmqueen { background: #5a4426; display: block; margin-top: 6px; }
#apiarybody button.rmqueen:hover { background: #6e5430; }
.winhead { display: flex; justify-content: space-between; align-items: center; color: #ffd24a; font-weight: bold; margin-bottom: 8px; }
.winhead button { background: #3a2e20; color: #ff6a4a; border: 2px solid #2a2018; cursor: pointer; font-family: inherit; }
.winhint { color: #b8a878; font-size: 10px; margin-top: 8px; }
#shopstock, #bankstock { max-height: 360px; overflow-y: auto; }
#bankmoney { margin-top: 6px; color: #ffd24a; font-size: 12px; }
.shoprow { display: flex; align-items: center; gap: 8px; padding: 4px 2px; border-bottom: 1px solid #3a2e20; }
.shoprow canvas { width: 24px; height: 24px; image-rendering: pixelated; flex: none; }
.shoprow .nm { flex: 1; color: #e8e2d0; }
.shoprow .pr { color: #ffd24a; }
.shoprow button { background: #3a5a2a; color: #fff; border: 2px solid #2a2018; cursor: pointer; font-family: inherit; padding: 2px 8px; }
.shoprow button:hover { background: #4a7a32; }
#tradecols { display: flex; gap: 12px; }
#tradecols > div { flex: 1; min-width: 0; }
#tradecols h4 { color: #8ad0ff; font-size: 11px; margin-bottom: 4px; }
.offer { min-height: 64px; background: #181208; border: 2px solid #3a2e20; padding: 4px; display: flex; flex-wrap: wrap; gap: 3px; align-content: flex-start; }
.offer canvas { width: 26px; height: 26px; background: #3a2e20; image-rendering: pixelated; }
.trademoney { margin-top: 6px; color: #ffd24a; font-size: 12px; }
.trademoney input { width: 54px; background: #181208; color: #ffd24a; border: 2px solid #6e5a40; font-family: inherit; }
#tradestatus { color: #8ad0ff; min-height: 16px; margin-top: 6px; font-size: 11px; }
#tradeok { width: 100%; margin-top: 6px; padding: 8px; background: #3a5a2a; color: #ffd24a; border: 2px outset #4a7a32; cursor: pointer; font-family: inherit; }
#tradeok:hover { background: #4a7a32; }

/* ── Pieniądze i ekwipunek ── */
#money { grid-column: 1 / -1; color: #ffd24a; font-size: 12px; padding: 4px 2px; border-bottom: 1px solid #3a2e20; }
#equiprow { grid-column: 1 / -1; display: flex; gap: 4px; padding-bottom: 4px; border-bottom: 1px solid #3a2e20; }
.eqslot {
  width: 34px; height: 34px; background: #2c2418; border: 2px solid #2a2018;
  display: flex; align-items: center; justify-content: center;
  color: #6e5a40; font-size: 15px; cursor: default;
}
.eqslot.full { border-color: #6e5a40; cursor: pointer; }
.eqslot.full:hover { border-color: #ffd24a; }
.eqslot canvas { width: 80%; height: 80%; image-rendering: pixelated; }

/* ── Czat ── */
#chatbox { margin-top: 8px; padding: 6px; }
#chatlog { height: 110px; overflow-y: auto; padding: 2px 4px; line-height: 1.45; }
#chatlog .m-info { color: #e8e2d0; }
#chatlog .m-quest { color: #ffd24a; }
#chatlog .m-combat { color: #ff6a4a; }
#chatlog .m-chat { color: #ffd24a; }
#chatlog .m-chat b { color: #fff; }
#chatlog .m-sys { color: #9fd9a0; font-style: italic; }
#chatin { margin-top: 4px; font-size: 13px; }

/* ── Menu kontekstowe ── */
#ctx {
  position: fixed; background: #211a12; border: 2px solid #6e5a40;
  min-width: 160px; z-index: 50; box-shadow: 3px 3px 0 #000a;
}
#ctx .h { color: #8ad0ff; padding: 5px 8px; border-bottom: 1px solid #3a2e20; font-size: 11px; }
#ctx div.it { color: #e8e2d0; padding: 5px 8px; cursor: pointer; }
#ctx div.it:hover { background: #4a3b2a; color: #ffd24a; }
#ctx .tgt { color: #ffd24a; }
