/**
 * STRATI.DE - Linux Desktop Simulation Website
 * Main Stylesheet
 */

/* ==========================================================================
   CSS Custom Properties (Theme)
   ========================================================================== */

:root {
  /* Colors */
  --bg1: #0b1020;
  --bg2: #101b35;
  --panel: #0e152aee;
  --panelBorder: #2a3558;
  --win: #0b1225f0;
  --winBorder: #34406b;
  --text: #e7ecff;
  --muted: #aeb8e6;
  --accent: #66d9ef;
  --danger: #ff5f56;
  --warn: #ffbd2e;
  --ok: #27c93f;

  /* Effects */
  --shadow: 0 18px 45px rgba(0,0,0,.45);
  --radius: 14px;

  /* Typography */
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --ui: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

* {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--ui);
  color: var(--text);
  overflow: hidden;
  overflow-x: hidden;
  background:
    radial-gradient(1200px 800px at 30% 25%, rgba(102,217,239,.20), transparent 60%),
    radial-gradient(900px 650px at 80% 70%, rgba(167,139,250,.18), transparent 55%),
    linear-gradient(135deg, var(--bg1), var(--bg2));
  user-select: none;
}

::selection {
  background: rgba(102,217,239,.25);
}

/* ==========================================================================
   Boot Screen
   ========================================================================== */

#bootscreen {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

#bootscreen.hidden {
  opacity: 0;
  visibility: hidden;
}

.boot-logo {
  white-space: pre;
  font-size: 10px;
  line-height: 1.1;
  margin-bottom: 30px;
  text-align: center;
}

.boot-logo .cyan { color: #66d9ef; }
.boot-logo .magenta { color: #f92672; }
.boot-logo .yellow { color: #e6db74; }
.boot-logo .green { color: #a6e22e; }
.boot-logo .orange { color: #fd971f; }
.boot-logo .white { color: #f8f8f2; }

.boot-messages {
  font-size: 13px;
  color: #888;
  max-width: 600px;
  width: 90%;
  height: 200px;
  overflow: hidden;
}

.boot-line {
  opacity: 0;
  animation: bootFadeIn 0.1s ease forwards;
  margin: 2px 0;
}

.boot-line .ok { color: #a6e22e; }
.boot-line .info { color: #66d9ef; }
.boot-line .warn { color: #e6db74; }

@keyframes bootFadeIn {
  to { opacity: 1; }
}

.boot-progress {
  margin-top: 20px;
  width: 300px;
  height: 4px;
  background: #222;
  border-radius: 2px;
  overflow: hidden;
}

.boot-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #66d9ef, #a6e22e);
  transition: width 0.3s ease;
}

/* ==========================================================================
   Desktop
   ========================================================================== */

#desktop {
  position: relative;
  width: 100%;
  height: 100vh;
  padding-top: 44px;
  overflow: hidden;
}

/* ==========================================================================
   Top Bar
   ========================================================================== */

#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--panelBorder);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9999;
}

.left, .center, .right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  box-shadow: 0 10px 25px rgba(0,0,0,.15) inset;
}

.logoDot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f97316, #ef4444);
  box-shadow: 0 0 0 2px rgba(0,0,0,.2);
}

#clock {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.btn {
  cursor: pointer;
  border: none;
  color: var(--text);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
}

.btn:hover {
  background: rgba(255,255,255,.10);
}

/* ==========================================================================
   Dock
   ========================================================================== */

#dock {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9998;
}

.dockIcon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  transition: transform .12s ease, background .12s ease;
}

.dockIcon:hover {
  transform: translateY(-3px) scale(1.02);
  background: rgba(0,0,0,.28);
}

.dockIcon svg {
  opacity: .95;
}

/* ==========================================================================
   Window
   ========================================================================== */

.window {
  position: absolute;
  width: 520px;
  height: 340px;
  border-radius: var(--radius);
  background: var(--win);
  border: 1px solid var(--winBorder);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.titlebar {
  height: 40px;
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border-bottom: 1px solid rgba(255,255,255,.08);
  cursor: grab;
}

.titlebar:active {
  cursor: grabbing;
}

.traffic {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-left: 4px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.35) inset;
}

.dot.close { background: var(--danger); }
.dot.min { background: var(--warn); }
.dot.max { background: var(--ok); }

.winTitle {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  margin-left: 6px;
}

.winTitle code {
  font-family: var(--mono);
  color: var(--text);
  opacity: .9;
}

.titlebarRight {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chip {
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(231,236,255,.85);
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.20);
}

.content {
  flex: 1 1 auto;
  min-height: 0;
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.resizeHandle {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, transparent 50%, rgba(255,255,255,.12) 50%),
    linear-gradient(135deg, transparent 60%, rgba(255,255,255,.18) 60%);
  border-radius: 6px;
  opacity: .9;
}

/* ==========================================================================
   Terminal
   ========================================================================== */

.terminal {
  flex: 1;
  min-height: 0;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.termOut {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) rgba(0,0,0,.2);
}

/* Custom Scrollbar - Webkit */
.termOut::-webkit-scrollbar {
  width: 8px;
}

.termOut::-webkit-scrollbar-track {
  background: rgba(0,0,0,.2);
  border-radius: 4px;
}

.termOut::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.15);
  border-radius: 4px;
}

.termOut::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,.25);
}

.termPrompt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  font-family: var(--mono);
  font-size: 13px;
}

.ps1 {
  color: rgba(231,236,255,.9);
}

