/* NAS 포털 스타일 */

/* ---- 색상 토큰 ---- */
:root {
  --a-l: #2747E8; --a-d: #8098FF;
  --bg: #ECEEF1;
  --surface: #FFFFFF;
  --field: #F4F5F7;
  --ink: #18202C;
  --muted: #5E6775;
  --line: #CDD2DA;
  --accent: var(--a-l);
  --accent-ink: #FFFFFF;
  --danger: #C2372F;
  --star: #E29A00;
  --lift: 0 22px 44px -20px rgba(24, 32, 44, .5);
  --panel-shadow: 0 40px 80px -48px rgba(24, 32, 44, .55);
  --blank-bg: 38% 86%;
  --blank-ink: 42% 34%;
  color-scheme: light;
  box-sizing: border-box;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
:root[data-accent="violet"] { --a-l: #6A3DE8; --a-d: #A88BFF; }
:root[data-accent="emerald"] { --a-l: #0B7F5C; --a-d: #4CD3A1; }
:root[data-accent="orange"] { --a-l: #C8540A; --a-d: #FF9B55; }
:root[data-accent="rose"] { --a-l: #C92A5A; --a-d: #FF7FA5; }
:root[data-accent="graphite"] { --a-l: #333B48; --a-d: #C3CAD6; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161C; --surface: #1B2028; --field: #141920;
    --ink: #E6E9EE; --muted: #9AA3B0; --line: #2D3440;
    --accent: var(--a-d); --accent-ink: #0E1116; --danger: #FF7B70; --star: #FFC23D;
    --lift: 0 22px 44px -18px rgba(0, 0, 0, .75);
    --panel-shadow: 0 40px 80px -40px rgba(0, 0, 0, .8);
    --blank-bg: 22% 22%; --blank-ink: 48% 76%;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161C; --surface: #1B2028; --field: #141920;
  --ink: #E6E9EE; --muted: #9AA3B0; --line: #2D3440;
  --accent: var(--a-d); --accent-ink: #0E1116; --danger: #FF7B70; --star: #FFC23D;
  --lift: 0 22px 44px -18px rgba(0, 0, 0, .75);
  --panel-shadow: 0 40px 80px -40px rgba(0, 0, 0, .8);
  --blank-bg: 22% 22%; --blank-ink: 48% 76%;
  color-scheme: dark;
}

/* ---- 기본 ---- */
*, *::before, *::after { box-sizing: inherit; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button, select, input, textarea { font: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
mark { background: color-mix(in srgb, var(--accent) 24%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 6px; text-align: center;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  background: var(--surface); font-family: inherit; font-size: .75rem; font-weight: 650; line-height: 1.5;
}

/* ---- 히어로 (three.js 배경) ---- */
.hero {
  position: relative; overflow: hidden;
  height: clamp(320px, 50vh, 520px);
  padding-top: env(safe-area-inset-top, 0px);
}
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 1.4s ease; }
.hero.ready canvas { opacity: 1; }
.hero-fade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 78%, transparent) 30%, transparent 64%),
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 55%, transparent) 0%, transparent 22%, transparent 58%, var(--bg) 100%);
}
.hero.no-webgl {
  background:
    radial-gradient(60% 90% at 85% 40%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(40% 60% at 60% 90%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%);
}
.hero-inner {
  position: relative; height: 100%;
  max-width: 1240px; margin: 0 auto;
  padding: 20px clamp(18px, 4vw, 40px) clamp(30px, 5vw, 52px);
  display: flex; flex-direction: column; justify-content: space-between;
}
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand-mark svg { display: block; }
.brand-mark .bg { fill: var(--accent); }
.brand-mark .fg { fill: var(--accent-ink); }
.hero-actions { display: flex; gap: 8px; }
.hero-text { max-width: 720px; }
#siteTitle {
  margin: 0;
  font-size: clamp(2.6rem, 7vw, 5.2rem);
  line-height: 1;
  font-weight: 830;
  letter-spacing: -0.05em;
  overflow-wrap: anywhere;
}
#siteSub { margin: 16px 0 0; max-width: 34em; color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.125rem); }
#siteSub:empty { display: none; }
.is-admin #siteSub:empty { display: block; }
.is-admin #siteSub:empty::before { content: "소개 문구를 입력하세요"; opacity: .55; }
.is-admin #siteTitle, .is-admin #siteSub { cursor: text; border-radius: 6px; outline: 1px dashed transparent; outline-offset: 4px; }
.is-admin #siteTitle:hover, .is-admin #siteSub:hover { outline-color: var(--line); }
.is-admin #siteTitle:focus, .is-admin #siteSub:focus { outline: 2px solid var(--accent); }

.icon-btn {
  flex: none; width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: var(--muted); cursor: pointer;
}
.icon-btn:hover { color: var(--ink); border-color: var(--muted); }
.is-admin #lockBtn { color: var(--accent); border-color: var(--accent); }
.shackle-open { display: none; }
.is-admin .shackle-open { display: inline; }
.is-admin .shackle-closed { display: none; }

/* ---- 본문 ---- */
.page { max-width: 1240px; margin: 0 auto; padding: 0 clamp(18px, 4vw, 40px) 48px; }

.admin-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  margin: 0 0 32px; padding: 14px 14px 14px 18px; border-radius: 14px;
  background: var(--surface);
  background: color-mix(in srgb, var(--accent) 9%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}
.admin-bar p { margin: 0; max-width: 40em; font-size: .9375rem; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---- 대표 서비스 ---- */
.featured {
  display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr);
  gap: clamp(16px, 2.6vw, 28px); margin: 0 0 clamp(36px, 5vw, 56px);
}
.featured.solo { grid-template-columns: minmax(0, 1fr); }
.feat-main {
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: center;
  gap: clamp(18px, 3vw, 36px); padding: clamp(14px, 1.8vw, 20px);
  border-radius: 22px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--panel-shadow);
}
.featured.solo .feat-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.feat-shot { display: block; border-radius: 14px; }
.feat-shot .shot { border-radius: 14px; }
.feat-body { min-width: 0; padding-right: clamp(4px, 1.5vw, 16px); }
.feat-kicker { display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: .8125rem; font-weight: 700; }
.feat-kicker .cat-tag { color: var(--muted); }
.feat-body h2 { margin: 10px 0 0; font-size: clamp(1.5rem, 2.6vw, 2.15rem); line-height: 1.15; letter-spacing: -0.035em; font-weight: 800; }
.feat-body h2 a { color: inherit; text-decoration: none; }
.feat-body h2 a:hover { color: var(--accent); }
.feat-desc { margin: 12px 0 0; color: var(--muted); font-size: 1rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.feat-body .tags { margin-top: 12px; }
.feat-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.feat-actions .btn { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; }
.feat-actions .btn.fav-on { color: var(--star); }
.feat-side { display: flex; flex-direction: column; gap: 4px; padding-top: 6px; }
.feat-side h3 { margin: 0 0 4px 10px; color: var(--muted); font-size: .8125rem; font-weight: 650; }
.feat-side.one .feat-mini { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.feat-side.one .mini-shot { border-radius: 12px; }
.feat-side.one .feat-mini strong { font-size: 1.0625rem; }
.feat-side.one .mini-shot .initial { font-size: 3.4rem; }
.btn.square { width: 42px; padding-left: 0; padding-right: 0; }
.feat-mini {
  display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 14px; align-items: center;
  padding: 10px; border-radius: 14px; color: inherit; text-decoration: none;
}
.feat-mini:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.feat-mini:hover strong { color: var(--accent); }
.mini-shot { position: relative; aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.mini-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.mini-shot.blank { display: grid; place-items: center; background: hsl(var(--h) var(--blank-bg)); }
.mini-shot .initial { font-size: 1.6rem; }
.feat-mini strong { display: block; font-size: 1rem; letter-spacing: -0.02em; line-height: 1.35; transition: color .2s; }
.feat-mini small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; color: var(--muted); font-size: .8438rem; }
@media (max-width: 960px) {
  .featured, .featured.solo { grid-template-columns: minmax(0, 1fr); }
  .feat-main, .featured.solo .feat-main { grid-template-columns: minmax(0, 1fr); }
  .feat-body { padding: 0 6px 6px; }
  .feat-side { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); padding-top: 0; }
  .feat-side h3 { grid-column: 1 / -1; }
  .feat-side.one .feat-mini { grid-template-columns: 112px minmax(0, 1fr); gap: 14px; }
  .feat-side.one .mini-shot .initial { font-size: 1.6rem; }
}

/* ---- 바로가기: 즐겨찾기, 최근 본 서비스 ---- */
.quick { display: flex; flex-wrap: wrap; gap: 16px 40px; margin: 0 0 clamp(28px, 4vw, 40px); }
.quick-group { min-width: 0; }
.quick-group h2 { margin: 0 0 10px; color: var(--muted); font-size: .8125rem; font-weight: 650; }
.quick-list { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-item {
  display: inline-flex; align-items: center; gap: 9px; max-width: 260px;
  padding: 5px 14px 5px 5px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: inherit; text-decoration: none; font-size: .875rem; font-weight: 620;
}
.quick-item:hover { border-color: var(--accent); color: var(--accent); }
.qi-thumb {
  flex: none; width: 28px; height: 28px; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; background: var(--field);
}
.qi-thumb img { width: 100%; height: 100%; object-fit: cover; }
.qi-thumb.blank { background: hsl(var(--h) var(--blank-bg)); }
.qi-thumb .initial { font-size: .8125rem; letter-spacing: 0; }
.quick-item .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- 도구 막대 ---- */
.toolbar { display: grid; gap: 14px; margin-bottom: clamp(24px, 3.5vw, 34px); }
.tools-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tools-right { display: flex; align-items: center; gap: 10px; }
.search { position: relative; flex: 1 1 240px; max-width: 400px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; padding: 8px 12px 8px 36px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: .9375rem;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.sort select {
  appearance: none; -webkit-appearance: none;
  padding: 7px 32px 7px 12px; border-radius: 10px;
  border: 1px solid var(--line); color: var(--ink); font-size: .875rem; font-weight: 620; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A93A0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center;
}
.views { flex: none; display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 11px; }
.views button {
  width: 34px; height: 28px; display: grid; place-items: center;
  border: none; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
}
.views button:hover { color: var(--ink); }
.views button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.cats { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.cats:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  font-size: .9063rem; font-weight: 620; cursor: pointer;
}
.chip:hover { border-color: var(--muted); }
.chip .n { color: var(--muted); font-size: .8125rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip[aria-pressed="true"] .n { color: inherit; opacity: .7; }
.status { display: flex; align-items: center; gap: 10px; margin: -8px 0 22px; color: var(--muted); font-size: .9063rem; }

/* ---- 서비스 타일 공통 ---- */
.grid { list-style: none; margin: 0; padding: 0; }
.tile { position: relative; }
.tile-link { display: block; color: inherit; text-decoration: none; border-radius: 12px; }
.tile-link:focus-visible { outline-offset: 8px; }
.shot {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  transform-origin: 50% 70%;
  transition: transform .4s cubic-bezier(.2, .7, .2, 1), box-shadow .4s;
}
.shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.shot::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 0%), rgba(255, 255, 255, .3), transparent 55%);
  opacity: 0; transition: opacity .3s;
}
.lifted .shot, .tile-link:focus-visible .shot { box-shadow: var(--lift); }
.lifted .shot::after { opacity: 1; }
.tile-link:focus-visible .shot { transform: translateY(-6px); }
.shot.blank { display: grid; place-items: center; background: hsl(var(--h) var(--blank-bg)); }
.initial { font-size: clamp(3.2rem, 7vw, 4.75rem); font-weight: 820; letter-spacing: -0.05em; color: hsl(var(--h) var(--blank-ink)); line-height: 1; }
.tile.is-hidden .shot { opacity: .6; }
.tile.is-hidden .shot img, .tile.is-hidden .shot .initial { filter: grayscale(.6); }

.badges { position: absolute; top: 10px; left: 10px; z-index: 1; display: flex; gap: 6px; }
.badge {
  padding: 3px 9px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font-size: .7188rem; font-weight: 760; letter-spacing: .01em; line-height: 1.5;
}
.badge.upd { background: var(--surface); color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent), 0 1px 4px rgba(0, 0, 0, .15); }
.badge.err { background: var(--danger); color: #fff; }

.tile-acts { position: absolute; top: 10px; right: 10px; z-index: 2; display: flex; gap: 6px; }
.act {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: none; border-radius: 50%; cursor: pointer;
  background: var(--surface); color: var(--ink);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
  opacity: 0; transition: opacity .2s, transform .2s;
}
.tile:hover .act, .tile:focus-within .act, .act.on { opacity: 1; }
.act:hover { transform: scale(1.08); }
.act.on { color: var(--star); }
@media (hover: none) { .act { opacity: 1; } }
.is-admin .tile-acts { display: none; }

.meta { padding: 18px 2px 0; min-width: 0; }
.title-row { display: flex; align-items: center; gap: 7px; min-width: 0; }
.title-row h2 { margin: 0; font-size: 1.1875rem; font-weight: 720; letter-spacing: -0.025em; line-height: 1.35; transition: color .2s; overflow-wrap: anywhere; }
.title-row svg { flex: none; color: var(--muted); }
.title-row .pin { color: var(--accent); }
.tile-link:hover h2 { color: var(--accent); }
.desc {
  margin: 6px 0 0; color: var(--muted); font-size: .9375rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tags { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 8px; color: var(--muted); font-size: .8125rem; }
.tag { cursor: pointer; }
.tag:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.tag.hit { color: var(--accent); font-weight: 650; }
.tag.more { cursor: default; text-decoration: none; color: var(--muted); }
.foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; min-width: 0; color: var(--muted); font-size: .8125rem; }
.cat-tag {
  flex: none; padding: 2px 8px; border-radius: 6px;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  font-size: .75rem; font-weight: 650;
}
.path { display: flex; align-items: center; gap: 5px; min-width: 0; opacity: .85; }
.path span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.path svg { flex: none; }

/* 큰 카드 */
.view-card { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: clamp(32px, 4.5vw, 52px) clamp(20px, 3vw, 34px); }

/* 작은 카드 */
.view-compact { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 176px), 1fr)); gap: 28px 18px; }
.view-compact .shot { border-radius: 9px; }
.view-compact .initial { font-size: 2.6rem; }
.view-compact .meta { padding-top: 11px; }
.view-compact .title-row h2 { font-size: 1rem; font-weight: 680; }
.view-compact .desc, .view-compact .foot, .view-compact .tags { display: none; }
.view-compact .tile-link { border-radius: 9px; }
.view-compact .badges { top: 7px; left: 7px; }
.view-compact .badge { font-size: .65rem; padding: 2px 7px; }
.view-compact .tile-acts { top: 7px; right: 7px; gap: 4px; }
.view-compact .act { width: 30px; height: 30px; }

