:root {
  color-scheme: dark;
  font: 13px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f3f3f5;
  background: #08090b;
  --panel: rgba(23, 24, 28, .88);
  --line: rgba(255, 255, 255, .10);
  --muted: #92939d;
  --accent: #9ab7f5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: url("background.jpg") center / cover no-repeat fixed, #08090b;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(0, 0, 0, var(--dim, .35));
  pointer-events: none;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; color: inherit; }

button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.topbar {
  position: relative;
  z-index: 1;
  height: 46px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(14, 15, 18, .76);
  border-bottom: 1px solid #ffffff12;
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
}

.brand { font-size: 11px; letter-spacing: 1.8px; }
.brand span { color: #8d9ab5; font-weight: 400; }

.topbar-right { display: flex; align-items: center; gap: 19px; }
#clock, .system-status { font-size: 11px; color: #c3c4cc; }
.system-status { display: flex; align-items: center; gap: 6px; }
.system-status i { width: 5px; height: 5px; border-radius: 50%; background: #8bc9a0; }

.desktop {
  position: relative;
  z-index: 1;
  height: calc(100vh - 46px);
}

.window {
  position: absolute;
  top: 44%;
  left: 50%;
  width: 520px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 145px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translate(-50%, -50%);
  background: var(--panel);
  border: 1px solid #ffffff20;
  border-radius: 12px;
  box-shadow: 0 26px 90px #0007, 0 2px 8px #0003;
  backdrop-filter: blur(32px) saturate(135%);
  -webkit-backdrop-filter: blur(32px) saturate(135%);
  animation: appear .18s ease-out;
}

.window[hidden] { display: none; }
.app-window { width: 440px; }

@keyframes appear {
  from { opacity: 0; }
  to { opacity: 1; }
}

.titlebar {
  flex-shrink: 0;
  height: 43px;
  padding: 0 13px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: rgba(255, 255, 255, .025);
  border-bottom: 1px solid #ffffff0c;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.titlebar:active { cursor: grabbing; }

.titlebar > span:nth-child(2) {
  grid-column: 2;
  font-size: 11px;
  color: #d0d0d6;
  pointer-events: none;
  white-space: nowrap;
}

.controls { display: flex; gap: 7px; grid-column: 1; grid-row: 1; }

.controls button {
  width: 12px;
  height: 12px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  transition: filter .15s;
}

.controls:hover button { filter: brightness(1.08); }
.controls .red { background: #ff6058; }
.controls .yellow { background: #febc2e; }
.controls .green { background: #28c840; }

.content { padding: 25px; overflow: auto; min-height: 0; }

.content h1 {
  font-size: 38px;
  line-height: 1.12;
  font-weight: 500;
  letter-spacing: -1.8px;
  margin: 18px 0 12px;
}

.content h2 { font-size: 18px; font-weight: 500; margin: 0 0 19px; }
.content p { color: #a7a8b1; line-height: 1.7; }
.content small, .eyebrow { font-size: 9px; color: #989ba8; letter-spacing: 1.8px; }

.welcome { padding: 37px; }
.welcome > p { margin: 0 0 25px; font-size: 12px; }

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 17px;
  padding: 10px 14px;
  color: #ffffff;
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 7px;
  font-size: 11px;
  transition: background .15s, transform .15s;
}

.primary:hover { background: rgba(255, 255, 255, .18); }
.primary:active { transform: scale(.98); }

.welcome-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 39px;
  padding-top: 15px;
  border-top: 1px solid #ffffff12;
  color: #737680;
  font-size: 8px;
  letter-spacing: 1.2px;
}

button:not(.controls button) {
  padding: 9px 12px;
  background: #ffffff08;
  border: 1px solid #ffffff16;
  border-radius: 7px;
  transition: background .15s, border-color .15s;
}

button:not(.controls button):hover {
  background: #ffffff12;
  border-color: #ffffff27;
}

button:disabled { opacity: .35; cursor: default; }

input:not([type="range"]), textarea {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  color: #f0f0f3;
  background: rgba(0, 0, 0, .19);
  border: 1px solid #ffffff16;
  border-radius: 7px;
}

input::placeholder, textarea::placeholder { color: #777984; }

textarea {
  min-height: 220px;
  margin-top: 10px;
  resize: vertical;
  line-height: 1.7;
}

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

.toolbar, .search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.toolbar button { min-width: 36px; padding: 7px 10px; }
#file-path { color: #b8b9c2; font-size: 11px; }
.file-list { display: grid; gap: 6px; }
.file-list button { text-align: left; padding: 11px 12px; }

.file-preview {
  margin-top: 14px;
  padding: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.8;
  color: #c5c6cf;
  background: #0002;
  border: 1px solid #ffffff0c;
  border-radius: 7px;
}

.calculator { padding: 18px; }

#calc-input {
  font-size: 25px;
  text-align: right;
  border-color: transparent;
  background: transparent;
}

#calc-result {
  min-height: 43px;
  padding: 9px 3px 14px;
  text-align: right;
  color: #aeb9d1;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.calc-grid button { min-height: 46px; font-size: 15px; background: #ffffff0a; }
.calc-grid .equals { background: #dce5f7; color: #11141b; }
.calc-grid .equals:hover { background: #fff; }

.terminal {
  background: rgba(5, 8, 8, .5);
  color: #c3dec9;
  font: 12px/1.7 Consolas, "SFMono-Regular", monospace;
}

#terminal-output {
  min-height: 150px;
  max-height: 290px;
  overflow: auto;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

#terminal-form { display: flex; align-items: center; gap: 8px; }
#terminal-form label { white-space: nowrap; color: #9bc5a8; }

#terminal-input {
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: #c3dec9;
  outline: none;
  font: inherit;
}

.notes-content { display: flex; flex-direction: column; }

#notes-title {
  font-size: 19px;
  font-weight: 500;
  border-color: transparent;
  background: transparent;
  padding-left: 0;
}

#notes-text {
  flex: 1;
  background: transparent;
  border-color: transparent;
  padding-left: 0;
}

#notes-status { font-size: 10px; margin-bottom: 0; }

.setting {
  display: flex;
  justify-content: space-between;
  margin: 19px 0 12px;
  color: #d5d5db;
  font-size: 12px;
}

#dim-range {
  width: 100%;
  accent-color: #b7c8ed;
  margin-bottom: 20px;
}

.setting-divider { border-top: 1px solid #ffffff12; margin: 4px 0 22px; }

/* Dock */

.dock {
  position: fixed;
  z-index: 9999;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 5px;
  padding: 7px 8px;
  max-width: calc(100vw - 20px);
  background: rgba(28, 29, 34, .70);
  border: 1px solid #ffffff2b;
  border-radius: 19px;
  box-shadow: 0 12px 45px #0007, inset 0 1px #ffffff0a;
  backdrop-filter: blur(32px) saturate(160%);
  -webkit-backdrop-filter: blur(32px) saturate(160%);
}

.dock button {
  position: relative;
  flex: 0 0 60px;
  width: 60px;
  height: 60px;
  padding: 0;
  display: grid;
  place-items: center;
  overflow: visible;
  border: 0;
  border-radius: 13px;
  background: transparent;
  transition: transform .18s ease, background .18s ease;
}

.dock button:hover {
  transform: translateY(-7px) scale(1.08);
  background: #ffffff08;
}

.dock img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.dock button.running::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: calc(50% - 2px);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #e5e5ed;
}

@media (max-width: 550px) {
  .topbar { padding: 0 14px; }

  .window, .app-window {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 125px);
  }

  .content { padding: 18px; }
  .welcome { padding: 25px; }
  .content h1 { font-size: 33px; }

  .dock {
    bottom: 9px;
    gap: 2px;
    padding: 5px;
  }

  .dock button {
    flex-basis: 45px;
    width: 45px;
    height: 45px;
  }

  .system-status { display: none; }
  #terminal-form label { font-size: 10px; }
}

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