:root {
  --bg: #eef0f6;
  --surface: #ffffff;
  --surface-2: #e4e7f1;
  --ink: #1b1d2a;
  --muted: #6b6f85;
  --line: #d7dbe8;
  --accent: #5b4cf0;
  --accent-ink: #ffffff;
  --ok: #138a5e;
  --warn: #b7791f;
  --bad: #cc3b4f;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161e;
    --surface: #1e2030;
    --surface-2: #282b3e;
    --ink: #eceef8;
    --muted: #9aa0bb;
    --line: #313550;
    --accent: #8c80ff;
    --accent-ink: #15161e;
    --ok: #4fd1a0;
    --warn: #f0b85a;
    --bad: #ff7a8c;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Pretendard, -apple-system, system-ui, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
[hidden] { display: none !important; }

/* 헤더 */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 8px; height: 60px; }
.brand { font-weight: 800; font-size: 1.1rem; letter-spacing: -0.03em; color: inherit; text-decoration: none; margin-right: auto; }

/* 버튼 */
.btn {
  appearance: none; font: inherit; font-weight: 600; font-size: .95rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; cursor: pointer; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.btn:hover { border-color: var(--muted); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 6px 12px; font-size: .88rem; }
.btn:disabled { opacity: .5; cursor: default; }

/* 갤러리 */
.hero { padding: 44px 0 28px; max-width: 640px; }
.hero h1 { font-size: clamp(1.8rem, 4.5vw, 2.8rem); font-weight: 800; letter-spacing: -0.045em; line-height: 1.15; margin: 0 0 10px; }
.hero p { color: var(--muted); margin: 0 0 20px; }
.grid { columns: 4 230px; column-gap: 12px; }
.shot {
  break-inside: avoid; margin: 0 0 12px; padding: 0;
  border-radius: 6px; overflow: hidden; background: var(--surface);
  cursor: zoom-in; position: relative; border: 0; width: 100%; display: block; text-align: left; font: inherit; color: inherit;
}
.shot img { display: block; width: 100%; height: auto; background: var(--surface-2); }
.shot .cap {
  position: absolute; inset: auto 0 0 0; padding: 28px 12px 10px;
  background: linear-gradient(transparent, rgba(10, 10, 20, .78));
  color: #fff; font-size: .85rem; opacity: 0; transition: opacity .15s;
}
.shot:hover .cap, .shot:focus-visible .cap { opacity: 1; }
.shot:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.shot .cap p { margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty { color: var(--muted); text-align: center; padding: 64px 0; }
.center { text-align: center; padding: 16px 0 48px; }

/* 티켓 (요청 결과 화면) */
.ticket {
  max-width: 620px; margin: 36px auto 60px;
  background: var(--surface); border-radius: 18px; position: relative;
}
.ticket .stub {
  padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-bottom: 2px dashed var(--line); position: relative;
}
.ticket .stub::before, .ticket .stub::after {
  content: ""; position: absolute; bottom: -13px; width: 24px; height: 24px; border-radius: 50%; background: var(--bg);
}
.ticket .stub::before { left: -12px; }
.ticket .stub::after { right: -12px; }
.ticket .no { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.02em; }
.ticket .body { padding: 22px 24px 26px; }
.status { font-weight: 700; font-size: .85rem; padding: 4px 12px; border-radius: 999px; background: var(--surface-2); }
.status.pending { color: var(--warn); }
.status.done { color: var(--ok); }
.status.rejected { color: var(--bad); }
.quote { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; white-space: pre-wrap; word-break: break-word; margin: 0 0 16px; }
.result img { display: block; max-width: 100%; border-radius: 10px; margin: 0 auto 14px; }
.notice {
  border-left: 4px solid var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border-radius: 0 10px 10px 0; padding: 12px 14px; margin-bottom: 18px; font-size: .93rem;
}
.linkbox { display: flex; gap: 8px; margin-top: 6px; }
.linkbox input { flex: 1; min-width: 0; font-size: .85rem; }
.hint { color: var(--muted); font-size: .85rem; }

/* 폼 */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], textarea {
  width: 100%; font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
textarea { min-height: 130px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .93rem; margin: 4px 0 16px; cursor: pointer; }
.check input { margin-top: 5px; accent-color: var(--accent); }
.row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* 다이얼로그 */
dialog {
  border: 0; border-radius: 16px; padding: 0; background: var(--surface); color: var(--ink);
  width: min(520px, calc(100% - 24px)); box-shadow: 0 24px 64px rgba(0, 0, 0, .3);
}
dialog::backdrop { background: rgba(12, 12, 24, .55); }
.dlg { padding: 22px; }
.dlg h2 { margin: 0 0 16px; font-size: 1.2rem; letter-spacing: -0.02em; }
dialog.light { width: min(1000px, calc(100% - 24px)); }
dialog.light img { display: block; max-width: 100%; max-height: 72vh; margin: 0 auto 14px; border-radius: 8px; }
.mylist { list-style: none; margin: 0 0 16px; padding: 0; max-height: 50vh; overflow: auto; }
.mylist a { display: block; padding: 10px 12px; border-radius: 8px; color: inherit; text-decoration: none; }
.mylist a:hover { background: var(--surface-2); }

/* 토스트 */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 10px;
  font-size: .9rem; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 100; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; }

/* 관리자 */
.tabs { display: flex; gap: 8px; margin: 24px 0 16px; flex-wrap: wrap; }
.tabs .btn[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.acard {
  background: var(--surface); border-radius: 14px; padding: 16px; margin-bottom: 12px;
  display: grid; grid-template-columns: 1fr 280px; gap: 16px;
}
@media (max-width: 760px) { .acard { grid-template-columns: 1fr; } }
.meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .83rem; color: var(--muted); margin-bottom: 8px; }
.meta b { color: var(--ink); }
.acard textarea { min-height: 64px; }
.drop {
  border: 2px dashed var(--line); border-radius: 10px; min-height: 170px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 10px; color: var(--muted); font-size: .86rem; cursor: pointer;
}
.drop:focus { outline: 2px solid var(--accent); border-color: transparent; }
.drop.over { border-color: var(--accent); color: var(--accent); }
.drop img { max-width: 100%; max-height: 260px; border-radius: 6px; display: block; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* 여러 장 */
.shot .count {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  background: rgba(10, 10, 20, .7); color: #fff; font-size: .75rem; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
}
.result figure { margin: 0 0 20px; text-align: center; }
.result figure img { margin-bottom: 8px; }
.light-imgs { max-height: 72vh; overflow-y: auto; margin-bottom: 14px; }
dialog.light .light-imgs img { max-height: none; margin: 0 auto 10px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; width: 100%; }
.thumbs:empty { display: none; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; max-height: none; border-radius: 0; }
.thumb.fresh { outline: 2px solid var(--accent); outline-offset: -2px; }
.thumb .x {
  position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border: 0; border-radius: 50%;
  background: rgba(10, 10, 20, .75); color: #fff; font-size: 14px; line-height: 1; cursor: pointer;
}
.drop { flex-direction: column; gap: 8px; align-items: stretch; }
.drop-hint { align-self: center; }