/* 목록 */
.view-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.view-list .tile { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 6px; border-bottom: 1px solid var(--line); }
.view-list .tile-link { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 18px; align-items: center; padding: 12px 10px; margin: 4px -10px; border-radius: 10px; }
.view-list .tile-link:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.view-list .tile-link:focus-visible { outline-offset: 0; }
.view-list .shot { border-radius: 7px; transition: none; }
.view-list .initial { font-size: 1.9rem; }
.view-list .badges { top: 5px; left: 5px; gap: 4px; }
.view-list .badge { font-size: .6rem; padding: 1px 6px; }
.view-list .meta { padding: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 28px; align-items: center; }
.view-list .title-row h2 { font-size: 1.0625rem; }
.view-list .desc { grid-column: 1; margin-top: 2px; -webkit-line-clamp: 1; font-size: .9063rem; }
.view-list .tags { grid-column: 1; margin-top: 5px; }
.view-list .foot { grid-column: 2; grid-row: 1 / span 3; margin-top: 0; max-width: 300px; justify-content: flex-end; }
.view-list .tile-acts { position: static; gap: 2px; }
.view-list .act { background: transparent; box-shadow: none; color: var(--muted); width: 34px; height: 34px; }
.view-list .act:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, transparent); transform: none; }
.view-list .act.on { color: var(--star); }
@media (max-width: 640px) {
  .view-list .tile-link { grid-template-columns: 84px minmax(0, 1fr); gap: 14px; }
  .view-list .foot, .view-list .tags { display: none; }
}

