:root {
  --bg: #0d0f14;
  --panel: #171a22;
  --panel2: #1f2430;
  --line: #2b3140;
  --fg: #e8ebf2;
  --muted: #8c93a3;
  --accent: #5b8cff;
  --danger: #ff5b6e;
  --ok: #43d17a;
}
* { box-sizing: border-box; }
/* PIN 게이트 */
#gate {
  position: fixed; inset: 0; z-index: 300; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
#gate.hidden { display: none; }
#gate .gate-box { text-align: center; padding: 40px; }
#gate .gate-lock { font-size: 56px; margin-bottom: 8px; }
#gate h2 { margin: 0 0 24px; color: var(--fg); font-weight: 600; }
#gate #pin-input {
  font-size: 40px; letter-spacing: 18px; text-align: center; width: 220px;
  padding: 14px 10px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--panel); color: var(--fg); outline: none;
}
#gate #pin-input:focus { border-color: var(--accent); }
#gate .pin-err { color: var(--danger); margin-top: 14px; min-height: 22px; font-size: 16px; }
#gate.shake .gate-box { animation: shake .35s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-10px)} 75%{transform:translateX(10px)} }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--fg);
  font-family: -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  font-size: 18px; line-height: 1.5;
}
.hidden { display: none !important; }
button {
  font: inherit; color: var(--fg); background: var(--panel2);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 16px; cursor: pointer;
}
button:hover, button:focus { border-color: var(--accent); outline: none; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.danger { color: var(--danger); border-color: var(--danger); }
input, select, textarea {
  font: inherit; color: var(--fg); background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}
a { color: var(--accent); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px; }
header.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
header.top h1 { font-size: 26px; margin: 0; }
.status { font-size: 14px; color: var(--muted); }
.status b.on { color: var(--ok); }
.status b.off { color: var(--danger); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; display: flex; flex-direction: column; gap: 10px;
}
.card h3 { margin: 0; font-size: 20px; }
.card .meta { color: var(--muted); font-size: 14px; }
.card .row { display: flex; gap: 8px; margin-top: auto; }

.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 14px; }
.inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font-size: 14px; display: inline-flex; gap: 8px; align-items: center;
}
.chip.sel { border-color: var(--accent); background: #24304d; }
.chip button { padding: 0 4px; background: none; border: none; color: var(--danger); }

.list { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow: auto;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--panel); }
.item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; }
.item:hover { background: var(--panel2); }
.item .grow { flex: 1; min-width: 0; }
.item .grow small { color: var(--muted); display: block; }
.handle { cursor: grab; color: var(--muted); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }

/* Player */
#player { position: fixed; inset: 0; background: #000; z-index: 100; }
#player .stage { position: absolute; inset: 0; overflow: hidden; }
/* frame = 사진 비율로 JS가 px 사이즈 잡아 화면 안에 '사진 전체'가 보이게 띄움(여백은 검은 stage).
   확대는 frame 안 img 에만 → frame(=사진 footprint)은 고정, 사진이 화면 밖으로 안 자람. */
#player .frame {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  overflow: hidden; opacity: 0; transition: opacity 1.2s ease;
}
#player .frame.show { opacity: 1; }
#player .frame img {
  display: block; width: 100%; height: 100%; object-fit: cover; /* frame이 사진비율이라 cover=무크롭(scale 1) */
  transform-origin: center center;
}
/* 줌은 img 에 상시 — .show(=frame) 제거 시점에 scale 안 튕김(깜빡 방지). translate 없음=가운데 고정. */
#player.kenburns .frame img { animation: kb 12s ease forwards; }
@keyframes kb { from { transform: scale(1) } to { transform: scale(1.12) } }
#player .hud {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 40px;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  opacity: 0; transition: opacity .3s; font-size: 22px;
  pointer-events: none; /* 숨겨졌을 땐 클릭 통과 (보일 때만 버튼 활성) */
}
#player .hud.show { opacity: 1; pointer-events: auto; }
#player .hud .np { color: #fff; display: flex; align-items: center; gap: 14px; min-width: 0; }
#player .hud .np .np-art { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex: none; box-shadow: 0 2px 10px rgba(0,0,0,.6); background: #222; }
#player .hud .np .np-art-fallback { font-size: 40px; flex: none; }
#player .hud .np .np-text { display: flex; flex-direction: column; min-width: 0; }
#player .hud .np .np-text > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#player .hud .np small { color: #cbd2e0; font-size: 16px; }
#player .controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
#player .hud-btn {
  background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.32);
  padding: 10px 16px; border-radius: 10px; font-size: 18px; cursor: pointer; white-space: nowrap;
}
#player .hud-btn:hover, #player .hud-btn:focus { background: rgba(255,255,255,.3); outline: none; }
/* 사진 카운터 오버레이 — 항상 표시(은은하게), 클릭 통과 */
#player .counter {
  position: absolute; top: 18px; right: 24px; z-index: 5;
  background: rgba(0,0,0,.45); color: #fff; font-size: 18px;
  padding: 6px 14px; border-radius: 999px; pointer-events: none;
  font-variant-numeric: tabular-nums; letter-spacing: .5px; opacity: .8;
}
#player .counter:empty { display: none; }
/* EXIF 정보 오버레이 — 좌상단, 은은하게, 클릭 통과 */
#player .photo-info {
  position: absolute; top: 16px; left: 24px; z-index: 5;
  color: #fff; font-size: 16px; line-height: 1.5; pointer-events: none;
  text-shadow: 0 1px 4px rgba(0,0,0,.9); opacity: .9; max-width: 60%;
}
#player .photo-info:empty { display: none; }
/* 에디터 음악 참조 배지 */
#track-list .badge {
  background: #2d6cdf; color: #fff; font-size: 12px; padding: 3px 9px;
  border-radius: 999px; white-space: nowrap; align-self: center;
}
.tap-start {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.85); color: #fff; font-size: 28px; z-index: 10; cursor: pointer; text-align: center;
}
/* 음악 먼저 로딩하는 동안 표시 — 첫 곡 재생 시작(또는 6s 폴백) 시 사라짐 */
.music-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: #000; color: #fff; font-size: 26px; z-index: 8; pointer-events: none; gap: 10px;
}
.music-loading.hidden { display: none; }
/* 재생 중 마우스 멈추면 커서 숨김(전체화면 몰입) */
#player.idle, #player.idle * { cursor: none !important; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--line); padding: 12px 18px; border-radius: 10px; z-index: 200; }
.spin { color: var(--muted); }
