/* ============ 폰트: KoPub 돋움 ============
   public/fonts/ 에 아래 파일명으로 넣으면 적용됩니다. 없으면 맑은 고딕으로 표시됩니다. */
@font-face { font-family: 'KoPubWorld Dotum'; font-weight: 300; font-display: swap;
  src: url('../fonts/KoPubWorldDotumLight.woff2') format('woff2'); }
@font-face { font-family: 'KoPubWorld Dotum'; font-weight: 500; font-display: swap;
  src: url('../fonts/KoPubWorldDotumMedium.woff2') format('woff2'); }
@font-face { font-family: 'KoPubWorld Dotum'; font-weight: 700; font-display: swap;
  src: url('../fonts/KoPubWorldDotumBold.woff2') format('woff2'); }

:root {
  --font: 'KoPubWorld Dotum', 'KoPub Dotum', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  --win-bg: #ffffff;
  --win-chrome: #eef3f8;
  --win-border: #b9c6d3;
  --text: #1d2733;
  --muted: #5d6b78;
  --accent: #1f7a4d;       /* 새.ZIP 그린 */
  --accent-2: #2a64c5;     /* 선택 블루 */
  --select: #d6e8ff;
  --heart: #e5484d;
  --taskbar-h: 0px;   /* 작업표시줄 없음 */
  --radius: 8px;
  --shadow: 0 18px 48px rgba(10, 30, 50, .28), 0 2px 6px rgba(10, 30, 50, .18);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  overflow: hidden;
  background: #fbf6e9;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;        /* 한글을 어절(띄어쓰기) 단위로 줄바꿈 */
  overflow-wrap: break-word;   /* 아주 긴 단어(주소 등)만 예외로 끊기 */
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

/* ============ 배경화면 ============ */
#scene { position: fixed; inset: 0; z-index: 0; }
#scene svg { width: 100%; height: 100%; display: block; }

/* 로고 */
.org-logo { position: fixed; top: 12px; right: 18px; z-index: 20; display: block; text-decoration: none; }
.org-logo img { height: 17px; width: auto; display: block;
  filter: drop-shadow(0 1px 1px rgba(15,45,30,.55)) drop-shadow(0 0 6px rgba(15,45,30,.35)); }
.org-logo-text { display: inline-block; padding: 6px 12px; background: rgba(255,255,255,.85); border-radius: 6px;
  font-weight: 700; font-size: 14px; color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.2); }

/* ============ 바탕화면 아이콘 ============ */
.desktop-icons {
  position: fixed; top: 12px; left: 8px; z-index: 2;
  display: grid; grid-auto-flow: row; gap: 8px; width: 130px;
}
.desk-icon {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 4px; border: 1px solid transparent; border-radius: 4px; background: none;
  text-decoration: none; cursor: pointer; color: #fff; text-align: center;
}
.desk-icon:hover { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.45); }
.desk-icon:focus-visible { outline: none; background: rgba(42,100,197,.35); border-color: rgba(255,255,255,.7); }
.desk-icon .label { font-size: 14px; line-height: 1.35; font-weight: 700; color: var(--text);
  background: rgba(255,255,255,.75); padding: 2px 8px; border-radius: 6px; }   /* 시안 D: 글씨 뒤 흰 반투명 배경 */
.desk-icon .ico { width: 72px; height: 58px; }
.ico { width: 58px; height: 50px; background-position: center; background-size: contain; background-repeat: no-repeat; filter: drop-shadow(0 2px 3px rgba(0,0,0,.3)); }
.ico-folder { background-image: url('../img/icon-folder.svg'); }
.ico-file { background-image: url('../img/icon-file.svg'); }
.ico-mini { display: inline-block; width: 18px; height: 16px; background-position: center; background-size: contain; background-repeat: no-repeat; vertical-align: -3px; flex: none; }