.ps1 .user { color: #a7f3d0; }
.ps1 .host { color: #93c5fd; }
.ps1 .path { color: #fda4af; }

.caret {
  width: 8px;
  height: 16px;
  background: rgba(102,217,239,.85);
  display: inline-block;
  margin-left: 2px;
  animation: blink 1.05s steps(1,end) infinite;
  border-radius: 2px;
}

@keyframes blink {
  50% { opacity: 0; }
}

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

/* ==========================================================================
   XTerm.js Terminal
   ========================================================================== */

.xtermContent {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 4px;
  background: #1a1a2e;
  border-radius: 0 0 12px 12px;
}

.xtermContainer {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 8px;
}

/* Override xterm.js default styles for better integration */
.xtermContainer .xterm {
  padding: 8px;
  height: 100%;
}

.xtermContainer .xterm-viewport {
  background: transparent !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) rgba(0,0,0,.2);
}

.xtermContainer .xterm-viewport::-webkit-scrollbar {
  width: 8px;
}

.xtermContainer .xterm-viewport::-webkit-scrollbar-track {
  background: rgba(0,0,0,.2);
  border-radius: 4px;
}

.xtermContainer .xterm-viewport::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.15);
  border-radius: 4px;
}

.xtermContainer .xterm-viewport::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,.25);
}

.xtermContainer .xterm-screen {
  height: 100% !important;
}

/* Terminal cursor style */
.xtermContainer .xterm-cursor-layer .xterm-cursor {
  background-color: #00d9ff !important;
}

/* Selection style */
.xtermContainer .xterm-selection div {
  background-color: rgba(0, 217, 255, 0.3) !important;
}

/* ==========================================================================
   Helpers
   ========================================================================== */

.hint {
  font-size: 12px;
  color: rgba(231,236,255,.75);
  margin-top: -2px;
}

/* ==========================================================================
   Editor Window
   ========================================================================== */

.editorWindow {
  position: absolute;
  width: 520px;
  height: 400px;
  border-radius: var(--radius);
  background: var(--win);
  border: 1px solid var(--winBorder);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.editorTitlebar {
  height: 40px;
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border-bottom: 1px solid rgba(255,255,255,.08);
  cursor: grab;
}

.editorTitlebar:active {
  cursor: grabbing;
}

.editorTitle {
  font-size: 12.5px;
  color: var(--muted);
  margin-left: 6px;
  user-select: none;
}

.editorActions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.editorContent {
  flex: 1 1 auto;
  min-height: 0;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.editorFilename {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(0,0,0,.2);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.08);
}

.editorFilename label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

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

.editorFilename input::placeholder {
  color: rgba(255,255,255,.3);
}

.editorTextarea {
  flex: 1;
  min-height: 0;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 10px;
  padding: 12px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.4;
  resize: none;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) rgba(0,0,0,.2);
}

.editorTextarea::-webkit-scrollbar {
  width: 8px;
}

.editorTextarea::-webkit-scrollbar-track {
  background: rgba(0,0,0,.2);
  border-radius: 4px;
}

.editorTextarea::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.15);
  border-radius: 4px;
}

.editorTextarea::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,.25);
}

.editorTextarea:focus {
  border-color: rgba(102,217,239,.4);
}

.editorFooter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

.editorStatus {
  font-size: 11px;
  color: var(--muted);
  transition: color 0.2s;
}

.editorStatus.unsaved {
  color: var(--warn);
}

.editorStatus.saved {
  color: var(--ok);
}

.editorStatus.error {
  color: var(--danger);
}

.editorSaveBtn {
  cursor: pointer;
  border: none;
  color: var(--text);
  background: rgba(102,217,239,.15);
  border: 1px solid rgba(102,217,239,.3);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-family: var(--ui);
  transition: background 0.15s, border-color 0.15s;
}

.editorSaveBtn:hover {
  background: rgba(102,217,239,.25);
  border-color: rgba(102,217,239,.5);
}

.editorHint {
  font-size: 11px;
  color: rgba(231,236,255,.5);
}

/* ==========================================================================
   Strudel Music Editor
   ========================================================================== */

.strudelEditorWindow {
  position: absolute;
  width: 700px;
  height: 500px;
  min-width: 500px;
  min-height: 400px;
  background: var(--win);
  border: 1px solid var(--winBorder);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.strudelTitlebar {
  height: 40px;
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.15);
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: grab;
}

.strudelTitlebar:active {
  cursor: grabbing;
}

.strudelTitle {
  font-size: 12.5px;
  color: var(--muted);
  margin-left: 6px;
  user-select: none;
}

.strudelActions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.strudelBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: rgba(255,255,255,.08);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.strudelBtn:hover {
  background: rgba(255,255,255,.15);
  color: var(--text);
}

.strudelBtn:active {
  transform: scale(0.95);
}

.strudelBtn.play {
  color: var(--ok);
}

.strudelBtn.play:hover {
  background: rgba(166,226,46,.2);
  color: var(--ok);
}

.strudelBtn.play.active {
  background: rgba(166,226,46,.25);
  color: var(--ok);
}

.strudelBtn.stop {
  color: var(--danger);
}

.strudelBtn.stop:hover {
  background: rgba(255,95,86,.2);
  color: var(--danger);
}

.strudelBtn.stop.active {
  background: rgba(255,95,86,.25);
  color: var(--danger);
}

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

.strudelEditorWrapper {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.strudelEditorWrapper iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  background: #1a1a2e;
}

.strudelEditorWrapper strudel-editor {
  flex: 1;
  min-height: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.strudelFooter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-top: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.1);
}

.strudelStatus {
  font-size: 11px;
  color: var(--muted);
  transition: color 0.2s;
}

.strudelStatus.playing {
  color: var(--ok);
}

.strudelStatus.stopped {
  color: var(--muted);
}