/* 관리 모드 */
.is-admin .tile:not(.add)[draggable="true"] { cursor: grab; }
.is-admin .tile-link { cursor: pointer; }
.is-admin .view-card .shot::before, .is-admin .view-compact .shot::before {
  content: "눌러서 수정"; position: absolute; top: 10px; right: 10px; z-index: 1;
  padding: 4px 11px; border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font-size: .8125rem; font-weight: 650;
  opacity: 0; transition: opacity .2s;
}
.is-admin .tile:hover .shot::before, .is-admin .tile-link:focus-visible .shot::before { opacity: 1; }
.tile.dragging { opacity: .35; }
.add-btn {
  width: 100%; aspect-ratio: 16 / 10;
  display: grid; place-content: center; justify-items: center; gap: 12px;
  border: 1.5px dashed var(--line); border-radius: 12px;
  background: transparent; color: var(--muted);
  font-weight: 650; cursor: pointer;
}
.add-btn:hover { border-color: var(--accent); color: var(--accent); }
.view-compact .add-btn { border-radius: 9px; }
.view-list .tile.add { display: block; border-bottom: none; }
.view-list .add-btn { aspect-ratio: auto; height: 60px; margin: 14px 0 0; grid-auto-flow: column; gap: 10px; border-radius: 10px; }
.plus { position: relative; width: 26px; height: 26px; }
.view-list .plus { width: 18px; height: 18px; }
.plus::before, .plus::after { content: ""; position: absolute; left: 50%; top: 50%; background: currentColor; border-radius: 2px; transform: translate(-50%, -50%); }
.plus::before { width: 100%; height: 2px; }
.plus::after { width: 2px; height: 100%; }

