/* Poprawione polskie litery: w Press Start 2P „ą ę Ą Ę” są zniekształcone, a wielkie „Ś Ć Ż” wyglądają
   jak małe — mamy własne, narysowane w tej samej siatce 8×8 (assets/pixibend-pl.ttf, skrypt
   assets/make-font-pl.py). Czcionka obejmuje tylko te znaki — reszta tekstu dalej jest w Press Start 2P. */
@font-face {
  font-family: 'PixiBend PL';
  src: url('data:font/ttf;base64,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') format('truetype'); /* PIXIBEND-PL */
  unicode-range: U+0104-0105, U+0106, U+0118-0119, U+015A, U+017B; /* ą ę Ą Ę + wielkie Ć Ś Ż */
  font-display: swap;
}

:root {
  --bg: #1b1d2b;
  --panel: #262a3d;
  --panel-edge: #3a4060;
  --text: #e9ecf5;
  --muted: #9aa1bd;
  --accent: #fcc419;
  --accent-dark: #c99a00;
  --danger: #ff6b6b;
  --font: 'PixiBend PL', 'Press Start 2P', ui-monospace, Menlo, monospace;

  /* wykresy: kolory z palety kategorycznej (wariant na ciemne tło), w stałej kolejności */
  --series-steps: #3987e5;    /* slot 1, niebieski */
  --series-placed: #d95926;   /* slot 2, pomarańczowy */
  --series-removed: #199e70;  /* slot 3, morski */
  --series-collected: #c98500; /* slot 4, żółty (zebrane przedmioty) */
  --chart-grid: rgba(255, 255, 255, 0.07);
  --chart-axis: rgba(255, 255, 255, 0.28);
  --chart-hover: rgba(255, 255, 255, 0.07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 10px;
  line-height: 1.6;
}

canvas { image-rendering: pixelated; image-rendering: crisp-edges; }

/* ---------- układ ---------- */

.topbar { padding: 16px; text-align: center; display: flex; align-items: center; justify-content: center; gap: 16px; position: relative; }
/* nazwa świata i menu gry tylko na ekranie świata */
.topbar__world, .topnav { display: none; }

/* ---------- wybór języka: flaga, po kliknięciu lista ---------- */
.topbar__lang { margin-left: 12px; }
body:not(.world-mode) .topbar__lang { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); }
.topbar { position: relative; }
.lang { position: relative; display: inline-block; line-height: 0; }
.lang canvas { width: 32px; height: 22px; image-rendering: pixelated; display: block; }
.lang__current {
  padding: 2px;
  background: #000;
  border: 2px solid var(--panel-edge);
  cursor: pointer;
}
.lang__current:hover, .lang.is-open .lang__current { border-color: var(--accent); }
.lang__list {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: var(--panel);
  border: 3px solid var(--panel-edge);
  box-shadow: 3px 3px 0 #000;
}
.lang.is-open .lang__list { display: flex; }
.lang__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  font: inherit;
  font-size: 9px;
  line-height: 1;
  color: var(--text);
  background: var(--bg);
  border: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.lang__item canvas { width: 24px; height: 16px; }
.lang__item:hover { border-color: var(--muted); }
.lang__item.is-current { border-color: var(--accent); color: var(--accent); }
.splash__lang { position: fixed; right: 16px; bottom: 16px; }
.splash__lang .lang__list { top: auto; bottom: calc(100% + 6px); }

/* ---------- ekran startowy: duże logo PIXIBEND ---------- */
body.splash-mode .topbar { display: none; } /* logo jest na środku, nie w belce */
.splash {
  min-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  cursor: pointer;
  user-select: none;
}
.splash__logo {
  /* 1 piksel logo = 6 px ekranu (na wąskim — mniej); ostre krawędzie */
  width: min(92vw, calc(136px * 6));
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35));
  animation: splash-float 3s ease-in-out infinite;
}
@keyframes splash-float { 50% { transform: translateY(-6px); } }
.splash__tagline { margin: 0; font-size: 10px; color: var(--muted); letter-spacing: 1px; }
.splash__hero { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 10px; }
.splash__player { width: 64px; height: 64px; image-rendering: pixelated; }
.splash__player[hidden] { display: none; }
.splash__hello { margin: 0; font-size: 10px; color: var(--accent); overflow-wrap: anywhere; }
.splash__hint { margin: 12px 0 0; font-size: 9px; color: var(--text); animation: splash-blink 1.2s steps(2) infinite; }
@keyframes splash-blink { 50% { opacity: 0.35; } }
.logo { margin: 0; font-size: 18px; color: var(--accent); letter-spacing: 2px; text-shadow: 3px 3px 0 #000; }

#app { max-width: 880px; margin: 0 auto; padding: 0 16px 32px; }

.screen__title { font-size: 12px; text-align: center; margin: 8px 0 20px; }

.panel {
  background: var(--panel);
  border: 4px solid var(--panel-edge);
  box-shadow: 4px 4px 0 #000;
  padding: 16px;
}

/* ---------- przyciski i pola ---------- */

.btn {
  font: inherit;
  color: var(--text);
  background: var(--panel-edge);
  border: none;
  padding: 10px 14px;
  cursor: pointer;
  box-shadow: inset -3px -3px 0 rgba(0,0,0,.35), 2px 2px 0 #000;
}
.btn:hover:not(:disabled) { filter: brightness(1.2); }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: inset -3px -3px 0 rgba(0,0,0,.35); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn--primary { background: var(--accent); color: #1b1d2b; }
.btn--icon { padding: 6px 8px; }

.input {
  font: inherit;
  width: 100%;
  padding: 10px;
  color: var(--text);
  background: var(--bg);
  border: 3px solid var(--panel-edge);
  outline: none;
}
.input:focus { border-color: var(--accent); }
.input--error { border-color: var(--danger); }

.field { display: block; margin-bottom: 14px; }
.field__label { display: block; margin-bottom: 6px; color: var(--muted); }
.field__error { display: block; min-height: 16px; margin-top: 4px; color: var(--danger); font-size: 8px; }
.field--disabled { opacity: .35; }

/* ---------- ekran personalizacji ---------- */

.cust__layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  align-items: start;
}

.cust__preview { text-align: center; position: sticky; top: 16px; }
.cust__big {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  background:
    repeating-conic-gradient(#2e3349 0 25%, #2a2e42 0 50%) 0 0 / 28px 28px;
}
.cust__name-tag { margin-top: 12px; color: var(--accent); min-height: 16px; word-break: break-all; }
.cust__small { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 12px; color: var(--muted); font-size: 8px; }
.cust__small canvas { background: #5c9e3d; max-width: 100%; height: auto; }

.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 3px solid #000;
  cursor: pointer;
}
.swatch.is-selected { outline: 3px solid var(--accent); outline-offset: 1px; }
.swatch:disabled { cursor: not-allowed; }

.cycler { display: flex; align-items: center; gap: 8px; }
.cycler__value { min-width: 110px; text-align: center; }

.cust__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.cust__actions .btn--primary { margin-left: auto; }

/* ---------- świat ---------- */

.world__panel { max-width: 760px; margin: 0 auto; position: relative; }

/* ---------- okno dialogowe ---------- */

.modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 11, 20, 0.75);
}
.modal[hidden] { display: none; }
.modal__box { width: 100%; max-width: 420px; }
.modal__title { margin: 0 0 16px; font-size: 12px; color: var(--accent); }
.modal__warn { color: var(--danger); font-size: 8px; margin: 0 0 16px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; }

