/* "Odkryj Piekary" (js/game/odkryj.js): HUD button, map pins, journal panel, collect card, toast */
#hud .row > #okBtn { display: inline-flex; align-items: center; gap: 5px; }
#okBtn svg { display: block; flex: 0 0 auto; }
#okBtn.active { background: var(--accent); }
@media (max-width: 600px) { #hud .row > #okBtn { margin-left: 0; flex: 1 1 auto; justify-content: center; } }
@media (max-width: 380px) { #hud .row > #okBtn { padding: 0 4px; font-size: 13px !important; } }

/* pins: DOM sprites placed by translate (top-left = 0,0), the icon centre on the point */
#okPins { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }   /* no z-index: stays under #hud (DOM order) */
.ok-pin { position: absolute; left: -16px; top: -30px; width: 32px; height: 32px; padding: 0; margin: 0; pointer-events: auto;
  display: grid; place-items: center; background: var(--paper); border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer; will-change: transform; }
.ok-pin::after { content: ''; position: absolute; left: 50%; bottom: -8px; margin-left: -3px; border: 3px solid transparent; border-top: 5px solid var(--ink); }
.ok-pin[hidden], #okPins[hidden] { display: none; }
.ok-pin svg { display: block; image-rendering: pixelated; }
.ok-pin > i { display: none; position: absolute; right: -6px; top: -6px; background: #fff; border: 2px solid var(--ink); line-height: 0; padding: 1px; }
.ok-pin.got { opacity: .55; box-shadow: none; }
.ok-pin.got > i { display: block; }
.ok-pin.resp { border-radius: 50%; background: #efe8f6; }
.ok-pin.k-step { background: #fff2d6; border-color: #c0392b; animation: okBob 1.2s steps(2) infinite; }
.ok-pin:hover, .ok-pin:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@keyframes okBob { 50% { margin-top: -3px; } }
@media (pointer: coarse) { .ok-pin { width: 38px; height: 38px; left: -19px; top: -36px; } }

/* journal: desktop = left side panel under the HUD, phone = bottom sheet */
.ok-panel { position: fixed; left: 16px; top: 128px; width: 320px; max-height: calc(100vh - 170px); overflow: auto; z-index: 21;
  background: var(--paper); border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--ink); padding: 10px 14px 12px; }
.ok-panel[hidden] { display: none; }
.ok-title { margin: 2px 0 2px; font-size: 22px; line-height: 1.1; }
.ok-panel h3 { margin: 12px 0 5px; font-size: 15px; border-bottom: 2px solid rgba(43, 36, 51, .18); }
.ok-place { margin: 0 0 8px; font-size: 13px; color: #6a4a10; }
.ok-prog { display: flex; gap: 6px; }
.ok-prog > div { flex: 1; background: #fff; border: 2px solid var(--ink); padding: 3px 6px; text-align: center; }
.ok-prog b { font-size: 20px; }
.ok-prog small { display: block; font-size: 11px; opacity: .8; }
.ok-bar { height: 8px; border: 2px solid var(--ink); background: #fff; margin: 6px 0 4px; }
.ok-bar i { display: block; height: 100%; background: var(--accent); }
.ok-hint { margin: 4px 0; font-family: system-ui, sans-serif; font-size: 12.5px; line-height: 1.4; opacity: .85; }
.ok-kinds { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 3px; font-size: 14px; }
.ok-kinds li { display: flex; align-items: center; gap: 5px; }
.ok-kinds svg { image-rendering: pixelated; flex: 0 0 auto; }
.ok-kinds b { margin-left: auto; font-family: system-ui, sans-serif; font-size: 13px; }
.ok-badges, .ok-dist { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.ok-badges li, .ok-dist li { border: 2px dashed rgba(43, 36, 51, .45); padding: 1px 6px; font-size: 13px; opacity: .6; }
.ok-badges li.on, .ok-dist li.on { border-style: solid; border-color: var(--ink); background: var(--accent); opacity: 1; }
.ok-dist li.on { background: #cfe3b8; }
.ok-q { background: #fff; border: 2px solid var(--ink); padding: 5px 8px; margin: 0 0 6px; font-size: 14px; }
.ok-q.off { opacity: .7; }
.ok-q-st { float: right; font-size: 12px; font-family: system-ui, sans-serif; font-weight: 600; }
.ok-q p { margin: 3px 0; font-family: system-ui, sans-serif; font-size: 12.5px; line-height: 1.4; }
.ok-q ol { margin: 2px 0 0; padding-left: 20px; font-family: system-ui, sans-serif; font-size: 12.5px; }
.ok-q li.on { text-decoration: line-through; opacity: .7; }
.ok-btn { font: inherit; font-size: 14px; background: #fff; border: 2px solid var(--ink); padding: 3px 8px; cursor: pointer; box-shadow: 2px 2px 0 var(--ink); }
.ok-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.ok-post { width: 100%; background: var(--accent); }
.ok-code { width: 100%; box-sizing: border-box; font: 11px/1.3 monospace; border: 2px solid var(--ink); resize: vertical; }
.ok-row { display: flex; gap: 6px; align-items: center; margin-top: 5px; flex-wrap: wrap; }
.ok-msg { font-size: 13px; }
.ok-end { justify-content: flex-end; margin-top: 12px; }

/* collect card: tour-card look, one notch above the journal */
.ok-card { z-index: 23; height: auto; max-height: min(460px, calc(100vh - 56px)); }
.ok-c-ico { line-height: 0; margin-top: 6px; }
.ok-c-ico svg { image-rendering: pixelated; }
.ok-c-extra { margin: 0 0 6px; font-size: 13px; color: #2e6b2e; }
.ok-c-extra:empty, .ok-c-act:empty { display: none; }
.ok-c-act { margin: 0 0 8px; }
.ok-go { background: var(--accent); }
.ok-c-more { display: none; }

/* toast: laid over the HUD's title line (odkryj.js places it), never over the map pins */
#okToast { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 25; background: var(--accent);
  border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); padding: 3px 12px; font-size: 16px; pointer-events: none;
  white-space: nowrap; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis; }
#okToast[hidden] { display: none; }

/* desktop: today's event card (eggs.css, bottom left) moves right of the open journal instead of covering it */
@media (min-width: 601px) {
  body:has(#okPanel:not([hidden])) .egg-card { left: 356px; max-width: calc(100vw - 372px); }
}

@media (max-width: 600px) {
  .ok-panel { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 48vh;
    padding: 8px 12px calc(22px + env(safe-area-inset-bottom)); }
  .ok-card { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 46vh; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  body.ok-carding .ok-panel { visibility: hidden; }
  /* today's event card would sit on the journal sheet: it waits until the journal is folded */
  body:has(#okPanel:not([hidden])) .egg-card.show { visibility: hidden; }
  body.odkryj #credits { display: none; }
  #okToast { font-size: 14px; padding: 2px 10px; }
}

/* walk mode extras (game/fog.js, game/skarbnik.js) */
.ok-fog { margin: 2px 0 4px; font-size: 14px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.ok-fog svg { image-rendering: pixelated; }
.ok-fog small { font-family: system-ui, sans-serif; font-size: 11.5px; opacity: .75; }
.ok-fogopt { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 13px; cursor: pointer; user-select: none; flex-wrap: wrap; }
.ok-fogopt input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.ok-fogopt small { font-family: system-ui, sans-serif; font-size: 11px; opacity: .7; }
/* compass: first line of the walk HUD (above the street name) */
#okCompass { pointer-events: none; display: inline-flex; align-items: center; gap: 6px; background: var(--paper); border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink); padding: 1px 8px 1px 4px; font-size: 14px; white-space: nowrap; max-width: calc(100vw - 32px); }
#okCompass[hidden] { display: none; }
body > #okCompass { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 15; }
#okCompass .ok-n { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); }
#okCompass .ok-n svg, #okCompass .ok-k svg { display: block; image-rendering: pixelated; }
#okCompass .ok-d { overflow: hidden; text-overflow: ellipsis; }
/* Skarbnik pin: a round dark badge */
.ok-pin.k-guide { background: #2b2433; border-color: #e8b730; border-radius: 6px; }
/* Skarbnik dialogue: a speech box at the bottom (desktop) / bottom sheet (phone), over the journal */
.ok-talk { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); z-index: 24;
  display: flex; gap: 12px; align-items: flex-start; background: var(--paper); border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--ink); padding: 10px 12px; }
.ok-talk[hidden] { display: none; }
.ok-t-face { flex: 0 0 auto; background: #2b2433; border: 2px solid var(--ink); padding: 4px; line-height: 0; }
.ok-t-face svg { image-rendering: pixelated; }
.ok-t-body { flex: 1 1 auto; min-width: 0; }
.ok-t-head { display: flex; align-items: center; gap: 8px; }
.ok-t-head b { font-size: 18px; }
.ok-t-where { font-size: 13px; color: #6a4a10; }
.ok-t-x { margin-left: auto; }
.ok-t-line { margin: 4px 0 6px; font-family: system-ui, sans-serif; font-size: 15px; line-height: 1.45; min-height: 3em; }
.ok-t-line i { font-family: "Pixelify Sans", monospace; font-style: normal; color: #6b4f8a; font-weight: 600; }
.ok-t-line small { font-size: 12.5px; opacity: .75; }
.ok-t-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.ok-t-src { font-family: system-ui, sans-serif; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ok-t-n { margin-left: auto; font-family: system-ui, sans-serif; opacity: .7; }
.ok-t-next { background: var(--accent); }
@media (max-width: 600px), (pointer: coarse) {
  #okCompass { font-size: 13px; box-shadow: 2px 2px 0 var(--ink); }
  #okCompass .ok-n { width: 20px; height: 20px; }
  .ok-talk { left: 8px; right: 8px; bottom: 8px; transform: none; width: auto; padding: 8px 10px calc(14px + env(safe-area-inset-bottom)); gap: 8px; z-index: 26; }
  .ok-t-face svg { width: 36px; height: 36px; }
  .ok-t-line { font-size: 14px; }
  body.ok-talking .ok-panel { visibility: hidden; }
  /* walking: the card is a one-line strip above the joystick (pad top ~134 px from the bottom), the map
     stays free; a tap opens the whole card in the same place (odkryj.js toggles .open) */
  body.walking .ok-card { left: 8px; right: 8px; top: auto; width: auto; bottom: calc(146px + env(safe-area-inset-bottom));
    height: auto; max-height: min(46vh, calc(100vh - 300px)); padding: 8px 12px 10px; transform: translateY(calc(100% + 190px)); cursor: pointer; }
  body.walking .ok-card.show { transform: none; }
  body.walking .ok-card:not(.open) { flex-direction: row; align-items: center; gap: 8px; padding: 4px 6px 4px 8px; overflow: hidden;
    border-width: 2px; box-shadow: 3px 3px 0 var(--ink); }
  body.walking .ok-card:not(.open) > :not(.ok-c-ico):not(.tc-name):not(.ok-c-more):not(.tc-head) { display: none; }
  body.walking .ok-card:not(.open) .ok-c-ico { order: 0; margin: 0; }
  body.walking .ok-card:not(.open) .ok-c-ico:empty { display: none; }
  body.walking .ok-card:not(.open) .ok-c-ico svg { width: 20px; height: 20px; }
  body.walking .ok-card:not(.open) .tc-name { order: 1; flex: 1 1 auto; min-width: 0; margin: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.walking .ok-card:not(.open) .ok-c-more { order: 2; display: block; flex: 0 0 auto; font-size: 12px; border: 2px solid var(--ink); background: var(--accent); padding: 0 5px; }
  body.walking .ok-card:not(.open) .tc-head { order: 3; flex: 0 0 auto; }
  body.walking .ok-card:not(.open) .ok-c-head { display: none; }
  body.walking .ok-card:not(.open) .tc-x { padding: 0 2px; }
  /* the journal stays as it is under the strip */
  body.walking.ok-carding .ok-panel { visibility: visible; }
}
