@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700&display=swap');

:root {
  --desktop-bg: radial-gradient(circle at 20% 20%, rgba(120, 157, 255, 0.35), transparent 55%),
                 radial-gradient(circle at 80% 0%, rgba(228, 132, 255, 0.35), transparent 60%),
                 linear-gradient(160deg, #0d1b3a, #060817 70%);
  --glass-bg: rgba(13, 23, 47, 0.72);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-highlight: rgba(255, 255, 255, 0.22);
  --text-primary: #f5f7ff;
  --text-secondary: rgba(234, 240, 255, 0.75);
  --accent: #7c8cff;
  --accent-strong: #93d3ff;
  --danger: #ff5f57;
  --warning: #febb2b;
  --success: #32d74b;
  --shadow: 0 24px 60px rgba(3, 12, 36, 0.55);
  --shadow-soft: 0 16px 40px rgba(3, 12, 36, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Manrope', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--desktop-bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
}

.desktop {
  position: relative;
  min-height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.ambient-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(100vh 100vh at 20% 80%, rgba(82, 138, 255, 0.2), transparent 60%),
              radial-gradient(100vh 100vh at 80% 30%, rgba(224, 91, 255, 0.16), transparent 65%);
  z-index: 0;
}

.window {
  position: absolute;
  width: clamp(280px, 24vw, 420px);
  max-width: 92vw;
  background: var(--glass-bg);
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px) saturate(160%);
  box-shadow: var(--shadow);
  color: var(--text-primary);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  z-index: 2;
}

.window:focus-within,
.window:hover {
  border-color: var(--glass-highlight);
  box-shadow: 0 20px 60px rgba(10, 40, 90, 0.65);
}

.window.dragging {
  cursor: grabbing;
  box-shadow: 0 36px 80px rgba(0, 0, 0, 0.55);
  transition: none;
}

.window-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.95rem 1.35rem 0.75rem;
  cursor: grab;
  user-select: none;
  background: linear-gradient(135deg, rgba(33, 57, 110, 0.85), rgba(30, 42, 84, 0.75));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.window.dragging .window-header {
  cursor: grabbing;
}

.window-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.control-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22);
}

.control-close { background: var(--danger); }
.control-minimize { background: var(--warning); }
.control-maximize { background: var(--success); }

.window-title {
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.window-content {
  position: relative;
  z-index: 1;
  padding: 1.6rem;
}

/* Clock */
.clock-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.clock-face {
  position: relative;
  width: clamp(150px, 16vw, 220px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.14), rgba(20, 32, 70, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 20px 35px rgba(0, 0, 0, 0.38), 0 12px 30px rgba(0, 0, 0, 0.25);
}

.clock-face::after {
  content: '';
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.08), rgba(2, 9, 25, 0.9));
  opacity: 0.55;
}

.tick-marks {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  pointer-events: none;
}

.tick-marks span {
  position: relative;
}

.tick-marks span::before {
  content: '';
  position: absolute;
  top: 6%;
  left: 50%;
  width: 4px;
  height: 12px;
  background: rgba(255, 255, 255, 0.25);
  transform: translateX(-50%);
  border-radius: 4px;
}

.hand {
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: 6px;
  border-radius: 999px;
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(0deg);
  backdrop-filter: brightness(1.2);
}

.hour-hand {
  height: 28%;
  background: linear-gradient(180deg, rgba(148, 182, 255, 0.85), rgba(34, 58, 120, 0.85));
}

.minute-hand {
  height: 38%;
  background: linear-gradient(180deg, rgba(199, 225, 255, 0.9), rgba(45, 72, 128, 0.9));
}

.second-hand {
  height: 44%;
  width: 3px;
  background: linear-gradient(180deg, rgba(255, 145, 179, 0.95), rgba(255, 74, 115, 0.95));
}

.clock-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(46, 65, 120, 0.8));
  border: 2px solid rgba(6, 20, 30, 0.8);
  transform: translate(-50%, -50%);
  z-index: 3;
}

