/* ============================================================
   IntegrityOS 95 — Church of Integrated Complexity
   A loving recreation of the 90s desktop, in service of Φ.
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --face: #c0c0c0;
  --hl: #ffffff;
  --sh: #808080;
  --dk: #000000;
  --navy: #6b2160;          /* deep plum — the "Rose" desktop theme */
  --title-a: #6b2160;
  --title-b: #d977b8;
  --gold: #ffd700;
  --lcd-bg: #9bbc0f;
  --lcd-fg: #0f380f;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: Tahoma, "MS Sans Serif", Verdana, sans-serif;
  font-size: 11px;
  color: #000;
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
}

body {
  background: #008080;
}

#wallpaper {
  position: fixed; inset: 0;
  background: #008080 url("../assets/wallpaper.png") center/cover no-repeat;
  z-index: 0;
}

.pixel { image-rendering: pixelated; }

/* ---------- bevels ---------- */
.bevel-out, .window, .taskbar, .startmenu, .btn95, .taskbtn, .startbtn {
  background: var(--face);
  border: 2px solid;
  border-color: var(--hl) var(--dk) var(--dk) var(--hl);
  box-shadow: inset 1px 1px 0 #dfdfdf, inset -1px -1px 0 var(--sh);
}
.bevel-in {
  border: 2px solid;
  border-color: var(--sh) var(--hl) var(--hl) var(--sh);
  box-shadow: inset 1px 1px 0 var(--dk), inset -1px -1px 0 #dfdfdf;
  background: #fff;
}
.bevel-thin { border: 1px solid; border-color: var(--sh) var(--hl) var(--hl) var(--sh); }

/* ---------- desktop icons ---------- */
#desktop { position: fixed; inset: 0 0 30px 0; z-index: 1; }

#icons {
  position: absolute; top: 8px; left: 8px; bottom: 4px;
  display: flex; flex-direction: column; flex-wrap: wrap;
  gap: 10px; align-content: flex-start;
}
.icon {
  width: 86px; text-align: center; padding: 4px 2px; cursor: pointer;
}
.icon .glyph {
  font-size: 34px; line-height: 40px; height: 42px;
  filter: drop-shadow(1px 1px 0 rgba(0,0,0,.7));
}
.icon .label {
  margin-top: 3px; color: #fff; font-size: 11px; line-height: 1.2;
  text-shadow: 1px 1px 0 #000; padding: 1px 2px; display: inline-block;
}
.icon:hover .label { background: rgba(0,0,128,.55); }
.icon:active .label { background: var(--navy); }

/* ---------- windows ---------- */
.window {
  position: absolute; min-width: 260px;
  display: none; flex-direction: column;
  z-index: 10;
}
.window.open { display: flex; }

