:root {
  --bg: #dfeaf6;
  --glass: rgba(248, 252, 255, 0.68);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --line: rgba(116, 145, 176, 0.26);
  --text: #566579;
  --muted: #8a9ab0;
  --blue: #99bfe7;
  --blue-deep: #6e9dcc;
  --cream: #fffaf1;
  --shadow: 0 24px 80px rgba(82, 118, 158, 0.22);
  --radius-window: 18px;
  --serif: "Cormorant Garamond", serif;
  --sans: "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; }
body {
  overflow: hidden;
  color: var(--text);
  font-family: var(--sans);
  background: var(--bg);
  word-break: keep-all;
  overflow-wrap: break-word;
}
button, textarea { font: inherit; color: inherit; }
button { border: 0; background: transparent; cursor: pointer; }

.desktop-shell {
  position: relative;
  width: 100vw;
  height: 100svh;
  overflow: hidden;
  background: #dbe8f6;
}

.background {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(223, 235, 248, .22), rgba(255,255,255,.12)),
    url("assets/desktop-wallpaper.png") center / cover no-repeat;
  transform: scale(1.015);
  filter: saturate(.94) brightness(1.02);
}

.background::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 58% 18%, rgba(255,255,255,.75), transparent 18%),
    linear-gradient(180deg, rgba(241,247,255,.16), rgba(185,209,236,.24));
  pointer-events: none;
}

.sparkle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: screen;
}