.strudelStatus.error {
  color: var(--danger);
}

.strudelHint {
  font-size: 11px;
  color: rgba(231,236,255,.5);
}

/* Style the strudel-editor component */
.strudelEditorWrapper strudel-editor::part(container) {
  height: 100%;
  border-radius: 0;
}

/* Strudel Toolbar */
.strudelToolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0,0,0,.15);
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.strudelFileControls {
  display: flex;
  gap: 8px;
}

.strudelFileBtn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  background: rgba(255,255,255,.06);
  color: var(--muted);
  font-family: var(--ui);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.strudelFileBtn:hover {
  background: rgba(255,255,255,.12);
  color: var(--text);
  border-color: rgba(255,255,255,.2);
}

.strudelFileBtn svg {
  opacity: 0.8;
}

.strudelFilename {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  padding: 4px 10px;
  background: rgba(0,0,0,.2);
  border-radius: 4px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Strudel File Picker */
.strudelFilePicker {
  position: absolute;
  top: 88px;
  left: 12px;
  width: 280px;
  max-height: 300px;
  background: var(--win);
  border: 1px solid var(--winBorder);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 100;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.strudelFilePicker.open {
  display: flex;
}

.strudelFilePickerHeader {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  background: rgba(0,0,0,.2);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.strudelFileList {
  flex: 1;
  overflow-y: auto;
  max-height: 240px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) rgba(0,0,0,.2);
}

.strudelFileList::-webkit-scrollbar {
  width: 6px;
}

.strudelFileList::-webkit-scrollbar-track {
  background: rgba(0,0,0,.2);
}

.strudelFileList::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.15);
  border-radius: 3px;
}

.strudelFileItem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid rgba(255,255,255,.04);
}

.strudelFileItem:hover {
  background: rgba(255,255,255,.08);
}

.strudelFileItem:last-child {
  border-bottom: none;
}

.strudelFileItem svg {
  color: var(--accent);
  opacity: 0.8;
}

.strudelFileItem span {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
}

.strudelFileEmpty {
  padding: 20px 14px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* Strudel Save Dialog */
.strudelSaveDialog {
  position: absolute;
  top: 88px;
  left: 12px;
  width: 300px;
  background: var(--win);
  border: 1px solid var(--winBorder);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 100;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.strudelSaveDialog.open {
  display: flex;
}

.strudelSaveHeader {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  background: rgba(0,0,0,.2);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.strudelSaveContent {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.strudelSaveInput {
  width: 100%;
  padding: 10px 12px;
  background: rgba(0,0,0,.3);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.strudelSaveInput:focus {
  border-color: var(--accent);
}

.strudelSaveInput::placeholder {
  color: rgba(255,255,255,.3);
}

.strudelSaveActions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.strudelSaveBtn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-family: var(--ui);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.strudelSaveBtn:active {
  transform: scale(0.98);
}

.strudelSaveBtn.cancel {
  background: rgba(255,255,255,.08);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.12);
}

.strudelSaveBtn.cancel:hover {
  background: rgba(255,255,255,.12);
}

.strudelSaveBtn.confirm {
  background: var(--accent);
  color: #000;
}

.strudelSaveBtn.confirm:hover {
  background: #7de4ff;
}

/* ==========================================================================
   Markdown Viewer
   ========================================================================== */

.mdViewerWindow {
  position: absolute;
  width: 600px;
  height: 500px;
  min-width: 400px;
  min-height: 300px;
  background: var(--win);
  border: 1px solid var(--winBorder);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.mdViewerTitlebar {
  height: 40px;
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.15);
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: grab;
}

.mdViewerTitlebar:active {
  cursor: grabbing;
}

.mdViewerTitle {
  font-size: 12.5px;
  color: var(--muted);
  margin-left: 6px;
  user-select: none;
}

.mdViewerActions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.mdViewerContent {
  flex: 1 1 auto;
  min-height: 0;
  padding: 24px 32px;
  overflow-y: auto;
  background: rgba(0,0,0,.1);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) rgba(0,0,0,.2);
}

.mdViewerContent::-webkit-scrollbar {
  width: 8px;
}

.mdViewerContent::-webkit-scrollbar-track {
  background: rgba(0,0,0,.2);
}

.mdViewerContent::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.15);
  border-radius: 4px;
}

/* Markdown Typography */
.mdViewerContent h1 {
  font-size: 1.8em;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 16px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.mdViewerContent h2 {
  font-size: 1.5em;
  font-weight: 600;
  color: var(--text);
  margin: 24px 0 12px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.mdViewerContent h3 {
  font-size: 1.25em;
  font-weight: 600;
  color: var(--text);
  margin: 20px 0 10px 0;
}

.mdViewerContent h4,
.mdViewerContent h5,
.mdViewerContent h6 {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--text);
  margin: 16px 0 8px 0;
}

.mdViewerContent p {
  margin: 0 0 12px 0;
  line-height: 1.7;
  color: var(--text);
}

.mdViewerContent a {
  color: var(--accent);
  text-decoration: none;
}

.mdViewerContent a:hover {
  text-decoration: underline;
}

.mdViewerContent strong {
  font-weight: 600;
  color: var(--text);
}

.mdViewerContent em {
  font-style: italic;
}

.mdViewerContent del {
  text-decoration: line-through;
  opacity: 0.7;
}

.mdViewerContent ul,
.mdViewerContent ol {
  margin: 0 0 12px 0;
  padding-left: 24px;
}

.mdViewerContent li {
  margin: 4px 0;
  line-height: 1.6;
  color: var(--text);
}

.mdViewerContent blockquote {
  margin: 12px 0;
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  background: rgba(0,0,0,.2);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
  font-style: italic;
}

.mdViewerContent hr {
  border: none;
  height: 1px;
  background: rgba(255,255,255,.1);
  margin: 24px 0;
}

.mdViewerContent .mdCodeBlock {
  margin: 12px 0;
  padding: 16px;
  background: rgba(0,0,0,.4);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  overflow-x: auto;
}

.mdViewerContent .mdCodeBlock code {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.mdViewerContent .mdInlineCode {
  font-family: var(--mono);
  font-size: 0.9em;
  padding: 2px 6px;
  background: rgba(0,0,0,.3);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 4px;
  color: var(--accent);
}

.mdViewerContent .mdImage {
  display: inline-block;
  padding: 8px 12px;
  background: rgba(0,0,0,.2);
  border: 1px dashed rgba(255,255,255,.2);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
}

.mdViewerContent .mdEmpty {
  text-align: center;
  color: var(--muted);
  padding: 40px;
}

/* Markdown Viewer Toolbar */
.mdViewerToolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0,0,0,.15);
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.mdFileBtn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  background: rgba(255,255,255,.06);
  color: var(--muted);
  font-family: var(--ui);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.mdFileBtn:hover {
  background: rgba(255,255,255,.12);
  color: var(--text);
  border-color: rgba(255,255,255,.2);
}

.mdFileBtn svg {
  opacity: 0.8;
}

/* Markdown View Toggle */
.mdViewToggle {
  margin-left: auto;
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  background: rgba(255,255,255,.06);
  color: var(--muted);
  font-family: var(--ui);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.mdViewToggle:hover {
  background: rgba(255,255,255,.12);
  color: var(--text);
  border-color: rgba(255,255,255,.2);
}

/* Markdown Source View */
.mdViewerSource {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 24px 32px;
  overflow: auto;
  background: rgba(0,0,0,.2);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) rgba(0,0,0,.2);
}

.mdViewerSource::-webkit-scrollbar {
  width: 8px;
}

.mdViewerSource::-webkit-scrollbar-track {
  background: rgba(0,0,0,.2);
}

.mdViewerSource::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.15);
  border-radius: 4px;
}

