* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: "Segoe UI", "Malgun Gothic", system-ui, sans-serif;
  background: #0b0e14;
  user-select: none;
  -webkit-user-select: none;
}

/* ── 로그인 (비밀번호 입력란만) ── */
#login {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(900px 600px at 50% 30%, #1a2438 0%, #0b0e14 70%);
  z-index: 100;
}
#pw {
  width: min(400px, 90vw);
  padding: 12px 16px;
  font-size: 1.05rem;
  text-align: center;
  color: #e8ecf4;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px;
  outline: none;
  backdrop-filter: blur(6px);
}
#pw:focus { border-color: rgba(255,255,255,.55); }
#pw.shake { animation: shake .35s; border-color: #f06a6a; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* ── 바탕화면 ── */
#desktop {
  position: fixed; inset: 0 0 44px 0;
  background:
    radial-gradient(1000px 700px at 70% 20%, rgba(255,255,255,.10), transparent 60%),
    linear-gradient(135deg, hsl(var(--hue,210), 55%, 22%), hsl(calc(var(--hue,210) + 45), 60%, 40%));
  overflow: hidden;
}
#desktop.dragover::after {
  content: "여기에 파일을 놓으면 업로드됩니다";
  position: absolute; inset: 12px;
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed rgba(255,255,255,.7);
  border-radius: 14px;
  background: rgba(0,0,0,.25);
  color: #fff; font-size: 1.1rem;
  pointer-events: none;
}

/* ── 아이콘/메모 공통 ── */
.item { position: absolute; touch-action: none; transition: left .16s linear, top .16s linear; }
.item.dragging { opacity: .75; transition: none; }

/* 파일 아이콘 */
.icon {
  width: 96px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 2px;
  border-radius: 6px;
  cursor: default;
}
.icon:hover { background: rgba(255,255,255,.12); }
.icon .glyph {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  font-size: 42px;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.45));
}
.icon .thumb {
  width: 56px; height: 56px;
  border-radius: 6px;
  background-size: cover; background-position: center;
  border: 1px solid rgba(255,255,255,.35);
  box-shadow: 0 2px 5px rgba(0,0,0,.4);
}
.icon .name {
  max-width: 94px;
  font-size: .74rem; line-height: 1.25;
  color: #fff; text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,.9);
  word-break: break-all;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 메모 (스티커) */
.memo {
  width: 190px; height: 150px;
  min-width: 130px; min-height: 90px;
  padding: 12px 12px 16px;
  background: linear-gradient(180deg, #fff7ae, #ffe98a);
  color: #4a3f10;
  border-radius: 3px;
  box-shadow: 0 6px 14px rgba(0,0,0,.35);
  font-size: .85rem; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
  overflow: auto;          /* 긴 메모는 스크롤 */
  resize: both;            /* 우하단 핸들로 크기 조절 */
  cursor: default;
}
.memo::before {
  content: "";
  position: absolute; top: -7px; left: 50%; transform: translateX(-50%) rotate(-2deg);
  width: 58px; height: 16px;
  background: rgba(255,255,255,.55);
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}

/* ── 작업표시줄 ── */
#taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: 44px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px;
  background: rgba(12, 16, 26, .82);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,255,255,.09);
  z-index: 50;
}
#startBtn {
  width: 38px; height: 34px;
  font-size: 1.1rem;
  color: #dfe7f5;
  background: transparent; border: 0; border-radius: 6px;
  cursor: pointer;
}
#startBtn:hover { background: rgba(255,255,255,.12); }
.tb-right { display: flex; align-items: center; gap: 10px; color: #dfe7f5; font-size: .82rem; }
#connDot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #57d98a;
  display: inline-block;
}
#connDot.off { background: #f06a6a; }
#clock { text-align: right; line-height: 1.2; white-space: pre-line; }

/* ── 우클릭 메뉴 ── */
.menu {
  position: fixed; z-index: 90;
  min-width: 168px;
  padding: 5px;
  background: rgba(28, 33, 46, .96);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(0,0,0,.5);
}
.menu button {
  display: block; width: 100%;
  padding: 8px 12px;
  font-size: .88rem; text-align: left;
  color: #e8ecf4;
  background: transparent; border: 0; border-radius: 5px;
  cursor: pointer;
}
.menu button:hover { background: rgba(255,255,255,.13); }
.menu hr { border: 0; border-top: 1px solid rgba(255,255,255,.1); margin: 4px 2px; }

/* ── 대화상자 ── */
.dlg-wrap {
  position: fixed; inset: 0; z-index: 95;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45);
}
.dlg {
  width: min(420px, 92vw);
  padding: 18px;
  background: #1c212e;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,.55);
}
.dlg-title { color: #e8ecf4; font-weight: 600; margin-bottom: 12px; }
.dlg textarea {
  width: 100%;
  padding: 10px;
  font: inherit; font-size: .92rem;
  color: #e8ecf4;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  resize: vertical;
  outline: none;
}
.dlg pre {
  max-height: 55vh; overflow: auto;
  padding: 10px;
  font: inherit; font-size: .92rem;
  color: #f4eecb;
  background: rgba(255,255,255,.06);
  border-radius: 8px;
  white-space: pre-wrap; word-break: break-word;
  user-select: text;
}
.dlg-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.btn {
  padding: 8px 16px;
  font-size: .88rem;
  color: #e8ecf4;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 7px;
  cursor: pointer;
}
.btn:hover { background: rgba(255,255,255,.18); }
.btn.primary { background: #2f6fdd; border-color: #2f6fdd; }
.btn.primary:hover { background: #3d7ceb; }

/* 업로드 진행 표시 */
#desktop .uploading {
  position: absolute;
  padding: 6px 10px;
  font-size: .78rem; color: #fff;
  background: rgba(0,0,0,.55);
  border-radius: 6px;
  pointer-events: none;
}
