/* =====================================================================
   mac 셸. html[data-shell="mac"] 일 때만 적용되는 덮어쓰기.
   Windows 셸의 기본 CSS 는 그대로 두고 여기서 모습만 바꾼다.
   ===================================================================== */

/*
 * 치수는 macOS(Sonoma, 노치 없는 화면) 기준:
 *   메뉴 막대 24px · 제목 표시줄 28px · 신호등 12px, 간격 8px, 왼쪽 13px · 창 모서리 10px
 *   독 64px(아이콘 48px, 모서리 16px) · 알림 344px(모서리 12px) · 본문 글자 13px
 *   Finder 사이드바 180px, 목록 행 22px, 머리글 11px · 로그인 암호 칸 196x24px
 */
html[data-shell="mac"] {
  --menubar-h: 24px;
  --taskbar-h: 76px;   /* 독(64px) + 아래 여백(6px) + 숨 쉴 틈 */
  --mac-accent: #007aff;
  --mac-font: -apple-system, "SF Pro Text", "Helvetica Neue", "Apple SD Gothic Neo", "Segoe UI", "Malgun Gothic", sans-serif;
}

html[data-shell="mac"] body {
  font-family: var(--mac-font);
}

/* ===== 바탕화면 ===== */
html[data-shell="mac"] .desktop {
  top: var(--menubar-h);
  bottom: 0; /* 독은 바탕화면 위에 떠 있다 */
  background:
    radial-gradient(ellipse at 15% 20%, rgba(255, 255, 255, 0.18), transparent 50%),
    radial-gradient(ellipse at 85% 80%, rgba(255, 170, 120, 0.25), transparent 55%),
    linear-gradient(160deg, #3b3f8f 0%, #6a4fb3 45%, #b85f9f 80%, #e08a6a 100%);
}

/* 아이콘은 오른쪽 위부터 세로로 */
html[data-shell="mac"] .desktop-icons {
  top: 10px;
  left: auto;
  right: 10px;
  bottom: calc(var(--taskbar-h) + 4px);
  /* 첫 번째 열이 오른쪽 끝에 오게 */
  flex-wrap: wrap-reverse;
  align-content: flex-start;
  gap: 8px 4px;
}

html[data-shell="mac"] .desktop-icon {
  width: 96px;
  padding: 6px 4px 5px;
  gap: 5px;
  border-radius: 6px;
}

html[data-shell="mac"] .desktop-icon.is-selected {
  background: rgba(0, 0, 0, 0.28);
  border-color: rgba(255, 255, 255, 0.2);
}

html[data-shell="mac"] .desktop-icon-image {
  width: 64px;
  height: 64px;
}

html[data-shell="mac"] .desktop-icon-label {
  font-size: 13px;
  line-height: 1.2;
  max-width: 92px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* 할 일 위젯은 왼쪽 위로 (오른쪽은 아이콘 자리) */
html[data-shell="mac"] .todo-widget {
  right: auto;
  left: 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.35);
}

/* ===== 창 층 ===== */
html[data-shell="mac"] .window-layer {
  top: var(--menubar-h);
}

/* ===== 메뉴 막대 ===== */
.menubar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--menubar-h, 24px);
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 12px 0 8px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: #111;
  font-size: 13px;
  user-select: none;
  z-index: 10000;
}