/* Markdown File Picker */
.mdFilePicker {
  position: absolute;
  top: 88px;
  left: 12px;
  width: 320px;
  max-height: 350px;
  background: var(--win);
  border: 1px solid var(--winBorder);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 100;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.mdFilePicker.open {
  display: flex;
}

.mdFilePickerHeader {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  background: rgba(0,0,0,.2);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.mdFileList {
  flex: 1;
  overflow-y: auto;
  max-height: 280px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) rgba(0,0,0,.2);
}

.mdFileList::-webkit-scrollbar {
  width: 6px;
}

.mdFileList::-webkit-scrollbar-track {
  background: rgba(0,0,0,.2);
}

.mdFileList::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.15);
  border-radius: 3px;
}

.mdFileItem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid rgba(255,255,255,.04);
}

.mdFileItem:hover {
  background: rgba(255,255,255,.08);
}

.mdFileItem:last-child {
  border-bottom: none;
}

.mdFileItem svg {
  color: #34d399;
  opacity: 0.8;
}

.mdFileItem .mdFileInfo {
  flex: 1;
  min-width: 0;
}

.mdFileItem .mdFileName {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mdFileItem .mdFilePath {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mdFileEmpty {
  padding: 20px 14px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ==========================================================================
   Image Viewer
   ========================================================================== */

.imageViewerWindow {
  position: absolute;
  width: 600px;
  height: 500px;
  min-width: 300px;
  min-height: 250px;
  background: var(--win);
  border: 1px solid var(--winBorder);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.imageViewerTitlebar {
  height: 40px;
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.15);
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: grab;
}

.imageViewerTitlebar:active {
  cursor: grabbing;
}

.imageViewerTitle {
  font-size: 12.5px;
  color: var(--muted);
  margin-left: 6px;
  user-select: none;
}

.imageViewerActions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.imageViewerToolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(0,0,0,.1);
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.imageFileBtn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  background: rgba(255,255,255,.05);
  color: var(--text);
  font-family: var(--ui);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.imageFileBtn:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.2);
}

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

.imageZoomBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 4px;
  background: rgba(255,255,255,.05);
  color: var(--text);
  font-family: var(--mono);
  font-size: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.imageZoomBtn:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.2);
}

.imageViewerContent {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: #1a1a1a;
}

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

.viewerImage {
  max-width: none;
  max-height: none;
  object-fit: contain;
  transition: transform 0.1s ease-out;
  transform-origin: center center;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
}

.imageError {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 40px;
}

/* Image File Picker */
.imageFilePicker {
  position: absolute;
  top: 88px;
  left: 12px;
  width: 320px;
  max-height: 400px;
  background: var(--win);
  border: 1px solid var(--winBorder);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 100;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.imageFilePicker.open {
  display: flex;
}

.imageFilePickerHeader {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  background: rgba(0,0,0,.2);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.imageFileList {
  flex: 1;
  overflow-y: auto;
  max-height: 330px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) rgba(0,0,0,.2);
}

.imageFileItem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid rgba(255,255,255,.04);
}

.imageFileItem:hover {
  background: rgba(255,255,255,.08);
}

.imageFileItem:last-child {
  border-bottom: none;
}

.imageFileThumbnail {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  background: rgba(0,0,0,.3);
}

.imageFileInfo {
  flex: 1;
  min-width: 0;
}

