/* macOS-Desktop auf Windows-XP-Bliss-Hintergrund */
:root {
  --menu-h: 28px;
  --folder-icon-size: 96px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bliss: url("./bliss.jpg");
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body.mac-desktop {
  background: var(--bliss) center center / cover no-repeat fixed;
  color: #fff;
}

a {
  color: inherit;
  text-decoration: none;
}

.menu-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--menu-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  color: #1d1d1f;
  font-size: 13px;
  font-weight: 500;
  user-select: none;
}

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

.menu-brand {
  font-weight: 700;
}

.menu-item,
.menu-brand {
  opacity: 0.85;
}

.menu-trigger,
.menu-direct {
  border: none;
  background: transparent;
  padding: 2px 6px;
  margin: 0;
  font: inherit;
  color: inherit;
  border-radius: 4px;
  cursor: default;
}

.menu-trigger:hover,
.menu-trigger.is-open,
.menu-direct:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.08);
}

.menu-trigger:active,
.menu-direct:active {
  background: rgba(0, 0, 0, 0.14);
}

.menu-dropdown {
  position: fixed;
  z-index: 300;
  min-width: 220px;
  padding: 5px 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.6) inset,
    0 8px 28px rgba(0, 0, 0, 0.22);
  color: #1d1d1f;
  font-size: 13px;
  font-weight: 400;
  user-select: none;
}

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

.menu-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  padding: 4px 18px 4px 22px;
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: default;
  white-space: nowrap;
}

.menu-dropdown-item:hover:not(:disabled),
.menu-dropdown-item:focus-visible {
  background: #2684ff;
  color: #fff;
  outline: none;
}

.menu-dropdown-item:disabled {
  color: #aeaeb2;
  cursor: default;
}

.menu-dropdown-shortcut {
  font-size: 12px;
  opacity: 0.72;
  font-variant-numeric: tabular-nums;
}

.menu-dropdown-item:hover:not(:disabled) .menu-dropdown-shortcut {
  color: rgba(255, 255, 255, 0.85);
}

.menu-dropdown-separator {
  height: 1px;
  margin: 5px 0;
  background: rgba(0, 0, 0, 0.1);
}

.menu-date,
.menu-lang {
  border: none;
  background: transparent;
  padding: 2px 6px;
  margin: 0;
  font: inherit;
  color: inherit;
  border-radius: 4px;
  cursor: default;
  opacity: 0.85;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 28px;
}

.menu-date:hover,
.menu-date.is-open,
.menu-lang:hover,
.menu-lang.is-open {
  opacity: 1;
  background: rgba(0, 0, 0, 0.08);
}

.menu-date:active,
.menu-lang:active {
  background: rgba(0, 0, 0, 0.14);
}

.menu-clock {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 52px;
  text-align: right;
}

.menu-calendar {
  position: fixed;
  z-index: 310;
  width: 280px;
  padding: 12px 14px 14px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(22px) saturate(1.35);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.65) inset,
    0 12px 36px rgba(0, 0, 0, 0.24);
  color: #1d1d1f;
  font-size: 13px;
  user-select: none;
}

.menu-calendar.hidden,
.menu-lang-popout.hidden {
  display: none;
}

.menu-lang-popout {
  position: fixed;
  z-index: 310;
  width: 200px;
  padding: 10px 0 8px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(22px) saturate(1.35);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.65) inset,
    0 12px 36px rgba(0, 0, 0, 0.24);
  color: #1d1d1f;
  font-size: 13px;
  user-select: none;
}

.menu-lang-popout-title {
  padding: 0 14px 8px;
  font-weight: 700;
  font-size: 12px;
  color: #6e6e73;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.menu-lang-popout-list {
  display: flex;
  flex-direction: column;
}

.menu-lang-popout-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 5px 14px;
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: default;
}

.menu-lang-popout-item:hover,
.menu-lang-popout-item:focus-visible {
  background: #2684ff;
  color: #fff;
  outline: none;
}