/* ============ 창 공통 ============ */
#windows { position: fixed; inset: 44px 0 0 0; z-index: 10; pointer-events: none; }
.win {
  background: var(--win-bg); border: 1px solid var(--win-border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column;
}
.win-layer { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; pointer-events: none; }
.win-layer > .win { pointer-events: auto; animation: winOpen .16s ease-out; }
.win-layer.modal { background: rgba(10, 25, 40, .28); pointer-events: auto; }
@keyframes winOpen { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

.win-title {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 0 0 12px; flex: none;
  background: var(--win-chrome); border-bottom: 1px solid #dde5ec; font-size: 13px; user-select: none;
}
.win-title > span:not(.ico-mini) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-ctrl { display: flex; height: 100%; }
.win-ctrl button { width: 46px; height: 100%; border: 0; background: none; cursor: pointer; font-size: 14px; color: #33414e; }
.win-ctrl button:hover { background: #dfe7ef; }
.win-ctrl button.close:hover { background: #e81123; color: #fff; }
.win-body { padding: 20px 22px; overflow: auto; }

/* ============ 폴더(탐색기) 창 ============ */
.explorer { width: min(1080px, 100%); height: min(720px, 100%); }
.explorer.maximized { width: 100%; height: 100%; border-radius: 0; }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid #e3e9ef; flex: none; flex-wrap: wrap; }
.btn-new {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 6px;
  background: var(--accent); color: #fff; border: 0; cursor: pointer; font-weight: 700; font-size: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.btn-new:hover { background: #18663f; }
.btn-new .plus { font-size: 18px; line-height: 1; font-weight: 400; }
.tool-sep { width: 1px; height: 22px; background: #dbe3ea; margin: 0 4px; }
.tool-btn { padding: 6px 10px; border-radius: 6px; border: 1px solid transparent; background: none; cursor: pointer; font-size: 13px; }
.tool-btn:hover { background: #eef3f8; }
.tool-btn[aria-pressed="true"] { background: var(--select); border-color: #b5d3fb; }
.addressbar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-bottom: 1px solid #e3e9ef; flex: none; font-size: 13px; }
.addressbar .path { flex: 1; padding: 5px 10px; border: 1px solid #d3dce5; border-radius: 4px; background: #fafcfd; color: var(--muted);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.addressbar .path b { color: var(--text); font-weight: 500; }
.explorer-main { display: flex; flex: 1; min-height: 0; }
.sidebar { width: 190px; flex: none; border-right: 1px solid #e3e9ef; padding: 10px 6px; overflow: auto; font-size: 13px; background: #fbfcfd; }
.sidebar a { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 4px; text-decoration: none; }
.sidebar a:hover { background: #eef3f8; }
.sidebar a.active { background: var(--select); }
.sidebar .side-head { font-size: 11px; color: var(--muted); padding: 8px 10px 4px; }
.gallery {
  flex: 1; overflow: auto; padding: 16px; align-content: start;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px;
}
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 8px 12px;
  border: 1px solid transparent; border-radius: 4px; background: none; cursor: pointer; text-align: center; text-decoration: none;
}
.tile:hover { background: #eaf3ff; border-color: #cfe3fc; }
.tile:focus-visible { outline: none; background: var(--select); border-color: #9fc6f7; }
.tile .thumb { width: 100%; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; }
.tile .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; border: 1px solid #d5dde5; background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.tile .name { font-size: 13px; line-height: 1.35; max-width: 100%; overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-all; }
.tile .meta { font-size: 11px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.tile .meta .h { color: var(--heart); }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 60px 20px; font-size: 14px; line-height: 1.7; }
.empty .ico { margin: 0 auto 12px; opacity: .55; width: 72px; height: 60px; }
.statusbar { display: flex; gap: 16px; padding: 5px 14px; border-top: 1px solid #e3e9ef; font-size: 12px; color: var(--muted); flex: none; background: #fbfcfd; }

/* ============ 사진 보기 창 ============ */
.viewer { width: min(1000px, 100%); max-height: 100%; }
.viewer-body { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); min-height: 0; flex: 1; overflow: hidden; }
.viewer-photo { background: #1b2229; display: flex; align-items: center; justify-content: center; min-height: 320px; max-height: calc(100vh - 160px); }
.viewer-photo img { max-width: 100%; max-height: calc(100vh - 160px); object-fit: contain; display: block; }
.viewer-info { padding: 22px; display: flex; flex-direction: column; gap: 12px; overflow: auto; max-height: calc(100vh - 160px); }
.viewer-info h2 { margin: 0; font-size: 22px; line-height: 1.35; word-break: keep-all; }
.viewer-info .byline { font-size: 13px; color: var(--muted); }
.viewer-info .desc { font-size: 15px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; margin: 0; }
.like-btn {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 8px 16px;
  border-radius: 999px; border: 1px solid #f1c4c6; background: #fff; color: var(--heart); cursor: pointer; font-weight: 700; font-size: 15px;
}
.like-btn:hover { background: #fff2f2; }
.like-btn .heart { font-size: 20px; line-height: 1; transition: transform .15s; }
.like-btn.on { background: var(--heart); color: #fff; border-color: var(--heart); }
.like-btn.pop .heart { transform: scale(1.35); }
.viewer-actions { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid #edf1f4; }

/* ============ 버튼/폼 ============ */
.btn { padding: 8px 16px; border-radius: 6px; border: 1px solid #c9d3dd; background: #fff; cursor: pointer; font-size: 14px; }
.btn:hover { background: #f1f5f9; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn-primary:hover { background: #18663f; }
.btn-danger { color: #c0262d; border-color: #efc2c4; }
.btn-danger:hover { background: #fff1f1; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: wait; }

.dialog { width: min(640px, 100%); max-height: 100%; }
.dialog .win-body { flex: 1; }
.form { display: grid; gap: 14px; }
.form fieldset { border: 1px solid #e0e7ee; border-radius: 6px; padding: 12px 14px 14px; margin: 0; display: grid; gap: 12px; }
.form legend { font-size: 13px; font-weight: 700; color: var(--accent); padding: 0 6px; }
.field { display: grid; gap: 5px; }
.field > span { font-size: 13px; font-weight: 500; }
.field > span .req { color: #d23; margin-left: 2px; }
.field small { font-size: 12px; color: var(--muted); }
.field input[type="text"], .field input[type="email"], .field input[type="tel"], .field input[type="password"], .field textarea, .field select {
  width: 100%; padding: 8px 10px; border: 1px solid #c9d3dd; border-radius: 4px; background: #fff;
}
.field textarea { resize: vertical; min-height: 96px; line-height: 1.6; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid #9fc6f7; border-color: var(--accent-2); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.field-hint { font-size: 12px; color: var(--muted); margin: -4px 0 0; }
.dropzone {
  border: 2px dashed #b9c6d3; border-radius: 6px; padding: 18px; text-align: center; cursor: pointer; background: #fafcfd;
  display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; color: var(--muted);
}
.dropzone.over { border-color: var(--accent-2); background: #eef6ff; }
.dropzone img { max-height: 180px; max-width: 100%; border-radius: 4px; }
.privacy-box { max-height: 130px; overflow: auto; font-size: 12px; line-height: 1.6; padding: 10px 12px; background: #f6f8fa; border: 1px solid #e0e7ee; border-radius: 4px; }
.privacy-box p { margin: 0 0 4px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px; border-top: 1px solid #e3e9ef; background: var(--win-chrome); flex: none; }
.form-error { color: #c0262d; font-size: 13px; min-height: 1em; margin: 0; }
.progress { height: 4px; background: #e3e9ef; border-radius: 2px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ============ 공모전 안내 (팝업/호버) ============ */
.info-text h2 { margin: 0 0 2px; font-size: 26px; color: var(--accent); }
.info-text p { line-height: 1.7; margin: 0 0 10px; }
.info-text .muted { color: var(--muted); margin-bottom: 14px; }
.info-list { display: grid; grid-template-columns: 104px 1fr; gap: 8px 12px; margin: 14px 0 0; font-size: 14px; }
.info-list dt { color: var(--muted); }
.info-list dd { margin: 0; }
.popup { width: min(640px, 100%); max-height: 100%; }
.popup .win-body { flex: 1; }
.popup-foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-top: 1px solid #e3e9ef; background: var(--win-chrome); font-size: 13px; }

.hover-info { position: fixed; z-index: 40; width: min(420px, calc(100vw - 24px)); pointer-events: none; animation: winOpen .14s ease-out; }
.hover-info .win-body { max-height: 60vh; }

/* ============ 관리자 ============ */
.admin { width: min(1200px, 100%); height: min(780px, 100%); }
.admin .win-body { flex: 1; padding: 0; display: flex; flex-direction: column; min-height: 0; }
.admin-bar { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 1px solid #e3e9ef; flex-wrap: wrap; }
.admin-bar .spacer { flex: 1; }
.admin-table-wrap { flex: 1; overflow: auto; }
table.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { padding: 8px 10px; border-bottom: 1px solid #edf1f4; text-align: left; vertical-align: middle; }
.admin-table th { position: sticky; top: 0; background: #f6f8fa; font-weight: 500; color: var(--muted); z-index: 1; white-space: nowrap; }
.admin-table img { width: 56px; height: 56px; object-fit: cover; border-radius: 3px; border: 1px solid #dde4ea; display: block; }
.admin-table tr.deleted td { color: #9aa5af; }
.admin-table tr.deleted img { opacity: .4; }
.admin-table .desc-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: #e7f4ec; color: var(--accent); white-space: nowrap; }
.badge.off { background: #f3e5e5; color: #b03a3a; }
.login-box { max-width: 340px; margin: 40px auto; display: grid; gap: 12px; padding: 0 20px; }

/* 알림 토스트 */
.toast { position: fixed; left: 50%; bottom: calc(var(--taskbar-h) + 16px); transform: translateX(-50%); z-index: 100;
  background: #1d2733; color: #fff; padding: 10px 18px; border-radius: 6px; font-size: 14px; box-shadow: var(--shadow);
  animation: winOpen .15s ease-out; }

.demo-flag { position: fixed; bottom: calc(var(--taskbar-h) + 8px); right: 12px; z-index: 5; background: #fff4c2; color: #6b5200;
  border: 1px solid #ecd27a; border-radius: 6px; padding: 4px 12px; font-size: 12px; }

/* ============ 모바일 ============ */
@media (max-width: 760px) {
  .desktop-icons { width: auto; grid-template-columns: repeat(4, 70px); gap: 2px; top: 40px; left: 50%; transform: translateX(-50%); }
  .desk-icon { padding: 5px 2px; gap: 4px; }
  .desk-icon .ico { width: 40px; height: 34px; }
  .desk-icon .label { font-size: 11px; line-height: 1.25; padding: 1px 5px; border-radius: 4px; }
  .win-layer { padding: 0; }
  .explorer, .viewer, .dialog, .admin { width: 100%; height: 100%; border-radius: 0; max-height: none; }
  .popup { margin: 12px; }
  .sidebar { display: none; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); padding: 10px; }
  .viewer-body { grid-template-columns: 1fr; overflow: auto; }
  .viewer-photo, .viewer-photo img, .viewer-info { max-height: none; }
  .viewer-photo img { max-height: 60vh; }
  .row2 { grid-template-columns: 1fr; }
  .org-logo img { height: 17px; }
}

/* ============ 폴더 창 보강 ============ */
.win-title .ico-mini { width: 22px; height: 19px; }
.nav-btns { display: flex; gap: 2px; }
.nav-btns button { width: 30px; height: 28px; border: 0; background: none; border-radius: 4px; cursor: pointer; font-size: 15px; color: #33414e; }
.nav-btns button:hover:not(:disabled) { background: #eef3f8; }
.nav-btns button:disabled { color: #b6c0c9; cursor: default; }
.addressbar .path .ico-mini { margin-right: 6px; }
.gallery.is-loading { opacity: .5; transition: opacity .1s; }

/* ============ 배경 마우스 반응 영역 ============ */
#scene .spot { fill: #fff; fill-opacity: 0; pointer-events: all; cursor: help; transition: fill-opacity .15s; }
#scene .spot:hover, #scene .spot.on { fill-opacity: .12; }
.spot-tip { position: fixed; z-index: 30; width: min(300px, calc(100vw - 24px)); pointer-events: none; animation: winOpen .12s ease-out; }
.spot-tip .win-title { height: 32px; font-size: 12px; }
.spot-tip .win-body { padding: 12px 14px; font-size: 13px; line-height: 1.6; }
.spot-tip .win-body p { margin: 0 0 4px; }

/* 공모전 안내: 상품 사진·작은 글씨 */
.info-list .prize-row { display: flex; gap: 12px; align-items: flex-start; }
.info-list .prize-row > div { flex: 1; }
.info-text .prize { margin: 0; flex: none; width: 112px; text-align: center; }
.info-text .prize img { width: 100%; height: auto; border-radius: 6px; display: block; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.info-text .prize figcaption { font-size: 11px; color: var(--muted); margin-top: 6px; }
.info-text .note { font-size: 12.5px; color: var(--muted); margin: 14px 0 2px; }
.info-text .note + .note { margin-top: 0; }
.info-text .note.small { font-size: 11.5px; }
.info-text .note a { color: var(--muted); }
.info-list dd { line-height: 1.6; }

/* 공모전 안내: 보조 문구·확인 상자·참여 방법 */
.info-list .sub { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.info-text .info-box { margin-top: 16px; padding: 12px 14px; background: #f6f8f4; border: 1px solid #e1e8dc; border-radius: 6px; }
.info-text .box-head { font-weight: 700; margin: 0 0 6px; }
.info-text .info-box ul { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.65; }
.how-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.how-steps li { border: 1px solid #e3e9ef; border-radius: 6px; padding: 10px; text-align: center; background: #fbfcfd; }
.how-steps p { margin: 8px 0 0; font-size: 12.5px; line-height: 1.55; text-align: left; }
.how-pic { height: 54px; display: flex; align-items: center; justify-content: center; position: relative; }
.how-pic .ico { width: 46px; height: 40px; }
.how-cursor { position: absolute; left: calc(50% + 6px); top: 24px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.3)); }
.how-btn { padding: 5px 10px; font-size: 12px; pointer-events: none; }
.how-like { padding: 4px 12px; font-size: 13px; pointer-events: none; align-self: center; }
@media (max-width: 760px) { .how-steps { grid-template-columns: 1fr; } }
.closed-box .win-body p { margin: 6px 0; font-size: 15px; line-height: 1.7; text-align: center; }

.spot-tip .spot-head { font-size: 15px; font-weight: 700; color: var(--accent); margin: 0 0 2px; }
.spot-tip .spot-sub { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