.imageFileName {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.imageFilePath {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.imageFileEmpty {
  padding: 20px 14px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ==========================================================================
   File Explorer
   ========================================================================== */

.fileExplorerWindow {
  position: absolute;
  width: 550px;
  height: 450px;
  min-width: 400px;
  min-height: 350px;
  background: var(--win);
  border: 1px solid var(--winBorder);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.fileExplorerTitlebar {
  height: 40px;
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.15);
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: grab;
}

.fileExplorerTitlebar:active {
  cursor: grabbing;
}

.fileExplorerTitle {
  font-size: 12.5px;
  color: var(--muted);
  margin-left: 6px;
  user-select: none;
}

.fileExplorerActions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.fileExplorerToolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0,0,0,.1);
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.fileExplorerNavBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 6px;
  background: rgba(255,255,255,.05);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.fileExplorerNavBtn:hover {
  background: rgba(255,255,255,.1);
  color: var(--text);
  border-color: rgba(255,255,255,.2);
}

.fileExplorerNavBtn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.fileExplorerPath {
  flex: 1;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  padding: 6px 12px;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fileExplorerContent {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.fileExplorerList {
  height: 100%;
  overflow-y: auto;
  padding: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) rgba(0,0,0,.2);
}

.fileExplorerList::-webkit-scrollbar {
  width: 8px;
}

.fileExplorerList::-webkit-scrollbar-track {
  background: rgba(0,0,0,.2);
}

.fileExplorerList::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.15);
  border-radius: 4px;
}

.fileExplorerItem {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 2px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.fileExplorerItem:hover {
  background: rgba(255,255,255,.08);
}

.fileExplorerItem.selected {
  background: rgba(102,217,239,.15);
}

.fileExplorerItem .icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(0,0,0,.2);
}

.fileExplorerItem .icon svg {
  opacity: 0.9;
}

.fileExplorerItem .icon.folder svg {
  color: #fbbf24;
}

.fileExplorerItem .icon.file svg {
  color: var(--muted);
}

.fileExplorerItem .icon.music svg {
  color: #a78bfa;
}

.fileExplorerItem .icon.text svg {
  color: #60a5fa;
}

.fileExplorerItem .icon.markdown svg {
  color: #34d399;
}

.fileExplorerItem .icon.image svg {
  color: #f472b6;
}

/* Thumbnail styles */
.fileExplorerItem .icon.hasThumbnail {
  width: 48px;
  height: 48px;
  padding: 0;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface);
}

.fileExplorerItem .icon .thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

/* Active state for thumbnail toggle button */
.fileExplorerNavBtn.active {
  background: var(--accent);
  color: white;
}

.fileExplorerItem .details {
  flex: 1;
  min-width: 0;
}

.fileExplorerItem .name {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fileExplorerItem .meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.fileExplorerEmpty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  font-size: 13px;
  gap: 12px;
}

.fileExplorerEmpty svg {
  opacity: 0.4;
}

.fileExplorerFooter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-top: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.1);
}

.fileExplorerStatus {
  font-size: 11px;
  color: var(--muted);
}

/* File Explorer Dialog (New Folder) */
.fileExplorerDialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  background: var(--win);
  border: 1px solid var(--winBorder);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 200;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.fileExplorerDialog.open {
  display: flex;
}

.fileExplorerDialogHeader {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: rgba(0,0,0,.2);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.fileExplorerDialogContent {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fileExplorerDialogInput {
  width: 100%;
  padding: 10px 12px;
  background: rgba(0,0,0,.3);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.fileExplorerDialogInput:focus {
  border-color: var(--accent);
}

.fileExplorerDialogInput::placeholder {
  color: rgba(255,255,255,.3);
}

.fileExplorerDialogActions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.fileExplorerDialogBtn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-family: var(--ui);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.fileExplorerDialogBtn:active {
  transform: scale(0.98);
}

.fileExplorerDialogBtn.cancel {
  background: rgba(255,255,255,.08);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.12);
}

.fileExplorerDialogBtn.cancel:hover {
  background: rgba(255,255,255,.12);
}

.fileExplorerDialogBtn.confirm {
  background: var(--accent);
  color: #000;
}

.fileExplorerDialogBtn.confirm:hover {
  background: #7de4ff;
}

/* ==========================================================================
   Custom Background
   ========================================================================== */

body.custom-background {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* ==========================================================================
   Top Bar Icon Button
   ========================================================================== */

.topbarIcon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.topbarIcon:hover {
  background: rgba(255,255,255,.12);
  color: var(--text);
}

.topbarIcon.listening {
  background: rgba(var(--accent-rgb), 0.2);
  animation: pulse-listening 1.5s ease-in-out infinite;
}

@keyframes pulse-listening {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ==========================================================================
   Settings Window
   ========================================================================== */

.settingsWindow {
  position: absolute;
  width: 500px;
  height: 400px;
  border-radius: var(--radius);
  background: var(--win);
  border: 1px solid var(--winBorder);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.settingsTitlebar {
  height: 40px;
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border-bottom: 1px solid rgba(255,255,255,.08);
  cursor: grab;
}

.settingsTitlebar:active {
  cursor: grabbing;
}

.settingsTitle {
  font-size: 12.5px;
  color: var(--muted);
  margin-left: 6px;
  user-select: none;
}

.settingsContent {
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) rgba(0,0,0,.2);
}

.settingsContent::-webkit-scrollbar {
  width: 8px;
}

.settingsContent::-webkit-scrollbar-track {
  background: rgba(0,0,0,.2);
  border-radius: 4px;
}

.settingsContent::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.15);
  border-radius: 4px;
}

.settingsContent::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,.25);
}