.menu-lang-popout-item.is-active {
  font-weight: 600;
}

.menu-lang-popout-check {
  font-size: 12px;
  opacity: 0.9;
}

.menu-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}

.menu-calendar-title {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
}

.menu-calendar-nav {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.06);
  color: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: default;
  padding: 0;
}

.menu-calendar-nav:hover {
  background: rgba(0, 0, 0, 0.1);
}

.menu-calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #6e6e73;
  text-align: center;
}

.menu-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.menu-calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: inherit;
  cursor: default;
  padding: 0;
}

.menu-calendar-day:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.08);
}

.menu-calendar-day.is-other {
  color: #aeaeb2;
}

.menu-calendar-day.is-today {
  background: #2684ff;
  color: #fff;
  font-weight: 700;
}

.menu-calendar-day.is-today:hover {
  background: #1a73e8;
}

.menu-calendar-day.is-selected:not(.is-today) {
  background: rgba(38, 132, 255, 0.18);
  font-weight: 600;
}

.menu-calendar-day:disabled {
  cursor: default;
  visibility: hidden;
}

.desktop {
  position: fixed;
  top: var(--menu-h);
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  touch-action: none;
}

.desktop-icon {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 130px;
  padding: 12px 10px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  text-align: center;
  cursor: default;
  user-select: none;
  touch-action: none;
  z-index: 1;
}

.desktop-icon:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.28);
}

.desktop-icon.selected {
  background: rgba(56, 120, 220, 0.42);
  border-color: rgba(255, 255, 255, 0.45);
}

.desktop-icon.dragging {
  z-index: 50;
  opacity: 0.92;
  cursor: grabbing;
  background: rgba(255, 255, 255, 0.22);
}

.desktop-icon .folder {
  width: var(--folder-icon-size);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  margin-bottom: 10px;
  display: block;
  pointer-events: none;
}

.icon-label {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  max-width: 120px;
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.9),
    0 0 10px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

/* Haftnotizen */
.sticky-note {
  position: absolute;
  width: 220px;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  border-radius: 4px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 10px 24px rgba(0, 0, 0, 0.28);
  font-family: "Marker Felt", "Chalkboard SE", "Comic Sans MS", cursive, var(--font);
  color: #2a2418;
  z-index: 5;
}

