:root {
  --font-sans: "Ubuntu", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  --font-mono: "Ubuntu Mono", "Cascadia Code", "JetBrains Mono", Consolas, monospace;

  --ubuntu-orange: #e95420;
  --ubuntu-orange-hover: #d44413;
  --ubuntu-aubergine: #77216f;

  /* Yaru Dark (default) */
  --win-bg: #242424;
  --win-bg-elevated: #2e2e2e;
  --win-header-bg: #2c2c2c;
  --win-border: rgba(255, 255, 255, 0.12);
  --win-shadow: 0 20px 52px rgba(0, 0, 0, 0.62);
  --win-shadow-inactive: 0 10px 28px rgba(0, 0, 0, 0.4);

  --text-primary: #f2f2f2;
  --text-secondary: #b8bcc4;
  --text-muted: #8a8f99;

  --surface-hover: rgba(255, 255, 255, 0.08);
  --surface-active: rgba(233, 84, 32, 0.2);
  --surface-input: #1a1a1a;
  --border-subtle: rgba(255, 255, 255, 0.1);

  --btn-bg: #363636;
  --btn-bg-hover: #444444;
  --btn-text: #f2f2f2;
  --btn-primary-bg: #e95420;
  --btn-primary-hover: #d44413;
  --btn-primary-text: #ffffff;
  --btn-danger-bg: rgba(224, 27, 36, 0.22);
  --btn-danger-hover: rgba(224, 27, 36, 0.36);
  --btn-danger-text: #ff8e93;

  --panel-bg: rgba(16, 16, 18, 0.92);
  --panel-text: #f2f2f2;
  --dock-bg: rgba(22, 22, 24, 0.78);
  --popover-bg: rgba(36, 36, 38, 0.96);

  --term-bg: #300a24;
  --term-text: #f5f5f5;
  --term-prompt: #8ae234;
  --term-error: #ff7b7b;
  --term-info: #729fcf;
}

[data-theme="light"] {
  --win-bg: #fafafa;
  --win-bg-elevated: #efefef;
  --win-header-bg: #f2f2f2;
  --win-border: rgba(0, 0, 0, 0.14);
  --win-shadow: 0 18px 46px rgba(0, 0, 0, 0.24);
  --win-shadow-inactive: 0 8px 22px rgba(0, 0, 0, 0.12);

  --text-primary: #1f1f1f;
  --text-secondary: #525252;
  --text-muted: #707070;

  --surface-hover: rgba(0, 0, 0, 0.06);
  --surface-active: rgba(233, 84, 32, 0.14);
  --surface-input: #ffffff;
  --border-subtle: rgba(0, 0, 0, 0.1);

  --btn-bg: #e4e4e4;
  --btn-bg-hover: #d4d4d4;
  --btn-text: #1f1f1f;
  --btn-primary-bg: #e95420;
  --btn-primary-hover: #d44413;
  --btn-primary-text: #ffffff;
  --btn-danger-bg: #fde2e2;
  --btn-danger-hover: #fbcaca;
  --btn-danger-text: #b91c1c;

  --popover-bg: rgba(250, 250, 250, 0.97);
}

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

::selection {
  background: rgba(233, 84, 32, 0.35);
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--ubuntu-orange);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 128, 0.35);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(128, 128, 128, 0.55);
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  user-select: none;
}

/* Desktop & Wallpapers */
.desktop {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #111827;
}