.sizes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.size { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.size small { font-size: 8px; color: var(--muted); }
.size.is-selected { outline: 3px solid var(--accent); outline-offset: 1px; }
.world__hud { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.world__name { color: var(--accent); }
.world__info { color: var(--muted); }
/* rozmiar canvasa (CSS) ustawia world.js → fitView, zawsze jako całkowita wielokrotność 16 px */
.world__canvas { display: block; border: 4px solid #000; background: #000; }
.world__bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.world__hud-gap { flex: 1; } /* odstęp w HUD (komunikaty są w dymkach na planszy) */

.hotbar {
  /* 15 kafelków = 2 rzędy po 8/7; na wąskim ekranie rzędy po 5 */
  display: grid;
  grid-template-columns: repeat(8, auto);
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}
@media (max-width: 480px) {
  .hotbar { grid-template-columns: repeat(5, auto); }
}
.hotbar__slot {
  position: relative;
  padding: 4px;
  background: var(--bg);
  border: 3px solid var(--panel-edge);
  cursor: pointer;
  line-height: 0;
}
.hotbar__slot canvas { width: 48px; height: 48px; }
.hotbar__slot:hover { border-color: var(--muted); }
.hotbar__slot.is-selected { border-color: var(--accent); }
.hotbar__key {
  position: absolute;
  left: 2px;
  top: 2px;
  font-size: 8px;
  line-height: 1;
  color: #fff;
  text-shadow: 1px 1px 0 #000;
}

.touch { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; } /* dłuższe napisy (DE) zawijają się */

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 36px);
  grid-template-rows: repeat(2, 32px);
  gap: 4px;
  touch-action: none;
  user-select: none;
}
.dpad .btn { padding: 0; }
.dpad__up { grid-column: 2; grid-row: 1; }
.dpad__left { grid-column: 1; grid-row: 2; }
.dpad__down { grid-column: 2; grid-row: 2; }
.dpad__right { grid-column: 3; grid-row: 2; }

/* krzyżak i przyciski akcji tylko na ekranach dotykowych (na komputerze cały dolny rząd znika) */
@media (hover: hover) and (pointer: fine) {
  .touch, .world__bottom { display: none; }
}

/* ---------- telefon ---------- */

@media (max-width: 640px) {
  .cust__layout { grid-template-columns: 1fr; }
  .cust__preview { position: static; }
  .cust__big { width: 168px; height: auto; }
}

/* ---------- statystyki ---------- */

.modal--fixed { position: fixed; z-index: 10; overflow-y: auto; align-items: flex-start; }
.stats { max-width: 720px; }
.stats__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stats__head .modal__title { margin: 0; }
.muted { color: var(--muted); }

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 16px 0;
}
.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: var(--bg);
  border: 3px solid var(--panel-edge);
  min-width: 0;
}
.stat-tile__label { color: var(--muted); font-size: 8px; }
.stat-tile__value {
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;           /* długie słowo przechodzi pod ikonkę w całości, zamiast łamać się w środku */
  align-items: center;
  gap: 6px;
  overflow-wrap: break-word; /* łamie tylko słowo, które nie mieści się nawet w pustej linii */
}
.stat-tile__sub { color: var(--muted); font-size: 7px; line-height: 1.5; }
.stat-tile__icon { width: 24px; height: 24px; flex: none; }

.stats__bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.stats__bar .field__label { margin: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font: inherit;
  font-size: 8px;
  color: var(--text);
  background: var(--bg);
  border: 3px solid var(--panel-edge);
  padding: 6px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip:hover { border-color: var(--muted); }
.chip.is-selected { border-color: var(--accent); }
.chip__auto { font-size: 6px; color: var(--bg); background: var(--muted); padding: 2px 3px; }

.insights { margin: 12px 0; padding-left: 16px; color: var(--text); font-size: 8px; line-height: 2; }

.charts { position: relative; }
.chart { margin-top: 8px; }
.chart__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 8px; }
.chart__title { color: var(--text); }
.chart__legend { display: flex; gap: 12px; color: var(--muted); }
.legend__item { display: inline-flex; align-items: center; gap: 6px; }
.legend__swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; }
.chart__plot svg { display: block; font-family: var(--font); font-size: 7px; touch-action: pan-y; }

.chart-tip {
  position: absolute;
  transform: translate(-50%, calc(-100% - 6px));
  pointer-events: none;
  background: #0f1019;
  border: 2px solid var(--panel-edge);
  padding: 8px 10px;
  font-size: 8px;
  white-space: nowrap;
  z-index: 2;
}
.chart-tip[hidden] { display: none; }
.chart-tip__title { color: var(--text); margin-bottom: 6px; }
.chart-tip__row { display: flex; align-items: center; gap: 6px; color: var(--muted); line-height: 1.8; }
.chart-tip__row b { margin-left: auto; padding-left: 12px; color: var(--text); font-weight: normal; }

