/* Windows 95 design tokens & primitives */

:root {
  --w95-gray: #c0c0c0;
  --w95-gray-light: #dfdfdf;
  --w95-gray-lighter: #ffffff;
  --w95-gray-dark: #808080;
  --w95-gray-darker: #404040;
  --w95-black: #000000;
  --w95-blue: #000080;
  --w95-blue-bright: #0000ff;
  --w95-teal: #008080;
  --w95-red: #ff0000;
  --w95-yellow: #ffff00;
  --w95-titlebar-active: #000080;
  --w95-titlebar-inactive: #808080;
  --w95-bsod: #0000aa;
}

html, body, #root {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--w95-teal);
  font-family: 'Pixelated MS Sans Serif', 'MS Sans Serif', 'Microsoft Sans Serif', Tahoma, Geneva, sans-serif;
  font-size: 11px;
  color: var(--w95-black);
  user-select: none;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  font-smooth: never;
}

/* Pixelated font via web safe stack with image-rendering tricks; Tahoma 11 is a good MS Sans Serif fallback */
body {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><polygon points='2,2 2,22 8,17 12,26 16,24 12,16 20,16' fill='white' stroke='black' stroke-width='1.5' stroke-linejoin='round'/></svg>") 0 0, default;
}

/* === Bevel system === */
/* Outset (raised) — buttons, window frames */
.bevel-out {
  border-top: 1px solid var(--w95-gray-lighter);
  border-left: 1px solid var(--w95-gray-lighter);
  border-right: 1px solid var(--w95-gray-darker);
  border-bottom: 1px solid var(--w95-gray-darker);
  box-shadow: inset -1px -1px 0 var(--w95-gray-dark), inset 1px 1px 0 var(--w95-gray-light);
}

/* Inset (sunken) — input fields, inset wells */
.bevel-in {
  border-top: 1px solid var(--w95-gray-dark);
  border-left: 1px solid var(--w95-gray-dark);
  border-right: 1px solid var(--w95-gray-lighter);
  border-bottom: 1px solid var(--w95-gray-lighter);
  box-shadow: inset 1px 1px 0 var(--w95-gray-darker), inset -1px -1px 0 var(--w95-gray-light);
}

/* Thin inset — for inputs */
.bevel-in-thin {
  border: 1px solid;
  border-color: var(--w95-gray-darker) var(--w95-gray-lighter) var(--w95-gray-lighter) var(--w95-gray-darker);
}

/* Thin outset — for status bar segments */
.bevel-out-thin {
  border: 1px solid;
  border-color: var(--w95-gray-lighter) var(--w95-gray-darker) var(--w95-gray-darker) var(--w95-gray-lighter);
}

/* Pressed state for buttons */
.bevel-pressed {
  border-top: 1px solid var(--w95-gray-darker);
  border-left: 1px solid var(--w95-gray-darker);
  border-right: 1px solid var(--w95-gray-lighter);
  border-bottom: 1px solid var(--w95-gray-lighter);
  box-shadow: inset 1px 1px 0 var(--w95-gray-dark);
}

/* === Window === */
.w95-window {
  background: var(--w95-gray);
  padding: 2px;
  display: flex;
  flex-direction: column;
}

