/* Middle.exe – Windows-XP/Y2K-Look, mobile-first */

:root {
  --luna-1: #0a246a;
  --luna-2: #0058e6;
  --luna-3: #3a93ff;
  --luna-hi: #7fb6ff;
  --face: #ece9d8;
  --face-dark: #d4d0c8;
  --edge: #003c74;
  --text: #000;
  --muted: #555;
  --start-1: #3c9a3c;
  --start-2: #57c04a;
  --task-1: #1f4fc7;
  --task-2: #3a7af0;
  --sel: #316ac5;
  --pink: #ff5fa8;
  --taskbar-h: 42px;
  --font: Tahoma, Verdana, "Segoe UI", system-ui, sans-serif;
  --pixel: "VT323", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 13px/1.4 var(--font);
  color: var(--text);
  background: #3a83d8;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- Desktop (Bliss) ---------- */
#desktop {
  position: relative;
  min-height: 100dvh;
  padding: 10px 8px calc(var(--taskbar-h) + 16px + env(safe-area-inset-bottom));
  overflow: hidden;
}
/* Himmel + Hügel bleiben beim Scrollen stehen */
#desktop::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 22% 7% at 20% 14%, rgba(255,255,255,.85), transparent 70%),
    radial-gradient(ellipse 16% 5% at 70% 9%, rgba(255,255,255,.75), transparent 70%),
    radial-gradient(ellipse 28% 8% at 82% 22%, rgba(255,255,255,.6), transparent 70%),
    linear-gradient(#1e62c9 0%, #4b95e8 35%, #9ccbf5 60%, #cfe7fa 75%);
}
.hill {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 0;
  width: 100%; height: 48%;
  pointer-events: none;
}

/* ---------- Pixel-Icons ---------- */
.px { display: inline-block; width: 32px; height: 32px; flex: none; }
.px.small { width: 16px; height: 16px; }
.px svg { width: 100%; height: 100%; display: block; shape-rendering: crispEdges; image-rendering: pixelated; }