.stats__table { margin-top: 14px; font-size: 8px; }
.stats__table summary { cursor: pointer; color: var(--muted); }
.table-wrap { max-height: 220px; overflow: auto; margin-top: 8px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--panel-edge); }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table th { color: var(--muted); font-weight: normal; position: sticky; top: 0; background: var(--panel); }

.stats__foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; font-size: 8px; color: var(--muted); }
.btn.is-armed { background: var(--danger); color: #1b1d2b; }

@media (max-width: 640px) {
  .stat-tiles { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- etap 6: widok mapy, minimapa, dymek tabliczki ---------- */

.world__view { display: flex; justify-content: center; }
.world__stage { position: relative; line-height: 0; } /* minimapa, dymek i baner przyklejone do canvasa */
.world__stage .bubble, .world__stage .achievement-banner, .world__stage .notice { line-height: 1.8; }

.minimap {
  position: absolute;
  top: 10px;
  right: 10px;
  max-width: 35%;
  height: auto;
  border: 3px solid #000;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
  opacity: 0.92;
  pointer-events: none;
}
.minimap[hidden] { display: none; }

.bubble {
  position: absolute;
  transform: translate(-50%, -100%);
  max-width: 260px;
  padding: 8px 10px;
  background: #fff8e6;
  color: #2b1d0e;
  border: 3px solid #1a1a2e;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.45);
  font-size: 8px;
  line-height: 1.7;
  text-align: center;
  word-break: break-word;
  pointer-events: none;
}
.bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -9px;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1a1a2e;
  border-bottom: 0;
}
.bubble[hidden] { display: none; }
.bubble--empty { color: #7a6a55; font-style: italic; }

.field__counter { display: block; text-align: right; color: var(--muted); font-size: 8px; margin-top: 4px; }
.modal__hint { font-size: 8px; line-height: 1.8; margin: 0 0 16px; }

/* ---------- etap 8: okno potwierdzenia ---------- */

.confirm__lines { margin: 0 0 14px; padding-left: 16px; font-size: 8px; line-height: 2; color: var(--text); }

/* ---------- etap 9: osiągnięcia, baner, przyciski cofania ---------- */

.ach-grid {
  list-style: none;
  margin: 8px 0 16px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.ach {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  background: var(--bg);
  border: 3px solid var(--panel-edge);
  opacity: 0.75;
  min-width: 0;
}
/* --tier = kolor medalu najwyższego zdobytego poziomu (brąz → diament) */
.ach--done { border-color: var(--tier, var(--accent)); opacity: 1; }
.ach__head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ach__label { font-size: 8px; color: var(--text); min-width: 0; }
.ach--done .ach__label { color: var(--tier, var(--accent)); }
.ach__pips { display: flex; gap: 2px; flex: none; }
.ach__pips i { display: block; width: 6px; height: 6px; border: 1px solid var(--panel-edge); background: transparent; }
.ach__pips i.is-on { border-color: #000; }
.ach--max { box-shadow: inset 0 0 0 1px var(--tier); }
.ach__desc { font-size: 7px; color: var(--muted); line-height: 1.6; }
.ach__state { font-size: 7px; color: var(--muted); }
.ach__bar { display: block; height: 6px; background: var(--panel-edge); }
.ach__bar i { display: block; height: 100%; background: var(--tier, var(--muted)); }

/* ---------- koszyk z towarem: lewy górny róg planszy ---------- */
.carry {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  max-width: 34%;
  padding: 4px 8px 4px 4px;
  color: #f8f9fa;
  background: rgba(20, 21, 36, 0.82);
  border: 2px solid #000;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  font-size: 8px;
  line-height: 1;
}
.carry canvas { width: 24px; height: 24px; image-rendering: pixelated; }
.carry canvas.carry__goods { width: 18px; height: 18px; }
.carry__count { color: var(--accent); }
.carry__item { display: inline-flex; align-items: center; gap: 2px; }
.carry.is-empty .carry__count { color: var(--muted); }
.carry.is-full { border-color: #fd7e14; }
.carry.is-full .carry__count { color: #fd7e14; }
.world__stage .carry { line-height: 1; }
@media (max-width: 640px) {
  .carry { top: 8px; left: 8px; max-width: calc(100% - 128px); }
  .carry canvas { width: 16px; height: 16px; }
  .carry canvas.carry__goods { width: 14px; height: 14px; }
}

/* ---------- komunikaty: dymki u góry planszy (pod nimi gra toczy się dalej) ---------- */
.notices {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 240px); /* nie wchodzą na minimapę (prawy górny róg) */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 3;
  pointer-events: none;
}
.notice {
  padding: 7px 12px;
  color: #f8f9fa;
  background: rgba(20, 21, 36, 0.9);
  border: 2px solid #000;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 2px 2px 0 rgba(0, 0, 0, 0.5);
  font-size: 9px;
  line-height: 1.7;
  text-align: center;
  animation: notice-in 0.2s ease-out;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.notice.is-leaving { opacity: 0; transform: translateY(-4px); }
@keyframes notice-in { from { opacity: 0; transform: translateY(-6px); } }
@media (max-width: 640px) {
  /* telefon: dymki po lewej, obok minimapy */
  .notices { top: 44px; left: 8px; transform: none; align-items: flex-start; max-width: calc(100% - 128px); }
  .notice { font-size: 8px; padding: 6px 8px; }
}

.achievement-banner {
  position: static;
  padding: 10px 14px;
  background: #1b1d2b;
  border: 3px solid var(--tier, var(--accent));
  box-shadow: 3px 3px 0 #000;
  font-size: 8px;
  line-height: 1.8;
  text-align: center;
  z-index: 3;
  pointer-events: none;
  animation: banner-in 0.25s ease-out;
}
.achievement-banner b { display: block; color: var(--tier, var(--accent)); font-weight: normal; }
.achievement-banner[hidden] { display: none; }
@keyframes banner-in { from { transform: translateY(-12px); opacity: 0; } }

.world__time {
  color: var(--muted);
  font: inherit;
  background: none;
  border: 0;
  border-bottom: 2px dotted var(--panel-edge);
  padding: 0 0 2px;
  cursor: pointer;
}
.world__time:hover, .world__time:focus-visible { color: var(--text); border-bottom-color: var(--accent); outline: none; }

/* ---------- okno "Pogoda i pora dnia" ---------- */
.world__panel > .modal .climate { max-width: 560px; max-height: 100%; overflow-y: auto; }
.climate__now-label { font-size: 8px; color: var(--accent); margin: 0 0 14px; line-height: 1.6; }
.climate__group { margin-bottom: 14px; }
.climate__title { font-size: 9px; font-weight: normal; margin: 0 0 8px; }
.climate__row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.climate__item { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.climate__now {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 8px; padding: 8px 4px; min-width: 0; overflow-wrap: anywhere;
}
.climate__icon { font-size: 20px; line-height: 1; }
.climate__now.is-selected { outline: 3px solid var(--accent); outline-offset: 1px; }
.climate__item.is-off .climate__now:not(.is-selected) { opacity: 0.45; }
.climate__cycle { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 7px; color: var(--muted); cursor: pointer; }
.climate__cycle input { margin: 0; accent-color: var(--accent); }
.climate__cycle input:disabled { cursor: not-allowed; }
.climate__fog { justify-content: flex-start; margin-top: 8px; }
.climate__note { font-size: 7px; line-height: 1.7; margin: 6px 0 0; }
.climate__actions { flex-wrap: wrap; }
@media (max-width: 480px) {
  .climate__row { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- obrót planszy (w HUD): ◀ ▲ Pn ▶ ---------- */
.rotate { display: inline-flex; align-items: center; gap: 4px; }
.rotate__btn {
  font: inherit;
  font-size: 8px;
  line-height: 1;
  padding: 3px 5px;
  color: var(--text);
  background: var(--bg);
  border: 2px solid var(--panel-edge);
  cursor: pointer;
}
.rotate__btn:hover { border-color: var(--accent); color: var(--accent); }
.rotate__north { min-width: 52px; text-align: center; color: var(--accent); font-size: 8px; }

@media (max-width: 640px) {
  .ach-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- etap 10: portal i lista światów ---------- */

.portal-box { max-width: 560px; }
.portal__hint { font-size: 8px; line-height: 1.8; margin: 0 0 12px; }
.portal__list { list-style: none; margin: 0 0 14px; padding: 0; max-height: 320px; overflow-y: auto; }
.portal__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  margin-bottom: 6px;
  background: var(--bg);
  border: 3px solid var(--panel-edge);
}
.portal__item.is-current { border-color: #9775fa; }
.portal__info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.portal__name { color: var(--text); font-size: 10px; overflow-wrap: anywhere; }
.portal__meta { color: var(--muted); font-size: 7px; line-height: 1.6; }
.portal__buttons { display: flex; align-items: center; gap: 6px; flex: none; }
.portal__here { color: #b197fc; font-size: 8px; }
.portal__item.is-editing { border-color: var(--accent); }
.portal__item.is-editing .portal__info { flex: 1; }
.portal__rename { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.portal__rename .input { flex: 1 1 160px; min-width: 0; }
.portal__rename .field__error { flex-basis: 100%; min-height: 0; margin: 0; }
.portal__actions { align-items: center; flex-wrap: wrap; }
.portal__count { margin-right: auto; font-size: 8px; }
/* wykres aktywności świata (ostatnie 14 dni) */
.portal-box { position: relative; }
.portal__activity { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.portal__activity svg { display: block; overflow: visible; }
.portal__axis { stroke: var(--chart-axis); stroke-width: 1; }
.portal__bar { fill: var(--series-steps); }
.portal__hit { fill: transparent; cursor: default; }
.portal__hit.is-hover { fill: var(--chart-hover); }
.portal__activity-label { color: var(--muted); font-size: 7px; line-height: 1.4; }
.portal__tip {
  position: absolute; z-index: 2; pointer-events: none; white-space: nowrap;
  background: #11131f; color: var(--text); border: 2px solid var(--panel-edge); padding: 4px 6px; font-size: 7px;
}
.portal__tip[hidden] { display: none; }

/* ---------- etap 11: skarby w HUD ---------- */
.world__treasure { color: #ffd43b; }

/* ---------- etap 11: kolekcja w statystykach ---------- */
.stat-tiles { grid-template-columns: repeat(5, 1fr); }
.collection { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 16px; }
.coll__icon { image-rendering: pixelated; }
.coll { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.coll__row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: center;
  padding: 4px 8px;
  background: var(--bg);
  border: 3px solid var(--panel-edge);
}
.coll__row--none { opacity: 0.45; }
.coll__icon { grid-row: 1 / 3; width: 32px; height: 32px; }
.coll__label { font-size: 8px; color: var(--text); }
.coll__count { font-size: 10px; color: var(--accent); text-align: right; }
.coll__detail { grid-column: 2 / 4; font-size: 7px; color: var(--muted); }
@media (max-width: 640px) {
  .stat-tiles { grid-template-columns: repeat(2, 1fr); }
  .collection { grid-template-columns: 1fr; }
}

/* ---------- ekran świata na całe okno ---------- */
/* panel gry sięga do samego dołu okna: bez marginesu strony, dolnej ramki i cienia pod spodem */
body.world-mode { display: flex; flex-direction: column; }
body.world-mode #app { max-width: none; padding: 0 12px; flex: 1; display: flex; flex-direction: column; width: 100%; box-sizing: border-box; }
body.world-mode .screen.world { flex: 1; display: flex; flex-direction: column; }
body.world-mode .world__panel { flex: 1; width: 100%; box-sizing: border-box; }
body.world-mode .topbar { padding: 6px 12px; justify-content: flex-start; }
body.world-mode .logo { font-size: 12px; text-shadow: 2px 2px 0 #000; white-space: nowrap; flex: none; }
/* kolorowe logo z ekranu startowego (assets/pixibend-logo.svg): wysokość w całych pikselach logo (27 = 1×, 54 = 2×), żeby piksele były równe */
.logo { line-height: 0; }
.logo__img { display: block; height: 54px; width: auto; image-rendering: pixelated; }
body.world-mode .logo__img { height: 27px; }
@media (max-width: 480px) { .logo__img { height: 27px; } }
/* przy 7 pozycjach menu: rozmiar i ziarno świata chowamy już poniżej 1180 px, żeby nazwa się mieściła */
@media (max-width: 1180px) {
  body.world-mode .topbar__world small { display: none; }
}
body.world-mode .world__panel {
  max-width: none; padding: 10px 12px 8px; border-bottom: 0; box-shadow: 4px 0 0 #000;
}
@media (max-width: 640px) {
  body.world-mode #app { padding: 0 6px; }
  body.world-mode .world__panel { padding: 8px 8px 6px; }
}

/* ---------- telefon: więcej miejsca na mapę ---------- */
@media (max-width: 640px) {
}

/* ---------- pasek kafelków na ekranie świata: zawsze jeden rząd ---------- */
/* Rozmiar ikonek zależy od szerokości samego paska (container query), nie okna:
   48 px (2× ikonki 24 px) gdy wszystko się mieści, 36 px gdy ciasno,
   a gdy i to za mało (telefon) — pasek przewija się palcem w bok. */
body.world-mode .hotbar {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start; /* nie "center" z ogólnej reguły — przy przewijaniu ucinałoby początek */
  gap: 4px;
  margin: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
body.world-mode .hotbar__slot {
  flex: none; padding: 2px; border-width: 2px;
  background: rgba(26, 26, 46, 0.55);
  border-color: rgba(255, 255, 255, 0.18);
}
body.world-mode .hotbar__slot:hover { border-color: rgba(255, 255, 255, 0.5); }
body.world-mode .hotbar__slot.is-selected { border-color: var(--accent); background: rgba(26, 26, 46, 0.8); }
/* marginesy "auto" centrują rząd, a przy przewijaniu nie ucinają pierwszej ikonki
   (w przeciwieństwie do justify-content: center) */
body.world-mode .hotbar__slot:first-child { margin-left: auto; }
body.world-mode .hotbar__slot:last-child { margin-right: auto; }
body.world-mode .hotbar__slot canvas { width: 48px; height: 48px; }
/* 18 × (48 + 4 + 4) + 17 × 4 + dok (2×6 + 2×2) + odstęp od krawędzi mapy ≈ 1120 px */
@container map (max-width: 1120px) {
  body.world-mode .hotbar__slot canvas { width: 36px; height: 36px; }
}

/* ---------- dok: pasek kafelków (i paleta kolorów) na dole mapy, na półprzezroczystym tle ---------- */
.world__view { container: map / inline-size; } /* szerokość obszaru mapy — od niej zależy rozmiar ikonek */
.world__stage { overflow: hidden; }            /* obcina ułamek piksela pod dolną krawędzią okna */
.world__dock {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 24px);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  background: rgba(10, 10, 22, 0.45);
  border: 2px solid rgba(0, 0, 0, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  line-height: 0;
  z-index: 2;
}
body.world-mode .world__dock .palette { margin: 0; }
@media (max-width: 640px) {
  .world__dock { bottom: 6px; padding: 4px; max-width: calc(100% - 12px); }
}

/* komputer: mapa do samej dolnej krawędzi okna — bez dolnej ramki i odstępu panelu */
@media (hover: hover) and (pointer: fine) {
  body.world-mode .world__panel { padding-bottom: 0; }
  body.world-mode .world__canvas { border-bottom-width: 0; }
}

/* ---------- okno "Pomoc" ---------- */
.help { max-width: 620px; }
.help__groups { display: grid; gap: 14px; margin-bottom: 12px; }
.help__group h4 { margin: 0 0 6px; font-size: 9px; font-weight: normal; color: var(--accent); }
.help__group dl {
  display: grid;
  grid-template-columns: 160px 1fr; /* ta sama szerokość we wszystkich grupach — kolumny się równają */
  gap: 6px 14px;
  margin: 0;
  font-size: 8px;
  line-height: 1.7;
}
.help__group dt { color: var(--text); white-space: nowrap; }
.help__group dd { margin: 0; color: var(--muted); }
.help__touch { font-size: 7px; line-height: 1.8; margin: 0 0 14px; }
.help__again { margin-right: auto; font-size: 7px; }
.help .modal__actions { align-items: center; flex-wrap: wrap; }
/* długie okno pomocy na niskim ekranie: przewija się, zamiast wychodzić poza mapę */
.world__panel > .modal { overflow-y: auto; z-index: 10; } /* okna nad mapą, dokiem i minimapą */
.world__panel > .modal .help { max-height: 100%; overflow-y: auto; }
@media (max-width: 640px) {
  .help__group dl { grid-template-columns: 1fr; gap: 2px; }
  .help__group dd { margin-bottom: 6px; }
}

/* ---------- statystyki w zakładkach ---------- */
/* Okno ma stałą wysokość: nagłówek, zakładki i stopka zawsze widoczne, przełącza się tylko treść.
   (Przewija się najwyżej treść jednej zakładki na bardzo niskim ekranie.) */
.modal--fixed { align-items: center; }
.stats {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 760px;
  height: min(720px, calc(100vh - 32px));
  margin: 0 auto;
}
.stats__head, .tabs, .stats__foot { flex: none; }
.stats__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 2px 2px;
}
.tabpanel[hidden] { display: none; }
.stats .stat-tiles { margin-top: 0; }
.coll-total { margin: 0 0 8px; font-size: 8px; }
.stats .ach-grid {
  margin-top: 0;
  /* 18 osiągnięć: węższe karty po 4 w rzędzie, żeby zakładka mieściła się bez przewijania */
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
}
.stats .ach { padding: 6px 8px; gap: 4px; }

.tabs {
  display: flex;
  gap: 4px;
  margin-top: 14px;
  border-bottom: 3px solid var(--panel-edge);
  overflow-x: auto;
}
.tab {
  font: inherit;
  font-size: 9px;
  color: var(--muted);
  background: transparent;
  border: 3px solid transparent;
  border-bottom: none;
  margin-bottom: -3px; /* aktywna zakładka "łączy się" z treścią */
  padding: 9px 12px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  color: var(--accent);
  background: var(--panel);
  border-color: var(--panel-edge);
  border-bottom: 3px solid var(--panel);
}
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
.tab__badge { font-size: 7px; color: var(--muted); }
.tab__badge:empty { display: none; }
.stats__foot { margin-top: 10px; padding-top: 10px; border-top: 3px solid var(--panel-edge); }

.tab__label--short { display: none; }
@media (max-width: 640px) {
  .stats { height: calc(100vh - 16px); }
  /* telefon: 4 równe zakładki z krótkimi nazwami, bez liczników — wszystkie widać naraz */
  .tabs { display: grid; grid-template-columns: repeat(4, 1fr); overflow: visible; gap: 2px; }
  .tab { justify-content: center; padding: 8px 2px 7px; font-size: 8px; }
  .tab__label { display: none; }
  .tab__label--short { display: inline; }
  .tab__badge { display: none; }
}

/* ---------- paleta bloków (w doku nad paskiem, tylko gdy wybrany blok): faktury + kolory ---------- */
.palette {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.palette[hidden] { display: none; }
.palette__textures, .palette__colors { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; }
.palette__texture {
  padding: 0;
  line-height: 0;
  cursor: pointer;
  border: 2px solid #000;
  background: #000;
}
.palette__texture canvas { width: 32px; height: 32px; image-rendering: pixelated; }
.palette__texture:hover { transform: translateY(-1px); }
.palette__texture.is-selected { outline: 3px solid var(--accent); outline-offset: 1px; }

/* ---------- nasiona (w doku nad paskiem, gdy wybrana jest grządka) ---------- */
.seeds { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
.seeds[hidden] { display: none; }
.seeds__item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px 2px 4px;
  font: inherit;
  font-size: 7px;
  line-height: 1;
  color: var(--text);
  background: rgba(26, 26, 46, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
}
.seeds__item canvas { width: 16px; height: 24px; image-rendering: pixelated; }
.seeds__item:hover { border-color: rgba(255, 255, 255, 0.5); }
.seeds__item.is-selected { border-color: var(--accent); color: var(--accent); }
.palette__swatch {
  width: 24px;
  height: 24px;
  padding: 0;
  cursor: pointer;
  border: 2px solid #000;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.55) 0 22%, transparent 22% 100%),
    var(--swatch);
  box-shadow: inset -3px -3px 0 rgba(0,0,0,0.25);
}
.palette__swatch:hover { transform: translateY(-1px); }
.palette__swatch.is-selected { outline: 3px solid var(--accent); outline-offset: 1px; }

/* ---------- górna belka na ekranie świata: logo · nazwa świata · menu ---------- */
body.world-mode .topbar__world {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  flex: 0 0 auto;      /* sama nazwa (bez rozmiaru i ziarna) — nie ściska się do kilku liter */
  max-width: 26vw;
  font-size: 9px;
  white-space: nowrap;
  overflow: hidden;
}
.topbar__world b { color: var(--text); font-weight: normal; overflow: hidden; text-overflow: ellipsis; }
.topbar__world small { color: var(--muted); font-size: 7px; }
body.world-mode .topnav { display: block; margin-left: auto; }
.topnav__item.is-off { text-decoration: line-through; opacity: 0.6; } /* dźwięk wyciszony */
.topnav__items { display: flex; align-items: center; gap: 2px; }
.topnav__item {
  font: inherit;
  font-size: 9px;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 8px 10px 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.topnav__item:hover, .topnav__item:focus-visible { color: var(--accent); border-bottom-color: var(--accent); outline: none; }
.topnav__item kbd {
  font: inherit;
  font-size: 7px;
  color: var(--bg);
  background: var(--muted);
  padding: 2px 4px;
}
.topnav__toggle { display: none; }

/* wąsko: menu zwinięte pod przycisk "Menu", nazwa świata bez rozmiaru i ziarna */
@media (max-width: 900px) {
  .topbar__world small { display: none; }
  .topnav__toggle {
    display: inline-block;
    font: inherit;
    font-size: 9px;
    color: var(--text);
    background: var(--panel-edge);
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    box-shadow: inset -2px -2px 0 rgba(0,0,0,.35);
  }
  .topnav { position: relative; }
  .topnav__items {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    flex-direction: column;
    align-items: stretch;
    min-width: 170px;
    padding: 6px;
    background: var(--panel);
    border: 3px solid var(--panel-edge);
    box-shadow: 4px 4px 0 #000;
  }
  .topnav.is-open .topnav__items { display: flex; }
  .topnav__item { justify-content: space-between; padding: 10px; border-bottom: none; }
  .topnav__item:hover, .topnav__item:focus-visible { background: var(--bg); }
}

/* ---------- sklep: zamknięte kafelki na pasku, sprzęt w doku, okno sklepu ---------- */
.hotbar__slot { position: relative; }
.hotbar__lock { display: none; position: absolute; right: 1px; top: 1px; font-size: 9px; line-height: 1; }
.hotbar__slot.is-locked canvas { opacity: 0.35; filter: grayscale(0.8); }
.hotbar__slot.is-locked .hotbar__lock { display: block; }

.gearbar { display: flex; gap: 4px; justify-content: center; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.gearbar[hidden] { display: none; }
.gearbar__item {
  background: rgba(26, 26, 46, 0.65); border: 2px solid var(--panel-edge); padding: 3px; cursor: pointer; line-height: 0;
}
.gearbar__item canvas { width: 24px; height: 24px; image-rendering: pixelated; }
.gearbar__item.is-selected { border-color: var(--accent); background: rgba(26, 26, 46, 0.85); }
.gearbar__key { position: static; margin-left: 2px; }

.shop-modal { padding: 8px; }
.shop-modal .shop {
  width: min(1240px, 100%); max-width: none; max-height: calc(100vh - 16px); overflow-y: auto;
  display: flex; flex-direction: column; padding: 10px 16px;
}
.shop .modal__hint { margin-bottom: 6px; }
.shop__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.shop__head .modal__title { margin-bottom: 8px; }
.shop__wallet { font-size: 10px; color: var(--accent); }
.shop__group { margin-bottom: 6px; }
.shop__group[hidden] { display: none; }
.shop__group .shop__title { display: none; } /* nazwa działu jest na zakładce */
.shop__tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; border-bottom: 3px solid var(--panel-edge); }
.shop__tab {
  font: inherit; font-size: 8px; color: var(--muted); background: none; cursor: pointer;
  border: 3px solid transparent; border-bottom: 0; padding: 7px 10px 6px; margin-bottom: -3px;
}
.shop__tab:hover { color: var(--text); }
.shop__tab.is-selected { color: var(--accent); border-color: var(--panel-edge); background: var(--panel); }
.shop__title { font-size: 9px; font-weight: normal; margin: 0 0 6px; }
.shop__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px; }
.shop__item {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center;
  border: 3px solid var(--panel-edge); padding: 5px 8px; background: rgba(0, 0, 0, 0.12);
}
.shop__icon { width: 32px; height: auto; max-height: 32px; object-fit: contain; image-rendering: pixelated; justify-self: center; }
.shop__text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.shop__text b { font-weight: normal; font-size: 8px; }
.shop__text small { font-size: 7px; line-height: 1.5; color: var(--muted); }
/* opis najwyżej w 2 linijkach (pełny — w podpowiedzi po najechaniu), żeby cały sklep mieścił się na ekranie */
.shop__desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.shop__buy { font-size: 7px; padding: 6px 8px; white-space: nowrap; }
.shop__item.is-owned, .shop__item.has-stock { border-color: #2f9e44; }
.shop__item.is-owned .shop__buy { color: #69db7c; }
.shop__item.is-poor .shop__buy { opacity: 0.6; }
.shop__foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 2px; }
.shop__message { flex: 1; min-height: 1em; font-size: 8px; color: #69db7c; margin: 0; line-height: 1.6; }
.shop__message.is-error { color: var(--danger); }
@media (max-width: 480px) {
  .shop__list { grid-template-columns: 1fr; }
}
.hotbar__count {
  position: absolute; right: 2px; bottom: 2px; font-size: 7px; line-height: 1; color: #fff;
  text-shadow: 1px 1px 0 #000; background: rgba(26, 26, 46, 0.7); padding: 1px 2px;
}
.hotbar__count[hidden] { display: none; }
.shop__text .shop__have { color: #69db7c; }
.shop__text .shop__have:empty { display: none; }

/* ---------- wnętrze schronienia (szałas, namiot) ---------- */
.world__panel > .modal .interior { max-width: 640px; max-height: 100%; overflow-y: auto; }
.interior__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.interior__count { font-size: 8px; color: var(--accent); }
.interior__room { display: block; margin: 0 auto 10px; max-width: 100%; height: auto; image-rendering: pixelated; cursor: pointer; outline: none; }
.interior__room:focus-visible { box-shadow: 0 0 0 3px var(--accent); }
.interior__hint { font-size: 7px; line-height: 1.7; margin: 0 0 8px; }
.interior__palette { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.interior__item {
  display: flex; align-items: center; gap: 6px; font: inherit; font-size: 7px; color: var(--text);
  background: rgba(0, 0, 0, 0.2); border: 2px solid var(--panel-edge); padding: 3px 6px 3px 3px; cursor: pointer;
}
.interior__item canvas { width: 32px; height: 32px; image-rendering: pixelated; }
.interior__item.is-selected { border-color: var(--accent); color: var(--accent); }
.interior__empty { font-size: 8px; line-height: 1.7; margin: 0 0 10px; }
.interior__nap-msg { min-height: 1em; font-size: 8px; color: var(--accent); margin: 0 0 8px; line-height: 1.6; }
.interior__actions { justify-content: space-between; }

/* jednorazowa podpowiedź (pierwszy towar, pierwsza sprzedaż) — wyróżniony dymek */
.notice.notice--tip { border-color: var(--accent); color: var(--accent); }

/* ---------- czytelne komunikaty dla dzieci: większe litery w dymkach, dymku tabliczki/zwierzęcia i banerze ---------- */
.notices { gap: 8px; max-width: calc(100% - 200px); }
.notice { font-size: 14px; line-height: 1.75; padding: 10px 16px; border-width: 3px; }
.bubble { font-size: 13px; line-height: 1.7; width: max-content; max-width: min(380px, 70vw); padding: 10px 14px; } /* krótki tekst w jednej linii, także przy brzegu mapy */
.achievement-banner { font-size: 12px; padding: 12px 18px; }
@media (max-width: 640px) {
  .notices { max-width: calc(100% - 110px); }
  .notice { font-size: 11px; padding: 8px 10px; }
  .bubble { font-size: 11px; max-width: min(260px, 70vw); }
  .achievement-banner { font-size: 10px; }
}

/* ==========================================================================
   Czytelne okna dla dzieci: większe litery we wszystkich oknach (sklep, Pomoc, wnętrza, światy,
   pogoda, statystyki, tabliczki, potwierdzenia). Ok. 1,4–1,5 × wcześniejszych rozmiarów; na telefonie
   trochę mniej, żeby okna się mieściły.
   ========================================================================== */
.modal { font-size: 12px; }
.modal__box { max-width: 540px; }
.modal__box.portal-box { max-width: 640px; }
.modal .btn { font-size: 12px; }
.modal__title { font-size: 18px; margin-bottom: 18px; }
.modal__hint { font-size: 12px; line-height: 1.75; }
.modal__warn { font-size: 11px; }
.modal .field__label { font-size: 12px; }
.modal .input { font-size: 13px; }
.modal .field__counter, .modal .field__error { font-size: 10px; }
.confirm__lines { font-size: 12px; line-height: 1.9; }
.size small { font-size: 10px; }
/* Pomoc */
.help { max-width: 760px; }
.help__group h4 { font-size: 13px; margin-bottom: 8px; }
.help__group dl { grid-template-columns: 220px 1fr; font-size: 11px; line-height: 1.75; gap: 8px 16px; }
.help__group dt { white-space: normal; }
.help__touch, .help__again { font-size: 10px; }
/* sklep */
.shop__wallet { font-size: 14px; }
.shop__tab { font-size: 12px; padding: 9px 14px 8px; }
.shop__list { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 8px; } /* szersze karty — nazwa i opis się mieszczą */
.shop__item { grid-template-columns: 40px 1fr auto; padding: 7px 10px; }
.shop__icon { width: 40px; max-height: 40px; }
.shop__text b { font-size: 12px; }
.shop__text small { font-size: 10px; line-height: 1.55; }
.shop__buy { font-size: 10px; padding: 8px 10px; }
.shop__message { font-size: 11px; }
/* wnętrze schronienia */
.interior__count { font-size: 12px; }
.interior__hint { font-size: 10px; }
.interior__item { font-size: 11px; padding: 4px 8px 4px 4px; }
.interior__item canvas { width: 40px; height: 40px; }
.interior__empty { font-size: 11px; }
.interior__nap-msg { font-size: 12px; }
/* pogoda i pora dnia */
.world__panel > .modal .climate { max-width: 680px; }
.climate__now-label { font-size: 12px; }
.climate__title { font-size: 13px; }
.climate__now { font-size: 11px; padding: 10px 4px; }
.climate__icon { font-size: 26px; }
.climate__cycle, .climate__note { font-size: 10px; }
/* lista światów */
.portal__hint { font-size: 11px; }
.portal__name { font-size: 14px; }
.portal__meta { font-size: 10px; }
.portal__here, .portal__count { font-size: 11px; }
.portal__activity-label, .portal__tip { font-size: 10px; }
/* statystyki */
.stat-tile__label { font-size: 11px; }
.stat-tile__sub { font-size: 10px; }
.insights, .chart__head, .stats__table, .stats__foot { font-size: 11px; }
.ach__label, .coll__label { font-size: 11px; }
.ach__desc, .ach__state, .coll__detail, .tab__badge { font-size: 10px; }
.modal .tab { font-size: 11px; }
@media (max-width: 640px) {
  .modal, .modal .btn { font-size: 11px; }
  .modal__title { font-size: 15px; }
  .modal__hint, .confirm__lines { font-size: 10px; }
  .help__group dl { grid-template-columns: 1fr; font-size: 10px; gap: 2px 0; }
  .help__group dd { margin-bottom: 6px; }
  .shop__list { grid-template-columns: 1fr; }
  /* telefon: przycisk z ceną pod opisem, żeby opis miał całą szerokość karty */
  .shop__item { grid-template-columns: 40px 1fr; }
  .shop__buy { grid-column: 1 / -1; justify-self: end; }
  .shop__tab { font-size: 10px; padding: 7px 8px 6px; }
  .shop__text b { font-size: 11px; }
  .climate__now { font-size: 10px; }
  .portal__name { font-size: 12px; }
}

/* ---------- baner zgody na analitykę (js/core/consent.js) ---------- */
.consent {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: center; padding: 12px; pointer-events: none;
}
.consent__box {
  pointer-events: auto; width: min(860px, 100%); max-height: 80vh; overflow-y: auto;
  border-color: var(--accent); box-shadow: 4px 4px 0 #000; font-size: 12px;
}
.consent__title { margin: 0 0 10px; font-size: 16px; color: var(--accent); font-weight: normal; }
.consent__text { margin: 0 0 10px; font-size: 11px; line-height: 1.75; }
.consent__kids { color: var(--accent); }
.consent__option { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; font-size: 11px; line-height: 1.6; cursor: pointer; }
.consent__option b { font-weight: normal; color: var(--accent); }
.consent__main[hidden], .consent__settings[hidden] { display: none; }
/* trzy równe przyciski (jak na typowych banerach cookies) */
.consent__actions .consent__btn { flex: 1 1 0; min-width: 150px; white-space: nowrap; }
.consent__option input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.consent__option--fixed { color: var(--muted); cursor: default; }
.consent__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.consent__actions .btn { font-size: 12px; }
@media (max-width: 640px) {
  .consent { padding: 6px; }
  .consent__text, .consent__option { font-size: 10px; }
  .consent__actions .btn { font-size: 10px; padding: 8px 10px; }
}

/* ---------- strona Regulamin i prywatność (regulamin.html) ---------- */
/* nagłówki w pikselowej czcionce gry, długi tekst w zwykłej — żeby dało się go wygodnie przeczytać */
.legal-page { font-size: 16px; line-height: 1.65; }
.legal__top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 920px; margin: 0 auto; padding: 20px 16px 0;
}
.legal__logo img { display: block; width: 180px; height: auto; image-rendering: pixelated; }
.legal__back, .legal__foot .btn { text-decoration: none; font-size: 10px; }
.legal {
  max-width: 920px; margin: 0 auto; padding: 8px 16px 48px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}
.legal h1, .legal h2, .legal h3 { font-family: var(--font); font-weight: normal; line-height: 1.5; }
.legal h1 { font-size: 22px; color: var(--accent); margin: 28px 0 6px; }
.legal h2 { font-size: 16px; color: var(--accent); margin: 40px 0 14px; scroll-margin-top: 16px; }
.legal h3 { font-size: 12px; color: var(--text); margin: 28px 0 8px; }
.legal__meta { color: var(--muted); margin: 0 0 20px; }
.legal a { color: var(--accent); }
.legal b { color: #fff; }
.legal code { font-size: 14px; background: rgba(255,255,255,0.08); padding: 1px 5px; }
.legal ol, .legal ul { padding-left: 1.4em; }
.legal li { margin: 0 0 8px; }
.legal__toc { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 14px 16px; margin: 0 0 20px; }
.legal__toc a { font-size: 15px; }
.legal__short, .legal__contact { padding: 4px 20px 16px; }
.legal__short h2, .legal__contact h2 { margin-top: 18px; }
.legal__table { overflow-x: auto; margin: 0 0 16px; }
.legal table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 620px; }
.legal th, .legal td { text-align: left; vertical-align: top; padding: 10px 12px; border: 1px solid var(--panel-edge); }
.legal th { background: var(--panel); color: var(--accent); font-weight: 600; }
.legal__foot { margin-top: 40px; }
.legal .btn { font-family: var(--font); }

/* link do regulaminu: baner zgody, Pomoc, ekran startowy */
.consent__text a, .help__legal { color: var(--accent); }
.help__legal { font-size: 10px; margin-right: 8px; }
.splash__legal { position: fixed; left: 16px; bottom: 16px; font-size: 8px; color: var(--muted); }
.splash__legal:hover { color: var(--accent); }
@media (max-width: 600px) {
  .legal-page { font-size: 15px; }
  .legal h1 { font-size: 17px; }
  .legal h2 { font-size: 13px; }
  .legal__logo img { width: 130px; }
}
