/* 인터뷰 데스크 — 속기 노트 스타일
   초록빛 속기 용지, 붉은 세로줄, 파란 볼펜. 묻는 말은 명조(Hahmlet), 답하는 말은 돋움(Gowun Dodum). */

:root {
  /* 색 */
  --paper: #E4EDDD;
  --paper-deep: #D2E0C9;
  --sheet: #F6FAF1;
  --sheet-hi: #FDFFFB;
  --line: #AFC2A5;
  --ink: #141B34;
  --ink-soft: #4A5270;
  --pen: #2338C4;
  --pen-deep: #18278F;
  --rule: #B4301F;
  --on-pen: #F6FAF1;

  /* 간격 (4px 그리드) */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s8: 32px;
  --s10: 40px;
  --s12: 48px;
  --s16: 64px;
  --s24: 96px;
  --gutter: 40px;

  /* 글자 */
  --ask: 'Hahmlet Variable', 'Hahmlet', serif;
  --answer: 'Gowun Dodum', sans-serif;

  /* 움직임: 들어올 때보다 나갈 때가 빠릅니다 */
  --enter: 280ms cubic-bezier(0.2, 0.7, 0.2, 1);
  --exit: 140ms cubic-bezier(0.4, 0, 1, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--answer);
  font-size: 17px;
  line-height: 28px;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ── 움직임 ─────────────────────────────────── */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes sink { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(4px); } }
@keyframes slide-in { from { opacity: 0; transform: translateX(32px); } to { opacity: 1; transform: none; } }
@keyframes slide-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(32px); } }
@keyframes stroke {
  0% { transform: scaleX(0); opacity: 1; }
  55% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}

.rise { animation: rise var(--enter) both; }
.leaving { animation: sink var(--exit) both; }

/* ── 버튼 ───────────────────────────────────── */
.btn {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: var(--s3) var(--s6);
  border: 0;
  border-radius: 2px;
  background: var(--pen);
  color: var(--on-pen);
  font-family: var(--ask);
  font-weight: 700;
  font-size: 17px;
  line-height: 24px;
  cursor: pointer;
  overflow: hidden;
  transition: transform var(--exit);
  -webkit-tap-highlight-color: transparent;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--ink);
  opacity: 0;
  transition: opacity var(--exit);
}
.btn:hover { transform: translateY(-2px); transition: transform var(--enter); }
.btn:hover::after { opacity: 0.22; transition: opacity var(--enter); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn:active::after { opacity: 0.4; }
.btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.btn[disabled] { background: var(--line); color: var(--ink-soft); cursor: not-allowed; transform: none; }
.btn[disabled]::after { opacity: 0; }

.btn.quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.btn.quiet::after { opacity: 0; }
.btn.quiet:hover::after { opacity: 0.08; }
.btn.quiet:active::after { opacity: 0.16; }
.btn.quiet[disabled] { color: var(--ink-soft); box-shadow: inset 0 0 0 2px var(--line); }
.btn.danger { background: var(--rule); }
.btn.small { min-height: 40px; padding: var(--s2) var(--s4); font-size: 15px; }

.link {
  padding: var(--s1) 0;
  border: 0;
  background: none;
  color: var(--pen);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  cursor: pointer;
  transition: opacity var(--exit);
}
.link:hover { color: var(--pen-deep); text-decoration-thickness: 2px; }
.link:active { opacity: 0.6; }
.link:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 2px; }
.link.danger { color: var(--rule); }
.link[disabled] { color: var(--ink-soft); cursor: not-allowed; text-decoration: none; }

/* ── 입력 ───────────────────────────────────── */
.input {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: var(--s2) var(--s3);
  border: 0;
  border-bottom: 2px solid var(--pen);
  border-radius: 2px 2px 0 0;
  background: var(--sheet);
  color: var(--ink);
  line-height: 28px;
}
textarea.input { resize: vertical; }
.input::placeholder { color: var(--ink-soft); opacity: 0.8; }
.input:hover { background: var(--sheet-hi); border-bottom-color: var(--pen-deep); }
.input:focus-visible { outline: 3px solid var(--pen); outline-offset: 2px; background: var(--sheet-hi); }
.input:active { background: var(--sheet-hi); }
.input[aria-invalid='true'] { border-bottom-color: var(--rule); }

