/* Desktop apps, shortcuts, menus and taskbar entries for body[data-layout="os"]. */

/* App shortcuts are appended to the shell's own .os-icons grid, so they only
   need the native button reset. */
body[data-layout="os"] .os-icons button.os-icon {
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

/* ---------- menus ---------- */

.os-menu {
  position: fixed;
  z-index: 4000;
  min-width: 196px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  color: #eef1fa;
  background: rgba(20, 24, 34, 0.96);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(22px);
}

.os-menu button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  color: inherit;
  background: none;
  font: inherit;
  font-size: 13px;
  text-align: left;
}

.os-menu button:hover,
.os-menu button:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.os-menu button.danger {
  color: #ff9b9b;
}

.os-menu hr {
  margin: 5px 8px;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

/* ---------- taskbar running windows ---------- */

body[data-layout="os"] .os-running {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: min(52vw, 720px);
  overflow-x: auto;
  scrollbar-width: none;
}

body[data-layout="os"] .os-running[hidden] {
  display: none;
}

body[data-layout="os"] .os-running::-webkit-scrollbar {
  display: none;
}

body[data-layout="os"] .os-running-task {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 168px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  color: #eef1fa;
  background: rgba(255, 255, 255, 0.06);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}

body[data-layout="os"] .os-running-task:hover {
  background: rgba(255, 255, 255, 0.12);
}

body[data-layout="os"] .os-running-task[aria-pressed="true"] {
  background: color-mix(in srgb, var(--cs-accent, #0a84ff) 24%, rgba(255, 255, 255, 0.08));
  border-color: color-mix(in srgb, var(--cs-accent, #0a84ff) 45%, transparent);
}

.os-running-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--cs-accent, #0a84ff);
  box-shadow: 0 0 8px color-mix(in srgb, var(--cs-accent, #0a84ff) 70%, transparent);
}

.os-running-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- window resizing ---------- */

.os-resize {
  position: absolute;
  z-index: 2;
}

.os-resize-n,
.os-resize-s {
  left: 10px;
  right: 10px;
  height: 8px;
  cursor: ns-resize;
}

.os-resize-n { top: -4px; }
.os-resize-s { bottom: -4px; }

.os-resize-e,
.os-resize-w {
  top: 10px;
  bottom: 10px;
  width: 8px;
  cursor: ew-resize;
}

.os-resize-e { right: -4px; }
.os-resize-w { left: -4px; }

.os-resize-ne,
.os-resize-nw,
.os-resize-se,
.os-resize-sw {
  width: 16px;
  height: 16px;
}

.os-resize-ne { top: -5px; right: -5px; cursor: nesw-resize; }
.os-resize-nw { top: -5px; left: -5px; cursor: nwse-resize; }
.os-resize-se { bottom: -5px; right: -5px; cursor: nwse-resize; }
.os-resize-sw { bottom: -5px; left: -5px; cursor: nesw-resize; }

.os-window.snap-left,
.os-window.snap-right {
  border-radius: 14px;
}

/* ---------- app chrome ---------- */

.os-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  color: #e9edf8;
  font-size: 13px;
}

.os-app button {
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.os-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  color: inherit;
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
}

/* Files */

.os-files-toolbar,
.os-notepad-toolbar,
.os-photos-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}

.os-files-toolbar > button,
.os-notepad-toolbar > button,
.os-photos-bar button {
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
}

.os-files-toolbar > button:hover,
.os-notepad-toolbar > button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.os-files-crumb {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.32);
  white-space: nowrap;
}

.os-files-crumb button {
  padding: 2px 6px;
  border: 0;
  border-radius: 5px;
  background: none;
  font-size: 12px;
}

.os-files-crumb button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.os-crumb-sep {
  opacity: 0.45;
}

.os-files-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px;
  outline: none;
}

.os-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: none;
  text-align: left;
}

.os-file-row:hover {
  background: rgba(255, 255, 255, 0.07);
}

.os-file-row[aria-selected="true"] {
  border-color: color-mix(in srgb, var(--cs-accent, #0a84ff) 44%, transparent);
  background: color-mix(in srgb, var(--cs-accent, #0a84ff) 18%, rgba(255, 255, 255, 0.04));
}

.os-file-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: #b9c4e2;
}

.os-file-icon svg {
  width: 24px;
  height: 24px;
}

.os-file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.os-file-meta {
  color: #93a0be;
  font-size: 11.5px;
}

.os-files-status {
  padding: 7px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #93a0be;
  font-size: 11.5px;
}

.os-files-empty,
.os-empty {
  padding: 24px;
  color: #93a0be;
  text-align: center;
}

/* Notepad */

.os-notepad-toolbar {
  gap: 8px;
}

.os-notepad-path {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: inherit;
  background: rgba(0, 0, 0, 0.34);
  font: inherit;
  font-size: 12px;
}

.os-notepad-status {
  color: #93a0be;
  font-size: 11.5px;
  white-space: nowrap;
}

.os-notepad-text {
  flex: 1;
  min-height: 0;
  padding: 16px 18px;
  border: 0;
  color: #e9edf8;
  background: rgba(0, 0, 0, 0.22);
  font: 13px/1.65 ui-monospace, "Cascadia Code", Consolas, monospace;
  resize: none;
  outline: none;
}

/* Calculator */

.os-app-calc {
  padding: 14px;
  gap: 12px;
  outline: none;
}

.os-calc-display {
  display: block;
  min-height: 64px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  font: 600 28px/1.2 ui-monospace, Consolas, monospace;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
}

.os-calc-grid {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.os-calc-grid button {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 16px;
}

.os-calc-grid button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.os-calc-grid button.accent {
  border-color: transparent;
  background: var(--accent, #0a84ff);
  color: #fff;
}

/* Terminal */

.os-app-terminal {
  padding: 10px 12px;
  background: rgba(3, 6, 12, 0.6);
  font: 12.5px/1.6 ui-monospace, "Cascadia Code", Consolas, monospace;
}

.os-term-out {
  flex: 1;
  min-height: 0;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #cfe0ff;
}

.os-term-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
}

.os-term-prompt {
  color: #8fd3a8;
  white-space: nowrap;
}

.os-term-input {
  flex: 1;
  min-width: 0;
  border: 0;
  color: #eaf1ff;
  background: none;
  font: inherit;
  outline: none;
}

/* One window, several sessions: the local shell plus every VM machine. */

.os-term-tabs {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
  overflow-x: auto;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  scrollbar-width: none;
}

.os-term-tabs::-webkit-scrollbar {
  height: 0;
}

.os-term-tab {
  flex: 0 0 auto;
  padding: 5px 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: rgba(233, 237, 248, 0.55);
  background: transparent;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.os-term-tab:hover {
  color: #eaf1ff;
  background: rgba(255, 255, 255, 0.07);
}

.os-term-tab[aria-selected="true"] {
  border-color: rgba(255, 255, 255, 0.12);
  color: #eaf1ff;
  background: rgba(255, 255, 255, 0.1);
}

.os-term-stage {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.os-term-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.os-term-panel[hidden] {
  display: none;
}

.os-term-banner {
  flex: 0 0 auto;
  margin: 0 0 8px;
  overflow: hidden;
  color: #7fb2ff;
  font-size: 10.5px;
  line-height: 1.1;
  text-shadow: 0 0 14px rgba(88, 148, 255, 0.35);
  user-select: none;
}

.os-term-vm {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  background: #000;
}

.os-term-vm-screen {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 6px;
  color: #cfd8e3;
  background: #000;
  outline: none;
}

.os-term-vm-screen:focus-visible {
  outline: 1px solid var(--accent, #0a84ff);
  outline-offset: -1px;
}

.os-term-vm-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
  background: #000;
}

.os-term-vm-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  gap: 6px;
  justify-items: center;
  padding: 20px;
  color: rgba(233, 237, 248, 0.72);
  background: rgba(4, 7, 12, 0.94);
  text-align: center;
}

.os-term-vm-overlay b {
  color: #eaf1ff;
  font-size: 13px;
}

.os-term-vm-overlay p {
  max-width: 46ch;
  margin: 0;
  color: rgba(233, 237, 248, 0.5);
  font-size: 11.5px;
  line-height: 1.5;
}

.os-term-launch {
  margin-top: 6px;
  padding: 7px 14px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: var(--accent, #0a84ff);
  font: inherit;
  font-weight: 600;
}

.os-term-status {
  flex: 0 0 auto;
  min-height: 15px;
  padding-top: 6px;
  color: rgba(233, 237, 248, 0.45);
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Photos */

.os-photos-bar {
  justify-content: space-between;
  color: #93a0be;
  font-size: 12px;
}

.os-photos-image {
  flex: 1;
  min-height: 0;
  width: 100%;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.35);
}

/* Personalization */

.os-app-settings {
  gap: 18px;
  padding: 20px;
  overflow: auto;
}

.os-settings-section h2 {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #93a0be;
}

.os-wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.os-wallpaper {
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 11.5px;
  text-align: left;
}

.os-wallpaper.on {
  border-color: var(--accent, #0a84ff);
  box-shadow: 0 0 0 1px var(--accent, #0a84ff) inset;
}

.os-wallpaper-preview {
  display: block;
  height: 60px;
  border-radius: 8px;
  background: linear-gradient(150deg, #37507a, #0d1320);
}

.os-wallpaper-preview[data-bgs="motion-naruto"] { background: radial-gradient(circle at 74% 18%, #ff8a1f7a, transparent 55%), conic-gradient(from 20deg at 74% 18%, #2a0d03, #ff7a1833 25%, #120603 60%, #ffb34722 85%, #2a0d03); }
.os-wallpaper-preview[data-bgs="motion-gojo"] { background: repeating-radial-gradient(circle at 26% 24%, #7fc4ff33 0 1px, transparent 1px 9px), radial-gradient(circle at 26% 24%, #8f6bff88, transparent 58%), linear-gradient(150deg, #0d2247, #03040a); }
.os-wallpaper-preview[data-bgs="motion-jarona"] { background: radial-gradient(circle at 68% 30%, #ff9ad07a, transparent 55%), conic-gradient(from 90deg at 68% 30%, #04140e, #5ee6a333 30%, #06131a 65%, #ff8fc433 90%, #04140e); }
.os-wallpaper-preview[data-bgs="alpine"] { background: url("../img/wallpapers/alpine.jpg") center / cover; }
.os-wallpaper-preview[data-bgs="anime-gojo"] { background: url("../img/wallpapers/anime-gojo.jpg") center / cover; }
.os-wallpaper-preview[data-bgs="anime-naruto"] { background: url("../img/wallpapers/anime-naruto.jpg") center / cover; }
.os-wallpaper-preview[data-bgs="anime-tanjiro"] { background: url("../img/wallpapers/anime-tanjiro.jpg") center / cover; }
.os-wallpaper-preview[data-bgs="anime-levi"] { background: url("../img/wallpapers/anime-levi.jpg") center / cover; }
.os-wallpaper-preview[data-bgs="anime-jiraiya"] { background: url("../img/wallpapers/anime-jiraiya.jpg") center / cover; }

.os-accent-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.os-accent {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--swatch, #0a84ff);
}

.os-accent.on {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4);
}

.os-app-settings .os-btn {
  margin-right: 8px;
}

.os-settings-note {
  margin: 0;
  color: #93a0be;
  font-size: 11.5px;
}

.os-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.os-settings-actions .os-btn {
  margin-right: 0;
}

/* Start menu app grid */

.os-start-apps {
  display: grid;
  gap: 8px;
  padding: 4px 0 8px;
}

.os-start-app-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.os-start-app {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: inherit;
  background: rgba(255, 255, 255, 0.04);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.os-start-app:hover {
  background: rgba(255, 255, 255, 0.12);
}

.os-start-app-icon svg {
  width: 20px;
  height: 20px;
}

/* Run dialog */

.os-run {
  position: fixed;
  z-index: 5000;
  top: 34%;
  left: 50%;
  width: min(460px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  color: #eef1fa;
  background: rgba(18, 22, 32, 0.97);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  transform: translateX(-50%);
}

.os-run label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  color: #93a0be;
}

.os-run input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  color: inherit;
  background: rgba(0, 0, 0, 0.35);
  font: inherit;
}

.os-run-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.os-run-actions button {
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  color: inherit;
  background: rgba(255, 255, 255, 0.07);
  font: inherit;
  cursor: pointer;
}

.os-run-actions button[type="submit"] {
  border-color: transparent;
  background: var(--accent, #0a84ff);
  color: #fff;
}

/* ---------- Studio (code editor + runner) ---------- */

.os-app-studio {
  background: #0b0f17;
}

.os-studio-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}

.os-studio-toolbar > button,
.os-studio-link {
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: inherit;
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}

.os-studio-toolbar > button.accent {
  border-color: transparent;
  background: var(--accent, #0a84ff);
  color: #fff;
}

.os-studio-path {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: inherit;
  background: rgba(0, 0, 0, 0.35);
  font: inherit;
  font-size: 12px;
}

.os-studio-target {
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: inherit;
  background: rgba(0, 0, 0, 0.35);
  font: inherit;
  font-size: 12px;
}

.os-studio-status {
  color: #93a0be;
  font-size: 11px;
  white-space: nowrap;
}

.os-studio-split {
  display: grid;
  flex: 1;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
}

.os-studio-editor,
.os-studio-textarea {
  min-height: 0;
}

.os-studio-editor {
  position: relative;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.os-studio-textarea {
  width: 100%;
  height: 100%;
  padding: 14px;
  border: 0;
  color: #e6edf3;
  background: #0b0f17;
  font: 13px/1.6 ui-monospace, "Cascadia Code", Consolas, monospace;
  resize: none;
  outline: none;
}

.os-studio-output {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.os-studio-frame {
  flex: 1;
  min-height: 0;
  border: 0;
  background: #fff;
}

.os-studio-frame[hidden] {
  display: none;
}

.os-studio-console {
  max-height: 45%;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #b8c7e0;
  background: rgba(0, 0, 0, 0.35);
  font: 11.5px/1.55 ui-monospace, Consolas, monospace;
}

.os-studio-log {
  white-space: pre-wrap;
  word-break: break-word;
}

.os-studio-log.error { color: #ff9b9b; }
.os-studio-log.warn { color: #ffd08a; }

@media (max-width: 760px) {
  .os-studio-split { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
}

/* ---------- Windows (.exe) apps ---------- */

.os-win32-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px;
}

.os-app-win32 {
  gap: 10px;
  padding: 16px;
  overflow: auto;
}

.os-app-win32 .os-empty {
  margin: 0;
  padding: 0;
  text-align: left;
}

.os-win32-list {
  display: grid;
  gap: 8px;
}

.os-win32-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.os-win32-item b {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.os-win32-item span {
  color: #93a0be;
  font-size: 11.5px;
}

.os-win32-item button {
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: inherit;
  background: rgba(255, 255, 255, 0.06);
  font: inherit;
  font-size: 12px;
}
