/* "Warstwy" panel (js/layers.js): paper card under the HUD; on a phone a compact bottom sheet */
#pkLayers { position: fixed; left: 12px; top: calc(var(--pk-hud-b, 96px) + 8px); z-index: 25; width: 336px;
  max-height: calc(100vh - var(--pk-hud-b, 96px) - 24px); overflow: auto; overscroll-behavior: contain;
  background: var(--paper); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); padding: 8px 10px 8px; }
#pkLayers[hidden] { display: none; }
#pkLayers .pl-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
#pkLayers .pl-head b { font-weight: 600; font-size: 15px; letter-spacing: 1px; text-transform: uppercase; }
#pkLayers .pl-x { font: inherit; font-size: 16px; width: 30px; height: 28px; background: none; border: 0; cursor: pointer; color: var(--ink); }
#pkLayers .pl-lbl { font-family: "Silkscreen", monospace; font-size: 10px; letter-spacing: .5px; text-transform: uppercase; opacity: .75; margin: 7px 0 3px; }
#pkLayers .pl-seg { display: flex; border: 2px solid var(--ink); background: #fff; }
#pkLayers .pl-seg button { flex: 1 1 0; min-width: 0; font: inherit; font-size: 13px; line-height: 1; padding: 6px 2px; border: 0;
  border-left: 2px solid var(--ink); background: none; color: var(--ink); cursor: pointer; white-space: nowrap; }
#pkLayers .pl-seg button:first-child { border-left: 0; }
#pkLayers .pl-seg button[aria-pressed="true"] { background: var(--accent); }
#pkLayers .pl-seg button:active { transform: translate(1px, 1px); }
#pkLayers .pl-seg.off { opacity: .45; }
/* "Święto": the pilgrimage buttons on two lines, the other feasts in a wrapping list under "inne" */
#pkLayers .pl-row[hidden], #pkLayers .pl-evmore[hidden] { display: none; }
#pkLayers .pl-seg button.pl-two { white-space: normal; padding: 3px 2px; line-height: 1.05; }
#pkLayers .pl-seg button.pl-two small { display: block; font-size: 10px; opacity: .75; }
#pkLayers .pl-evmore { margin-top: 4px; }
#pkLayers .pl-evmore .pl-seg { flex-wrap: wrap; gap: 2px; background: var(--ink); }
#pkLayers .pl-evmore .pl-seg button { flex: 1 1 auto; border-left: 0; background: #fff; padding: 6px 6px; }
#pkLayers .pl-evmore .pl-seg button[aria-pressed="true"] { background: var(--accent); }
#pkLayers .pl-info { font-family: system-ui, sans-serif; font-size: 12px; line-height: 1.35; margin-top: 4px; min-height: 16px; }
#pkLayers .pl-air { opacity: .8; }
#pkLayers .pl-more > summary { cursor: pointer; list-style: none; user-select: none; }
#pkLayers .pl-more > summary::-webkit-details-marker { display: none; }
#pkLayers .pl-more > summary::before { content: "\25B8"; display: inline-block; width: 12px; font-family: system-ui, sans-serif; }
#pkLayers .pl-more[open] > summary::before { content: "\25BE"; }
#pkLayers .pl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
#pkLayers .pl-grid label { display: flex; align-items: center; gap: 7px; font-size: 14px; cursor: pointer; padding: 3px 0; user-select: none; }
#pkLayers .pl-grid input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
#pkLayers .pl-grid i { width: 16px; height: 16px; flex: 0 0 16px; border: 2px solid var(--ink); background: #fff; position: relative; }
#pkLayers .pl-grid input:checked + i { background: var(--accent); }
#pkLayers .pl-grid input:checked + i::after { content: ""; position: absolute; left: 3px; top: 0; width: 4px; height: 8px;
  border: solid var(--ink); border-width: 0 3px 3px 0; transform: rotate(45deg); }
#pkLayers .pl-grid input:focus-visible + i { outline: 2px dashed var(--ink); outline-offset: 2px; }
/* music switch (js/layers.js musicRow, only with the sound on and a playlist): a grid cell two columns wide -
   its own row on a desktop, beside "Dźwięk" in the phone's three columns - with the title and credit */