.check {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: var(--s3);
  align-items: start;
  cursor: pointer;
}
.check input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 24px;
  height: 24px;
  margin: 2px 0 0;
  border: 2px solid var(--ink);
  border-radius: 2px;
  background: var(--sheet);
  cursor: pointer;
}
.check input::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 1px;
  width: 8px;
  height: 14px;
  border: solid var(--on-pen);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg) scale(0);
  transition: transform var(--exit);
}
.check input:hover { border-color: var(--pen); background: var(--sheet-hi); }
.check input:active { transform: scale(0.92); }
.check input:checked { background: var(--pen); border-color: var(--pen); }
.check input:checked::after { transform: rotate(45deg) scale(1); transition: transform var(--enter); }
.check input:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.note { font-size: 15px; line-height: 24px; color: var(--ink-soft); }
.alert { color: var(--rule); font-size: 15px; line-height: 24px; }

/* ══ 응답자 화면 ══════════════════════════════ */
.pad {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 42rem) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}
.pad-col {
  grid-column: 2;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--s6) var(--s4) 0 var(--s4);
  border-left: 2px solid var(--rule);
}

.pad-top {
  display: flex;
  justify-content: space-between;
  gap: var(--s4);
  font-size: 13px;
  line-height: 20px;
  color: var(--ink-soft);
}
.pad-top .count { flex: none; font-family: var(--ask); font-weight: 600; color: var(--ink); }

/* 시작·마침 화면 */
.cover { padding: var(--s16) 0 var(--s12); }
.cover-title {
  font-family: var(--ask);
  font-weight: 800;
  font-size: clamp(44px, 12.5vw, 96px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: var(--s8);
}
.cover-intro { font-size: 20px; line-height: 32px; max-width: 30em; margin-bottom: var(--s10); }
.cover-how { display: grid; gap: var(--s2); margin-bottom: var(--s10); max-width: 34em; }
.cover-how li { position: relative; }
.cover-how li::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--s4) - 2px - var(--gutter) / 2 - 3px);
  top: 11px;
  width: 6px;
  height: 6px;
  background: var(--ink);
}
.cover-consent { display: grid; gap: var(--s6); max-width: 34em; padding-top: var(--s6); border-top: 1px solid var(--line); }
.cover-consent .note { color: var(--ink); }
.cover-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4) var(--s6); }

/* 문답 기록 */
.log {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--s4);
  padding: var(--s12) 0 var(--s8);
}
.turn { position: relative; white-space: pre-wrap; }
.turn::before {
  content: attr(data-mark);
  position: absolute;
  left: calc(-1 * (var(--s4) + 2px + var(--gutter)));
  top: 0;
  width: var(--gutter);
  text-align: center;
  font-family: var(--ask);
  font-weight: 700;
  font-size: 15px;
  line-height: 28px;
}
.turn.q { font-family: var(--ask); font-weight: 500; font-size: 16px; line-height: 28px; color: var(--ink-soft); }
.turn.q::before { color: var(--pen); }
.turn.a { color: var(--ink); max-width: 36em; }
.turn.a::before { color: var(--ink-soft); font-weight: 500; }
.turn.q.now {
  margin-top: var(--s8);
  font-weight: 700;
  font-size: clamp(28px, 7.4vw, 44px);
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.turn.q.now::before { line-height: clamp(36px, 9.6vw, 57px); font-size: 17px; }

.pending { display: flex; align-items: center; gap: var(--s2); height: 28px; margin-top: var(--s8); }
.pending i { display: block; width: 28px; height: 3px; background: var(--pen); transform-origin: left center; animation: stroke 1.3s infinite; }
.pending i:nth-child(2) { animation-delay: 0.18s; }
.pending i:nth-child(3) { animation-delay: 0.36s; }

/* 답 적는 자리 */
.composer {
  position: sticky;
  bottom: 0;
  display: grid;
  gap: var(--s2);
  padding: var(--s4) 0 calc(var(--s4) + env(safe-area-inset-bottom));
  background: var(--paper);
  border-top: 1px solid var(--line);
}
.composer-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s3); align-items: end; }
.composer textarea { min-height: 56px; max-height: 40vh; resize: none; padding: var(--s3) var(--s3); }
.composer .btn { min-height: 56px; }
.composer-foot { display: flex; justify-content: space-between; gap: var(--s4); align-items: baseline; }
.composer-foot .link { font-size: 15px; }

.closing { padding: var(--s8) 0 var(--s16); border-top: 1px solid var(--line); }
.closing p + p { margin-top: var(--s6); }
.closing-title { font-family: var(--ask); font-weight: 800; font-size: clamp(32px, 8vw, 56px); line-height: 1.15; letter-spacing: -0.03em; margin-bottom: var(--s4); }

@media (min-width: 900px) {
  :root { --gutter: 72px; }
  .pad { padding-left: 9vw; }
  .pad-col { padding-left: var(--s8); padding-right: var(--s8); }
  .turn::before { left: calc(-1 * (var(--s8) + 2px + var(--gutter))); }
  .turn.q { font-size: 17px; }
  .turn.a { font-size: 18px; }
  .turn.q.now { font-size: 44px; }
  .cover-how li::before { left: calc(-1 * var(--s8) - 2px - var(--gutter) / 2 - 3px); }
}

