/* Layout: 교정 작업대 — 왼쪽은 시안 스테이지(핀을 찍는 곳), 오른쪽은 교정 메모 패널 */
:root {
  --bg: #EDEFF2;
  --surface: #FFFFFF;
  --ink: #15181E;
  --muted: #5C6371;
  --line: #D6DAE1;
  --soft: #E3E8F6;
  --accent: #2F55D4;
  --accent-ink: #FFFFFF;
  --ok: #128A63;
  --warn: #B86200;
  --danger: #BF3420;
  --pin-ink: #FFFFFF;
  --halo: #15181E;
  --r1: #2F55D4; --r2: #C96A0A; --r3: #128A63; --r4: #B0307F;
  --r5: #6A4BCF; --r6: #0D7F9C; --r7: #B8352A; --r8: #4F5866;
  --f-body: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317; --surface: #1A1D23; --ink: #E7E9ED; --muted: #9AA1AD; --line: #2C3139; --soft: #222A42;
    --accent: #7D99FF; --accent-ink: #0D1120; --ok: #3CC896; --warn: #F0A04B; --danger: #F27C66; --pin-ink: #0E1116;
    --r1: #7D99FF; --r2: #F0A04B; --r3: #3CC896; --r4: #F17CC4;
    --r5: #A894FF; --r6: #4FC6E0; --r7: #F2897C; --r8: #AEB6C3;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.55;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: env(safe-area-inset-top, 0px) calc(40px + env(safe-area-inset-bottom, 0px));
}
[hidden] { display: none !important; }
img { max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1180px; margin: 0 auto; }

