:root{
  --bg: #17140f;
  --bg-light: #221d15;
  --bg-lighter: #2c2519;
  --paper: #ede4d0;
  --text: #ece4d2;
  --text-dim: #9a8f79;
  --accent: #d1893f;
  --accent-hover: #b8752f;
  --danger: #b8503f;
  --ok: #7a9b5c;
  --window-bg: #1c1810;
  --taskbar-bg: #1a160f;
  --border: rgba(236, 228, 210, 0.10);
  --border-strong: rgba(236, 229, 211, 0.20);
  --radius-sm: 2px;
  --radius: 3px;
  --radius-lg: 5px;
  --shadow: 4px 4px 0 rgba(0, 0, 0, 0.4);
  --shadow-sm: 2px 2px 0 rgba(0, 0, 0, 0.35);
  --transition: 0.15s cubic-bezier(0.4, 0, 0.2, 1);

  --font-display: 'Fraunces', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', ui-monospace, monospace;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-mono);
}

html, body{
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  user-select: none;
  font-family: var(--font-body);
}

::selection{
  background: var(--accent);
  color: #1c1810;
}

#desktop{
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;

  background: radial-gradient(ellipse 120% 90% at 50% -10%, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.35) 100%), var(--bg);
}

#desktop::before{
  content: "";
  
  position: absolute;
  inset: 0;
  background: url("./assets/noise.svg") repeat;
  opacity: 1;

  pointer-events: none;
}

.desktop-icons{
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  z-index: 1;
}

.icon{
  width: 80px;
  padding: 10px 4px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition);
  border: 1px dashed transparent;
}

.icon:hover{
  background: rgba(236, 228, 210, 0.05);
  border-color: var(--border-strong);
}

.icon:active{
  transform: scale(0.96);
  background: rgba(209, 137, 63, 0.10);
}

.icon-image{
  font-size: 30px;
  filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.3));
}

.icon-label{
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-align: center;
  color: var(--text);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

#window-layer{
  position: absolute;
  top: 0%;
  left: 0%;
  width: 100%;
  height: calc(100% - 48px);
  pointer-events: none;
  z-index: 10;
}

#window-layer > *{
  pointer-events: auto;
}

.window{
  position: absolute;
  width: 600px;
  height: 400px;
  background: var(--window-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: windowOpen 0.18s ease;
}

@keyframes windowOpen{
  from{
    opacity: 0;
    transform: scale(0.98) translateY(6px);
  }

  to{
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.window.minimized{
  display: none;
}

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

.window-titlebar{
  height: 38px;
  background: var(--bg-lighter);
  border-bottom: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 0 14px;
  cursor: grab;
}

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

.window-title{
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.window-title::before{
  content: "A";
  width: 15px;
  height: 15px;
  min-width: 15px;
  border-radius: 50%;
  background: var(--accent);
  color: #1c1810;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 10px;
  text-transform: none;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.window-controls{
  display: flex;
  gap: 5px;
}

.window-controls button{
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: transparent;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  transition: var(--transition);
}

.window-controls .minimize:hover{
  border-color: var(--accent);
  color: var(--accent);
}

.window-controls .maximize:hover{
  border-color: var(--ok);
  color: var(--ok);
}

.window-controls .close:hover{
  border-color: var(--danger);
  background: var(--danger);
  color: var(--window-bg);
}

.window-content{
  flex: 1;
  overflow: auto;
  padding: 16px;
  background: var(--window-bg);
  font-family: var(--font-body);
}

.resize-handle{
  position: absolute;
  z-index: 5;
}

.resize-n, .resize-s{
  left: 8px;
  right: 8px;
  height: 6px;
  cursor: ns-resize;
}

.resize-n{
  top: 0;
}

.resize-s{
  bottom: 0;
}

.resize-e, .resize-w{
  top: 8px;
  bottom: 8px;
  width: 6px;
  cursor: ew-resize;
}

.resize-e{
  right: 0;
}

.resize-w{
  left: 0;
}

.resize-ne, .resize-nw, .resize-se, .resize-sw{
  width: 14px;
  height: 14px;
  z-index: 6;
}

.resize-ne{
  top: 0;
  right: 0;
  cursor: nesw-resize;
}

.resize-nw{
  top: 0;
  left: 0;
  cursor: nwse-resize;
}

.resize-se{
  bottom: 0;
  right: 0;
  cursor: nwse-resize;
}

.resize-sw{
  bottom: 0;
  left: 0;
  cursor: nesw-resize;
}

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

#snap-preview{
  position: absolute;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, left 0.12s ease, top 0.12s ease, width 0.12s ease, height 0.12s ease;
}

#snap-preview.active{
  opacity: 1;
}

#taskbar{
  position: fixed;
  bottom: 0; left: 0;
  width: 100%;
  height: 48px;
  background: var(--taskbar-bg);
  box-shadow: inset 0 1px 0 var(--border-strong);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 100;
}

#start-btn{
  height: 32px;
  padding: 0 14px;
  background: var(--bg-lighter);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

#start-btn:hover{
  border-color: var(--accent);
  color: var(--accent);
}

#taskbar-apps{
  display:flex;
  gap: 4px;
  flex: 1;
}