#pkLayers .pl-music { grid-column: span 2; display: flex; align-items: center; gap: 10px; min-width: 0; }
#pkLayers .pl-music[hidden] { display: none; }
#pkLayers .pl-music label { flex: 0 0 auto; }
#pkLayers .pl-mt { flex: 1 1 auto; min-width: 0; overflow: hidden; font-family: system-ui, sans-serif; font-size: 12px; line-height: 1.3; }
#pkLayers .pl-mt span { display: block; }
#pkLayers .pl-mt .pl-cr { opacity: .7; }
#pkLayers .pl-music.off .pl-mt { opacity: .5; }
#pkLayers .pl-src { font-family: system-ui, sans-serif; font-size: 10px; opacity: .65; margin-top: 7px; }
#pkLayers .pl-src a { color: inherit; }
/* live temperature on the HUD button */
#layersBtn .pl-temp { font-family: "Silkscreen", monospace; font-weight: 400; font-size: 11px; line-height: 1; }
#layersBtn .pl-temp[hidden] { display: none; }

/* compact (phones, landscape phones): the label left of its row, the layer switches folded */
@media (max-width: 600px), (max-height: 520px) {
  #pkLayers { padding: 4px 8px 6px; }
  #pkLayers .pl-head b { font-size: 13px; }
  #pkLayers .pl-x { height: 22px; }
  #pkLayers .pl-row { display: grid; grid-template-columns: 50px 1fr; align-items: center; gap: 6px; margin-top: 5px; }
  #pkLayers .pl-row .pl-lbl { margin: 0; font-size: 9px; line-height: 1.15; }
  #pkLayers .pl-seg button { font-size: 12px; padding: 6px 1px; }
  #pkLayers .pl-seg button.pl-two { padding: 2px 1px; }
  #pkLayers .pl-evmore { margin: 3px 0 0 56px; }
  #pkLayers .pl-evmore .pl-seg button { padding: 5px 4px; }
  #pkLayers .pl-info { font-size: 11px; line-height: 1.25; margin-top: 3px; min-height: 0; padding-left: 56px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #pkLayers .pl-air { display: none; }
  #pkLayers .pl-more > summary { margin: 6px 0 2px; }
  #pkLayers .pl-grid { grid-template-columns: 1fr 1fr 1fr; gap: 0 6px; }
  #pkLayers .pl-grid label { font-size: 13px; gap: 5px; padding: 3px 0; }
  #pkLayers .pl-music { gap: 6px; }
  #pkLayers .pl-mt { font-size: 10.5px; line-height: 1.2; }
  #pkLayers .pl-mt .pl-ti { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #pkLayers .pl-mt .pl-cr { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  #pkLayers .pl-src { margin-top: 3px; }
}
/* phone portrait: a bottom sheet (the open bottom cards move up above it, see below); the map above stays free */
@media (max-width: 600px) {
  #pkLayers { left: 0; right: 0; bottom: 0; top: auto; width: auto; z-index: 30; max-height: 60vh;
    border-width: 3px 0 0; box-shadow: 0 -3px 0 rgba(43, 36, 51, .25); padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 360px) { #pkLayers .pl-grid { grid-template-columns: 1fr 1fr; } #pkLayers .pl-row { grid-template-columns: 44px 1fr; } #pkLayers .pl-evmore { margin-left: 50px; } }
/* phone portrait, sheet open over an open bottom card: the card moves up above it (shorter, it scrolls), so
   the sheet never hides the tour / retro / Zaduszki / egg card text and buttons and some map stays in view
   (js/layers.js sets --pk-sheet-h and body.pk-sheet; a card coming up while the sheet is open closes it) */
@media (max-width: 600px) {
  body.pk-sheet .tour-card.show, body.pk-sheet .zad-card.show, body.pk-sheet .egg-card.show { bottom: calc(var(--pk-sheet-h, 173px) + 8px);
    overflow: auto; max-height: min(30vh, calc(100vh - var(--pk-sheet-h, 173px) - var(--pk-hud-b, 96px) - 24px)); }
}