.sticky-note[data-color="yellow"] {
  background: linear-gradient(180deg, #fffce8 0%, #fff3a6 100%);
  border: 1px solid #e0cf6a;
}

.sticky-note[data-color="pink"] {
  background: linear-gradient(180deg, #fff0f7 0%, #ffcce6 100%);
  border: 1px solid #e8a8c8;
}

.sticky-note[data-color="green"] {
  background: linear-gradient(180deg, #f2ffe8 0%, #d4f4b8 100%);
  border: 1px solid #a8d48a;
}

.sticky-note[data-color="blue"] {
  background: linear-gradient(180deg, #eef7ff 0%, #c8e6ff 100%);
  border: 1px solid #8ec0e8;
}

.sticky-note[data-color="purple"] {
  background: linear-gradient(180deg, #f7f0ff 0%, #e4ccff 100%);
  border: 1px solid #c4a0e8;
}

.sticky-note-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
  padding: 6px 8px 4px;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.sticky-note-bar.is-dragging {
  cursor: grabbing;
}

.sticky-note-colors {
  display: flex;
  align-items: center;
  gap: 5px;
}

.sticky-note-color {
  width: 14px;
  height: 14px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.18);
  cursor: pointer;
  flex-shrink: 0;
}

.sticky-note-color[data-color="yellow"] {
  background: #fff3a6;
}

.sticky-note-color[data-color="pink"] {
  background: #ffcce6;
}

.sticky-note-color[data-color="green"] {
  background: #d4f4b8;
}

.sticky-note-color[data-color="blue"] {
  background: #c8e6ff;
}

.sticky-note-color[data-color="purple"] {
  background: #e4ccff;
}

.sticky-note-color.is-active {
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
}

.sticky-note-close {
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.55);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.sticky-note-close:hover {
  background: rgba(0, 0, 0, 0.12);
  color: rgba(0, 0, 0, 0.8);
}

.sticky-note-body {
  flex: 1;
  min-height: 120px;
  padding: 2px 12px 12px;
  outline: none;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
}

.sticky-note-body.is-empty::before {
  content: attr(data-placeholder);
  color: rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

/* TextEdit-ähnliches Fenster */
.mac-window {
  position: fixed;
  z-index: 200;
  left: 50%;
  top: calc(var(--menu-h) + 48px);
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 32px));
  height: min(420px, calc(100vh - var(--menu-h) - 56px));
  min-width: 300px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.28),
    0 22px 50px rgba(0, 0, 0, 0.45);
  font-family: var(--font);
  color: #1d1d1f;
}

.mac-window.is-positioned {
  transform: none;
}

.mac-window.is-maximized {
  left: 6px !important;
  top: var(--menu-h) !important;
  width: calc(100vw - 12px) !important;
  height: calc(100vh - var(--menu-h) - 6px) !important;
  transform: none !important;
  border-radius: 8px;
}

.mac-window.is-minimized {
  top: auto !important;
  bottom: 10px;
  left: 50% !important;
  width: 300px !important;
  height: auto !important;
  min-height: 0;
  transform: translateX(-50%) !important;
}

.mac-window.is-minimized .mac-window-toolbar,
.mac-window.is-minimized .mac-window-body,
.mac-window.is-minimized .mac-window-resize {
  display: none;
}

.mac-window.hidden {
  display: none;
}

.mac-window-titlebar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 12px;
  background: linear-gradient(180deg, #ececef 0%, #d8d8dc 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  cursor: grab;
  user-select: none;
}

.mac-window-titlebar.dragging {
  cursor: grabbing;
}

.traffic-lights {
  display: flex;
  align-items: center;
  gap: 7px;
}

.traffic-light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

.traffic-light.close {
  background: #ff5f57;
  border-color: #e14640;
  cursor: pointer;
  padding: 0;
}

.traffic-light.close:hover {
  filter: brightness(0.95);
}

.traffic-light.minimize {
  background: #febc2e;
  border-color: #dfa023;
  cursor: pointer;
  padding: 0;
}

.traffic-light.minimize:hover,
.traffic-light.zoom:hover {
  filter: brightness(0.95);
}

.traffic-light.zoom {
  background: #28c840;
  border-color: #1aab2f;
  cursor: pointer;
  padding: 0;
}

.mac-window-title {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #3a3a3c;
  margin-right: 52px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mac-window-toolbar {
  padding: 6px 10px;
  background: #f5f5f7;
  border-bottom: 1px solid #e5e5ea;
  font-size: 11px;
  color: #6e6e73;
}

.toolbar-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: #fff;
  border: 1px solid #d1d1d6;
}

.mac-window-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: #fff;
}

.mac-window-resize {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.mac-window.is-maximized .mac-window-resize,
.mac-window.is-minimized .mac-window-resize {
  display: none;
}

.resize-handle {
  position: absolute;
  pointer-events: auto;
}

.resize-handle[data-resize="n"] {
  top: 0;
  left: 10px;
  right: 10px;
  height: 6px;
  cursor: ns-resize;
}

.resize-handle[data-resize="s"] {
  bottom: 0;
  left: 10px;
  right: 10px;
  height: 6px;
  cursor: ns-resize;
}

.resize-handle[data-resize="e"] {
  top: 10px;
  right: 0;
  bottom: 10px;
  width: 6px;
  cursor: ew-resize;
}

.resize-handle[data-resize="w"] {
  top: 10px;
  left: 0;
  bottom: 10px;
  width: 6px;
  cursor: ew-resize;
}

.resize-handle[data-resize="ne"] {
  top: 0;
  right: 0;
  width: 14px;
  height: 14px;
  cursor: nesw-resize;
}

.resize-handle[data-resize="nw"] {
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
}

.resize-handle[data-resize="se"] {
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
}

.resize-handle[data-resize="sw"] {
  left: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  cursor: nesw-resize;
}

.mac-text-content {
  margin: 0;
  padding: 14px 16px 18px;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: #1d1d1f;
  user-select: text;
}

.menu-mobile {
  display: none;
}

@media (max-width: 768px) {
  :root {
    --menu-h: 44px;
    --folder-icon-size: 80px;
  }

  body.mac-desktop {
    background-attachment: scroll;
  }

  .menu-bar {
    padding: 0 max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
    padding-top: env(safe-area-inset-top);
    height: calc(var(--menu-h) + env(safe-area-inset-top));
  }

  .menu-left,
  .menu-right {
    gap: 8px;
  }

  .menu-left {
    flex: 1;
    min-width: 0;
  }

  .menu-brand {
    max-width: min(42vw, 160px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .menu-desktop-only {
    display: none !important;
  }

  .menu-mobile {
    display: inline-flex;
    margin-left: auto;
    width: 40px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
    cursor: pointer;
  }

  .menu-mobile span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 1px;
    background: #1d1d1f;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  .menu-mobile.is-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .menu-mobile.is-open span:nth-child(2) {
    opacity: 0;
  }

  .menu-mobile.is-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .menu-date {
    display: none;
  }

  .menu-clock {
    min-width: 44px;
    font-size: 12px;
  }

  .menu-trigger,
  .menu-direct,
  .menu-date,
  .menu-lang {
    padding: 6px 8px;
    min-height: 36px;
  }

  .menu-dropdown {
    left: 10px !important;
    right: 10px;
    width: auto;
    min-width: 0;
    max-width: none;
  }

  .menu-dropdown-item {
    padding: 10px 16px;
    white-space: normal;
  }

  .menu-calendar,
  .menu-lang-popout {
    left: 10px !important;
    right: 10px !important;
    width: auto;
    max-width: none;
  }

  .desktop {
    top: calc(var(--menu-h) + env(safe-area-inset-top));
    padding: 20px 12px;
    padding-bottom: env(safe-area-inset-bottom);
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    justify-content: center;
    gap: 16px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .desktop-icon {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: 110px;
    padding: 10px 8px;
    touch-action: manipulation;
  }

  .desktop-icon .folder {
    width: var(--folder-icon-size);
    height: auto;
  }

  .icon-label {
    font-size: 14px;
    max-width: 100px;
  }

  .mac-window {
    left: 8px !important;
    top: calc(var(--menu-h) + env(safe-area-inset-top) + 8px) !important;
    width: calc(100vw - 16px) !important;
    height: calc(100dvh - var(--menu-h) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px) !important;
    min-width: 0;
    transform: none !important;
    border-radius: 12px;
  }

  .mac-window.is-positioned {
    transform: none !important;
  }

  .mac-window.is-maximized {
    left: 0 !important;
    top: calc(var(--menu-h) + env(safe-area-inset-top)) !important;
    width: 100vw !important;
    height: calc(100dvh - var(--menu-h) - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    border-radius: 0;
  }

  .mac-window.is-minimized {
    bottom: max(10px, env(safe-area-inset-bottom));
    width: min(300px, calc(100vw - 24px)) !important;
  }

  .mac-text-content {
    font-size: 13px;
    padding: 12px 14px 16px;
  }

  .resize-handle {
    display: none;
  }

  .sticky-note {
    width: min(220px, calc(100% - 32px));
    min-height: 140px;
    position: relative;
    left: auto !important;
    top: auto !important;
    flex-shrink: 0;
  }

  .sticky-note-body {
    min-height: 100px;
    font-size: 14px;
  }
}