.w95-titlebar {
  background: linear-gradient(90deg, var(--w95-blue) 0%, #1084d0 100%);
  color: white;
  padding: 2px 2px 2px 4px;
  font-weight: bold;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 18px;
  flex-shrink: 0;
}

.w95-titlebar.inactive {
  background: linear-gradient(90deg, #808080 0%, #b5b5b5 100%);
}

.w95-titlebar-buttons {
  display: flex;
  gap: 0;
}

.w95-titlebar-button {
  width: 16px;
  height: 14px;
  background: var(--w95-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Marlett', 'Segoe UI Symbol', sans-serif;
  font-size: 9px;
  font-weight: bold;
  color: black;
  cursor: pointer;
  margin-left: 2px;
  padding: 0;
}

.w95-titlebar-button:active {
  border-top: 1px solid var(--w95-gray-darker) !important;
  border-left: 1px solid var(--w95-gray-darker) !important;
  border-right: 1px solid var(--w95-gray-lighter) !important;
  border-bottom: 1px solid var(--w95-gray-lighter) !important;
}

/* === Menu bar === */
.w95-menubar {
  display: flex;
  background: var(--w95-gray);
  padding: 1px 2px;
  font-size: 11px;
  border-bottom: 1px solid var(--w95-gray-dark);
  flex-shrink: 0;
}

.w95-menu-item {
  padding: 2px 6px;
  cursor: pointer;
}

.w95-menu-item:hover, .w95-menu-item.open {
  background: var(--w95-blue);
  color: white;
}

.w95-menu-item .underline-key {
  text-decoration: underline;
}

/* === Buttons === */
.w95-button {
  background: var(--w95-gray);
  padding: 3px 12px;
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  min-width: 75px;
  text-align: center;
  position: relative;
}

.w95-button:focus {
  outline: 1px dotted black;
  outline-offset: -4px;
}

.w95-button:active {
  border-top: 1px solid var(--w95-gray-darker);
  border-left: 1px solid var(--w95-gray-darker);
  border-right: 1px solid var(--w95-gray-lighter);
  border-bottom: 1px solid var(--w95-gray-lighter);
  box-shadow: inset 1px 1px 0 var(--w95-gray-dark);
  padding: 4px 11px 2px 13px;
}

/* === Inputs === */
.w95-input {
  background: white;
  padding: 3px 4px;
  font-family: inherit;
  font-size: 11px;
  outline: none;
  border: 1px solid;
  border-color: var(--w95-gray-darker) var(--w95-gray-lighter) var(--w95-gray-lighter) var(--w95-gray-darker);
  box-shadow: inset 1px 1px 0 var(--w95-gray-dark);
}

/* === Taskbar === */
.w95-taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 28px;
  background: var(--w95-gray);
  display: flex;
  align-items: center;
  padding: 2px;
  gap: 4px;
  z-index: 9999;
  border-top: 1px solid var(--w95-gray-lighter);
  box-shadow: inset 0 1px 0 var(--w95-gray-light);
}

.w95-taskbar-button {
  background: var(--w95-gray);
  height: 22px;
  padding: 0 6px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 140px;
  max-width: 200px;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.w95-taskbar-button.active {
  border-top: 1px solid var(--w95-gray-darker);
  border-left: 1px solid var(--w95-gray-darker);
  border-right: 1px solid var(--w95-gray-lighter);
  border-bottom: 1px solid var(--w95-gray-lighter);
  background: 
    repeating-conic-gradient(var(--w95-gray) 0 25%, var(--w95-gray-light) 0 50%) 50% / 2px 2px;
  box-shadow: inset 1px 1px 0 var(--w95-gray-dark);
}

.w95-start-button {
  background: var(--w95-gray);
  height: 22px;
  padding: 0 4px 0 2px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: bold;
  font-size: 11px;
  cursor: pointer;
}

.w95-start-button.open {
  border-top: 1px solid var(--w95-gray-darker);
  border-left: 1px solid var(--w95-gray-darker);
  border-right: 1px solid var(--w95-gray-lighter);
  border-bottom: 1px solid var(--w95-gray-lighter);
  box-shadow: inset 1px 1px 0 var(--w95-gray-dark);
  padding: 1px 3px 0 3px;
}

.w95-tray {
  margin-left: auto;
  height: 22px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 8px;
  font-size: 11px;
}

/* === Desktop icons === */
.w95-desktop-icon {
  width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px;
  cursor: pointer;
  color: white;
  text-align: center;
  font-size: 11px;
  text-shadow: 1px 1px 0 black;
}

.w95-desktop-icon.selected .w95-desktop-icon-label {
  background: var(--w95-blue);
  outline: 1px dotted white;
  outline-offset: 0;
}

.w95-desktop-icon-image {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: flex;
  align-items: center;
  justify-content: center;
}

.w95-desktop-icon-label {
  padding: 1px 3px;
  line-height: 1.2;
  word-break: break-word;
}

/* === Start menu === */
.w95-start-menu {
  position: fixed;
  bottom: 28px;
  left: 2px;
  width: 200px;
  background: var(--w95-gray);
  padding: 2px;
  z-index: 10000;
  display: flex;
}

.w95-start-menu-side {
  width: 22px;
  background: var(--w95-gray-dark);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: white;
  font-weight: bold;
  font-size: 18px;
  letter-spacing: 1px;
  font-style: italic;
  background: linear-gradient(180deg, #808080 0%, #404040 100%);
}

.w95-start-menu-side b {
  color: white;
  font-style: italic;
}

.w95-start-menu-side b span {
  color: var(--w95-gray-light);
}

.w95-start-menu-items {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.w95-start-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 16px 4px 4px;
  cursor: pointer;
  font-size: 12px;
  position: relative;
}

.w95-start-menu-item:hover {
  background: var(--w95-blue);
  color: white;
}

.w95-start-menu-item .arrow {
  margin-left: auto;
  font-family: 'Marlett', 'Segoe UI Symbol', sans-serif;
  font-size: 10px;
}

.w95-start-menu-divider {
  height: 1px;
  background: var(--w95-gray-dark);
  border-bottom: 1px solid var(--w95-gray-lighter);
  margin: 2px 1px;
}

.w95-submenu {
  position: absolute;
  left: 100%;
  top: -2px;
  background: var(--w95-gray);
  padding: 2px;
  min-width: 180px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
}

/* === Status bar === */
.w95-statusbar {
  background: var(--w95-gray);
  display: flex;
  padding: 2px;
  gap: 2px;
  font-size: 11px;
  flex-shrink: 0;
}

.w95-statusbar-segment {
  padding: 2px 4px;
  flex: 1;
}

/* === Scrollbar === */
.w95-scroll {
  scrollbar-color: var(--w95-gray) var(--w95-gray-light);
}
.w95-scroll::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}
.w95-scroll::-webkit-scrollbar-track {
  background: 
    repeating-conic-gradient(var(--w95-gray) 0 25%, var(--w95-gray-light) 0 50%) 50% / 2px 2px;
}
.w95-scroll::-webkit-scrollbar-thumb {
  background: var(--w95-gray);
  border-top: 1px solid var(--w95-gray-lighter);
  border-left: 1px solid var(--w95-gray-lighter);
  border-right: 1px solid var(--w95-gray-darker);
  border-bottom: 1px solid var(--w95-gray-darker);
  box-shadow: inset -1px -1px 0 var(--w95-gray-dark), inset 1px 1px 0 var(--w95-gray-light);
}
.w95-scroll::-webkit-scrollbar-button:single-button {
  background: var(--w95-gray);
  border-top: 1px solid var(--w95-gray-lighter);
  border-left: 1px solid var(--w95-gray-lighter);
  border-right: 1px solid var(--w95-gray-darker);
  border-bottom: 1px solid var(--w95-gray-darker);
  box-shadow: inset -1px -1px 0 var(--w95-gray-dark), inset 1px 1px 0 var(--w95-gray-light);
  height: 16px;
  width: 16px;
}

/* === BSOD === */
.bsod {
  position: fixed;
  inset: 0;
  background: var(--w95-bsod);
  color: white;
  font-family: 'Perfect DOS VGA 437', 'Courier New', monospace;
  font-size: 16px;
  padding: 40px 60px;
  z-index: 99999;
  line-height: 1.4;
  white-space: pre-wrap;
}

.bsod-banner {
  background: white;
  color: var(--w95-bsod);
  padding: 0 8px;
  display: inline-block;
  font-weight: bold;
}

.blink {
  animation: blink 1s steps(1) infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}

/* === Boot screens === */
.bios-screen {
  position: fixed;
  inset: 0;
  background: black;
  color: #c0c0c0;
  font-family: 'Perfect DOS VGA 437', 'Courier New', monospace;
  font-size: 15px;
  padding: 24px 32px;
  z-index: 99998;
  line-height: 1.35;
  white-space: pre;
  overflow: hidden;
}

.boot-splash {
  position: fixed;
  inset: 0;
  background: black;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99998;
}

/* === Window frame === */
.w95-window-frame {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: var(--w95-gray);
  padding: 2px;
  border-top: 1px solid var(--w95-gray-lighter);
  border-left: 1px solid var(--w95-gray-lighter);
  border-right: 1px solid var(--w95-gray-darker);
  border-bottom: 1px solid var(--w95-gray-darker);
  box-shadow: inset -1px -1px 0 var(--w95-gray-dark), inset 1px 1px 0 var(--w95-gray-light), 1px 1px 0 black;
}

.w95-window-content {
  flex: 1;
  background: var(--w95-gray);
  overflow: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Resize handle */
.w95-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  z-index: 5;
}

/* Tab style */
.w95-tabs {
  display: flex;
  padding: 0 4px;
  gap: 2px;
  border-bottom: 1px solid var(--w95-gray-darker);
  background: var(--w95-gray);
  margin-top: 4px;
}

.w95-tab {
  background: var(--w95-gray);
  padding: 4px 12px 6px 12px;
  cursor: pointer;
  font-size: 11px;
  margin-bottom: -1px;
  border-top: 1px solid var(--w95-gray-lighter);
  border-left: 1px solid var(--w95-gray-lighter);
  border-right: 1px solid var(--w95-gray-darker);
  border-bottom: 0;
  position: relative;
  z-index: 1;
}

.w95-tab.active {
  background: var(--w95-gray);
  padding: 4px 14px 6px 14px;
  margin: -2px -2px -1px -2px;
  z-index: 2;
}

/* Selection */
::selection {
  background: var(--w95-blue);
  color: white;
}

/* Lucide icon size in titlebar buttons */
.w95-titlebar-button svg { display: block; }

/* Fieldset */
.w95-fieldset {
  border: 1px solid var(--w95-gray-lighter);
  outline: 1px solid var(--w95-gray-dark);
  outline-offset: -2px;
  padding: 8px 12px;
  margin: 8px 0;
  position: relative;
}
.w95-fieldset legend {
  padding: 0 4px;
  background: var(--w95-gray);
  font-size: 11px;
}

/* Link styled like text in 95 */
.w95-link {
  color: var(--w95-blue);
  text-decoration: underline;
  cursor: pointer;
}
.w95-link:hover { color: var(--w95-blue-bright); }

/* Marquee selection */
.marquee {
  position: absolute;
  border: 1px dashed white;
  background: rgba(255,255,255,0.05);
  pointer-events: none;
  z-index: 1;
}