.menu-bar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 500;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(245, 249, 255, .72);
  border-bottom: 1px solid rgba(255,255,255,.48);
  backdrop-filter: blur(18px);
  box-shadow: 0 10px 34px rgba(101, 132, 162, .08);
  font-size: 13px;
}
.menu-left, .menu-right { display: flex; align-items: center; gap: 22px; }
.menu-left strong { font-weight: 600; color: #46556a; letter-spacing: .02em; }
.apple-mark { font-size: 16px; color: #3c4a5f; }
.menu-bar button { padding: 6px 0; }
.menu-popover {
  position: fixed;
  top: 34px;
  left: 170px;
  min-width: 170px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.84);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
.menu-popover button {
  display: block;
  width: 100%;
  padding: 9px 12px;
  text-align: left;
  border-radius: 10px;
}
.menu-popover button:hover { background: rgba(153, 191, 231, .18); }

.desktop { position: relative; z-index: 2; width: 100%; height: 100%; padding-top: 38px; }
.desktop-icons { position: absolute; inset: 38px auto auto 0; z-index: 40; }
.desktop-icon {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 74px;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-radius: 12px;
  user-select: none;
  cursor: pointer;
  transition: transform 0.1s;
  touch-action: none;
}
.desktop-icon:active {
  transform: scale(0.96);
}
.desktop-icon.selected { background: rgba(255,255,255,.45); outline: 2px solid rgba(255,255,255,.8); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.desktop-icon img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 11px;
  border: 2px solid rgba(255,255,255,.74);
  box-shadow: 0 10px 22px rgba(91, 119, 149, .16);
}
.desktop-icon span:last-child {
  font-size: 12px;
  color: #526276;
  text-shadow: 0 1px 8px rgba(255,255,255,.9);
}
.folder-shape {
  display: block;
  width: 64px;
  height: 45px;
  border-radius: 6px;
  background: linear-gradient(#cfe4fb 0 24%, #e6f2ff 24%);
  border: 1px solid rgba(104, 142, 181, .26);
  box-shadow: 0 14px 26px rgba(98, 130, 164, .14);
}
.folder.cream .folder-shape { background: linear-gradient(#fff6df 0 24%, #fffdf7 24%); }
.file-shape {
  display: grid;
  place-items: end center;
  width: 48px;
  height: 58px;
  padding-bottom: 8px;
  border-radius: 4px;
  background: linear-gradient(135deg, transparent 0 16%, rgba(188,207,228,.45) 16% 24%, #f8fbff 24%);
  border: 1px solid rgba(124,150,177,.25);
  font-size: 10px !important;
}

.widget, .window {
  border: 1px solid rgba(255,255,255,.64);
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(1.12);
  box-shadow: var(--shadow);
}

.widgets {
  position: absolute;
  z-index: 20;
  right: 40px;
  top: 98px;
  width: 285px;
  display: grid;
  gap: 26px;
}
.widget { border-radius: 18px; cursor: grab; touch-action: none; }
.widget:active { cursor: grabbing; }
.sticky-note {
  position: absolute;
  right: 300px;
  top: 14px;
  width: 214px;
  min-height: 178px;
  padding: 24px;
  transform: rotate(.5deg);
}
.sticky-note h2, .widget h2 {
  margin: 0 0 18px;
  color: var(--blue-deep);
  font-family: var(--serif);
  font-size: 18px;
  font-style: italic;
  font-weight: 500;
}
.paperclip {
  position: absolute;
  right: 16px;
  top: -14px;
  font-size: 45px;
  color: #85acd5;
  transform: rotate(28deg);
}
.sticky-note textarea {
  width: 100%;
  min-height: 76px;
  padding: 0;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: #637085;
  line-height: 1.8;
}
.sticky-note small { color: var(--muted); font-size: 10px; }

.calendar { padding: 22px 24px; }
.widget-head { display: flex; align-items: center; justify-content: space-between; }
.widget-head h2 { margin: 0; color: #65758a; font-family: var(--sans); font-size: 15px; font-style: normal; font-weight: 400; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px 8px;
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
}
.calendar-grid b { color: #7e8fa4; font-weight: 500; }
.calendar-grid button { height: 24px; border-radius: 999px; font-size: 12px; }
.calendar-grid .today { color: white; background: var(--blue); }
.calendar-grid .selected { outline: 1px solid var(--blue-deep); }

.player { display: grid; grid-template-columns: 84px 1fr; gap: 16px; padding: 18px; }
.player img, .weather img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; }
.player strong { display: block; margin: 4px 0; color: #6e84a0; font-family: var(--serif); font-size: 17px; }
.player span { color: var(--muted); font-size: 12px; }
.progress { height: 4px; margin: 14px 0; border-radius: 99px; background: rgba(123,154,188,.18); overflow: hidden; }
.progress i { display: block; width: 42%; height: 100%; background: var(--blue); border-radius: inherit; }
.player-controls { display: flex; align-items: center; justify-content: center; gap: 16px; }
.play {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: white;
  background: #8799ad;
}

.weather { position: relative; display: grid; grid-template-columns: 82px 1fr; gap: 16px; padding: 18px; color: white; background: rgba(145, 185, 224, .46); }
.weather strong { display: block; font-size: 46px; font-weight: 300; line-height: 1; }
.weather p, .weather small { margin: 0; color: rgba(255,255,255,.88); }
.working { position: relative; padding: 24px; }
.working p { margin: 0 0 20px; }
.work-row { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--blue-deep); }
.work-row div { flex: 1; height: 4px; border-radius: 99px; background: rgba(123,154,188,.15); }
.work-row i { display: block; width: 63%; height: 100%; border-radius: inherit; background: var(--blue); }
.flower { position: absolute; right: 26px; bottom: 22px; color: #91b7e0; font-size: 46px; opacity: .8; }

.quote-card {
  position: absolute;
  left: 32px;
  bottom: 110px;
  z-index: 18;
  width: 190px;
  padding: 26px 22px;
  border-radius: 16px;
  cursor: grab;
  touch-action: none;
}
.quote-card:active {
  cursor: grabbing;
}
.quote-card::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 72px;
  width: 48px;
  height: 20px;
  background: rgba(139, 188, 234, .55);
  transform: rotate(-6deg);
}
.quote-card p { margin: 0 0 18px; font-family: var(--serif); font-style: italic; font-size: 17px; line-height: 1.55; color: #5f82a8; }
.quote-card span { font-size: 11px; color: #7590ab; }

.window-manager { position: absolute; inset: 38px 0 0; z-index: 100; pointer-events: none; }
.window {
  position: absolute;
  min-width: 300px;
  min-height: 220px;
  border-radius: var(--radius-window);
  overflow: hidden;
  pointer-events: auto;
  resize: both;
}
.window.maximized {
  left: 16px !important;
  top: 52px !important;
  width: calc(100vw - 32px) !important;
  height: calc(100svh - 132px) !important;
}
.titlebar {
  height: 42px;
  display: grid;
  grid-template-columns: 92px 1fr 92px;
  align-items: center;
  border-bottom: 1px solid rgba(124, 150, 177, .16);
  background: rgba(245, 250, 255, .42);
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.titlebar:active {
  cursor: grabbing;
}
.traffic { display: flex; gap: 8px; padding-left: 22px; align-items: center; }
.traffic button {
  position: relative;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffaaab !important; /* Pastel Red */
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.15s;
}
.traffic button:nth-child(2) { background: #ffe4a0 !important; /* Pastel Yellow */ }
.traffic button:nth-child(3) { background: #bdf2c5 !important; /* Pastel Green */ }
.traffic button:hover {
  filter: brightness(0.9);
}
.traffic button[data-close]::before { content: "×"; font-size: 10px; color: rgba(0,0,0,0.4); line-height: 1; display: none; }
.traffic button[data-minimize]::before { content: "−"; font-size: 10px; color: rgba(0,0,0,0.4); line-height: 1; display: none; }
.traffic button[data-maximize]::before { content: "+"; font-size: 8px; color: rgba(0,0,0,0.4); line-height: 1; display: none; }
.traffic:hover button::before {
  display: block;
}
.titlebar h2 { margin: 0; text-align: center; color: #6d8db1; font-size: 13px; font-weight: 400; }
.window-actions { display: flex; justify-content: flex-end; gap: 10px; padding-right: 18px; color: #6d8db1; }
.window-actions button { cursor: pointer; transition: opacity 0.15s; }
.window-actions button:hover { opacity: 0.7; }
.window-content { height: calc(100% - 42px); overflow: auto; padding: 24px; }
.resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: se-resize;
  z-index: 10;
  background: linear-gradient(135deg, transparent 65%, rgba(109, 141, 177, 0.3) 65%);
  border-bottom-right-radius: var(--radius-window);
  touch-action: none;
}

.about-layout { display: grid; grid-template-columns: 1.1fr 180px; gap: 28px; align-items: center; }
.kicker { color: var(--blue-deep); text-transform: uppercase; letter-spacing: .12em; font-size: 11px; }
.about-layout h1, .detail-view h1 {
  margin: 34px 0 20px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(44px, 5vw, 68px);
  line-height: .98;
  color: #687285;
}
.about-layout p, .detail-view p { line-height: 1.75; color: #6f7c8f; }
.oval-img {
  width: 170px;
  height: 235px;
  object-fit: cover;
  border-radius: 50% / 35%;
  box-shadow: inset 0 0 0 1px white, 0 18px 40px rgba(79, 111, 143, .18);
}
.dots { display: flex; gap: 10px; margin-top: 24px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: #c6d8ed; }
.dots i:nth-child(2) { background: #8fb8df; }

.works-tabs { display: flex; gap: 18px; margin-bottom: 18px; }
.works-tabs button { min-width: 70px; padding: 9px 16px; border-radius: 999px; color: #7d8ea3; }
.works-tabs button.active { background: rgba(147, 184, 224, .3); color: #557da5; }
.work-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 18px;
}
.work-card { text-align: left; }
.work-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; display: block; }
.work-card strong { display: block; margin-top: 10px; color: #617287; font-weight: 500; }
.work-card span { color: #8e9bad; font-size: 12px; }

.diary textarea, .text-editor textarea {
  width: 100%;
  min-height: 280px;
  padding: 18px;
  border: 1px solid rgba(124,150,177,.18);
  border-radius: 14px;
  outline: 0;
  resize: vertical;
  background: rgba(255,255,255,.38);
  line-height: 1.8;
}
.diary-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 14px; }
.save-button { padding: 10px 16px; border-radius: 999px; color: white; background: var(--blue-deep); }
.image-viewer img { width: 100%; max-height: 440px; object-fit: contain; border-radius: 14px; background: rgba(255,255,255,.35); }
.viewer-tools { display: flex; gap: 10px; margin-top: 14px; }
.viewer-tools button { padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,.45); }
.detail-view img { width: 100%; max-height: 300px; object-fit: cover; border-radius: 16px; margin-bottom: 18px; }

.dock {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 520;
  transform: translateX(-50%);
  display: flex;
  align-items: end;
  gap: 20px;
  padding: 12px 22px;
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 22px;
  background: rgba(245,250,255,.48);
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 54px rgba(79, 111, 143, .18);
}
.dock button {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255,255,255,.54);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
  transition: transform .18s ease;
}
.dock button:hover { transform: translateY(-8px) scale(1.18); }
.dock img { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }
.dock button.running::after {
  content: "";
  position: absolute;
  bottom: -7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #78a9d7;
}

.mobile-launcher { display: none; }

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

@media (max-width: 760px) {
  body { overflow: auto; }
  .desktop-shell { min-height: 100svh; height: auto; overflow: hidden; padding-bottom: 88px; }
  .menu-bar { height: 44px; padding: 0 14px; }
  .menu-left button, .menu-right span:nth-child(-n+2) { display: none; }
  .desktop { min-height: 100svh; padding-top: 54px; }
  .desktop-icons, .quote-card { display: none; }
  .widgets {
    position: relative;
    right: auto;
    top: auto;
    width: auto;
    padding: 16px;
    grid-template-columns: 1fr;
  }
  .sticky-note { position: relative; right: auto; top: auto; width: auto; transform: none; }
  .mobile-launcher {
    position: relative;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 16px;
  }
  .mobile-launcher button {
    padding: 16px 10px;
    border-radius: 18px;
    background: rgba(255,255,255,.55);
    backdrop-filter: blur(18px);
  }
  .window-manager { position: fixed; inset: 44px 0 74px; }
  .window {
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: calc(100svh - 118px) !important;
    resize: none;
    border-radius: 18px 18px 0 0;
  }
  .window.minimized { display: none; }
  .about-layout, .work-grid { grid-template-columns: 1fr; }
  .dock { bottom: 10px; gap: 10px; padding: 10px 14px; max-width: calc(100vw - 22px); }
  .dock button { width: 38px; height: 38px; }
}