/* Header */
.bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; padding-block: 22px 18px; }
.bar-title { min-width: 0; }
.eyebrow { margin: 0; font-size: 12px; letter-spacing: .06em; color: var(--muted); font-weight: 500; }
.bar h1 { margin: 2px 0 0; font-size: 22px; line-height: 1.3; font-weight: 700; text-wrap: balance; overflow-wrap: anywhere; }
.bar-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.role { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }
.link-btn { background: none; border: 0; padding: 4px 2px; color: var(--muted); font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.notice { margin: 0 0 16px; padding: 10px 14px; border-radius: 8px; background: var(--soft); font-size: 14px; }

/* Simple pages: landing, login, project list */
.page { display: grid; gap: 18px; max-width: 760px; }
.page p { margin: 0; }
.lead { color: var(--muted); max-width: 62ch; }
.form-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.input { flex: 1 1 200px; min-width: 0; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 15px; }
.input.sm { padding: 7px 10px; font-size: 14px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.form-err { color: var(--danger); font-size: 13px; }

.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.proj { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; align-items: center; padding: 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.proj:hover { border-color: var(--accent); }
.proj-cover { width: 56px; height: 70px; border-radius: 4px; background: var(--soft); object-fit: cover; }
.proj strong { display: block; font-size: 15px; overflow-wrap: anywhere; }
.proj span { display: block; font-size: 12.5px; color: var(--muted); }

/* Work area */
.work { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .work { grid-template-columns: minmax(0, 1fr); } }
.stage-col { display: grid; gap: 12px; min-width: 0; }

.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.tab { display: flex; align-items: center; gap: 8px; flex: none; padding: 5px 10px 5px 5px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 500; }
.tab img { width: 26px; height: 34px; object-fit: cover; border-radius: 3px; }
.tab[aria-selected="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.count { font-family: var(--f-mono); font-size: 11px; font-weight: 600; min-width: 20px; text-align: center; padding: 1px 6px; border-radius: 10px; background: var(--soft); }

.stage { position: relative; max-width: 100%; margin: 0 auto; border-radius: 6px; background: var(--surface); box-shadow: 0 0 0 1px var(--line), 0 14px 34px -20px rgba(0, 0, 0, .45); }
.stage.can-pin { cursor: crosshair; }
.stage > img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 6px; user-select: none; -webkit-user-drag: none; }
.layer { position: absolute; inset: 0; pointer-events: none; }
.layer > * { pointer-events: auto; }
.stage-hint { margin: 0; text-align: center; font-size: 13px; color: var(--muted); }
.empty-stage { padding: 48px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: 10px; }

.pin { position: absolute; transform: translate(-50%, -50%); min-width: 28px; height: 28px; padding: 0 7px; border-radius: 14px; border: 2px solid #FFFFFF; background: var(--c, var(--accent)); color: var(--pin-ink); font: 600 12px/24px var(--f-mono); box-shadow: 0 2px 8px rgba(0, 0, 0, .35); cursor: pointer; white-space: nowrap; }
.pin.is-draft { background: var(--ink); color: var(--bg); }
.pin.is-active { box-shadow: 0 0 0 3px var(--c, var(--accent)), 0 2px 8px rgba(0, 0, 0, .35); }

.halo { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; border: 2px dashed var(--halo); background: rgba(255, 255, 255, .18); pointer-events: none !important; }
.halo span { position: absolute; left: 50%; top: -4px; transform: translate(-50%, -100%); padding: 1px 8px; border-radius: 10px; background: var(--halo); color: #FFFFFF; font-size: 11px; font-weight: 600; white-space: nowrap; }

.composer { position: absolute; z-index: 5; width: 260px; max-width: calc(100% - 16px); display: grid; gap: 8px; padding: 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 18px 40px -14px rgba(0, 0, 0, .5); cursor: default; }
.composer label { font-size: 12px; font-weight: 600; color: var(--muted); }
.composer textarea { width: 100%; resize: vertical; min-height: 72px; padding: 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); font-size: 14px; line-height: 1.5; }
.composer-actions { display: flex; align-items: center; gap: 6px; }
.composer-actions .spacer { flex: 1; }
.err { margin: 0; font-size: 12px; color: var(--danger); }

.btn { border: 0; border-radius: 6px; padding: 8px 14px; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; display: inline-block; text-align: center; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-ghost { border: 1px solid var(--line); border-radius: 6px; padding: 7px 12px; background: transparent; font-size: 14px; cursor: pointer; text-decoration: none; color: var(--ink); display: inline-block; }
.btn-ghost.sm { padding: 3px 9px; font-size: 12.5px; }
.btn-ghost.danger { color: var(--danger); }
.btn-ghost:disabled { opacity: .5; cursor: default; }
.btn-block { width: 100%; }

/* Panel */
.panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; }
.card h2 { margin: 0; font-size: 12px; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.card p { margin: 0; }
.muted { color: var(--muted); font-size: 13px; }
.guide { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; }

.fb-list { display: grid; }
.fb { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 10px 0; border: 0; border-top: 1px solid var(--line); text-align: left; background: none; width: 100%; }
.fb:first-child { border-top: 0; padding-top: 2px; }
button.fb { cursor: pointer; }
.fb.is-active .fb-text { color: var(--accent); }
.fb .pin { position: static; transform: none; display: inline-block; cursor: inherit; }
.fb-body { display: grid; gap: 6px; min-width: 0; }
.fb-who { font-size: 12px; color: var(--muted); }
.fb-text { overflow-wrap: anywhere; white-space: pre-wrap; }

.ai { display: grid; gap: 6px; padding: 10px 12px; border-radius: 8px; background: var(--soft); font-size: 13.5px; }
.ai-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.feas { font-family: var(--f-mono); font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 10px; color: var(--surface); }
.feas.o { background: var(--ok); } .feas.m { background: var(--warn); } .feas.x { background: var(--danger); }
.ai-why { color: var(--muted); font-size: 12.5px; }

.who { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
.who:first-of-type { border-top: 0; padding-top: 0; }
.who-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.who-link { display: flex; gap: 6px; align-items: center; }
.who-link code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--f-mono); font-size: 12px; color: var(--muted); background: var(--bg); padding: 4px 8px; border-radius: 6px; user-select: all; }
.state { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 10px; background: var(--soft); color: var(--muted); }
.state.done { background: var(--ok); color: var(--surface); }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); }

.slide-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.slide-row img { width: 30px; height: 38px; object-fit: cover; border-radius: 3px; }
.slide-row span { overflow-wrap: anywhere; }
.upload { display: grid; gap: 6px; }

/* 세로로 쌓는 그리드는 내용이 길어도 부모 폭을 넘지 않게 한 칸을 고정한다 */
.page, .who, .fb-body, .ai, .upload { grid-template-columns: minmax(0, 1fr); }

.status-line { font-size: 13px; color: var(--muted); }
.status-line.ok { color: var(--ok); }
.status-line.bad { color: var(--danger); }

@media (prefers-reduced-motion: no-preference) {
  .pin, .tab, .btn, .btn-ghost, .proj { transition: box-shadow .12s, border-color .12s, opacity .12s; }
}