/* 빈 상태 */
.empty { max-width: 34em; padding: 24px 0 56px; }
.empty h2 { margin: 0 0 8px; font-size: 1.375rem; letter-spacing: -0.02em; }
.empty p { margin: 0; color: var(--muted); }

.page-foot {
  display: flex; flex-wrap: wrap; gap: 10px 24px;
  margin-top: 80px; padding-top: 20px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: .8125rem;
}

/* ---- 버튼 ---- */
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: .9375rem; font-weight: 650; text-decoration: none; line-height: 1.4;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.plain { background: transparent; border-color: transparent; color: var(--muted); }
.btn.plain:hover { color: var(--ink); }
.btn.plain.danger-text { color: var(--danger); padding-left: 6px; }
.btn.small { padding: 6px 12px; font-size: .8125rem; }
.btn:disabled { opacity: .55; cursor: default; }

/* ---- 대화상자 ---- */
dialog.dlg {
  width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  padding: 0; border: none; border-radius: 18px;
  background: var(--surface); color: var(--ink);
  box-shadow: 0 32px 80px -24px rgba(0, 0, 0, .5);
}
dialog.dlg.wide { width: min(840px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(14, 19, 27, .5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
dialog[open] { animation: dlg-in .22s cubic-bezier(.2, .7, .2, 1); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.dlg form, .dlg .dlg-body { padding: 26px 26px 22px; }
.dlg h2 { margin: 0 0 6px; font-size: 1.3125rem; letter-spacing: -0.025em; }
.hint { margin: 0 0 18px; color: var(--muted); font-size: .9375rem; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > span { font-size: .875rem; font-weight: 650; }
.field input, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--field); color: var(--ink); font-size: 1rem;
}
.field textarea { min-height: 72px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.field small { color: var(--muted); font-size: .8125rem; }
.check { display: flex; align-items: center; gap: 9px; font-size: .9375rem; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--accent); }
.sub-hint { margin: 6px 0 14px 27px; color: var(--muted); font-size: .8125rem; }
.sub-hint.flush { margin-left: 0; }
.sub-hint:empty { display: none; }
.err { min-height: 1.4em; margin: 6px 0 0; color: var(--danger); font-size: .875rem; }
.dlg-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.spacer { flex: 1; }

.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-top: 20px; }
@media (max-width: 700px) { .edit-grid { grid-template-columns: 1fr; gap: 18px; } }
.shot-drop, .zip-drop {
  position: relative; overflow: hidden;
  display: grid; place-items: center; text-align: center;
  border: 1.5px dashed var(--line); border-radius: 12px;
  background: var(--field); cursor: pointer;
}
.shot-drop { aspect-ratio: 16 / 10; }
.zip-drop { gap: 4px; padding: 22px 18px; margin-bottom: 16px; color: var(--muted); font-size: .875rem; }
.zip-drop strong { color: var(--ink); font-size: .9375rem; word-break: break-all; }
.shot-drop:hover, .shot-drop.over, .zip-drop:hover, .zip-drop.over { border-color: var(--accent); }
.shot-drop.over, .zip-drop.over { background: color-mix(in srgb, var(--accent) 8%, var(--field)); }
.zip-drop.has-file { border-style: solid; }
.shot-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.shot-drop.has-img { border-style: solid; }
.shot-drop.has-img::after {
  content: "눌러서 바꾸기"; position: absolute; right: 10px; bottom: 10px;
  padding: 4px 11px; border-radius: 999px;
  background: var(--surface); color: var(--ink); font-size: .8125rem; font-weight: 650;
  opacity: 0; transition: opacity .2s;
}
.shot-drop.has-img:hover::after, .shot-drop.has-img:focus-visible::after { opacity: 1; }
.drop-hint { display: grid; gap: 6px; padding: 18px 22px; color: var(--muted); font-size: .875rem; }
.drop-hint strong { color: var(--ink); font-size: .9375rem; }
.shot-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 6px; min-height: 32px; }
.shot-tools small { color: var(--muted); font-size: .8125rem; }
.opt-field { margin-top: 14px; }

.gate { padding: 12px 14px; border-radius: 10px; background: var(--field); color: var(--muted); font-size: .8125rem; }
.gate p { margin: 0; }
.copy-row { display: flex; gap: 6px; margin-top: 8px; }
.copy-row input {
  flex: 1; min-width: 0; padding: 6px 9px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem;
}
.dlg-body > .copy-row input { background: var(--field); padding: 9px 11px; font-size: .8125rem; }

.tag-box {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  min-height: 46px; padding: 7px 8px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--field); cursor: text;
}
.tag-box:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.tag-box input { flex: 1 1 120px; min-width: 0; padding: 4px; border: none; background: transparent; color: var(--ink); font-size: 1rem; outline: none; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px 4px 3px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-size: .875rem; font-weight: 600;
}
.tag-chip button {
  width: 20px; height: 20px; display: grid; place-items: center;
  border: none; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1;
}
.tag-chip button:hover { background: var(--field); color: var(--danger); }