/* ---------- Desktop-Icons ---------- */
.icons {
  position: relative; z-index: 2;
  display: flex; gap: 4px; justify-content: space-between;
  margin: 0 auto 10px; max-width: 640px;
}
.icon {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: 1px dashed transparent; padding: 6px 2px; cursor: pointer;
}
.icon .lbl {
  color: #fff; font-size: 11px; text-shadow: 1px 1px 1px #000, 0 0 3px #000;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px;
}
.icon:hover .lbl, .icon:focus-visible .lbl { background: var(--sel); }
.icon:focus-visible { outline: none; border-color: #fff; }

/* ---------- Fenster ---------- */
.win {
  position: relative; z-index: 3;
  background: var(--face);
  border: 1px solid var(--edge);
  border-top: 0;
  border-radius: 8px 8px 0 0;
  box-shadow: inset 0 0 0 2px var(--luna-2), inset 0 0 0 3px var(--luna-3), 4px 6px 18px rgba(0,0,0,.35);
  padding: 0 3px 3px;
  max-width: 640px; margin: 0 auto;
}
.titlebar {
  display: flex; align-items: center; gap: 6px;
  height: 30px; margin: 0 -3px; padding: 0 5px 0 8px;
  border-radius: 7px 7px 0 0;
  background: linear-gradient(#0997ff 0%, #0053ee 8%, #0050ee 40%, #0066ff 88%, #0066ff 93%, #005bff 95%, #003dd7 96%, #003dd7 100%);
  color: #fff;
  user-select: none; -webkit-user-select: none;
}
.titlebar .title {
  flex: 1; min-width: 0; margin: 0;
  font: bold 13px/1 "Trebuchet MS", var(--font);
  text-shadow: 1px 1px #0f1089;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ctrls { display: flex; gap: 2px; }
.ctrls > * {
  display: grid; place-items: center;
  width: 21px; height: 21px; padding: 0;
  border: 1px solid #fff; border-radius: 3px;
  background: linear-gradient(135deg, #5d9bff, #2462e4 60%, #1d4fc0);
  position: relative; cursor: default;
}
.ctrls .b-min::after { content: ""; width: 7px; height: 3px; background: #fff; margin-top: 8px; }
.ctrls .b-max::after { content: ""; width: 9px; height: 8px; border: 2px solid #fff; border-top-width: 3px; }
.ctrls .b-close { background: linear-gradient(135deg, #f0a088, #e35b32 45%, #c43a12); cursor: pointer; }
.ctrls .b-close::before, .ctrls .b-close::after {
  content: ""; position: absolute; width: 12px; height: 2px; background: #fff; border-radius: 1px;
}
.ctrls .b-close::before { transform: rotate(45deg); }
.ctrls .b-close::after { transform: rotate(-45deg); }

.menubar {
  padding: 3px 6px; border-bottom: 1px solid var(--face-dark);
  display: flex; gap: 12px; font-size: 12px; color: #222;
  white-space: nowrap; overflow: hidden;
}
.win > .body { padding: 10px; }

/* ---------- XP-Buttons ---------- */
.xp-btn {
  min-width: 76px; padding: 5px 12px;
  border: 1px solid var(--edge); border-radius: 3px;
  background: linear-gradient(#fff, #ecebe6 85%, #d6d0c5);
  box-shadow: inset -1px -1px #c6c0b5, inset 1px 1px #fff;
  cursor: pointer;
}
.xp-btn:hover { box-shadow: inset 0 -2px #f8b330, inset 0 2px #fce7b6, inset 2px 0 #f9d27f, inset -2px 0 #f9d27f; }
.xp-btn:active { background: linear-gradient(#e3e2da, #f0efea); }
.xp-btn.primary { box-shadow: inset 0 0 0 1px #8fb3ef, inset -1px -1px #c6c0b5; }
.xp-btn:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid #919b9c; }
.tab {
  flex: 1; padding: 6px 4px; cursor: pointer;
  border: 1px solid #919b9c; border-bottom: 0; border-radius: 4px 4px 0 0;
  background: linear-gradient(#fff, #ecebe5);
  font-weight: bold; color: #333;
}
.tab[aria-selected="true"] {
  background: #fcfcfe; position: relative; top: 1px; padding-bottom: 7px;
  border-top: 3px solid #ffc83c; color: #000;
}

/* ---------- Spielfläche ---------- */
.task { margin: 2px 0 10px; }
.task b { color: var(--luna-1); }
.stage {
  background: #fff; border: 1px solid #7f9db9;
  padding: 6px; display: grid; gap: 6px;
}
.stage.single { grid-template-columns: 1fr; }
.stage.grid4 { grid-template-columns: 1fr 1fr; }
.shot {
  margin: 0; position: relative; overflow: hidden;
  background: #222; border: 1px solid #333;
}
.stage.single .shot { aspect-ratio: 4 / 5; }
.stage.grid4 .shot { aspect-ratio: 3 / 4; }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot .tag {
  position: absolute; left: 4px; top: 4px;
  font: 18px/1 var(--pixel); color: #fff; background: rgba(0,0,0,.55); padding: 1px 5px;
}
.shot.revealed::after {
  content: attr(data-age);
  position: absolute; left: 0; right: 0; bottom: 0;
  font: 20px/1.1 var(--pixel); color: #fff; padding: 4px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,.8));
}
.composite { position: relative; aspect-ratio: 1; background: #222; border: 1px solid #333; }
.composite canvas { width: 100%; height: 100%; display: block; }
.composite .qlabel {
  position: absolute; font: 18px/1 var(--pixel); color: #fff;
  background: rgba(0,0,0,.55); padding: 1px 5px;
}
.composite .qlabel:nth-of-type(1) { left: 4px; top: 4px; }
.composite .qlabel:nth-of-type(2) { right: 4px; top: 4px; }
.composite .qlabel:nth-of-type(3) { left: 4px; bottom: 4px; }
.composite .qlabel:nth-of-type(4) { right: 4px; bottom: 4px; }
.loading { padding: 40px 10px; text-align: center; font: 22px var(--pixel); }

.guess { margin-top: 12px; }
.guess label { display: block; margin-bottom: 4px; font-weight: bold; }
.guess .row { display: flex; gap: 8px; }
.guess input {
  flex: 1; min-width: 0;
  font: 24px/1 var(--pixel); padding: 4px 8px;
  border: 1px solid #7f9db9; background: #fff; border-radius: 0;
}
.guess input:focus { outline: 2px solid #ffc83c; outline-offset: 0; }
.err { color: #c00; min-height: 1em; margin: 4px 0 0; font-size: 12px; }

.statusbar {
  display: flex; gap: 2px; margin-top: 2px; font-size: 11px;
}
.statusbar span {
  flex: 1; padding: 2px 6px; border: 1px solid; border-color: #aca899 #fff #fff #aca899;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- Dialoge ---------- */
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(0, 20, 80, .25); }
.dialog {
  position: fixed; z-index: 30;
  left: 8px; right: 8px; top: 50%; transform: translateY(-50%);
  max-width: 460px; margin: 0 auto; max-height: calc(100dvh - var(--taskbar-h) - 24px);
  display: flex; flex-direction: column;
}
.dialog > .body { overflow: auto; }
.msg { display: flex; gap: 12px; align-items: flex-start; }
.msg p { margin: 0 0 8px; }
.btns { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.ico {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; font: bold 22px/1 Georgia, serif; color: #fff;
}
.ico-info { background: radial-gradient(circle at 35% 30%, #8ec5ff, #1c5fd6 70%); border: 1px solid #0b3a96; font-style: italic; }
.ico-ok { background: radial-gradient(circle at 35% 30%, #a6f08a, #2f9b1d 70%); border: 1px solid #1f6b12; }
.ico-warn {
  border-radius: 0; background: none; color: #000; position: relative;
}
.ico-warn::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(#ffe46b, #f2b705);
  clip-path: polygon(50% 4%, 98% 94%, 2% 94%); z-index: -1;
}
.ico-warn { z-index: 0; padding-top: 8px; }
.ico-err { background: radial-gradient(circle at 35% 30%, #ff9a8a, #d0200e 70%); border: 1px solid #8a1206; font-family: var(--font); }
.verdict { font-weight: bold; font-size: 15px; }
.mono { font: 20px var(--pixel); margin: 0 0 8px; }

.xp-progress {
  height: 20px; border: 1px solid #686868; border-radius: 3px; padding: 2px; background: #fff;
}
.xp-progress i {
  display: block; height: 100%; width: 0;
  background: repeating-linear-gradient(90deg, #2fb42f 0 8px, transparent 8px 10px);
  transition: width .15s linear;
}

.restable { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12px; background: #fff; }
.restable th, .restable td { border: 1px solid #c8c4b4; padding: 4px 6px; text-align: left; vertical-align: middle; }
.restable th { background: linear-gradient(#fff, #ebeadb); font-weight: normal; }
.restable td.num { text-align: right; font-family: var(--pixel); font-size: 17px; white-space: nowrap; }
.restable tfoot td { font-weight: bold; background: #fffbe6; }
.restable img { width: 40px; height: 40px; object-fit: cover; display: block; border: 1px solid #999; }
.restable .q { font: 16px var(--pixel); color: var(--luna-2); }

.notepad { background: #fff; border: 1px solid #7f9db9; margin: 0 0 3px; }
.notepad pre { margin: 0; font: 13px/1.5 "Lucida Console", Monaco, monospace; white-space: pre-wrap; }

.shutdown {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(#5a7edc, #003399); color: #fff; text-align: center;
}
.shutdown .xp-btn { color: #000; margin-top: 12px; }

/* ---------- Y2K-Akzente ---------- */
.glitch { text-shadow: -2px 0 #ff2bd6, 2px 0 #00e5ff; }
.big { font: 30px/1 var(--pixel); margin: 0 0 8px; color: var(--luna-1); }
.shutdown .big { color: #fff; font-size: 40px; }

.sticker {
  position: fixed; z-index: 1; pointer-events: none; user-select: none;
  font: 28px/1 var(--pixel); padding: 4px 10px;
  box-shadow: 3px 3px 0 rgba(0,0,0,.35);
}
.s-17 {
  right: 10px; bottom: calc(var(--taskbar-h) + 18px);
  background: var(--pink); color: #fff; font-size: 54px; transform: rotate(-8deg);
  border: 3px solid #fff; border-radius: 10px;
}
.s-caution {
  display: none;
  background: repeating-linear-gradient(-45deg, #ffd400 0 14px, #111 14px 28px);
  color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000; font-size: 24px;
  transform: rotate(6deg);
}
.s-555 {
  display: none;
  background: #fff; color: #111; border: 2px solid #111; transform: rotate(-4deg);
}

.deco-player { display: none; }
.lcd {
  background: #0b1a0b; color: #6dff6d; font: 20px/1.1 var(--pixel);
  padding: 6px 8px; border: 2px inset #999; display: flex; gap: 10px; overflow: hidden;
}
.marquee { flex: 1; overflow: hidden; white-space: nowrap; }
.marquee span { display: inline-block; padding-left: 100%; animation: marquee 14s linear infinite; }
@keyframes marquee { to { transform: translateX(-100%); } }
.seek { height: 6px; margin: 10px 4px 4px; background: #fff; border: 1px solid #888; position: relative; }
.seek i { position: absolute; left: 34%; top: -6px; width: 10px; height: 16px; background: linear-gradient(#fff, #c9c6ba); border: 1px solid #555; }

@keyframes shake { 0%,100% { transform: translate(0,-50%); } 25% { transform: translate(-8px,-50%); } 75% { transform: translate(8px,-50%); } }
.shake { animation: shake .25s 2; }

/* ---------- Taskleiste ---------- */
.taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--taskbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; align-items: stretch;
  background: linear-gradient(#3168d5 0%, #4993e6 4%, #2157d7 10%, #2663da 92%, #1941a5 100%);
}
.start {
  display: flex; align-items: center; gap: 6px;
  padding: 0 18px 0 10px; border: 0; border-radius: 0 12px 12px 0;
  background: linear-gradient(#3c8f3c 0%, #5cc35c 8%, #3c9a3c 40%, #36912f 88%, #2a7a25 100%);
  color: #fff; font: italic bold 19px/1 "Trebuchet MS", var(--font);
  text-shadow: 1px 1px 1px #222; cursor: pointer;
  box-shadow: inset -2px 0 3px rgba(0,0,0,.3);
}
.start .px.small { width: 20px; height: 20px; }
.start[aria-expanded="true"] { filter: brightness(.85); }
.tasks { flex: 1; min-width: 0; display: flex; align-items: center; padding: 0 6px; }
.task-btn {
  display: flex; align-items: center; gap: 6px; max-width: 180px;
  height: 30px; padding: 0 10px; border-radius: 3px; color: #fff;
  background: linear-gradient(#1e52b7, #3c79e4); box-shadow: inset 1px 1px 2px rgba(0,0,0,.45);
  white-space: nowrap; overflow: hidden;
}
.tray {
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: linear-gradient(#0f8de7, #18a7f0 10%, #0d84e0 90%, #0b6fc8);
  border-left: 1px solid #0b4ea6; color: #fff; font-size: 12px;
}

/* ---------- Startmenü ---------- */
.startmenu {
  position: fixed; z-index: 45; left: 0; bottom: calc(var(--taskbar-h) + env(safe-area-inset-bottom));
  width: min(380px, 100vw);
  background: #fff; border: 1px solid #1c50c6; border-radius: 8px 8px 0 0; overflow: hidden;
  box-shadow: 3px -2px 14px rgba(0,0,0,.4);
}
.startmenu header {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: linear-gradient(#1868ce, #0e60cb 60%, #2b78dc); color: #fff; font-size: 16px;
  text-shadow: 1px 1px #0b3f9b;
}
.startmenu header .px { background: #fff; border: 2px solid #d8e4f8; border-radius: 4px; padding: 2px; width: 40px; height: 40px; }
.startmenu .cols { display: grid; grid-template-columns: 1.3fr 1fr; border-top: 2px solid #e88e2f; }
.startmenu ul { list-style: none; margin: 0; padding: 6px 0; }
.startmenu ul.right { background: #d3e5fa; border-left: 1px solid #95bdee; }
.startmenu li button {
  width: 100%; display: flex; align-items: center; gap: 8px; text-align: left;
  border: 0; background: none; padding: 6px 10px; cursor: pointer;
}
.startmenu li button .px.small { width: 24px; height: 24px; }
.startmenu li button small { display: block; color: var(--muted); font-size: 11px; }
.startmenu li button:hover, .startmenu li button:focus-visible { background: var(--sel); color: #fff; outline: none; }
.startmenu li button:hover small { color: #dde; }
.startmenu ul.right button { color: #0a246a; font-weight: bold; }
.startmenu footer {
  display: flex; justify-content: flex-end; padding: 6px 8px;
  background: linear-gradient(#4282d6, #2b6fd3 60%, #1e5ec5);
}
.startmenu footer button {
  display: flex; align-items: center; gap: 6px; border: 0; background: none; color: #fff; cursor: pointer; padding: 4px 6px;
}
.startmenu footer button:hover { background: rgba(255,255,255,.15); }
.pw { width: 20px; height: 20px; border-radius: 4px; background: linear-gradient(135deg, #f0a088, #e35b32 45%, #c43a12); border: 1px solid #fff; position: relative; }
.pw::after { content: "⏻"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: #fff; }

/* ---------- Breitere Screens ---------- */
@media (min-width: 720px) {
  #desktop { padding: 20px 20px calc(var(--taskbar-h) + 24px); }
  .icons {
    position: absolute; left: 14px; top: 18px; margin: 0;
    flex-direction: column; gap: 14px; width: 92px;
  }
  .icon { flex: none; }
  .icon .lbl { white-space: normal; text-align: center; }
  .game { margin-top: 6px; max-width: 860px; }
  .stage.single .shot, .composite {
    height: min(56vh, 540px); width: auto; margin: 0 auto;
  }
  .stage.single .shot { aspect-ratio: 4 / 5; }
  .stage.grid4 { grid-template-columns: repeat(4, 1fr); }
  .stage.single { background: #fff; }
  .titlebar.drag { cursor: move; }
  .s-caution { display: block; left: 6%; bottom: 22%; }
  .s-555 { display: block; left: 3%; bottom: 38%; }
  .s-17 { right: 4%; bottom: 14%; font-size: 80px; }
}
@media (min-width: 1560px) {
  .deco-player {
    display: block; position: fixed; right: 3%; top: 40px; width: 300px; transform: rotate(2deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .marquee span { animation: none; padding-left: 0; }
  .shake { animation: none; }
}

/* ---------- Anmeldebildschirm (nur gehostete, verschlüsselte Version) ---------- */
.xp-login {
  position: fixed; inset: 0; z-index: 100;
  display: grid; grid-template-rows: 64px 1fr 64px;
  background: #5a7edc; color: #fff;
  transition: opacity .4s;
}
.xp-login.xl-out { opacity: 0; pointer-events: none; }
.xl-top { background: #00309c; border-bottom: 2px solid #f9a64a; }
.xl-bot {
  background: linear-gradient(#467bd8, #2c4fb3); border-top: 2px solid #8fb2ef;
  display: flex; align-items: center; padding: 0 20px; font-size: 12px;
}
.xl-mid {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 16px;
  background: radial-gradient(ellipse at 20% 15%, #8ab0f0 0, #5a7edc 45%, #3c62c8 100%);
}
.xl-left { text-align: center; }
.xl-left p { margin: 0; font-size: 15px; }
.xl-left .xl-brand { font: 52px/1 var(--pixel); color: #fff; margin-bottom: 8px !important; }
.xl-user { display: flex; align-items: center; gap: 14px; }
.xl-pic {
  width: 72px; height: 72px; border: 3px solid #fff; border-radius: 6px; background: #fff;
  display: grid; place-items: center; box-shadow: 0 0 0 2px #f9b54a, 2px 3px 6px rgba(0,0,0,.35);
}
.xl-pic .px { width: 52px; height: 52px; }
.xl-fields label { display: block; font-size: 20px; margin-bottom: 6px; text-shadow: 1px 1px #1c3a8c; }
.xl-row { display: flex; gap: 6px; }
.xl-row input {
  width: 180px; padding: 6px 8px; font: 14px var(--font);
  border: 1px solid #1c3a8c; border-radius: 3px;
}
.xl-row button {
  width: 32px; border: 1px solid #fff; border-radius: 4px; cursor: pointer;
  background: linear-gradient(#5ac85a, #2b8f2b); color: #fff; font-size: 16px; font-weight: bold;
}
.xl-msg { min-height: 1.3em; margin: 6px 0 0; font-size: 12px; }
.xl-msg.bad { color: #fff; background: #c0322a; padding: 3px 6px; border-radius: 3px; display: inline-block; }
@media (min-width: 720px) {
  .xl-mid { flex-direction: row; gap: 0; }
  .xl-left { width: 50%; text-align: right; padding-right: 36px; border-right: 1px solid rgba(255,255,255,.5); }
  .xl-user { width: 50%; padding-left: 36px; }
}