.mb-logo {
  width: 28px;
  height: 20px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.mb-logo svg {
  width: 15px;
  height: 15px;
}

.mb-logo:hover,
.mb-logo.is-open {
  background: rgba(0, 0, 0, 0.1);
}

.mb-app {
  font-weight: 700;
  padding: 0 10px 0 8px;
}

.mb-menu {
  padding: 1px 10px;
  border-radius: 4px;
}

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

.mb-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mb-clock {
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.mb-clock:hover {
  background: rgba(0, 0, 0, 0.1);
}

@media (max-width: 720px) {
  .mb-menu { display: none; }
}

/* ===== 독 (작업 표시줄 재활용) ===== */
html[data-shell="mac"] .taskbar {
  left: 50%;
  right: auto;
  bottom: 6px;
  transform: translateX(-50%);
  height: 64px;
  max-width: calc(100vw - 24px);
  padding: 0 6px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  align-items: center;
}

html[data-shell="mac"] .tb-start,
html[data-shell="mac"] .tb-tray {
  display: none;
}

html[data-shell="mac"] .tb-pinned {
  align-items: center;
  gap: 2px;
  padding-right: 6px;
  margin-right: 6px;
  border-right: 1px solid rgba(0, 0, 0, 0.18);
}

html[data-shell="mac"] .tb-pin {
  width: 56px;
  height: 60px;
  border-radius: 12px;
  transition: transform 120ms ease;
  position: relative;
}

/* 독: 실행 중인 앱 아래 점 */
html[data-shell="mac"] .tb-pin.is-running::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
}
html[data-shell="mac"] .tb-pin.is-minimized::after { background: rgba(0, 0, 0, 0.3); }

html[data-shell="mac"] .tb-pin:hover {
  background: transparent;
  transform: translateY(-6px) scale(1.12);
}

html[data-shell="mac"] .tb-pin svg,
html[data-shell="mac"] .tb-task svg {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}

html[data-shell="mac"] .tb-badge {
  top: 4px;
  right: 4px;
}

html[data-shell="mac"] .tb-tasks {
  flex: 0 1 auto;
  align-items: center;
  gap: 2px;
  overflow: visible;
}

html[data-shell="mac"] .tb-task {
  flex: 0 0 auto;
  width: 56px;
  height: 60px;
  min-width: 0;
  padding: 0;
  justify-content: center;
  position: relative;
  border: none;
  border-radius: 12px;
  transition: transform 120ms ease;
}

html[data-shell="mac"] .tb-task:hover {
  background: transparent;
  transform: translateY(-6px) scale(1.12);
}

html[data-shell="mac"] .tb-task.is-active {
  background: transparent;
}

html[data-shell="mac"] .tb-task-title {
  display: none;
}

html[data-shell="mac"] .tb-task-icon,
html[data-shell="mac"] .tb-task-icon svg {
  width: 48px;
  height: 48px;
}

html[data-shell="mac"] .tb-task-icon svg {
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}

/* 실행 중 표시점 */
html[data-shell="mac"] .tb-task::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
}

html[data-shell="mac"] .tb-task.is-minimized::after {
  background: rgba(0, 0, 0, 0.3);
}

/* ===== 애플 메뉴 (시작 메뉴 재활용) ===== */
html[data-shell="mac"] .start-menu {
  top: calc(var(--menubar-h) + 4px);
  bottom: auto;
  left: 6px;
  width: 250px;
  max-width: calc(100vw - 12px);
  max-height: calc(100vh - var(--menubar-h) - 10px);
  overflow-y: auto;
  padding: 6px 0;
  border-radius: 10px;
  background: rgba(242, 242, 247, 0.96);
  color: #111;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

html[data-shell="mac"] .sm-user {
  padding: 8px 14px 10px;
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

html[data-shell="mac"] .sm-avatar {
  width: 28px;
  height: 28px;
}

html[data-shell="mac"] .sm-items {
  padding: 4px 6px;
}

html[data-shell="mac"] .sm-item {
  padding: 5px 10px;
  border-radius: 5px;
  color: #111;
  font-size: 13px;
}

html[data-shell="mac"] .sm-item-label {
  min-width: 0;
  white-space: normal;
}

html[data-shell="mac"] .sm-item:hover {
  background: var(--mac-accent);
  color: #fff;
}

html[data-shell="mac"] .sm-item-icon,
html[data-shell="mac"] .sm-item-icon svg {
  width: 18px;
  height: 18px;
}

html[data-shell="mac"] .sm-divider {
  margin: 5px 10px;
  background: rgba(0, 0, 0, 0.12);
}

/* ===== 창 ===== */
html[data-shell="mac"] .win {
  border: 1px solid rgba(0, 0, 0, 0.28);
  border-radius: 10px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35), 0 0 0 0.5px rgba(255, 255, 255, 0.35) inset;
}

html[data-shell="mac"] .win.is-active {
  border-color: rgba(0, 0, 0, 0.35);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.5), 0 0 0 0.5px rgba(255, 255, 255, 0.35) inset;
}

html[data-shell="mac"] .win.is-maximized {
  border-radius: 0;
  border: none;
}

/* 제목 표시줄: 신호등은 왼쪽, 제목은 가운데. 앱별 색은 쓰지 않는다. */
html[data-shell="mac"] .win[class] .win-titlebar {
  height: 28px;
  padding-left: 0;
  gap: 0;
  background: #f1f0f1;
  color: #3a3a3c;
  border-bottom: 1px solid #d6d5d6;
  font-size: 13px;
  font-weight: 600;
}