/* 공유 */
.qr {
  display: grid; place-items: center; width: 220px; aspect-ratio: 1; margin: 0 auto 16px;
  padding: 12px; border-radius: 16px; background: #fff; border: 1px solid var(--line);
  color: #5E6775; font-size: .8125rem; text-align: center;
}
.qr svg { width: 100%; height: 100%; display: block; }

/* 빠른 실행 */
dialog.palette {
  width: min(640px, calc(100vw - 24px)); max-height: min(80vh, 640px);
  margin: 12vh auto auto; padding: 0; border: none; border-radius: 18px;
  background: var(--surface); color: var(--ink);
  box-shadow: 0 40px 100px -24px rgba(0, 0, 0, .55);
  overflow: hidden; flex-direction: column;
}
dialog.palette[open] { display: flex; }
.pal-input { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--muted); }
.pal-input input { flex: 1; min-width: 0; border: none; background: transparent; color: var(--ink); font-size: 1.125rem; outline: none; }
.pal-list { list-style: none; margin: 0; padding: 6px; overflow: auto; flex: 1; }
.pal-group { padding: 10px 10px 4px; color: var(--muted); font-size: .75rem; font-weight: 650; }
.pal-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.pal-item[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 13%, transparent); }
.pal-thumb { position: relative; flex: none; width: 52px; aspect-ratio: 16 / 10; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: var(--field); display: grid; place-items: center; }
.pal-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.pal-thumb.blank { background: hsl(var(--h) var(--blank-bg)); }
.pal-thumb .initial { font-size: .9rem; letter-spacing: 0; }
.pal-text { min-width: 0; flex: 1; }
.pal-text strong { display: block; font-size: .9688rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-text small { display: block; color: var(--muted); font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: .9375rem; }
.pal-foot { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 10px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }

/* 배포 */
.folder-row { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--field); overflow: hidden; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.folder-row:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.folder-row span { padding: 0 2px 0 12px; color: var(--muted); font-size: .9rem; }
.folder-row span:last-child { padding: 0 12px 0 2px; }
.field .folder-row input { flex: 1; min-width: 0; padding: 10px 0; border: none; background: transparent; font-family: inherit; font-size: .9375rem; outline: none; }
.progress { height: 6px; margin-top: 16px; border-radius: 3px; background: var(--field); overflow: hidden; }
.progress i { display: block; width: 0; height: 100%; background: var(--accent); transition: width .2s; }

/* 통계 */
.stat-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 52px 52px; gap: 14px; align-items: center; padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: .9375rem; }
.stat-head { padding-top: 0; color: var(--muted); font-size: .78rem; font-weight: 650; }
.stat-row .n { text-align: right; font-variant-numeric: tabular-nums; }
.stat-row .name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.stat-row .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-row .name svg { flex: none; color: var(--muted); }
.stat-list { list-style: none; margin: 0; padding: 0; max-height: 52vh; overflow: auto; }
.spark { display: block; width: 150px; height: 28px; }
.spark rect { fill: var(--accent); }
.spark rect.zero { fill: var(--line); }
@media (max-width: 560px) { .stat-row { grid-template-columns: minmax(0, 1fr) 44px 44px; } .stat-row > :nth-child(2) { display: none; } }

/* 설정 */
.set-sec { padding: 18px 0 4px; border-top: 1px solid var(--line); }
.set-sec:first-of-type { border-top: none; padding-top: 10px; }
.set-sec h3 { margin: 0 0 12px; font-size: .9688rem; letter-spacing: -0.01em; }
.set-sec .field input { padding: 8px 11px; font-size: .9375rem; }
.swatches { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.swatch span { display: block; width: 32px; height: 32px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.swatch input:checked + span { outline: 2px solid var(--ink); outline-offset: 3px; }
.swatch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }
.set-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }

/* 알림 */
#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 10;
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 10px;
  background: var(--ink); color: var(--bg); font-size: .9375rem; font-weight: 650;
  opacity: 0; transform: translate(-50%, 12px); pointer-events: none;
  transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--danger); color: #fff; }

@media (max-width: 560px) {
  .hero { height: clamp(300px, 46vh, 380px); }
  .admin-bar { padding: 14px; }
  .tools-right { width: 100%; justify-content: space-between; }
  .search { max-width: none; }
  .page-foot { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .shot, .shot::after, #toast, .title-row h2, .hero canvas, body { transition: none; }
  dialog[open] { animation: none; }
}
