/* Shared lofi.os design system for sub-pages */
:root {
  --accent: #ffd600;
  --accent-ink: var(--accent);
  --accent-dim: #b39700;
  --bg: #1a1a1a;
  --bg2: #232323;
  --bg3: #2e2e2e;
  --border: #3a3a3a;
  --text: #e8e8e8;
  --text-muted: #888;
  --titlebar: #1a1a1a;
  --win-bg: #232323;
  --scanline-opacity: 0.03;
}

[data-theme="white"] {
  --bg: #dcd8ca;
  --bg2: #ece8dc;
  --bg3: #d5cebc;
  --border: #7f765f;
  --text: #13100b;
  --text-muted: #453d2f;
  --titlebar: #d0c8b6;
  --win-bg: #ebe4d5;
  --scanline-opacity: 0.025;
  --accent: #ffd600;
  --accent-ink: #000000;
}

[data-theme="white"] .os-taskbar-logo,
[data-theme="white"] .os-nav-link.active,
[data-theme="white"] .os-nav-link:hover,
[data-theme="white"] .lofi-os-page .win-title,
[data-theme="white"] .lofi-os-page .os-win-title,
[data-theme="white"] .mm-tag,
[data-theme="white"] .mm-drop-zone h2,
[data-theme="white"] .mm-result-header h2,
[data-theme="white"] .meta-section-title,
[data-theme="white"] .status-badge.found,
[data-theme="white"] .modal-header h3,
[data-theme="white"] .scroll-top {
  color: #000000;
}

[data-theme="white"] .os-taskbar-logo {
  text-shadow: none;
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--bg3);
}

body.lofi-os-page {
  margin: 0;
  font-family: "Space Mono", monospace;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-top: 36px;
  transition: background 0.3s, color 0.3s;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Ccircle cx='10' cy='10' r='4' fill='%23FFD600'/%3E%3Ccircle cx='10' cy='10' r='2' fill='%231a1a1a'/%3E%3C/svg%3E")
      10 10,
    auto;
}

body.lofi-os-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, var(--scanline-opacity)) 2px,
    rgba(0, 0, 0, var(--scanline-opacity)) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

.lofi-os-page ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.lofi-os-page ::-webkit-scrollbar-track {
  background: var(--bg3);
}

.lofi-os-page ::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}

/* Taskbar */
.os-taskbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 36px;
  background: var(--bg);
  border-bottom: 1px solid var(--accent);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 0.65rem;
  z-index: 10000;
  font-family: "VT323", monospace;
  font-size: 18px;
}

.os-taskbar-logo {
  color: var(--accent-ink);
  text-decoration: none;
  letter-spacing: 2px;
  text-shadow: 0 0 8px var(--accent);
  flex-shrink: 0;
}

.os-taskbar-logo:hover {
  opacity: 0.9;
}

.os-taskbar-sep {
  color: var(--border);
  flex-shrink: 0;
}

.os-taskbar-title {
  color: var(--text-muted);
  font-size: 16px;
  flex-shrink: 0;
}

.os-taskbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.os-nav-link {
  font-family: "VT323", monospace;
  font-size: 15px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
  line-height: 1.2;
}

.os-nav-link:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
}

.os-nav-link.active {
  color: var(--accent-ink);
  border-color: var(--accent);
}

.os-taskbar-lang {
  font-family: "VT323", monospace;
  font-size: 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  padding: 2px 6px;
  margin-left: auto;
  cursor: pointer;
}

.os-taskbar-lang:hover,
.os-taskbar-lang:focus {
  border-color: var(--accent);
  outline: none;
}

.os-taskbar-spacer {
  flex: 1;
  min-width: 8px;
}

.os-theme-btns {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.os-theme-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.1s;
}

.os-theme-btn:hover {
  transform: scale(1.15);
  border-color: var(--accent);
}

.os-theme-btn.dark {
  background: #1a1a1a;
}

.os-theme-btn.white {
  background: #f0ede6;
}

.os-theme-btn.active {
  border-color: var(--accent) !important;
  box-shadow: 0 0 6px var(--accent);
}

/* Page shell */
.os-page {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem;
}

