/* Jedyny końcowy system rozmiarów okien. Ten plik celowo ładuje się ostatni. */
.window {
  box-sizing: border-box !important;
  overflow: hidden !important;
  max-width: 100vw !important;
  max-height: calc(100vh - 42px) !important;
}

.window:not(.hidden) {
  display: flex !important;
  flex-direction: column !important;
}

.window[data-minimized="1"] { display: none !important; }

.window > .titlebar {
  flex: 0 0 30px !important;
  width: 100% !important;
}

.window > * { min-width: 0; }

.window[data-window="welcome"] { min-width: min(420px, 100vw) !important; min-height: min(330px, calc(100vh - 42px)) !important; }
.window[data-window="roms"] { min-width: min(560px, 100vw) !important; min-height: min(460px, calc(100vh - 42px)) !important; }
.window[data-window="services"] { min-width: min(560px, 100vw) !important; min-height: min(440px, calc(100vh - 42px)) !important; }
.window[data-window="about"] { height: 75vh !important; min-width: min(360px, 100vw) !important; min-height: min(300px, calc(100vh - 42px)) !important; }
.window[data-window="links"] { min-width: min(340px, 100vw) !important; min-height: min(460px, calc(100vh - 42px)) !important; }
.window[data-window="detail"] {
  width: min(820px, calc(100vw - 30px)) !important;
  height: min(720px, calc(100vh - 70px)) !important;
  min-width: min(760px, 100vw) !important;
  min-height: min(620px, calc(100vh - 42px)) !important;
}
.window[data-window="game"] { width: min(720px, calc(100vw - 30px)) !important; height: min(610px, calc(100vh - 62px)) !important; min-width: min(620px, 100vw) !important; min-height: min(590px, calc(100vh - 42px)) !important; }

#rom-list {
  grid-template-columns: repeat(auto-fill, minmax(300px, 390px)) !important;
  justify-content: start !important;
}

#service-list {
  grid-template-columns: repeat(auto-fill, minmax(280px, 390px)) !important;
  grid-auto-rows: 350px !important;
  align-items: stretch !important;
  justify-content: start !important;
}

#rom-list .listing-card { width: 100% !important; }

#rom-list .listing-card,
#service-list .listing-card {
  min-height: 350px !important;
  max-height: 100% !important;
  overflow: hidden !important;
}

#service-list .listing-card {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  align-self: stretch !important;
}

#service-list .card-body {
  flex: 1 1 auto !important;
}

#rom-list .card-visual,
#service-list .card-visual {
  flex: 0 0 155px !important;
  height: 155px !important;
}

.listing-card .card-body {
  min-height: 0 !important;
  overflow: visible !important;
}

