/* =========================================================
   retro/ — pulpit w stylu Windows 98
   Zero zewnętrznych zasobów: fonty systemowe, grafika w CSS.
   ========================================================= */
:root {
  --w98-bg: #008080;
  --w98-face: #c0c0c0;
  --w98-light: #ffffff;
  --w98-shadow: #808080;
  --w98-dark: #000000;
  --w98-title: linear-gradient(90deg, #000080, #1084d0);
  --w98-title-off: linear-gradient(90deg, #808080, #b5b5b5);
  --w98-text: #000000;
  --mono: "Lucida Console", "DejaVu Sans Mono", Consolas, monospace;
  --ui: Tahoma, Verdana, "DejaVu Sans", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html, body { height: 100%; }
body {
  font-family: var(--ui);
  font-size: 13px;
  color: var(--w98-text);
  background: var(--w98-bg);
  background-image:
    radial-gradient(circle at 50% 40%, #0a9a9a, #005f5f 75%);
  overflow: hidden;
  -webkit-font-smoothing: none;
}

/* efekt CRT — linie i delikatna winieta */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.09) 0 1px, transparent 1px 4px),
    radial-gradient(ellipse at center, transparent 68%, rgba(0,0,0,.20));
  mix-blend-mode: multiply;
}
body.no-crt::after { display: none; }

/* ---------- ramki 3D ---------- */
.out {
  border: 2px solid;
  border-color: var(--w98-light) var(--w98-dark) var(--w98-dark) var(--w98-light);
  background: var(--w98-face);
  box-shadow: inset 1px 1px 0 var(--w98-face), inset -1px -1px 0 var(--w98-shadow);
}
.in {
  border: 2px solid;
  border-color: var(--w98-shadow) var(--w98-light) var(--w98-light) var(--w98-shadow);
  background: var(--w98-light);
  box-shadow: inset 1px 1px 0 var(--w98-dark);
}

/* ---------- pulpit ---------- */
.desktop { position: absolute; inset: 0 0 34px 0; overflow: hidden; }

.icons { position: absolute; top: 12px; left: 12px; display: grid; gap: 4px; width: 86px; }
.icon {
  display: grid; justify-items: center; gap: 3px; padding: 6px 3px;
  background: none; border: 1px dotted transparent; cursor: pointer; color: #fff;
  font-family: var(--ui); font-size: 11px; text-align: center; line-height: 1.25;
  text-shadow: 1px 1px 1px rgba(0,0,0,.85);
}
.icon:hover { background: rgba(0, 0, 128, .35); }
.icon:focus-visible { border-color: #fff; outline: none; }
.icon-glyph { font-size: 30px; line-height: 1; filter: drop-shadow(1px 1px 0 rgba(0,0,0,.5)); }

/* ---------- okna ---------- */
.win {
  position: absolute; min-width: 260px; display: none; flex-direction: column;
  padding: 3px; max-width: calc(100vw - 24px);
}
.win.open { display: flex; }
.win-bar {
  display: flex; align-items: center; gap: 6px; padding: 3px 3px 3px 6px;
  background: var(--w98-title); color: #fff; cursor: move; user-select: none;
}
.win.inactive .win-bar { background: var(--w98-title-off); }
.win-title { flex: 1; font-weight: 700; font-size: 12px; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-btns { display: flex; gap: 2px; }
.win-btn {
  width: 18px; height: 16px; padding: 0; cursor: pointer;
  font-family: var(--ui); font-size: 11px; font-weight: 700; line-height: 1;
  display: grid; place-items: center;
  border: 2px solid; border-color: var(--w98-light) var(--w98-dark) var(--w98-dark) var(--w98-light);
  background: var(--w98-face); color: #000;
}
.win-btn:active { border-color: var(--w98-dark) var(--w98-light) var(--w98-light) var(--w98-dark); }
.win-menu {
  display: flex; gap: 12px; padding: 3px 7px; font-size: 12px;
  border-bottom: 1px solid var(--w98-shadow);
}
.win-menu span { cursor: default; }
.win-menu span u { text-underline-offset: 1px; }
.win-body {
  flex: 1; overflow: auto; padding: 12px 14px; margin: 3px;
  line-height: 1.55; max-height: min(62vh, 460px);
}
.win-body.paper { background: var(--w98-light); }
.win-body.paper.mono { font-family: var(--mono); font-size: 12px; }
.win-status {
  display: flex; gap: 4px; padding: 2px 3px 1px; font-size: 11px;
}
.win-status span {
  padding: 2px 6px;
  border: 1px solid; border-color: var(--w98-shadow) var(--w98-light) var(--w98-light) var(--w98-shadow);
}
.win-status span:first-child { flex: 1; }

.win-body h2 { font-size: 15px; margin-bottom: 8px; }
.win-body h3 { font-size: 13px; margin: 16px 0 6px; }
.win-body p + p { margin-top: 9px; }
.win-body ul { margin: 8px 0 8px 20px; }
.win-body li { margin-bottom: 5px; }
.win-body a { color: #0000c0; }
.win-body a:hover { color: #c00000; }
.win-body hr { border: 0; border-top: 1px solid var(--w98-shadow); border-bottom: 1px solid var(--w98-light); margin: 14px 0; }

.btn98 {
  padding: 5px 16px; cursor: pointer; font-family: var(--ui); font-size: 12px;
  border: 2px solid; border-color: var(--w98-light) var(--w98-dark) var(--w98-dark) var(--w98-light);
  background: var(--w98-face); color: #000; box-shadow: inset 1px 1px 0 #dfdfdf, inset -1px -1px 0 var(--w98-shadow);
}
.btn98:active { border-color: var(--w98-dark) var(--w98-light) var(--w98-light) var(--w98-dark); box-shadow: none; padding: 6px 15px 4px 17px; }
.btn98.primary { font-weight: 700; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* tabela cennika */
.tbl98 { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.tbl98 th, .tbl98 td { padding: 5px 8px; text-align: left; border: 1px solid var(--w98-shadow); }
.tbl98 thead th { background: #000080; color: #fff; }
.tbl98 tbody tr:nth-child(even) { background: #eaeaea; }
.tbl98 td:last-child { text-align: right; font-weight: 700; white-space: nowrap; }

/* ciekawostki */
.fact { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px dotted var(--w98-shadow); }
.fact:last-child { border-bottom: 0; }
.fact b { flex: none; color: #000080; font-family: var(--mono); }

/* pasek zadań */
.taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: 34px; z-index: 500;
  display: flex; align-items: center; gap: 4px; padding: 3px 4px;
  border-top: 2px solid var(--w98-light); background: var(--w98-face);
}
.start {
  display: flex; align-items: center; gap: 6px; padding: 3px 10px 3px 6px;
  font-weight: 700; font-size: 12px; cursor: pointer;
  border: 2px solid; border-color: var(--w98-light) var(--w98-dark) var(--w98-dark) var(--w98-light);
  background: var(--w98-face); color: #000;
}
.start.on { border-color: var(--w98-dark) var(--w98-light) var(--w98-light) var(--w98-dark); }
.start-flag {
  width: 16px; height: 15px; flex: none;
  background:
    linear-gradient(135deg, #ff3b30 0 50%, transparent 50%) 0 0 / 8px 7px no-repeat,
    linear-gradient(135deg, #34c759 0 50%, transparent 50%) 9px 0 / 8px 7px no-repeat,
    linear-gradient(135deg, #007aff 0 50%, transparent 50%) 0 8px / 8px 7px no-repeat,
    linear-gradient(135deg, #ffcc00 0 50%, transparent 50%) 9px 8px / 8px 7px no-repeat;
}
.tasks { flex: 1; display: flex; gap: 3px; overflow: hidden; }
.task {
  min-width: 0; max-width: 170px; flex: 0 1 auto; padding: 4px 10px; cursor: pointer;
  font-size: 12px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border: 2px solid; border-color: var(--w98-light) var(--w98-dark) var(--w98-dark) var(--w98-light);
  background: var(--w98-face); color: #000;
}
.task.active { border-color: var(--w98-dark) var(--w98-light) var(--w98-light) var(--w98-dark); font-weight: 700; }
.tray {
  display: flex; align-items: center; gap: 8px; padding: 3px 9px; font-size: 12px;
  border: 1px solid; border-color: var(--w98-shadow) var(--w98-light) var(--w98-light) var(--w98-shadow);
  font-variant-numeric: tabular-nums;
}
.tray button { background: none; border: 0; cursor: pointer; font-size: 13px; padding: 0; }

/* menu Start */
.startmenu {
  position: fixed; left: 4px; bottom: 36px; z-index: 600; width: 240px; padding: 3px;
  display: none;
}
.startmenu.open { display: flex; }
.startmenu-side {
  width: 26px; flex: none; writing-mode: vertical-rl; transform: rotate(180deg);
  background: linear-gradient(0deg, #000080, #1084d0); color: #fff;
  font-weight: 700; font-size: 15px; letter-spacing: 1px; text-align: right; padding: 8px 4px;
}
.startmenu-items { flex: 1; display: flex; flex-direction: column; }
.startmenu-items button {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px; cursor: pointer;
  background: none; border: 0; font-family: var(--ui); font-size: 13px; text-align: left; color: #000;
}
.startmenu-items button:hover { background: #000080; color: #fff; }
.startmenu-items hr { border: 0; border-top: 1px solid var(--w98-shadow); border-bottom: 1px solid var(--w98-light); margin: 3px 4px; }

/* baner powrotu */
.backbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 26px; font-size: 12px;
  background: #000080; color: #fff; border-bottom: 1px solid #fff;
}
.backbar a { color: #ffdf6b; font-weight: 700; }
.desktop { top: 26px; }

@media (max-width: 640px) {
  .win { left: 8px !important; right: 8px; width: auto !important; }
  .icons { width: 74px; }
  .tray { font-size: 11px; padding: 3px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  body::after { background: none; }
}