.taskbar-app{
  height: 36px;
  padding: 0 14px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size:12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.taskbar-app:hover{
  box-shadow: inset 0 -2px 0 var(--border-strong);
}

.taskbar-app.active{
  background: color-mix(in srgb, var(--accent) 14%, var(--bg-light));
  border-color: var(--accent);
  box-shadow: inset 2px 0 0 var(--accent);
}

#system-tray{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  height: 32px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-dim);
}

.tray-icon{
  font-size: 13px;
}

#start-menu {
  position: fixed;
  bottom: 56px;
  left: 16px;
  width: 380px;
  max-height: min(640px, calc(100vh - 88px));
  background: var(--taskbar-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 101;
  overflow-y: auto;
  overflow-x: hidden;
  animation: menuOpen 0.16s ease;
}

@keyframes menuOpen {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#start-menu.hidden {
  display: none;
}

.start-greeting {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 18px 16px;
  background: var(--bg-light);
  border-bottom: 1px solid var(--border);
}

.start-greeting-icon-badge {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: var(--radius-lg);
  background: var(--bg-lighter);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.start-greeting-text {
  flex: 1;
}

.start-greeting-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  font-style: italic;
  color: var(--text);
}

.start-greeting-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 3px;
  font-family: var(--font-mono);
}

.start-greeting-date {
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  line-height: 1.5;
  white-space: nowrap;
  font-family: var(--font-mono);
}


.start-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 16px 4px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}

.start-search-icon {
  font-size: 12px;
  color: var(--text-dim);
}

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

.start-search input::placeholder {
  color: var(--text-dim);
}

.start-search-kbd {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  background: var(--bg-lighter);
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  padding: 2px 6px;
}

.start-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 6px;
}

.start-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 14px 16px 6px;
}

.start-section-header .start-section-label {
  padding: 0;
}

.start-section-link {
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
}

.start-section-link:hover {
  text-decoration: underline;
}
.start-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 4px 14px 14px;
}

.start-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 4px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-light);
  transition: var(--transition);
}

.start-app:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-light));
}

.start-app:active {
  transform: scale(0.96);
}

.start-app-icon-badge {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: var(--shadow-sm);
}

.start-app-label {
  font-size: 10px;
  color: var(--text);
  text-align: center;
}

.start-grid-empty {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  padding: 16px;
}

.start-grid .start-app {
  opacity: 0;
  animation: tileIn 0.2s ease forwards;
}

.start-grid .start-app:nth-child(1) {
  animation-delay: 0.02s;
}

.start-grid .start-app:nth-child(2) {
  animation-delay: 0.04s;
}

.start-grid .start-app:nth-child(3) {
  animation-delay: 0.06s;
}

.start-grid .start-app:nth-child(4) {
  animation-delay: 0.08s;
}

.start-grid .start-app:nth-child(5) {
  animation-delay: 0.10s;
}

.start-grid .start-app:nth-child(6) {
  animation-delay: 0.12s;
}

