/* ==========================================================================
   OS9LIVES — Core Stylesheet
   ========================================================================== */

/* Reset & Base */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --os9-font: "Chicago", "Geneva", "Helvetica Neue", monospace, sans-serif;
  --os9-mono: "Monaco", "Courier New", monospace;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--os9-font);
  user-select: none;
  -webkit-user-select: none;
}

body {
  background: #555;
}

/* ===== BOOT SCREEN ===== */
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.boot-logo {
  font-size: 64px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #f0f0f0;
  margin-bottom: 30px;
}

.boot-accent {
  color: #ff0044;
}

.boot-status {
  font-size: 14px;
  color: #888;
  margin-bottom: 20px;
  font-family: var(--os9-mono);
}

.boot-bar {
  width: 240px;
  height: 8px;
  background: #222;
  border: 1px solid #444;
  overflow: hidden;
}

.boot-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff0044, #ffdd00);
  transition: width 0.3s ease;
}

/* ===== MENU BAR ===== */
.menu-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 24px;
  display: flex;
  align-items: center;
  z-index: 9000;
  padding: 0 6px;
  gap: 2px;
  border-bottom: 1px solid rgba(0,0,0,0.3);
}

.menu-item {
  padding: 2px 10px;
  font-size: 13px;
  cursor: default;
  white-space: nowrap;
  border-radius: 2px;
  transition: background 0.1s;
}

.menu-item:hover {
  background: rgba(0,0,0,0.15);
}

.menu-item.active {
  background: rgba(0,0,0,0.8);
  color: #fff;
}

.menu-logo {
  font-weight: bold;
}

.menu-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.menu-flag {
  width: 20px;
  height: 14px;
  background: linear-gradient(180deg, #000 0%, #000 33%, #ff0044 33%, #ff0044 66%, #ffdd00 66%, #ffdd00 100%);
  cursor: pointer;
}

.crt-toggle {
  cursor: pointer;
  font-weight: bold;
  border: 1px solid rgba(0,0,0,0.2);
}

.crt-toggle.active {
  background: rgba(255, 0, 68, 0.3);
}

/* ===== DROPDOWN MENUS ===== */
.dropdown {
  position: absolute;
  min-width: 180px;
  z-index: 9500;
  border: 1px solid rgba(0,0,0,0.4);
  box-shadow: 2px 2px 8px rgba(0,0,0,0.3);
  padding: 3px 0;
}

.dropdown-item {
  padding: 4px 16px;
  font-size: 13px;
  cursor: default;
  white-space: nowrap;
}

.dropdown-item:hover {
  background: rgba(0,0,0,0.8);
  color: #fff;
}

.dropdown-divider {
  height: 1px;
  background: rgba(0,0,0,0.15);
  margin: 3px 8px;
}

/* ===== DESKTOP ===== */
.desktop {
  position: fixed;
  top: 24px;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}

.desktop-icons {
  position: absolute;
  inset: 0;
  padding: 10px;
}

.desktop-icon {
  position: absolute;
  width: 72px;
  text-align: center;
  cursor: pointer;
  padding: 4px;
  border-radius: 3px;
}

.desktop-icon:hover {
  background: rgba(255,255,255,0.1);
}

.desktop-icon.selected {
  background: rgba(0,0,0,0.3);
}

.desktop-icon-img {
  width: 48px;
  height: 48px;
  margin: 0 auto 4px;
}

.desktop-icon-label {
  font-size: 11px;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
  word-wrap: break-word;
  line-height: 1.2;
}

/* ===== WINDOWS ===== */
.os9-window {
  position: absolute;
  min-width: 200px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 2px 12px rgba(0,0,0,0.4);
  border: 1px solid rgba(0,0,0,0.5);
}

.os9-window.inactive {
  box-shadow: 1px 1px 6px rgba(0,0,0,0.2);
}

.os9-titlebar {
  height: 22px;
  display: flex;
  align-items: center;
  padding: 0 6px;
  cursor: grab;
  border-bottom: 1px solid rgba(0,0,0,0.3);
  flex-shrink: 0;
  gap: 6px;
}

.os9-titlebar.dragging {
  cursor: grabbing;
}

.os9-close-box {
  width: 12px;
  height: 12px;
  border: 1px solid rgba(0,0,0,0.6);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: bold;
}

.os9-close-box:hover::after {
  content: "×";
}

.os9-title {
  flex: 1;
  font-size: 12px;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.os9-zoom-box {
  width: 12px;
  height: 12px;
  border: 1px solid rgba(0,0,0,0.6);
  cursor: pointer;
  flex-shrink: 0;
}

.os9-window-content {
  flex: 1;
  overflow: auto;
  position: relative;
}

.os9-window.collapsed .os9-window-content {
  display: none;
}

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

/* ===== DESKTOP FOOTER ===== */
.desktop-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 10px;
  font-family: var(--os9-mono);
  color: rgba(255,255,255,0.6);
  background: rgba(0,0,0,0.3);
  pointer-events: none;
}

/* ===== THEME PANEL ===== */
.theme-panel {
  position: fixed;
  top: 80px;
  right: 20px;
  width: 280px;
  z-index: 8000;
  border: 1px solid rgba(0,0,0,0.5);
  box-shadow: 4px 4px 20px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
}

.theme-panel-header {
  height: 22px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 12px;
  border-bottom: 1px solid rgba(0,0,0,0.3);
  gap: 6px;
}

.theme-panel-close {
  margin-left: auto;
  border: 1px solid rgba(0,0,0,0.4);
  background: none;
  cursor: pointer;
  width: 16px;
  height: 16px;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-panel-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
}

.theme-option {
  padding: 8px 12px;
  cursor: pointer;
  border: 1px solid transparent;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 3px;
}

.theme-option:hover {
  border-color: rgba(0,0,0,0.2);
}

.theme-option.active {
  border-color: rgba(0,0,0,0.5);
}

.theme-swatch {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(0,0,0,0.3);
  flex-shrink: 0;
}

/* ===== BOMB DIALOG ===== */
.bomb-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9800;
  width: 360px;
  padding: 20px;
  border: 2px solid #000;
  box-shadow: 6px 6px 30px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
}

.bomb-text {
  font-size: 14px;
  line-height: 1.6;
}

.bomb-sub {
  font-size: 12px;
  opacity: 0.8;
}

.bomb-button {
  padding: 6px 24px;
  border: 2px solid #000;
  cursor: pointer;
  font-family: var(--os9-font);
  font-size: 13px;
  font-weight: bold;
}

/* ===== CRT OVERLAY ===== */
.crt-overlay {
  position: fixed;
  inset: 0;
  z-index: 9700;
  pointer-events: none;
}

.crt-overlay.hidden { display: none; }

.crt-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.15) 0px,
    rgba(0,0,0,0.15) 1px,
    transparent 1px,
    transparent 3px
  );
}

.crt-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 50%,
    rgba(0,0,0,0.4) 100%
  );
}

.crt-flicker {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.02);
  animation: flicker 0.15s infinite;
}

@keyframes flicker {
  0% { opacity: 0.8; }
  50% { opacity: 1; }
  100% { opacity: 0.9; }
}

/* ===== UTILITY ===== */
.hidden { display: none !important; }