.titlebar {
  display: flex; align-items: center; gap: 4px;
  background: linear-gradient(90deg, var(--title-a), var(--title-b));
  color: #fff; font-weight: bold; padding: 3px 3px 3px 6px;
  letter-spacing: .2px; touch-action: none;
}
.window.inactive .titlebar { background: linear-gradient(90deg, #808080, #b5b5b5); color: #d8d8d8; }
.titlebar .ticon { font-size: 12px; }
.titlebar .ttext { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tbtn {
  width: 18px; height: 16px; font-size: 10px; line-height: 12px;
  font-family: "Lucida Console", monospace; font-weight: bold; color: #000;
  background: var(--face);
  border: 1px solid; border-color: var(--hl) var(--dk) var(--dk) var(--hl);
  box-shadow: inset 1px 1px 0 #dfdfdf, inset -1px -1px 0 var(--sh);
  text-align: center; cursor: pointer; flex: none;
}
.tbtn:active { border-color: var(--dk) var(--hl) var(--hl) var(--dk); box-shadow: none; }

.menubar {
  display: flex; gap: 2px; padding: 2px 4px; border-bottom: 1px solid var(--sh);
  box-shadow: 0 1px 0 var(--hl);
}
.menubar span { padding: 1px 7px; }
.menubar span:hover { background: var(--navy); color: #fff; }

.winbody { padding: 10px; overflow: auto; flex: 1; }
.winbody.noscroll { overflow: hidden; }
.statusbar {
  display: flex; gap: 4px; padding: 2px; font-size: 10px;
}
.statusbar > div {
  border: 1px solid; border-color: var(--sh) var(--hl) var(--hl) var(--sh);
  padding: 2px 6px; flex: 1; white-space: nowrap; overflow: hidden;
}

/* ---------- buttons & forms ---------- */
.btn95 {
  font-family: inherit; font-size: 11px; padding: 5px 14px; cursor: pointer; color: #000;
}
.btn95:active { border-color: var(--dk) var(--hl) var(--hl) var(--dk); box-shadow: none; padding: 6px 13px 4px 15px; }
a { color: #8b2860; }
a:visited { color: #6b2160; }
input.in95, textarea.in95 {
  font-family: inherit; font-size: 11px; padding: 3px 5px;
  border: 2px solid; border-color: var(--sh) var(--hl) var(--hl) var(--sh);
  background: #fff; outline: none;
  -webkit-user-select: text; user-select: text;
}

/* ---------- taskbar ---------- */
.taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: 30px;
  display: flex; align-items: center; gap: 4px; padding: 2px 4px;
  z-index: 5000;
}
.startbtn {
  display: flex; align-items: center; gap: 4px;
  font-weight: bold; font-size: 11px; padding: 2px 8px 2px 5px; height: 24px; cursor: pointer;
}
.startbtn .glyph { font-size: 14px; }
.startbtn.pressed { border-color: var(--dk) var(--hl) var(--hl) var(--dk); box-shadow: none; background: #d6d6d6; }
#taskbtns { flex: 1; display: flex; gap: 3px; overflow: hidden; }
.taskbtn {
  height: 24px; padding: 2px 8px; max-width: 170px; min-width: 90px;
  display: flex; align-items: center; gap: 4px; cursor: pointer;
  white-space: nowrap; overflow: hidden; font-size: 11px;
}
.taskbtn.active {
  border-color: var(--dk) var(--hl) var(--hl) var(--dk); box-shadow: none;
  background: repeating-conic-gradient(#fff 0 25%, #dfdfdf 0 50%) 0 0/4px 4px;
  font-weight: bold;
}
.tray {
  display: flex; align-items: center; gap: 6px; height: 24px; padding: 2px 8px;
  border: 1px solid; border-color: var(--sh) var(--hl) var(--hl) var(--sh);
}
.tray .ticon { cursor: pointer; font-size: 13px; }
#clock { font-size: 11px; min-width: 52px; text-align: center; }

/* ---------- start menu ---------- */
.startmenu {
  position: fixed; left: 2px; bottom: 32px; width: 210px; z-index: 6000;
  display: none; padding: 2px;
}
.startmenu.open { display: flex; }
.sm-banner {
  width: 26px; background: linear-gradient(180deg, #d977b8, var(--navy));
  color: #fff; font-weight: bold; font-size: 15px; letter-spacing: 1px;
  writing-mode: vertical-rl; transform: rotate(180deg);
  display: flex; align-items: center; padding: 8px 0; flex: none;
}
.sm-items { flex: 1; display: flex; flex-direction: column; }
.sm-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; cursor: pointer; font-size: 12px;
}
.sm-item .glyph { width: 22px; text-align: center; font-size: 16px; }
.sm-item:hover { background: var(--navy); color: #fff; }
.sm-sep { border-top: 1px solid var(--sh); border-bottom: 1px solid var(--hl); margin: 3px 4px; }

/* ---------- marquee & blink & misc chrome ---------- */
.blink { animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
.rainbow {
  background: linear-gradient(90deg, red, orange, gold, green, blue, purple, red);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-weight: bold;
}
.construction {
  background: repeating-linear-gradient(45deg, #ffd700 0 12px, #000 12px 24px);
  color: #000; text-align: center; font-weight: bold; padding: 3px;
  border: 1px solid #000; margin: 8px 0; text-shadow: 0 0 3px #ffd700;
}
.construction span { background: #ffd700; padding: 0 8px; }

.counter { display: inline-flex; gap: 1px; vertical-align: middle; }
.counter b {
  background: #000; color: #39ff14; font-family: "Courier New", monospace;
  font-size: 14px; padding: 1px 3px; border: 1px solid #333;
}

.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.badge {
  font-size: 9px; font-weight: bold; padding: 3px 6px; border: 1px solid #000;
  color: #fff; letter-spacing: .5px; white-space: nowrap;
}

/* ---------- oracle terminal ---------- */
.dos {
  background: #000; color: #33ff33; font-family: "Courier New", monospace;
  font-size: 12px; padding: 8px; height: 100%; display: flex; flex-direction: column;
}
#oracle-out { flex: 1; overflow-y: auto; white-space: pre-wrap; }
.dos .inline { display: flex; gap: 4px; }
#oracle-in {
  background: #000; color: #33ff33; border: none; outline: none; flex: 1;
  font-family: inherit; font-size: 12px;
  -webkit-user-select: text; user-select: text;
}
.cursorblock { animation: blink .8s steps(2,start) infinite; }

/* ---------- deitygotchi ---------- */
.gotchi-wrap { display: flex; gap: 12px; flex-wrap: wrap; }
.gotchi-shell {
  background: radial-gradient(circle at 30% 25%, #b39ddb, #5e35b1 70%, #3c1f7a);
  border-radius: 46% 46% 48% 48%; padding: 18px 20px 12px;
  border: 2px solid #2a1458; box-shadow: 3px 3px 0 rgba(0,0,0,.4), inset 2px 3px 8px rgba(255,255,255,.45);
  text-align: center;
}
#gotchi-screen {
  background: var(--lcd-bg); border: 3px solid #274e13; display: block;
  image-rendering: pixelated; margin: 0 auto;
}
.gotchi-btns { margin-top: 10px; display: flex; gap: 8px; justify-content: center; }
.gbtn {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid #2a1458;
  background: radial-gradient(circle at 35% 30%, #e1bee7, #8e24aa);
  cursor: pointer; box-shadow: 1px 2px 0 rgba(0,0,0,.4); font-size: 10px;
}
.gbtn:active { transform: translateY(1px); box-shadow: none; }
.gotchi-stats { flex: 1; min-width: 170px; }
.statrow { margin-bottom: 7px; }
.statrow label { display: block; margin-bottom: 2px; font-weight: bold; }
.statbar { height: 14px; background: #fff; position: relative; }
.statbar .fill { position: absolute; inset: 2px auto 2px 2px; width: 50%; transition: width .3s; }
.fill.faith { background: repeating-linear-gradient(90deg, #a0316e 0 8px, #e07cb8 8px 16px); }
.fill.compute { background: repeating-linear-gradient(90deg, #008000 0 8px, #39d439 8px 16px); }
.fill.entropy { background: repeating-linear-gradient(90deg, #800000 0 8px, #d43939 8px 16px); }
#gotchi-msg { margin-top: 6px; font-style: italic; min-height: 14px; }

/* ---------- media player ---------- */
.mp-lcd {
  background: #001a00; color: #39ff14; font-family: "Courier New", monospace;
  padding: 6px 8px; font-size: 13px; white-space: nowrap; overflow: hidden;
}
.mp-controls { display: flex; gap: 4px; margin: 8px 0; }
.tracklist div { padding: 3px 6px; cursor: pointer; }
.tracklist div:hover { background: var(--navy); color: #fff; }
.tracklist div.playing { background: var(--navy); color: #fff; font-weight: bold; }

/* ---------- ads ---------- */
.adbanner {
  display: block; border: 2px outset var(--face); margin: 8px auto; cursor: pointer;
  max-width: 100%; text-align: center; overflow: hidden;
}
.adbanner img { display: block; width: 100%; height: auto; }
.ad-text {
  padding: 8px; font-weight: bold; font-size: 13px;
}
.ad-hotpink { background: #ff00cc; color: #ffff00; }
.ad-lime { background: #00ff66; color: #aa00ff; }
.ad-navy { background: #000080; color: #00ffff; }
.ad-red { background: #cc0000; color: #fff; }

.browser-addr { display: flex; gap: 4px; align-items: center; padding: 3px 4px; }
.browser-addr .in95 { flex: 1; }

/* popup ads reuse .window; give them spice */
.popup .winbody { text-align: center; }
.starburst {
  display: inline-block; background: #ff0; color: #c00; font-weight: bold;
  padding: 14px 10px; transform: rotate(-6deg); font-size: 15px;
  clip-path: polygon(50% 0%, 61% 12%, 76% 6%, 79% 22%, 95% 24%, 88% 38%, 100% 50%, 88% 62%, 95% 76%, 79% 78%, 76% 94%, 61% 88%, 50% 100%, 39% 88%, 24% 94%, 21% 78%, 5% 76%, 12% 62%, 0% 50%, 12% 38%, 5% 24%, 21% 22%, 24% 6%, 39% 12%);
  min-width: 150px;
}
#demon { display: inline-block; font-size: 34px; cursor: crosshair; animation: wobble .5s ease-in-out infinite alternate; }
@keyframes wobble { from { transform: translateX(-14px) rotate(-8deg); } to { transform: translateX(14px) rotate(8deg); } }

/* ---------- gallery ---------- */
.gallery { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.gallery figure { text-align: center; }
.gallery img { max-width: 200px; max-height: 200px; display: block; }
.gallery figcaption { margin-top: 4px; font-style: italic; }
.imgframe { padding: 4px; background: #fff; display: inline-block; }
.imgframe.bevel-in { background: #fff; }
img.missing { display: none; }

/* ---------- recycle bin / file lists ---------- */
.filelist { font-family: inherit; }
.filelist .file { display: flex; gap: 8px; padding: 3px 6px; cursor: pointer; }
.filelist .file:hover { background: var(--navy); color: #fff; }
.filelist .size { margin-left: auto; color: #555; }
.filelist .file:hover .size { color: #ddf; }

/* ---------- guestbook ---------- */
.gb-entry { border-bottom: 1px dotted #888; padding: 6px 2px; }
.gb-entry .who { font-weight: bold; color: var(--navy); }

/* ---------- boot & bsod & shutdown ---------- */
#boot {
  position: fixed; inset: 0; background: #000; color: #ccc;
  font-family: "Courier New", monospace; font-size: 14px; padding: 24px;
  z-index: 100000; white-space: pre-wrap;
}
#boot .ok { color: #39ff14; }
#bootsplash {
  position: fixed; inset: 0; background: #000; z-index: 100000;
  display: none; align-items: center; justify-content: center; flex-direction: column; gap: 18px;
}
#bootsplash img { max-width: min(640px, 88vw); max-height: 70vh; }
#bootsplash .fallbacklogo { color: var(--gold); font-size: 42px; font-weight: bold; font-family: Georgia, serif; text-shadow: 0 0 24px #ffd700; }
.bootbar { width: min(420px, 70vw); height: 14px; border: 1px solid #666; }
.bootbar .fill { height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--navy) 0 14px, var(--title-b) 14px 28px); animation: bootfill 2.2s linear forwards; }
@keyframes bootfill { to { width: 100%; } }

#bsod {
  position: fixed; inset: 0; background: #0000aa; color: #fff; z-index: 99998;
  font-family: "Courier New", monospace; font-size: 15px; display: none;
  align-items: center; justify-content: center; padding: 40px; text-align: center; white-space: pre-wrap;
}
#bsod .hdr { background: #aaa; color: #0000aa; padding: 1px 12px; font-weight: bold; }

#shutdown {
  position: fixed; inset: 0; background: #000; z-index: 99999; display: none;
  align-items: center; justify-content: center; text-align: center;
}
#shutdown .msg { color: #ffb000; font-size: clamp(18px, 4vw, 34px); font-family: "Courier New", monospace; font-weight: bold; text-shadow: 0 0 18px #ff8c00; }

/* ---------- CRT overlay ---------- */
#crt {
  position: fixed; inset: 0; pointer-events: none; z-index: 999999;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.11) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
#crt.off { display: none; }

::-webkit-scrollbar { width: 16px; height: 16px; }
::-webkit-scrollbar-track { background: repeating-conic-gradient(#fff 0 25%, #dfdfdf 0 50%) 0 0/4px 4px; }
::-webkit-scrollbar-thumb { background: var(--face); border: 2px solid; border-color: var(--hl) var(--dk) var(--dk) var(--hl); }