html[data-shell="mac"] .win[class]:not(.is-active) .win-titlebar {
  background: #f7f7f7;
  color: #b4b4b6;
  border-bottom-color: #e3e3e3;
}

html[data-shell="mac"] .win-icon {
  display: none;
}

html[data-shell="mac"] .win-title {
  text-align: center;
  order: 2;
}

html[data-shell="mac"] .win-controls {
  order: 1;
  flex: 0 0 72px;
  align-self: center;
  align-items: center;
  gap: 8px;
  padding-left: 13px;
}

/* 제목을 정확히 가운데에 두기 위한 오른쪽 여백 */
html[data-shell="mac"] .win-titlebar::after {
  content: "";
  order: 3;
  flex: 0 0 72px;
}

html[data-shell="mac"] .win-ctrl {
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  min-width: 0;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 50%;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.18);
  font-size: 0;
  line-height: 0;
  color: transparent;
  background: #dcdcdc;
  position: relative;
  overflow: hidden;
  transition: none;
}

html[data-shell="mac"] .win.is-active .win-ctrl-close { background: #ff5f57; order: 1; }
html[data-shell="mac"] .win.is-active .win-ctrl-min   { background: #febc2e; order: 2; }
html[data-shell="mac"] .win.is-active .win-ctrl-max   { background: #28c840; order: 3; }
html[data-shell="mac"] .win-ctrl-close { order: 1; }
html[data-shell="mac"] .win-ctrl-min   { order: 2; }
html[data-shell="mac"] .win-ctrl-max   { order: 3; }

/* 마우스를 올리면 세 단추 모두에 기호가 나타난다 (×, −, 확대 화살표). 색은 그대로. */
html[data-shell="mac"] .win-ctrl::before,
html[data-shell="mac"] .win-ctrl::after {
  content: "";
  position: absolute;
  opacity: 0;
  background: rgba(0, 0, 0, 0.55);
}
html[data-shell="mac"] .win-controls:hover .win-ctrl::before,
html[data-shell="mac"] .win-controls:hover .win-ctrl::after { opacity: 1; }
html[data-shell="mac"] .win-ctrl-close::before,
html[data-shell="mac"] .win-ctrl-close::after { left: 2.5px; top: 5.25px; width: 7px; height: 1.5px; border-radius: 1px; }
html[data-shell="mac"] .win-ctrl-close::before { transform: rotate(45deg); }
html[data-shell="mac"] .win-ctrl-close::after { transform: rotate(-45deg); }
html[data-shell="mac"] .win-ctrl-min::before { left: 2.5px; top: 5.25px; width: 7px; height: 1.5px; border-radius: 1px; }
html[data-shell="mac"] .win-ctrl-min::after { display: none; }
html[data-shell="mac"] .win-ctrl-max::before,
html[data-shell="mac"] .win-ctrl-max::after { width: 0; height: 0; background: transparent; border-style: solid; }
html[data-shell="mac"] .win-ctrl-max::before { top: 2px; right: 2px; border-width: 0 5px 5px 0; border-color: transparent rgba(0,0,0,0.55) transparent transparent; }
html[data-shell="mac"] .win-ctrl-max::after { bottom: 2px; left: 2px; border-width: 5px 0 0 5px; border-color: transparent transparent transparent rgba(0,0,0,0.55); }
html[data-shell="mac"] .win-ctrl:hover { filter: brightness(0.9); }
html[data-shell="mac"] .win-ctrl-close:hover { color: transparent; }

html[data-shell="mac"] .win--dialog {
  border-radius: 12px;
}

/* 텍스트 편집기에는 Windows 식 상태 표시줄이 없다 */
html[data-shell="mac"] .np-statusbar {
  display: none;
}

/* 앱 내부의 두 번째 색띠(엑셀 리본 탭 등)는 그대로 두되 제목과 이어지도록 */
html[data-shell="mac"] .xl-ribbon-tabs {
  background: #217346;
}

/* ===== 알림: 오른쪽 위 ===== */
html[data-shell="mac"] .toast-stack {
  top: calc(var(--menubar-h) + 8px);
  bottom: auto;
  right: 8px;
}

html[data-shell="mac"] .toast {
  width: 344px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(245, 245, 247, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #111;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}

html[data-shell="mac"] .toast-text {
  color: rgba(0, 0, 0, 0.65);
}

html[data-shell="mac"] .toast-close {
  color: rgba(0, 0, 0, 0.45);
}

html[data-shell="mac"] .toast-close:hover {
  color: #000;
}

/* ===== 잠금 화면 / 로그인 ===== */
html[data-shell="mac"] .lock-screen {
  background: #3b3f8f;
}

html[data-shell="mac"] .lk-bg {
  background:
    radial-gradient(ellipse at 15% 20%, rgba(255, 255, 255, 0.18), transparent 50%),
    radial-gradient(ellipse at 85% 80%, rgba(255, 170, 120, 0.25), transparent 55%),
    linear-gradient(160deg, #3b3f8f 0%, #6a4fb3 45%, #b85f9f 80%, #e08a6a 100%);
}

html[data-shell="mac"] .lock-screen.is-form .lk-bg {
  filter: blur(22px) brightness(0.7);
}

/* 시계는 위 가운데, 날짜가 위에 */
html[data-shell="mac"] .lk-clock {
  left: 0;
  right: 0;
  top: 44px;
  bottom: auto;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  text-align: center;
}

html[data-shell="mac"] .lock-screen.is-form .lk-clock {
  opacity: 1;
  transform: translateY(0) scale(0.6);
  transform-origin: top center;
}

html[data-shell="mac"] .lk-time {
  font-size: 90px;
  font-weight: 200;
  letter-spacing: -2px;
}

html[data-shell="mac"] .lk-date {
  font-size: 17px;
  font-weight: 500;
  margin: 0 0 4px;
}

html[data-shell="mac"] .lk-form {
  width: 260px;
  transform: translate(-50%, -30%);
}

html[data-shell="mac"] .lock-screen.is-form .lk-form {
  transform: translate(-50%, -40%);
}

html[data-shell="mac"] .lk-avatar {
  width: 96px;
  height: 96px;
  margin-bottom: 12px;
}

html[data-shell="mac"] .lk-name {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 14px;
}

html[data-shell="mac"] .lk-input-row {
  width: 196px;
}

html[data-shell="mac"] .lk-input {
  height: 24px;
  border: none;
  border-radius: 12px 0 0 12px;
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  text-align: center;
  font-size: 13px;
}

html[data-shell="mac"] .lk-input::placeholder {
  color: rgba(255, 255, 255, 0.75);
}

html[data-shell="mac"] .lk-submit {
  height: 24px;
  width: 28px;
  border: none;
  border-radius: 0 12px 12px 0;
  background: rgba(255, 255, 255, 0.4);
  font-size: 13px;
}

html[data-shell="mac"] .lk-error,
html[data-shell="mac"] .lk-hint {
  font-size: 12px;
}

@media (max-width: 720px) {
  html[data-shell="mac"] .lk-time { font-size: 64px; }
  html[data-shell="mac"] .taskbar { height: 56px; }
  html[data-shell="mac"] .tb-pin,
  html[data-shell="mac"] .tb-task { width: 44px; height: 50px; }
  html[data-shell="mac"] .tb-pin svg,
  html[data-shell="mac"] .tb-task svg,
  html[data-shell="mac"] .tb-task-icon,
  html[data-shell="mac"] .tb-task-icon svg { width: 34px; height: 34px; }
}

/* ===== 독: 최소화한 창 (구분선 오른쪽, 창 아이콘을 작은 창 모양 틀에) ===== */
html[data-shell="mac"] .tb-minis {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-left: 6px;
  margin-left: 6px;
  border-left: 1px solid rgba(0, 0, 0, 0.18);
}
html[data-shell="mac"] .tb-mini {
  width: 56px;
  height: 60px;
  border: none;
  border-radius: 12px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 120ms ease;
}
html[data-shell="mac"] .tb-mini:hover { transform: translateY(-6px) scale(1.12); }
html[data-shell="mac"] .tb-mini-win {
  width: 46px;
  height: 36px;
  border-radius: 5px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.25);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
html[data-shell="mac"] .tb-mini-win::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 7px;
  border-radius: 5px 5px 0 0;
  background: #e8e8e8;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}
html[data-shell="mac"] .tb-mini-win svg { width: 18px; height: 18px; margin-top: 5px; }
html[data-shell="windows"] .tb-minis { display: none; }
