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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", sans-serif;
  background: var(--bg-void);
  color: var(--text-hi);
}

#boot {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg-void);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 60px;
  gap: 14px;
  transition: opacity 0.3s ease;
}

#boot.hidden {
  opacity: 0;
  pointer-events: none;
}

.boot-id {
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--text-lo);
}

.boot-mark {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-hi);
}

.boot-rule {
  width: 240px;
  height: 1px;
  background: var(--line);
}

.boot-log {
  font-size: 13px;
  color: var(--accent);
  font-family: ui-monospace, monospace;
}

#desktop {
  position: relative;
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
}

#topbar {
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  z-index: 200;
}

.tb-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.tb-brand {
  font-weight: 700;
  color: var(--accent);
}

.tb-menu {
  display: flex;
  gap: 4px;
}

.tb-menu-item {
  position: relative;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-lo);
}

.tb-menu-item:hover {
  background: var(--bg-panel-2);
  color: var(--text-hi);
}

.tb-menu-item.open {
  background: var(--bg-panel-2);
  color: var(--text-hi);
}

.tb-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  background: var(--bg-panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  min-width: 160px;
  flex-direction: column;
  gap: 2px;
}

.tb-menu-item.open .tb-dropdown {
  display: flex;
}

.tb-dropdown button {
  background: none;
  border: none;
  text-align: left;
  padding: 7px 10px;
  border-radius: 5px;
  color: var(--text-hi);
  font-size: 13px;
  cursor: pointer;
}

.tb-dropdown button:hover {
  background: var(--bg-panel);
}

.tb-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.tb-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-lo);
}

.tb-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  display: inline-block;
}

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

#icons {
  position: absolute;
  top: 54px;
  left: 16px;
  display: grid;
  grid-template-columns: repeat(3, 86px);
  gap: 14px;
  z-index: 10;
}

.icon {
  width: 86px;
  min-height: 92px;
  padding: 8px 4px;
  border: 1px solid transparent;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.icon .glyph {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--accent);
}

.icon:hover .glyph {
  border-color: var(--accent);
}

.icon:hover {
  background: var(--bg-panel-2);
  border-color: var(--line);
}

.icon .label {
  font-size: 12px;
  color: var(--text-hi);
  text-align: center;
}

#windows-layer {
  position: absolute;
  inset: 0;
  top: 38px;
}

.win {
  position: absolute;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.win.focused {
  border-color: var(--accent);
}

.win-titlebar {
  height: 34px;
  flex-shrink: 0;
  background: var(--bg-panel-2);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  cursor: default;
}

.win-titlebar .title {
  font-size: 13px;
  color: var(--text-hi);
}

.win-controls {
  display: flex;
  gap: 6px;
}

.win-btn {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  color: var(--text-lo);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.win-btn:hover {
  color: var(--text-hi);
  border-color: var(--accent);
}

.win-btn.max::before {
  content: '\25a1';
  font-size: 14px;
  line-height: 1;
}

.win-btn.close::before {
  content: '\00d7';
  font-size: 17px;
  line-height: 1;
}

.win-btn.close:hover {
  color: #fff;
  background: #d0453f;
  border-color: #d0453f;
}

.win-body {
  flex: 1;
  overflow: auto;
  padding: 14px;
}

.win-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
}

#dock {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  z-index: 150;
}

.dock-empty {
  font-size: 12px;
  color: var(--text-lo);
}

.dock-item {
  font-size: 12px;
  color: var(--text-lo);
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
  background: var(--bg-panel-2);
}

.dock-item.active {
  color: var(--text-hi);
  border: 1px solid var(--accent);
}

.app-notes {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-notes textarea {
  flex: 1;
  resize: none;
  background: var(--bg-void);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-hi);
  padding: 10px;
  font-size: 13px;
  font-family: inherit;
}

.notes-bar {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-lo);
}

.app-calc {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
}

.calc-sub {
  text-align: right;
  font-size: 12px;
  color: var(--text-lo);
  min-height: 14px;
}

.calc-display {
  text-align: right;
  font-size: 32px;
  color: var(--text-hi);
  padding: 4px 0 10px;
  border-bottom: 1px solid var(--line);
}

.calc-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.calc-btn {
  background: var(--bg-panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-hi);
  font-size: 16px;
  cursor: pointer;
}

.calc-btn:hover {
  border-color: var(--accent);
}

.calc-btn.op {
  color: var(--accent);
}

.calc-btn.eq {
  background: var(--accent);
  color: var(--bg-void);
  border-color: var(--accent);
}

.calc-btn.zero {
  grid-column: span 2;
}

.app-prefs .prefs-label {
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-lo);
  margin-bottom: 10px;
}

.prefs-swatches {
  display: flex;
  gap: 10px;
}

.swatch {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-hi);
  text-align: center;
}

.swatch.active {
  border-color: var(--accent);
}

.swatch-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}

.swatch-dots .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.app-about h2 {
  color: var(--accent);
  margin-bottom: 10px;
}

.app-about p {
  font-size: 13px;
  color: var(--text-lo);
  line-height: 1.6;
}

.app-about b {
  color: var(--text-hi);
}