.os-page-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Window chrome */
.lofi-os-page .window,
.lofi-os-page .os-window {
  background: var(--win-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s, background 0.3s;
}

.lofi-os-page .window:hover,
.lofi-os-page .os-window:hover {
  border-color: var(--accent);
}

.lofi-os-page .win-titlebar,
.lofi-os-page .os-win-titlebar {
  background: var(--titlebar);
  border-bottom: 1px solid var(--border);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "VT323", monospace;
  font-size: 16px;
  color: var(--text-muted);
  user-select: none;
}

.lofi-os-page .win-title,
.lofi-os-page .os-win-title {
  flex: 1;
  color: var(--accent-ink);
  letter-spacing: 1px;
}

.lofi-os-page .win-controls,
.lofi-os-page .os-win-controls {
  display: flex;
  gap: 5px;
}

.lofi-os-page .win-btn,
.lofi-os-page .os-win-btn {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.lofi-os-page .win-btn:hover,
.lofi-os-page .os-win-btn:hover {
  opacity: 0.85;
  transform: scale(1.12);
}

.lofi-os-page .win-btn.close,
.lofi-os-page .os-win-btn.close {
  background: #ff5f57;
}

.lofi-os-page .win-btn.minimize,
.lofi-os-page .os-win-btn.minimize {
  background: #febc2e;
}

.lofi-os-page .win-btn.expand,
.lofi-os-page .os-win-btn.expand {
  background: #28c840;
}

.lofi-os-page .win-body,
.lofi-os-page .os-win-body {
  padding: 1rem;
  color: var(--text);
}

/* Buttons */
.lofi-os-page button,
.lofi-os-page .os-btn {
  font-family: "VT323", monospace;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg3);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.lofi-os-page button:hover,
.lofi-os-page .os-btn:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
}

.lofi-os-page .os-btn-primary,
.lofi-os-page button.os-btn-primary {
  background: var(--accent);
  color: #000;
  font-weight: 700;
  border-color: var(--accent);
}

.lofi-os-page .os-btn-primary:hover,
.lofi-os-page button.os-btn-primary:hover {
  background: #fff;
  color: #000;
  border-color: #fff;
}

.lofi-os-page .os-btn-danger {
  border-color: var(--border);
  color: var(--text-muted);
}

.lofi-os-page .os-btn-danger:hover {
  border-color: #e05c5c;
  color: #e05c5c;
}

/* Inputs */
.lofi-os-page input[type="text"],
.lofi-os-page input[type="url"],
.lofi-os-page input[type="number"],
.lofi-os-page input[type="file"],
.lofi-os-page select,
.lofi-os-page textarea {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: "Space Mono", monospace;
  font-size: 13px;
}

.lofi-os-page input:focus,
.lofi-os-page select:focus,
.lofi-os-page textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.lofi-os-page label {
  color: var(--text-muted);
  font-size: 12px;
}

/* ideas-board variable bridge */
body.lofi-os-page {
  --panel: var(--win-bg);
  --p2: var(--bg3);
  --ac: var(--bg2);
  --red: var(--accent);
  --tx: var(--text);
  --txd: var(--text-muted);
  --txb: var(--text);
  --br: var(--border);
  --brb: var(--border);
}

body.lofi-os-page #hud {
  top: 36px;
  background: var(--bg);
  border-bottom: 1px solid var(--accent);
}

body.lofi-os-page .hlogo {
  color: var(--accent-ink);
}

body.lofi-os-page .cat-node,
body.lofi-os-page #modal,
body.lofi-os-page #sub-modal {
  background: var(--win-bg);
  border-color: var(--border);
  color: var(--text);
}

body.lofi-os-page #bg {
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, var(--scanline-opacity)) 2px,
    rgba(0, 0, 0, var(--scanline-opacity)) 4px
  );
  background-size: auto;
}

body.lofi-os-page #controls,
body.lofi-os-page #submit-btn {
  font-family: "VT323", monospace;
}

body.lofi-os-page .cbtn {
  font-family: "VT323", monospace;
  color: var(--text-muted);
}

body.lofi-os-page .cbtn:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--bg3);
}

body.lofi-os-page #submit-btn {
  background: var(--accent);
  color: #000;
  box-shadow: 0 0 12px rgba(255, 214, 0, 0.25);
}

body.lofi-os-page #submit-btn:hover {
  background: #fff;
}