.clock-digital {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

#clock-time {
  font-size: clamp(2.1rem, 3vw, 2.7rem);
  font-weight: 700;
  letter-spacing: 0.12em;
}

#clock-date {
  font-size: 0.95rem;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Calendar */
.calendar-app {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.calendar-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.calendar-controls button {
  appearance: none;
  border: none;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 14px;
  font-size: 1.2rem;
  color: var(--text-primary);
  background: rgba(124, 140, 255, 0.2);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.calendar-controls button:hover {
  transform: translateY(-2px);
  background: rgba(124, 140, 255, 0.35);
}

#calendar-label {
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(32px, 1fr));
  gap: 0.55rem;
}

.day-name {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-align: center;
}

.day-cell {
  min-height: 64px;
  border-radius: 16px;
  background: rgba(18, 34, 74, 0.65);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 0.6rem;
  font-weight: 600;
  color: rgba(241, 245, 255, 0.85);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: transform 0.2s ease, background 0.3s ease;
}

.day-cell.today {
  background: linear-gradient(160deg, rgba(124, 140, 255, 0.9), rgba(99, 211, 255, 0.75));
  color: #050a1a;
  box-shadow: 0 16px 32px rgba(69, 128, 255, 0.35);
}

.day-cell:not(.empty):hover {
  transform: translateY(-4px);
  background: linear-gradient(160deg, rgba(82, 108, 190, 0.8), rgba(43, 63, 132, 0.85));
}

.day-cell.empty {
  background: transparent;
  box-shadow: none;
}

/* Sticky Notes */
.notes-app {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.notes-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

#add-note {
  appearance: none;
  border: none;
  padding: 0.65rem 1.2rem;
  border-radius: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(135deg, rgba(255, 205, 112, 0.95), rgba(255, 149, 128, 0.95));
  color: #4a2700;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(255, 173, 70, 0.35);
  transition: transform 0.25s ease, box-shadow 0.3s ease;
}

#add-note:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 36px rgba(255, 173, 70, 0.45);
}

.autosave-indicator {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(241, 245, 255, 0.6);
}

.notes-canvas {
  position: relative;
  width: 100%;
  min-height: 320px;
  height: clamp(320px, 56vh, 680px);
  border-radius: 24px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: rgba(14, 24, 52, 0.55);
  box-shadow: inset 0 0 30px rgba(6, 14, 32, 0.45);
  overflow: hidden;
}

.note {
  position: absolute;
  width: clamp(160px, 32%, 200px);
  min-height: 160px;
  padding: 0.65rem;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(255, 252, 160, 0.95), rgba(255, 214, 112, 0.95));
  box-shadow: 0 14px 36px rgba(38, 28, 0, 0.25);
  color: #4a3b00;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transform: rotate(var(--rotate, 0deg));
  cursor: default;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.note.dragging {
  cursor: grabbing;
  box-shadow: 0 20px 46px rgba(38, 28, 0, 0.35);
}

.note-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.note-handle {
  font-size: 1rem;
  color: rgba(74, 59, 0, 0.8);
  cursor: grab;
  user-select: none;
}

.note.dragging .note-handle {
  cursor: grabbing;
}

.note-delete {
  appearance: none;
  border: none;
  background: rgba(0, 0, 0, 0.08);
  color: rgba(74, 59, 0, 0.7);
  font-size: 1.1rem;
  line-height: 1;
  border-radius: 10px;
  padding: 0.15rem 0.45rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.note-delete:hover {
  background: rgba(0, 0, 0, 0.15);
}

.note-body {
  flex: 1;
  outline: none;
  font-size: 0.95rem;
  line-height: 1.5;
  letter-spacing: 0.04em;
  cursor: text;
  white-space: pre-wrap;
}

@media (max-width: 960px) {
  .window {
    width: min(88vw, 420px);
  }

  .desktop {
    padding-bottom: 6rem;
  }
}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  .window {
    position: relative;
    margin: 2rem auto;
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
  }

  .notes-canvas {
    min-height: 340px;
    height: clamp(360px, 65vh, 720px);
  }
}