.settingsSection {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settingsSectionTitle {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.backgroundGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.backgroundItem {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  padding: 8px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: rgba(0,0,0,.2);
  transition: border-color 0.15s, background 0.15s;
}

.backgroundItem:hover {
  background: rgba(0,0,0,.3);
}

.backgroundItem.active {
  border-color: var(--accent);
  background: rgba(102,217,239,.1);
}

.backgroundPreview {
  width: 100%;
  aspect-ratio: 16/10;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  background-color: rgba(0,0,0,.3);
}

.backgroundPreview.default-gradient {
  background:
    radial-gradient(1200px 800px at 30% 25%, rgba(102,217,239,.20), transparent 60%),
    radial-gradient(900px 650px at 80% 70%, rgba(167,139,250,.18), transparent 55%),
    linear-gradient(135deg, var(--bg1), var(--bg2));
}

.backgroundLabel {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.backgroundItem.active .backgroundLabel {
  color: var(--text);
}

/* Background Remove Button */
.backgroundRemoveBtn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.backgroundItem:hover .backgroundRemoveBtn {
  opacity: 1;
}

.backgroundRemoveBtn:hover {
  transform: scale(1.1);
  background: rgba(239, 68, 68, 1);
}

/* Background Upload Container */
.backgroundUploadContainer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.backgroundUploadBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border: 2px dashed rgba(255,255,255,.2);
  border-radius: 10px;
  background: rgba(0,0,0,.15);
  color: var(--muted);
  font-family: var(--ui);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.backgroundUploadBtn:hover {
  border-color: var(--accent);
  background: rgba(0,0,0,.25);
  color: var(--text);
}

.backgroundUploadBtn svg {
  opacity: 0.8;
}

/* ==========================================================================
   Language Selector
   ========================================================================== */

.languageGrid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.languageItem {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  cursor: pointer;
  border-radius: 8px;
  border: 2px solid transparent;
  background: rgba(0,0,0,.2);
  font-size: 13px;
  color: var(--muted);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.languageItem:hover {
  background: rgba(0,0,0,.3);
  color: var(--text);
}

.languageItem.active {
  border-color: var(--accent);
  background: rgba(102,217,239,.1);
  color: var(--text);
}

/* ==========================================================================
   Clock Options
   ========================================================================== */

.clockOptionsGrid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.clockOptionItem {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  cursor: pointer;
  border-radius: 8px;
  border: 2px solid transparent;
  background: rgba(0,0,0,.2);
  font-size: 13px;
  color: var(--muted);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.clockOptionItem:hover {
  background: rgba(0,0,0,.3);
  color: var(--text);
}

.clockOptionItem.active {
  border-color: var(--accent);
  background: rgba(102,217,239,.1);
  color: var(--text);
}

/* ==========================================================================
   Audio Section
   ========================================================================== */

.audioGrid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.audioProfileItem {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  cursor: pointer;
  border-radius: 8px;
  border: 2px solid transparent;
  background: rgba(0,0,0,.2);
  font-size: 13px;
  color: var(--muted);
  transition: all .15s ease;
}

.audioProfileItem:hover {
  background: rgba(0,0,0,.3);
  color: var(--text);
}

.audioProfileItem.active {
  border-color: var(--accent);
  background: rgba(102,217,239,.1);
  color: var(--text);
}

/* ==========================================================================
   Speech Settings (Accessibility)
   ========================================================================== */

.speechSettings {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.speechToggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(0,0,0,.2);
  cursor: pointer;
  transition: background 0.15s;
}

.speechToggle:hover {
  background: rgba(0,0,0,.3);
}

.speechToggleInfo {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.speechToggleLabel {
  font-size: 13px;
  color: var(--text);
}

.speechToggleDesc {
  font-size: 11px;
  color: var(--muted);
}

.speechSwitch {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: rgba(255,255,255,.15);
  transition: background 0.2s;
}

.speechSwitch.active {
  background: var(--accent);
}

.speechSwitch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s;
}

.speechSwitch.active::after {
  transform: translateX(20px);
}

.speechVoiceSelect {
  padding: 10px 14px;
  border: 2px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: rgba(0,0,0,.2);
  color: var(--text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.speechVoiceSelect:hover {
  background: rgba(0,0,0,.3);
  border-color: rgba(255,255,255,.2);
}

.speechVoiceSelect:focus {
  border-color: var(--accent);
}

.speechRateContainer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.speechRateLabel {
  font-size: 12px;
  color: var(--muted);
  min-width: 100px;
}

.speechRateSlider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255,255,255,.15);
  border-radius: 2px;
  outline: none;
}

.speechRateSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.speechRateSlider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

.speechRateValue {
  font-size: 12px;
  color: var(--text);
  min-width: 40px;
  text-align: right;
}

.speechNotSupported {
  padding: 12px;
  border-radius: 8px;
  background: rgba(255,100,100,.1);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* ==========================================================================
   User Section
   ========================================================================== */

.userInputContainer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.usernameInput {
  padding: 10px 14px;
  border: 2px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: rgba(0,0,0,.2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.usernameInput:hover {
  background: rgba(0,0,0,.3);
  border-color: rgba(255,255,255,.2);
}

.usernameInput:focus {
  border-color: var(--accent);
  background: rgba(0,0,0,.3);
}

.usernameInput::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

/* ==========================================================================
   Backup Section
   ========================================================================== */

.backupGrid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.backupBtn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  background: rgba(0,0,0,.2);
  color: var(--text);
  font-family: var(--ui);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
}

.backupBtn:hover {
  background: rgba(0,0,0,.3);
  border-color: rgba(255,255,255,.2);
}

.backupBtn svg {
  flex-shrink: 0;
  opacity: 0.8;
}

.backupBtn .backupBtnContent {
  flex: 1;
}

.backupBtn .backupBtnTitle {
  font-weight: 500;
  margin-bottom: 2px;
}

.backupBtn .backupBtnDesc {
  font-size: 11px;
  color: var(--muted);
}

.backupBtn.download svg {
  color: #34d399;
}

.backupBtn.restore svg {
  color: #60a5fa;
}

.backupStatus {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  display: none;
}

.backupStatus.success {
  display: block;
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.backupStatus.error {
  display: block;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ==========================================================================
   About Section
   ========================================================================== */

.aboutSection {
  padding-top: 12px;
}

.aboutBtn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
}

.aboutBtn:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.aboutBtn svg {
  color: var(--accent);
  flex-shrink: 0;
}

/* ==========================================================================
   Version Section
   ========================================================================== */

.versionSection {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.versionInfo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.versionLabel {
  opacity: 0.7;
}

.versionValue {
  font-family: var(--mono);
  color: var(--accent);
}

/* ==========================================================================
   Activities Menu
   ========================================================================== */

.activitiesMenu {
  position: relative;
}

.activitiesBtn {
  cursor: pointer;
  transition: background .15s ease;
}

.activitiesBtn:hover {
  background: rgba(255,255,255,.1);
}

.activitiesDropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  min-width: 260px;
  max-width: 320px;
  background: var(--panel);
  border: 1px solid var(--panelBorder);
  border-radius: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
  z-index: 9999;
}

.activitiesDropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.activitiesHeader {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 8px 8px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  margin-bottom: 6px;
}

.activitiesWindowList {
  max-height: 300px;
  overflow-y: auto;
}

.activitiesWindowItem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s ease;
}

.activitiesWindowItem:hover {
  background: rgba(255,255,255,.1);
}

.activitiesWindowItem.active {
  background: rgba(102,217,239,.15);
}

.activitiesWindowIcon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.activitiesWindowTitle {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activitiesWindowSubtitle {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.activitiesWindowClose {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--muted);
  opacity: 0;
  transition: all .15s;
  flex-shrink: 0;
}

.activitiesWindowItem:hover .activitiesWindowClose {
  opacity: 1;
}

.activitiesWindowClose:hover {
  background: rgba(255,100,100,.3);
  color: #ff6b6b;
}

.activitiesEmpty {
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  display: none;
}

.activitiesEmpty.visible {
  display: block;
}

/* ==========================================================================
   Power Menu
   ========================================================================== */

.powerMenu {
  position: relative;
}

.powerDropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  min-width: 200px;
  background: var(--panel);
  border: 1px solid var(--panelBorder);
  border-radius: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.15s, visibility 0.15s, transform 0.15s;
  z-index: 10000;
}

.powerDropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.powerOption {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: var(--ui);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}

.powerOption:hover {
  background: rgba(255,255,255,.08);
}

.powerOption.danger {
  color: var(--danger);
}

.powerOption.danger:hover {
  background: rgba(255,95,86,.15);
}

.powerOption svg {
  opacity: 0.8;
}

.powerDivider {
  height: 1px;
  background: rgba(255,255,255,.1);
  margin: 6px 0;
}

/* ==========================================================================
   Shutdown Screen
   ========================================================================== */

#shutdownScreen {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#shutdownScreen.visible {
  opacity: 1;
  visibility: visible;
}

.shutdown-logo {
  white-space: pre;
  font-size: 10px;
  line-height: 1.1;
  margin-bottom: 30px;
  text-align: center;
}

.shutdown-logo .cyan { color: #66d9ef; }
.shutdown-logo .magenta { color: #f92672; }
.shutdown-logo .yellow { color: #e6db74; }
.shutdown-logo .green { color: #a6e22e; }
.shutdown-logo .orange { color: #fd971f; }
.shutdown-logo .white { color: #f8f8f2; }

.shutdown-messages {
  font-size: 13px;
  color: #888;
  max-width: 600px;
  width: 90%;
  height: 200px;
  overflow: hidden;
}

.shutdown-line {
  opacity: 0;
  animation: bootFadeIn 0.1s ease forwards;
  margin: 2px 0;
}

.shutdown-line .ok { color: #a6e22e; }
.shutdown-line .info { color: #66d9ef; }
.shutdown-line .warn { color: #e6db74; }
.shutdown-line .fail { color: #f92672; }

.shutdown-progress {
  margin-top: 20px;
  width: 300px;
  height: 4px;
  background: #222;
  border-radius: 2px;
  overflow: hidden;
}

.shutdown-progress-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #f92672, #fd971f);
  transition: width 0.3s ease;
}

/* ==========================================================================
   Confirm Dialog
   ========================================================================== */

#confirmDialog {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

#confirmDialog.visible {
  opacity: 1;
  visibility: visible;
}

.confirmBox {
  background: var(--win);
  border: 1px solid var(--winBorder);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.confirmBox h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--text);
}

.confirmBox p {
  margin: 0 0 24px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.confirmActions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.confirmBtn {
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  font-family: var(--ui);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.confirmBtn:active {
  transform: scale(0.98);
}

.confirmBtn.cancel {
  background: rgba(255,255,255,.1);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.15);
}

.confirmBtn.cancel:hover {
  background: rgba(255,255,255,.15);
}

.confirmBtn.danger {
  background: var(--danger);
  color: #fff;
}

.confirmBtn.danger:hover {
  background: #ff7066;
}

/* ==========================================================================
   Performance HUD
   ========================================================================== */

.perfHudWindow {
  width: 340px;
  height: 520px;
  min-width: 280px;
  min-height: 300px;
}

.perfHudTitlebar {
  background: linear-gradient(180deg, rgba(40,44,52,1) 0%, rgba(30,33,40,1) 100%);
}

.perfHudTitle {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.perfHudActions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.perfHudBtn {
  padding: 4px 8px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 4px;
  background: rgba(0,0,0,.2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  transition: all .15s ease;
}

.perfHudBtn:hover {
  background: rgba(0,0,0,.4);
  color: var(--text);
  border-color: rgba(255,255,255,.25);
}

.perfHudBtn.paused {
  background: rgba(102,217,239,.15);
  border-color: var(--accent);
  color: var(--accent);
}

.perfHudContent {
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) rgba(0,0,0,.2);
  background: linear-gradient(180deg, rgba(20,22,28,1) 0%, rgba(15,17,21,1) 100%);
}

.perfHudContent::-webkit-scrollbar {
  width: 6px;
}

.perfHudContent::-webkit-scrollbar-track {
  background: rgba(0,0,0,.2);
}

.perfHudContent::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.15);
  border-radius: 3px;
}

.perfSection {
  background: rgba(0,0,0,.3);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  padding: 10px;
}

.perfSectionTitle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.perfSectionTitle svg {
  opacity: 0.8;
}

.perfRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.perfLabel {
  font-size: 12px;
  color: var(--muted);
}

.perfValue {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.perfValue.good {
  color: #4ade80;
}

.perfValue.warn {
  color: #fbbf24;
}

.perfValue.bad {
  color: #f87171;
}

.perfMemBarContainer {
  height: 6px;
  background: rgba(0,0,0,.4);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}

.perfMemBar {
  height: 100%;
  border-radius: 3px;
  transition: width .3s ease, background .3s ease;
}

.perfMemBar.good {
  background: linear-gradient(90deg, #4ade80, #22c55e);
}

.perfMemBar.warn {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.perfMemBar.bad {
  background: linear-gradient(90deg, #f87171, #ef4444);
}

/* ==========================================================================
   Responsive / Mobile
   ========================================================================== */

@media (max-width: 720px) {
  .window {
    width: min(92vw, 520px);
    height: min(65vh, 360px);
  }

  #topbar {
    height: 40px;
    padding: 0 8px;
  }

  #topbar .left,
  #topbar .center,
  #topbar .right {
    gap: 6px;
  }

  #topbar .pill {
    padding: 5px 8px;
    gap: 6px;
  }

  #topbar .btn {
    padding: 6px 8px;
    font-size: 12px;
  }

  .topbarIcon {
    width: 32px;
    height: 32px;
  }

  #dock {
    bottom: 10px;
    gap: 8px;
    padding: 8px 10px;
  }

  .dockIcon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .dockIcon svg {
    width: 20px;
    height: 20px;
  }

  .boot-logo {
    font-size: 6px;
  }
}

/* Smartphone portrait mode */
@media (max-width: 480px) {
  /* Window constraints - prevent windows from going off-screen */
  .window {
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100vh - 120px) !important;
    width: calc(100vw - 16px) !important;
    left: 8px !important;
  }

  /* Top bar adjustments */
  #topbar {
    height: 36px;
    padding: 0 6px;
  }

  #topbar .left,
  #topbar .center,
  #topbar .right {
    gap: 4px;
  }

  /* Hide center workspace pill on small screens */
  #topbar .center {
    display: none;
  }

  #topbar .pill {
    padding: 4px 6px;
    gap: 4px;
  }

  #topbar .pill span {
    font-size: 11px !important;
  }

  /* Hide "Activities" text, keep only the dot */
  #topbar .activitiesBtn span:not(.logoDot) {
    display: none;
  }

  /* Make "+ Terminal" button smaller */
  #topbar .btn {
    padding: 4px 6px;
    font-size: 11px;
  }

  .topbarIcon {
    width: 28px;
    height: 28px;
  }

  .topbarIcon svg {
    width: 16px;
    height: 16px;
  }

  .logoDot {
    width: 8px;
    height: 8px;
  }

  /* Hide Wi-Fi text on smartphones */
  #topbar .right .pill span:first-child {
    display: none;
  }

  /* Hide the bullet separator */
  #topbar .right .pill span[style*="opacity:.8"] {
    display: none;
  }

  /* Dock adjustments */
  #dock {
    bottom: 8px;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 14px;
    max-width: calc(100vw - 16px);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
  }

  #dock::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }

  .dockIcon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
  }

  .dockIcon svg {
    width: 18px;
    height: 18px;
  }

  .dockIcon:hover {
    transform: none;
  }

  /* Hide less essential dock icons on smartphones */
  #dockEditor,
  #dockMarkdown,
  #dockImage,
  #dockPerfHud,
  #dockHelp {
    display: none;
  }
}

/* Very small screens (iPhone SE, etc.) */
@media (max-width: 375px) {
  /* Top bar - minimal */
  #topbar {
    height: 32px;
    padding: 0 4px;
  }

  #topbar .left,
  #topbar .right {
    gap: 2px;
  }

  #topbar .pill {
    padding: 3px 5px;
    gap: 3px;
  }

  #topbar .pill span {
    font-size: 10px !important;
  }

  #topbar .btn {
    padding: 3px 5px;
    font-size: 10px;
  }

  .topbarIcon {
    width: 26px;
    height: 26px;
  }

  .topbarIcon svg {
    width: 14px;
    height: 14px;
  }

  /* Dock */
  #dock {
    gap: 4px;
    padding: 5px 6px;
  }

  .dockIcon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 8px;
  }

  .dockIcon svg {
    width: 16px;
    height: 16px;
  }
}