.start-grid .start-app:nth-child(7) {
  animation-delay: 0.14s;
}

.start-grid .start-app:nth-child(8) {
  animation-delay: 0.16s;
}

@keyframes tileIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.start-recent-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px 8px;
}

.start-recent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.start-recent-item:hover {
  background: var(--bg-light);
}

.start-recent-icon-badge {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.start-recent-text {
  flex: 1;
  min-width: 0;
}

.start-recent-title {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.start-recent-sub {
  font-size: 10px;
  color: var(--text-dim);
}

.start-recent-time {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
}

.start-recent-empty {
  padding: 6px 16px 14px;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
}

.start-toggles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}

.start-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-lg);
  background: var(--bg-light);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.start-toggle:hover {
  border-color: var(--border-strong);
}

.start-toggle.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-light));
}

.start-toggle-icon {
  font-size: 14px;
}

.start-toggle-label {
  font-size: 11px;
  color: var(--text);
  font-weight: 500;
}

.start-toggle-sub {
  font-size: 10px;
  color: var(--text-dim);
}

.start-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.start-profile-avatar {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: var(--radius-lg);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.start-profile-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.start-profile-status {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  display: inline-block;
}

.start-footer {
  padding: 8px;
  border-top: 1px solid var(--border)
}

.start-app-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.start-app-row:hover {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
}

.start-list-icon {
  font-size: 15px;
}

.start-list-label {
  font-size: 12px;
  color: var(--text);
}

.start-app:focus-visible,
.start-recent-item:focus-visible,
.start-toggle:focus-visible,
.start-app-row:focus-visible,
.start-section-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* -- Apps Folder -- */

.apps-folder {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 14px;
  padding: 8px;
}

.folder-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
  border: 1px dashed transparent;
}

.folder-item:hover {
  background: var(--bg-light);
  border-color: var(--border-strong);
}

.folder-icon {
  font-size: 34px;
}

.folder-label {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* -- Terminal -- */

.terminal-app {
  margin: -16px;
  height: calc(100% + 32px);
  display: flex;
  flex-direction: column;
  background: #100d09;
  font-family: var(--font-mono);
  font-size: 13px;
}

.terminal-output {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  color: #cfc4ad;
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-line {
  line-height: 1.6;
}

.terminal-line.command {
  color: var(--text);
}

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

.terminal-prompt-inline {
  color: var(--accent);
  margin-right: 6px;
}

.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 12px;
  border-top: 1px solid var(--border);
}

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

/* -- Settings -- */

.settings-app {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 9px;
  font-family: var(--font-body);
}

.settings-section h3 {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  font-size: 14px;
}

.toggle {
  padding: 5px 12px;
  background: var(--bg-light);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: var(--transition);
  min-width: 56px;
  text-align: center;
}

.toggle.active {
  background: color-mix(in srgb, var(--accent) 16%, var(--bg-light));
  border-color: var(--accent);
  color: var(--accent);
}

.accent-colors {
  display: flex;
  gap: 8px;
}

.accent-btn {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-lg);
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}

.accent-btn:hover {
  transform: translateY(-2px);
}

.accent-btn.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--bg-light);
}

.settings-section p {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}

/* -- Scrollbar -- */

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

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

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--accent) 40%, var(--border-strong));
}

/* -- Context Menu -- */
.context-menu {
  position: fixed;
  min-width: 180px;
  background: var(--bg-lighter);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 4px;
  z-index: 200;
  animation: menuOpen 0.1s ease;
}

.context-menu-item {
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 2px;
  cursor: pointer;
  color: var(--text);
  transition: var(--transition);
}

.context-menu-item:hover {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}

.context-menu-item.disabled {
  color: var(--text-dim);
  cursor: default;
  opacity: 0.6;
}

.context-menu-item.disabled:hover {
  background: none;
  color: var(--text-dim);
}

.hidden {
  display: none !important;
}

.no-animations *,
.no-animations *::before,
.no-animations *::after {
  animation-duration: 0.001s !important;
  animation-delay: 0s !important;
  transition: none !important;
}