[data-wallpaper="wp1"] .desktop,
.wallpaper-preview-wp1 {
  background-image: url('../assets/fond-ecran-linux-web-1.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

[data-wallpaper="wp2"] .desktop,
.wallpaper-preview-wp2 {
  background-image: url('../assets/fond-ecran-linux-web-2.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

[data-wallpaper="wp3"] .desktop,
.wallpaper-preview-wp3 {
  background-image: url('../assets/fond-ecran-linux-web-3.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

[data-wallpaper="wp4"] .desktop,
.wallpaper-preview-wp4 {
  background-image: url('../assets/fond-ecran-linux-web-4.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

[data-wallpaper="tux"] .desktop,
.wallpaper-preview-tux {
  background-image: url('../assets/wallpaper-tux.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

[data-wallpaper="ubuntu"] .desktop,
.wallpaper-preview-ubuntu {
  background:
    radial-gradient(circle at 60% 45%, rgba(233, 84, 32, 0.22), transparent 52%),
    radial-gradient(circle at 25% 25%, rgba(155, 44, 122, 0.55), transparent 55%),
    linear-gradient(135deg, #2c001e 0%, #5e1748 52%, #77216f 100%);
}

[data-wallpaper="aube"] .desktop,
.wallpaper-preview-aube {
  background:
    radial-gradient(circle at 75% 20%, rgba(251, 146, 60, 0.22), transparent 45%),
    linear-gradient(135deg, #3730a3 0%, #6d4c9c 48%, #c06c84 100%);
}

[data-wallpaper="ocean"] .desktop,
.wallpaper-preview-ocean {
  background:
    radial-gradient(circle at 80% 18%, rgba(56, 189, 248, 0.25), transparent 45%),
    linear-gradient(135deg, #0c4a6e 0%, #0369a1 52%, #0284c7 100%);
}

[data-wallpaper="foret"] .desktop,
.wallpaper-preview-foret {
  background:
    radial-gradient(circle at 25% 20%, rgba(74, 222, 128, 0.18), transparent 45%),
    linear-gradient(135deg, #064e3b 0%, #166534 52%, #15803d 100%);
}

[data-wallpaper="nuit"] .desktop,
.wallpaper-preview-nuit {
  background:
    radial-gradient(circle at 70% 25%, rgba(99, 102, 241, 0.22), transparent 45%),
    linear-gradient(135deg, #0f172a 0%, #1e1b4b 52%, #312e81 100%);
}

/* Ubuntu Top Panel */
.top-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 30px;
  padding: 0 8px;
  background: var(--panel-bg);
  color: var(--panel-text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  z-index: 200;
  font-size: 13px;
  font-weight: 500;
}

.top-panel-left {
  display: flex;
  align-items: center;
}

.top-panel-center {
  display: flex;
  justify-content: center;
}

.top-panel-right {
  display: flex;
  justify-content: flex-end;
}

.panel-pill {
  height: 24px;
  padding: 0 10px;
  border-radius: 99px;
  border: none;
  background: transparent;
  color: var(--panel-text);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.14s ease;
}

.panel-pill:hover,
.panel-pill.active {
  background: rgba(255, 255, 255, 0.14);
}

.workspace-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
}

.workspace-dash {
  width: 16px;
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.45);
}

.panel-clock-btn {
  font-variant-numeric: tabular-nums;
}

/* Ubuntu Left Dock */
.ubuntu-dock {
  position: absolute;
  top: 30px;
  left: 0;
  bottom: 0;
  width: 58px;
  padding: 8px 0;
  background: var(--dock-bg);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  z-index: 150;
}

.dock-apps {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.dock-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.dock-separator {
  width: 32px;
  height: 1px;
  background: rgba(255, 255, 255, 0.14);
  margin: 2px 0;
}

.dock-item {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #f2f2f2;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.14s ease, transform 0.12s ease;
}

.dock-item:hover {
  background: rgba(255, 255, 255, 0.14);
}

.dock-item.active {
  background: rgba(255, 255, 255, 0.18);
}

.dock-item::before {
  content: "";
  position: absolute;
  left: -5px;
  width: 4px;
  height: 0;
  border-radius: 0 3px 3px 0;
  background: var(--ubuntu-orange);
  transition: height 0.15s ease;
}

.dock-item.running::before {
  height: 6px;
}

.dock-item.active::before {
  height: 18px;
}

.dock-badge {
  position: absolute;
  right: 2px;
  bottom: 2px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--ubuntu-orange);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
}

.dock-tooltip {
  position: absolute;
  left: 54px;
  padding: 5px 10px;
  border-radius: 7px;
  background: rgba(20, 20, 22, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  z-index: 300;
}

.dock-item:hover .dock-tooltip {
  opacity: 1;
  transform: translateX(0);
}

/* Desktop Icons (bottom-right like Ubuntu) */
.desktop-icons {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2;
}

.desktop-icon {
  width: 88px;
  padding: 8px 6px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  text-align: center;
  transition: background 0.14s ease, border-color 0.14s ease;
}

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

.desktop-icon.selected {
  background: rgba(233, 84, 32, 0.28);
  border-color: rgba(233, 84, 32, 0.65);
  backdrop-filter: blur(6px);
}

.desktop-icon svg {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

.desktop-icon span {
  font-size: 12px;
  font-weight: 500;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
  line-height: 1.25;
}

/* Window Layer */
.window-layer {
  position: absolute;
  top: 30px;
  left: 58px;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 20;
}

.window {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: var(--win-bg);
  border: 1px solid var(--win-border);
  border-radius: 12px;
  box-shadow: var(--win-shadow-inactive);
  overflow: hidden;
  pointer-events: auto;
  min-width: 300px;
  min-height: 220px;
}

.window.focused {
  box-shadow: var(--win-shadow);
}

.window.minimized {
  display: none;
}

.window.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: 0;
}

.window-header {
  height: 38px;
  min-height: 38px;
  padding: 0 10px 0 14px;
  background: var(--win-header-bg);
  border-bottom: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: 76px 1fr 76px;
  align-items: center;
  cursor: grab;
}

.window-header:active {
  cursor: grabbing;
}

.window-title {
  grid-column: 2;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.window-controls {
  grid-column: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.window-ctrl-btn {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: var(--surface-hover);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, color 0.12s ease;
}

.window-ctrl-btn:hover {
  background: rgba(128, 128, 128, 0.28);
  color: var(--text-primary);
}

.window-ctrl-btn.close:hover {
  background: var(--ubuntu-orange);
  color: #ffffff;
}

.window-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: text;
}

/* Resize handles */
.resize-handle {
  position: absolute;
  z-index: 5;
}
.resize-e { top: 8px; right: 0; bottom: 8px; width: 6px; cursor: ew-resize; }
.resize-s { left: 8px; right: 8px; bottom: 0; height: 6px; cursor: ns-resize; }
.resize-w { top: 8px; left: 0; bottom: 8px; width: 6px; cursor: ew-resize; }
.resize-n { top: 0; left: 8px; right: 8px; height: 6px; cursor: ns-resize; }
.resize-se { right: 0; bottom: 0; width: 12px; height: 12px; cursor: nwse-resize; }
.resize-sw { left: 0; bottom: 0; width: 12px; height: 12px; cursor: nesw-resize; }
.resize-ne { right: 0; top: 0; width: 12px; height: 12px; cursor: nesw-resize; }
.resize-nw { left: 0; top: 0; width: 12px; height: 12px; cursor: nwse-resize; }

.window.maximized .resize-handle {
  display: none;
}

/* Popovers (Calendar & Quick Settings) */
.panel-popover {
  position: absolute;
  top: 36px;
  padding: 14px;
  border-radius: 14px;
  background: var(--popover-bg);
  border: 1px solid var(--win-border);
  box-shadow: var(--win-shadow);
  backdrop-filter: blur(16px);
  color: var(--text-primary);
  z-index: 250;
}

.panel-popover.hidden {
  display: none;
}

.calendar-popover {
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 13.5px;
  text-transform: capitalize;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  text-align: center;
  font-size: 12px;
}

.cal-dow {
  color: var(--text-muted);
  font-weight: 600;
  padding: 4px 0;
}

.cal-day {
  padding: 6px 0;
  border-radius: 99px;
  color: var(--text-primary);
}

.cal-day.muted {
  color: var(--text-muted);
  opacity: 0.45;
}

.cal-day.today {
  background: var(--ubuntu-orange);
  color: #ffffff;
  font-weight: 700;
}

.tray-popover {
  right: 10px;
  width: 260px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tray-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tray-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.tray-tile {
  padding: 10px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--btn-bg);
  color: var(--btn-text);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  transition: background 0.12s ease;
}

.tray-tile:hover {
  background: var(--btn-bg-hover);
}

.tray-tile.active {
  background: var(--ubuntu-orange);
  color: #ffffff;
  border-color: transparent;
}

/* App Launcher Overlay */
.app-launcher {
  position: absolute;
  inset: 30px 0 0 58px;
  background: rgba(16, 16, 18, 0.72);
  backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 180;
}

.app-launcher.hidden {
  display: none;
}

.launcher-panel {
  width: min(560px, 90%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.launcher-search {
  width: 100%;
  max-width: 360px;
  height: 40px;
  padding: 0 16px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

.launcher-search::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.launcher-search:focus {
  border-color: var(--ubuntu-orange);
  background: rgba(255, 255, 255, 0.14);
}

.launcher-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(100px, 1fr));
  gap: 16px;
  width: 100%;
}

.launcher-app-btn {
  padding: 16px 10px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background 0.14s ease, transform 0.12s ease;
}

.launcher-app-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-2px);
}

/* Terminal App */
.terminal-app {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--term-bg);
  color: var(--term-text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  padding: 12px 14px;
  overflow-y: auto;
  cursor: text;
}

.terminal-output {
  white-space: pre-wrap;
  word-break: break-word;
}

.term-line {
  margin-bottom: 2px;
}

.term-line.muted {
  color: #c5b3c0;
}

.term-line.error {
  color: var(--term-error);
}

.term-line.info {
  color: var(--term-info);
}

.term-prompt-label {
  color: var(--term-prompt);
  font-weight: 600;
}

.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.terminal-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--term-text);
  font-family: var(--font-mono);
  font-size: 13px;
  caret-color: var(--term-prompt);
}

/* File Explorer App */
.files-app {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--win-bg);
  min-height: 0;
}

.files-nav {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
}

.files-path-input {
  flex: 1;
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-input);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12.5px;
  outline: none;
}

.files-toolbar {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ui-btn {
  height: 30px;
  padding: 0 11px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: var(--btn-bg);
  color: var(--btn-text);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.12s ease;
}

.ui-btn:hover:not(:disabled) {
  background: var(--btn-bg-hover);
}

.ui-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ui-btn.primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border-color: transparent;
}

.ui-btn.primary:hover:not(:disabled) {
  background: var(--btn-primary-hover);
}

.ui-btn.danger {
  background: var(--btn-danger-bg);
  color: var(--btn-danger-text);
}

.ui-btn.danger:hover:not(:disabled) {
  background: var(--btn-danger-hover);
}

.files-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.files-item {
  padding: 7px 10px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: background 0.1s ease;
}

.files-item:hover {
  background: var(--surface-hover);
}

.files-item.selected {
  background: var(--surface-active);
}

.files-item-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.files-item-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.files-item-name {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.files-item-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.files-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Text Editor App */
.editor-app {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--win-bg);
  min-height: 0;
}

.editor-toolbar {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.editor-path {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.editor-status {
  font-size: 11.5px;
  color: var(--text-muted);
}

.editor-textarea {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  padding: 12px 14px;
  background: var(--win-bg);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
}

/* Settings App */
.settings-app {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--win-bg);
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.settings-heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.settings-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.wallpaper-card {
  padding: 6px;
  border-radius: 9px;
  border: 2px solid var(--border-subtle);
  background: var(--win-bg-elevated);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.wallpaper-card.active {
  border-color: var(--ubuntu-orange);
  background: var(--surface-active);
}

.wallpaper-swatch {
  height: 56px;
  border-radius: 6px;
}

.wallpaper-name {
  font-size: 12.5px;
  font-weight: 500;
  padding: 0 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}


/* Context Menu */
.context-menu {
  position: fixed;
  min-width: 210px;
  padding: 6px;
  border-radius: 10px;
  background: var(--popover-bg);
  border: 1px solid var(--win-border);
  box-shadow: var(--win-shadow);
  backdrop-filter: blur(14px);
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.context-menu.hidden {
  display: none;
}

.context-menu-item {
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s ease;
}

.context-menu-item:hover {
  background: var(--surface-hover);
}

.context-menu-item.danger {
  color: var(--btn-danger-text);
}

/* Files Drag & Drop */
.files-list.drag-over {
  outline: 2px dashed var(--ubuntu-orange);
  outline-offset: -4px;
  background: var(--surface-active);
}

.files-drop-hint {
  padding: 6px 12px;
  font-size: 11.5px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
}

/* Editor Gutter & Preview */
.editor-main {
  flex: 1;
  min-height: 0;
  display: flex;
  position: relative;
}

.editor-gutter {
  width: 44px;
  padding: 12px 8px 12px 6px;
  background: var(--win-bg-elevated);
  border-right: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  text-align: right;
  white-space: pre;
  overflow: hidden;
  user-select: none;
}

.editor-gutter.hidden,
.editor-textarea.hidden,
.editor-preview.hidden {
  display: none;
}

.editor-preview {
  flex: 1;
  overflow: auto;
  background: var(--win-bg);
}

.editor-preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

.editor-md-preview {
  padding: 18px 22px;
  line-height: 1.6;
  color: var(--text-primary);
  max-width: 72ch;
}

.editor-md-preview h1,
.editor-md-preview h2,
.editor-md-preview h3 {
  margin: 12px 0 6px;
}

.editor-md-preview ul {
  padding-left: 20px;
  margin: 6px 0;
}

.editor-md-preview code {
  font-family: var(--font-mono);
  background: var(--win-bg-elevated);
  padding: 2px 5px;
  border-radius: 4px;
}

/* Chroma-inix Browser */
.browser-app {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--win-bg);
}

.browser-toolbar {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 6px;
}

.browser-url-input {
  flex: 1;
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-input);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12.5px;
  outline: none;
}

.browser-hint-bar {
  padding: 6px 12px;
  background: var(--win-bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.browser-hint-bar.hidden {
  display: none;
}

.browser-viewport {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.browser-iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

.browser-blocked-card {
  margin: auto;
  max-width: 440px;
  padding: 24px;
  border-radius: 12px;
  background: var(--win-bg-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.browser-blocked-card code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  word-break: break-all;
}

.browser-home {
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 660px;
}

.browser-home-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.browser-links-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Linux Challenges App */
.challenges-app {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--win-bg);
}

.challenges-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.challenges-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.challenges-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.challenge-item {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--win-bg-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.challenge-item.done {
  border-color: rgba(74, 222, 128, 0.45);
}

.challenge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.challenge-title {
  font-weight: 600;
  font-size: 13.5px;
}

.challenge-badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--btn-bg);
  color: var(--text-secondary);
}

.challenge-badge.done {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.challenge-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
}


/* Terminal Console Games */
.terminal-output.hidden,
.terminal-input-row.hidden,
.terminal-game-screen.hidden {
  display: none;
}

.terminal-game-screen {
  flex: 1;
  margin: 0;
  outline: none;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.35;
  color: var(--term-text);
  white-space: pre;
  overflow: hidden;
  user-select: none;
}

.terminal-game-canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.terminal-game-canvas-wrap.hidden {
  display: none;
}

.terminal-game-canvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  image-rendering: pixelated;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.term-prompt-root {
  color: #ff6b6b;
}

/* Browser Sites Popup & History */
.browser-app {
  position: relative;
}

.browser-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 16px;
}

.browser-modal-backdrop.hidden {
  display: none;
}

.browser-modal {
  width: min(460px, 100%);
  max-height: 85%;
  overflow-y: auto;
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--win-bg);
  border: 1px solid var(--win-border);
  box-shadow: var(--win-shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.browser-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.browser-modal-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.browser-history-panel {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 680px;
}

.browser-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.browser-history-item {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--win-bg-elevated);
  color: var(--text-primary);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}

.browser-history-item:hover {
  background: var(--surface-hover);
}

.browser-history-url {
  font-family: var(--font-mono);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.browser-history-time {
  font-size: 11.5px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Window Snapping Preview */
.window-snap-preview {
  position: absolute;
  z-index: 9000;
  background: rgba(233, 84, 32, 0.18);
  border: 2px solid var(--accent, #e95420);
  border-radius: 10px;
  pointer-events: none;
  transition: all 0.12s ease;
}

/* Chroma-inix Multi-Tabs, Bookmarks & Reader */
.browser-tabs-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px 0;
  background: var(--win-bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.browser-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 170px;
  padding: 4px 8px;
  border-radius: 7px 7px 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
}

.browser-tab.active {
  background: var(--win-bg);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.browser-tab-title {
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 125px;
  padding: 0;
}

.browser-tab-close,
.browser-tab-add {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
}

.browser-tab-close:hover,
.browser-tab-add:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.browser-bookmark-btn {
  min-width: 32px;
  font-size: 15px;
}

.browser-custom-bm-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.browser-reader-panel {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.browser-reader-thumb {
  max-width: 220px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.browser-reader-extract {
  line-height: 1.65;
  font-size: 14.5px;
  color: var(--text-primary);
}

/* Universal File Viewer */
.viewer-app {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--win-bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.viewer-file-info {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.viewer-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  background: var(--win-bg);
}

.viewer-zoom-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--win-bg-elevated);
}

.viewer-image-wrap {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.viewer-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 0.12s ease;
  border-radius: 4px;
}

.viewer-pdf-frame {
  width: 100%;
  height: 100%;
  flex: 1;
  border: none;
  background: #ffffff;
}

.viewer-csv-wrap {
  flex: 1;
  overflow: auto;
  padding: 12px;
}

.viewer-csv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.viewer-csv-table th,
.viewer-csv-table td {
  border: 1px solid var(--border-subtle);
  padding: 6px 10px;
  text-align: left;
  white-space: nowrap;
}

.viewer-csv-table th {
  position: sticky;
  top: 0;
  background: var(--win-bg-elevated);
  font-weight: 600;
}

.viewer-csv-table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.03);
}

.viewer-media-box {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.viewer-video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
}

.viewer-text-pre {
  margin: 0;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-primary);
}

/* Pre-Desktop Splash Screen (Full-screen Favicon Logo) */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 21000;
  background: radial-gradient(circle at center, #5e1742 0%, #1a051d 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.28s ease;
}

.splash-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.splash-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: splashZoom 0.6s ease-out;
}

.splash-spinner {
  position: absolute;
  bottom: 36px;
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.22);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: splashSpin 0.85s linear infinite;
}

@keyframes splashZoom {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes splashSpin {
  to { transform: rotate(360deg); }
}

/* Pre-Desktop Screen 1: Boot Screen */
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: #000000;
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.22s ease;
}

.splash-screen.hidden,
.boot-screen.hidden,
.login-screen.hidden,
.window-snap-preview.hidden {
  display: none !important;
}

.boot-screen.fade-out,
.login-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.boot-prompt-box {
  text-align: center;
  padding: 24px;
}

.boot-prompt-title {
  font-size: clamp(20px, 2.8vw, 30px);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.boot-prompt-sub {
  font-size: 13px;
  color: #cbd5e1;
  font-weight: 500;
}

/* Pre-Desktop Screen 2: GDM-style Login Screen */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 19000;
  background: #2c3034;
  color: #f1f5f9;
  display: flex;
  flex-direction: column;
  transition: opacity 0.22s ease;
}

.login-top-bar {
  height: 30px;
  background: rgba(0, 0, 0, 0.38);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 12.5px;
  font-weight: 600;
}

.login-top-spacer {
  width: 64px;
}

.login-top-icons {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0.9;
}

.login-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
}

.login-user-card {
  width: min(320px, 88vw);
  padding: 16px 20px;
  border-radius: 10px;
  border: none;
  background: #1c1f22;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  transition: transform 0.12s ease, background 0.15s ease;
}

.login-user-card.active {
  background: #1a5fb4;
}

.login-user-card:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.login-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.login-form {
  width: min(320px, 88vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-form-box {
  background: #22262a;
  padding: 22px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.login-form-header {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
  color: #cbd5e1;
}

.login-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #14171a;
  color: #f8fafc;
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
}

.login-input:focus {
  border-color: #3584e4;
}

.login-pwd-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-pwd {
  padding-right: 38px;
}

.login-pwd-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.login-pwd-toggle:hover {
  color: #f8fafc;
}

.login-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.login-submit-btn {
  width: 100%;
  padding: 9px 14px;
}

.login-link-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
}

.login-link-btn:hover {
  color: #e2e8f0;
  text-decoration: underline;
}

.login-error {
  color: #fca5a5;
  font-size: 13px;
  font-weight: 500;
}