.card-device { margin: 7px 0 0; color: #174c8e; font: 700 11px/1.2 Arial,sans-serif; text-transform: uppercase; letter-spacing: .08em; }
.card-action { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; margin-top: auto; padding-top: 6px; }
.card-action .price { font-size: 13px !important; text-align: right; }
.more-info { padding: 7px 11px; border: 2px outset #fff; background: #c0c0c0; color: #111; font: 700 10px Arial,sans-serif; cursor: pointer; }
.more-info:active { border-style: inset; }

.detail-photo {
  height: 230px !important;
  min-height: 230px !important;
}

.welcome-content,
.links-content,
.game-shell,
#detail-content {
  flex: 1 1 0 !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: auto !important;
}

.app-window > .toolbar,
.app-window > .service-intro,
.about-window > .notepad-menu,
.about-window > .notepad-status {
  flex: 0 0 auto !important;
}

.app-window > .listing-grid {
  flex: 1 1 0 !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  overflow: auto !important;
}

.about-window > .notepad-page {
  flex: 1 1 0 !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  overflow: auto !important;
}

.resize-handle {
  position: absolute !important;
  right: 1px !important;
  bottom: 1px !important;
  z-index: 200 !important;
  display: block !important;
  pointer-events: auto !important;
}

.window-statusbar {
  position: relative !important;
  flex: 0 0 20px !important;
  width: 100% !important;
  min-height: 20px !important;
  background: #c0c0c0 !important;
  border-top: 2px groove #fff !important;
  box-shadow: inset 1px 1px 0 #e7e7e7,inset -1px -1px 0 #777 !important;
}
.window-statusbar::before { content: ""; position: absolute; left: 4px; right: 24px; top: 4px; bottom: 4px; border: 1px inset #ddd; }
.window-statusbar .resize-handle { right: 1px !important; bottom: 1px !important; }

.window.maximized .resize-handle { display: none !important; }

.window.maximized {
  left: 0 !important;
  top: 0 !important;
  right: auto !important;
  bottom: auto !important;
  width: 100vw !important;
  width: 100dvw !important;
  height: calc(100vh - 42px) !important;
  height: calc(100dvh - 42px) !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: 100vw !important;
  max-width: 100dvw !important;
  max-height: calc(100vh - 42px) !important;
  max-height: calc(100dvh - 42px) !important;
}

.tray-slot { position: relative; display: inline-grid; place-items: center; }
.tray-popup-button { display: grid; place-items: center; width: 22px; height: 22px; padding: 1px; border: 1px solid transparent; background: transparent; color: #005b38; cursor: pointer; }
.tray-popup-button:active,.tray-slot.open .tray-popup-button { border: 1px inset #fff; background: #aaa79b; }
.tray-popup-button img { display: block; width: 18px; height: 18px; object-fit: contain; }
.credit-slot > .tray-popup-button,
.credit-slot > .tray-popup-button:active,
.credit-slot.open > .tray-popup-button {
  width: 20px !important;
  height: 20px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}
.credit-slot > .tray-popup-button img { width: 20px !important; height: 20px !important; }
.credit-slot > button::after { display: none !important; content: none !important; }
.tray-tooltip { display: none; position: absolute; right: -10px; bottom: 31px; width: max-content; max-width: 190px; padding: 8px 10px; color: #111; background: #ffffdf; border: 1px solid #111; box-shadow: 2px 2px 0 rgba(0,0,0,.28); font: 11px/1.4 Arial,sans-serif; z-index: 150; }
.tray-tooltip::after { content: ""; position: absolute; right: 15px; bottom: -6px; width: 10px; height: 10px; background: #ffffdf; border-right: 1px solid #111; border-bottom: 1px solid #111; transform: rotate(45deg); }
.tray-slot:hover .tray-tooltip,.tray-slot:focus-within .tray-tooltip,.tray-slot.open .tray-tooltip { display: block; }
.tray-tooltip a { color: #000082; font-weight: bold; }

.game-icon { position: relative !important; overflow: visible !important; background: #050505 !important; border: 2px outset #777 !important; }
.game-icon i::before { content: ""; position: absolute; left: 12px; right: 12px; bottom: 9px; height: 11px; border: 1px solid #ddd; border-radius: 4px 4px 2px 2px; background: #b72c27; box-shadow: inset 0 -3px 0 #68100e; }
.game-icon i::after { content: ""; position: absolute; left: 21px; bottom: 19px; width: 4px; height: 13px; background: #ddd; border-radius: 2px 2px 0 0; box-shadow: 0 -3px 0 1px #d9342d,10px 8px 0 -1px #f5d83e; }
.task-icon { position: relative !important; overflow: hidden !important; flex: 0 0 22px !important; width: 22px !important; height: 22px !important; box-sizing: border-box !important; }
.task-icon-roms { color: #70ffbd !important; background: #171d1a !important; border: 2px ridge #aaa !important; font: 700 6px Arial,sans-serif !important; }
.task-icon-services { color: #111 !important; background: #efbd38 !important; border: 2px outset #fff !important; font-size: 12px !important; }
.task-icon-about { color: #000080 !important; background: #fff !important; border: 1px solid #555 !important; font: 700 6px Arial,sans-serif !important; clip-path: polygon(0 0,72% 0,100% 28%,100% 100%,0 100%) !important; }
.task-icon-links { color: #5b2600 !important; background: #ff9a32 !important; border: 2px outset #ffd08d !important; font: 900 14px Arial,sans-serif !important; }
.task-icon-detail { color: #fff !important; background: #2872c9 !important; border: 2px outset #9ac6ff !important; font: 700 6px Arial,sans-serif !important; }
.task-icon-game { background: #050505 !important; border: 2px outset #777 !important; font-size: 0 !important; }
.task-icon-game::before { content: ""; position: absolute; left: 4px; right: 4px; bottom: 3px; height: 6px; border: 1px solid #ddd; border-radius: 2px; background: #b72c27; }
.task-icon-game::after { content: "" !important; position: absolute; left: 9px; bottom: 9px; width: 3px; height: 7px; background: #ddd; border-radius: 2px 2px 0 0; box-shadow: 0 -2px 0 1px #d9342d,6px 5px 0 -1px #f5d83e; }
.task-button { display: flex !important; align-items: center !important; gap: 5px !important; padding: 2px 5px !important; }
.task-label { display: block !important; min-width: 0 !important; overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important; }

.game-shell { display: grid !important; grid-template-rows: auto minmax(0,1fr) auto auto auto auto !important; gap: 0 !important; padding: 10px 10px 12px !important; overflow: hidden !important; }
#game-canvas { align-self: stretch !important; justify-self: stretch !important; contain: strict; transform: translateZ(0); width: 100% !important; height: 100% !important; min-height: 0 !important; max-height: none !important; object-fit: contain !important; background: #031a16 !important; }
.game-message,.game-controls,.game-help,.game-hud { flex: none !important; }
.game-pause-button { justify-self: center; width: 124px; min-height: 25px; margin-top: 6px; padding: 3px 8px; border: 2px outset #ff8a82; background: #b7201a; color: #fff; font: 700 9px Arial,sans-serif; cursor: pointer; }
.game-pause-button:active { border-style: inset; background: #81120e; }
.links-subtitle { margin: -9px 0 15px; color: #557069; font: 10px/1.35 "Courier New",monospace; }
.sale-banner { position: relative; overflow: hidden; display: grid; gap: 4px; margin: 0 -8px 16px; padding: 12px 10px 11px; border: 3px ridge #fff; color: #fff; text-align: center; text-shadow: 2px 2px 0 #14225f; background-color: #3534a8; background-image: radial-gradient(circle at 18% 25%,#ffde32 0 5%,transparent 6%),radial-gradient(circle at 83% 72%,#ff5d8f 0 7%,transparent 8%),linear-gradient(135deg,#087f76 0%,#2269c7 38%,#7839ac 68%,#ef5a36 100%); box-shadow: inset 0 0 0 2px #14225f,3px 3px 0 #175e59; }
.sale-banner::before,.sale-banner::after { content: ""; position: absolute; width: 18px; height: 18px; background: #fff23d; border: 2px solid #35105f; transform: rotate(45deg); }
.sale-banner::before { left: -10px; top: -10px; }.sale-banner::after { right: -10px; bottom: -10px; }
.sale-banner span { font: 700 9px "Courier New",monospace; letter-spacing: .15em; }
.sale-banner b { font: 900 16px/1.05 Arial,sans-serif; letter-spacing: .035em; }
.sale-banner small { font: 700 8px "Courier New",monospace; letter-spacing: .12em; }
.sale-banner + h2 { margin-top: 0 !important; }

@media (min-width: 761px) {
  .window[data-window="links"] { height: min(500px, calc(100vh - 70px)) !important; }
}

@media (max-width: 760px) {
  .window-statusbar { flex-basis: 28px !important; min-height: 28px !important; }
  .window-statusbar::before { right: 32px; }
  .tray { gap: 3px !important; padding: 0 4px !important; }
  .tray .signal,.connection-slot { display: inline-grid !important; }
  .tray-tooltip { right: -5px; max-width: min(190px, calc(100vw - 20px)); }

  .window[data-window="game"] {
    left: 0 !important;
    right: auto !important;
    top: 4px !important;
    width: 100vw !important;
    width: 100dvw !important;
    min-width: min(360px, 100dvw) !important;
    min-height: min(430px, calc(100dvh - 42px)) !important;
  }

  .window[data-window="links"] {
    left: 12px !important;
    top: 12px !important;
    width: 75vw !important;
    min-width: min(260px, calc(100vw - 12px)) !important;
    min-height: min(360px, calc(100vh - 42px)) !important;
  }

  .window[data-window="roms"],
  .window[data-window="services"],
  .window[data-window="about"] {
    left: 12px !important;
    top: 12px !important;
    width: 75vw !important;
    min-width: min(260px, calc(100vw - 12px)) !important;
  }

  .window[data-window="about"] {
    height: 60vh !important;
    min-height: min(280px, calc(100vh - 42px)) !important;
  }

  .window {
    min-width: min(280px, 100vw) !important;
  }

  .window[data-window="welcome"] {
    left: 24px !important;
    right: auto !important;
    top: 300px !important;
    width: min(330px, calc(100vw - 48px)) !important;
    height: min(310px, calc(100vh - 350px)) !important;
    min-width: min(260px, calc(100vw - 24px)) !important;
    min-height: min(240px, calc(100vh - 42px)) !important;
  }

  .window[data-window="roms"],
  .window[data-window="services"] {
    height: min(85vh, calc(100vh - 54px)) !important;
    min-height: min(350px, calc(100vh - 42px)) !important;
  }

  .window[data-window="detail"] {
    left: 20px !important;
    top: 20px !important;
    width: calc(100vw - 46px) !important;
    height: min(520px, calc(100vh - 96px)) !important;
    min-width: min(300px, calc(100vw - 20px)) !important;
    min-height: min(390px, calc(100vh - 42px)) !important;
  }

  #rom-list,
  #service-list {
    grid-template-columns: 1fr !important;
  }

  #service-list { grid-auto-rows: 390px !important; }

  #rom-list .listing-card,
  #service-list .listing-card {
    min-height: 390px !important;
    max-height: none !important;
  }

  #service-list .listing-card { height: 390px !important; }

  .listing-card .card-body { padding-bottom: 16px !important; }
  .card-action { flex: 0 0 auto !important; padding-bottom: 2px !important; }

  #rom-list .card-visual,
  #service-list .card-visual {
    flex-basis: 145px !important;
    height: 145px !important;
  }

  .detail-photo {
    height: 190px !important;
    min-height: 190px !important;
  }
}

@media (max-width: 760px) {
  .window.maximized:not([data-window="game"]) {
    left: 0 !important;
    top: 0 !important;
    right: auto !important;
    bottom: auto !important;
    width: 100vw !important;
    width: 100dvw !important;
    height: calc(100vh - 42px) !important;
    height: calc(100dvh - 42px) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 100vw !important;
    max-width: 100dvw !important;
    max-height: calc(100vh - 42px) !important;
    max-height: calc(100dvh - 42px) !important;
  }
}

/* Keep interface text crisp: the CRT scanline layer previously covered every window. */
.desktop::after { display: none !important; }
.window,.taskbar,.start-menu,.tray-tooltip { text-shadow: none; }

/* Fixed-size connection bars do not depend on a platform font glyph. */
.connection-button {
  width: 22px !important;
  min-width: 22px !important;
  max-width: 22px !important;
  height: 22px !important;
  padding: 2px !important;
  flex: 0 0 22px !important;
  overflow: hidden;
  font-size: 0 !important;
  line-height: 1 !important;
}
.connection-bars {
  width: 15px;
  height: 14px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
}
.connection-bars i {
  display: block;
  width: 3px;
  flex: 0 0 3px;
  background: #005b38;
}
.connection-bars i:nth-child(1) { height: 5px; }
.connection-bars i:nth-child(2) { height: 9px; }
.connection-bars i:nth-child(3) { height: 13px; }

.window-controls {
  position: relative;
  z-index: 8;
  flex: 0 0 auto;
}
.window-controls button {
  position: relative;
  z-index: 9;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.start-items button {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-height: 42px;
}
.start-program-icon {
  display: inline-grid !important;
  place-items: center;
  flex: 0 0 22px !important;
}

@media (max-width: 760px) {
  .window-controls { gap: 2px !important; }
  .window-controls button {
    width: 30px !important;
    min-width: 30px !important;
    height: 26px !important;
    line-height: 20px !important;
  }

  .window[data-window="game"] {
    height: calc(100vh - 46px) !important;
    height: calc(100dvh - 46px) !important;
    max-height: calc(100vh - 46px) !important;
    max-height: calc(100dvh - 46px) !important;
  }
  .window[data-window="game"] .game-shell {
    grid-template-rows: auto minmax(100px,1fr) auto auto auto !important;
    padding: 6px 6px max(7px, env(safe-area-inset-bottom)) !important;
    overflow-y: auto !important;
  }
  .window[data-window="game"] #game-canvas {
    max-height: min(180px, calc(100dvh - 300px)) !important;
  }
  .window[data-window="game"] .game-controls {
    display: grid !important;
    grid-template-columns: 58px minmax(0,1fr) 58px !important;
    min-height: 42px !important;
    position: relative;
    z-index: 3;
  }
  .window[data-window="game"] .game-controls button {
    display: block !important;
    min-height: 42px !important;
    touch-action: manipulation !important;
  }
  .window[data-window="game"] .game-pause-button {
    display: block !important;
    min-height: 30px !important;
    position: relative;
    z-index: 3;
    touch-action: manipulation;
  }
  .window[data-window="game"] .game-help { margin-top: 4px !important; }
}