/* ══ 운영자 화면 ══════════════════════════════ */
.adm { display: grid; grid-template-columns: 320px minmax(0, 1fr); min-height: 100vh; }
.rail { display: flex; flex-direction: column; gap: var(--s6); padding: var(--s6) var(--s5) var(--s6) var(--s6); border-right: 2px solid var(--rule); }
.wordmark { font-family: var(--ask); font-weight: 800; font-size: 28px; line-height: 32px; letter-spacing: -0.03em; }
.rail-list { display: grid; border-top: 1px solid var(--ink); }
.rail-item {
  position: relative;
  display: grid;
  gap: var(--s1);
  width: 100%;
  padding: var(--s3) var(--s2) var(--s3) var(--s4);
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
  cursor: pointer;
  transition: transform var(--exit);
}
.rail-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--pen);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform var(--exit);
}
.rail-item:hover { background: var(--paper-deep); }
.rail-item:active { transform: translateX(2px); }
.rail-item:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }
.rail-item[aria-current='true']::before { transform: scaleY(1); transition: transform var(--enter); }
.rail-item .name { font-family: var(--ask); font-weight: 600; font-size: 18px; line-height: 24px; }
.rail-item .meta { font-size: 13px; line-height: 20px; color: var(--ink-soft); }
.rail-foot { margin-top: auto; display: grid; gap: var(--s3); font-size: 13px; line-height: 20px; color: var(--ink-soft); }
.rail-foot strong { font-family: var(--ask); font-weight: 600; color: var(--ink); }

.main { padding: var(--s10) var(--s8) var(--s24); max-width: 64rem; }
.main-title { font-family: var(--ask); font-weight: 800; font-size: clamp(32px, 4.6vw, 60px); line-height: 1.12; letter-spacing: -0.03em; }
.main-sub { margin-top: var(--s4); display: flex; flex-wrap: wrap; gap: var(--s2) var(--s6); align-items: center; }
.sharelink { font-size: 15px; line-height: 24px; color: var(--ink-soft); word-break: break-all; }

.tabs { display: flex; gap: var(--s8); margin: var(--s10) 0 var(--s8); border-bottom: 1px solid var(--line); }
.tab {
  position: relative;
  padding: var(--s3) 0;
  border: 0;
  background: none;
  font-family: var(--ask);
  font-weight: 600;
  font-size: 18px;
  line-height: 24px;
  color: var(--ink-soft);
  cursor: pointer;
}
.tab::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 3px;
  background: var(--pen);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--exit);
}
.tab:hover { color: var(--ink); }
.tab:active { opacity: 0.6; }
.tab:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.tab[aria-selected='true'] { color: var(--ink); }
.tab[aria-selected='true']::after { transform: scaleX(1); transition: transform var(--enter); }

.toolbar { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s6); align-items: center; margin-bottom: var(--s6); }
.toolbar .count { font-family: var(--ask); font-weight: 800; font-size: 40px; line-height: 48px; letter-spacing: -0.03em; }
.toolbar .spacer { flex: 1; }

.rows { width: 100%; border-collapse: collapse; }
.rows th { padding: var(--s2); border-bottom: 1px solid var(--ink); text-align: left; font-weight: 400; font-size: 13px; line-height: 20px; color: var(--ink-soft); white-space: nowrap; }
.rows td { padding: var(--s3) var(--s2); border-bottom: 1px solid var(--line); vertical-align: top; font-size: 15px; line-height: 24px; }
.rows td.when { white-space: nowrap; color: var(--ink-soft); }
.rows td.sum { font-size: 17px; line-height: 28px; }
.rows tr.click { cursor: pointer; }
.rows tr.click:hover td { background: var(--paper-deep); }
.rows tr.click:active td { background: var(--line); }
.rows tr.click:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }

.state { white-space: nowrap; }
.state::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: var(--s2); background: var(--ink-soft); }
.state.completed::before { background: var(--pen); }
.state.active::before { background: transparent; box-shadow: inset 0 0 0 2px var(--ink-soft); }
.state.used::before { background: var(--ink); }

.stack { display: grid; gap: var(--s10); }
.stack > .toolbar { margin-bottom: calc(-1 * var(--s4)); }
.empty { padding: var(--s12) 0; max-width: 30em; }
.empty-title { font-family: var(--ask); font-weight: 700; font-size: 28px; line-height: 36px; letter-spacing: -0.02em; margin-bottom: var(--s3); }

/* 설정 양식 */
.form { display: grid; gap: var(--s8); max-width: 44rem; }
.form-row { display: grid; gap: var(--s2); }
.form-row > label, .form-legend { font-family: var(--ask); font-weight: 600; font-size: 17px; line-height: 24px; }
.form-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s6); }
.field-list { display: grid; gap: var(--s3); }
.field-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) auto; gap: var(--s3); align-items: center; }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--s4) var(--s6); align-items: center; padding-top: var(--s6); border-top: 1px solid var(--line); }
select.input { appearance: none; -webkit-appearance: none; padding-right: var(--s8); background-image: linear-gradient(45deg, transparent 50%, var(--pen) 50%), linear-gradient(135deg, var(--pen) 50%, transparent 50%); background-position: calc(100% - 18px) 21px, calc(100% - 12px) 21px; background-size: 6px 6px; background-repeat: no-repeat; cursor: pointer; }

/* 응답 한 건 */
.scrim { position: fixed; inset: 0; background: var(--ink); opacity: 0.4; animation: fade-in var(--enter) both; }
.scrim.leaving { animation: fade-out var(--exit) both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 0.4; } }
@keyframes fade-out { from { opacity: 0.4; } to { opacity: 0; } }
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(640px, 100vw);
  padding: var(--s6) var(--s6) var(--s16);
  overflow-y: auto;
  background: var(--sheet);
  border-left: 2px solid var(--ink);
  animation: slide-in var(--enter) both;
}
.drawer.leaving { animation: slide-out var(--exit) both; }
.drawer-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s4); margin-bottom: var(--s6); }
.drawer-title { font-family: var(--ask); font-weight: 800; font-size: 32px; line-height: 40px; letter-spacing: -0.03em; }
.drawer h3 { font-family: var(--ask); font-weight: 600; font-size: 13px; line-height: 20px; color: var(--ink-soft); margin: var(--s8) 0 var(--s3); padding-bottom: var(--s2); border-bottom: 1px solid var(--ink); }
.summary { font-family: var(--ask); font-weight: 500; font-size: 20px; line-height: 32px; }
.facts { display: grid; gap: var(--s4); }
.facts dt { font-size: 13px; line-height: 20px; color: var(--ink-soft); }
.facts dd { font-size: 17px; line-height: 28px; }
.facts dd.blank { color: var(--ink-soft); }
.script { display: grid; gap: var(--s3); padding-left: var(--s8); border-left: 2px solid var(--rule); margin-left: var(--s6); }
.script .turn::before { left: calc(-1 * (var(--s8) + 2px + var(--s6))); width: var(--s6); }
.drawer-actions { display: flex; flex-wrap: wrap; gap: var(--s4) var(--s6); align-items: center; margin-top: var(--s10); padding-top: var(--s6); border-top: 1px solid var(--line); }

/* 들어가기 */
.gate { display: grid; align-content: center; gap: var(--s12); min-height: 100vh; padding: var(--s8) var(--s6) var(--s8) 12vw; border-left: 0; }
.gate-title { font-family: var(--ask); font-weight: 800; font-size: clamp(56px, 13vw, 144px); line-height: 1; letter-spacing: -0.04em; }
.gate-form { display: grid; grid-template-columns: minmax(0, 20rem) auto; gap: var(--s3); align-items: end; max-width: 32rem; }
.gate-form label { grid-column: 1 / -1; font-family: var(--ask); font-weight: 600; }

.toast {
  position: fixed;
  left: 50%;
  bottom: var(--s8);
  padding: var(--s3) var(--s5);
  background: var(--ink);
  color: var(--sheet);
  font-size: 15px;
  line-height: 24px;
  border-radius: 2px;
  transform: translateX(-50%);
  animation: toast-in var(--enter) both;
  z-index: 10;
}
.toast.leaving { animation: toast-out var(--exit) both; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toast-out { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, 4px); } }

@media (max-width: 860px) {
  .adm { grid-template-columns: minmax(0, 1fr); }
  .rail { border-right: 0; border-bottom: 2px solid var(--rule); padding: var(--s5) var(--s4); }
  .rail-foot { margin-top: 0; }
  .rail-list { max-height: 228px; overflow-y: auto; }
  .main { padding: var(--s8) var(--s4) var(--s16); }
  .field-item { grid-template-columns: minmax(0, 1fr); padding-bottom: var(--s3); border-bottom: 1px solid var(--line); }
  .rows th.opt, .rows td.opt { display: none; }
  .gate { padding-left: var(--s6); }
  .gate-form { grid-template-columns: minmax(0, 1fr); }
  .tabs { gap: var(--s6); }
}

/* '모션 줄이기' 설정을 켠 사람에게는 움직임 없이 바로 보여 줍니다 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
  .btn:hover, .btn:active, .rail-item:active, .check input:active { transform: none; }
  .pending i { animation: none; opacity: 0.6; }
}
