/* JW 대본 열람실 — 공개 열람 화면 스타일 (밝은·어두운 테마, 글자 크기 조절 지원) */

:root {
  color-scheme: light;
  --active-bg: #e5edf5;
  --active-ink: #224f75;
  --hover-bg: #ecf1f6;
  --soft-bg: #edf2f7;
  --blue-dark: #1c476c;
  --card-hover: #9db7cd;
  --dashed: #ccd7e1;
  --notice-line: #dfc9ac;
  --notice-bg: #fff9f0;
  --mark: #fff0a3;
  --mark-ink: #4a3810;
  --pill-line: #d7e3ec;
  --warn: #955326;
  --new: #b4532a;
  --new-bg: #fdeee6;
  --shadow: rgba(32, 50, 73, 0.05);
  --reader-size: 17px;
  --ink: #203249;
  --muted: #657487;
  --blue: #285c87;
  --line: #dfe6ec;
  --paper: #fff;
  --bg: #f5f7fa;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    "Noto Sans KR",
    sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
a {
  color: inherit;
  text-decoration: none;
}
button,
input {
  font: inherit;
}
button,
a,
input,
summary {
  -webkit-tap-highlight-color: transparent;
}
button,
a,
summary {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.6;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 3px solid #78b5dd;
  outline-offset: 3px;
}
a:hover {
  color: var(--blue);
}
.top {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: 1220px;
  margin: auto;
  padding: 23px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 750;
  font-size: 19px;
  overflow-wrap: anywhere;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-size: 22px;
  font-family: serif;
}
.read-only {
  white-space: nowrap;
  border: 1px solid var(--pill-line);
  border-radius: 20px;
  padding: 6px 12px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 650;
}
.shell {
  max-width: 1220px;
  margin: auto;
  display: grid;
  grid-template-columns: 235px minmax(0, 1fr);
  gap: 45px;
  padding: 30px;
}
aside {
  align-self: start;
  position: sticky;
  top: 25px;
  padding-top: 37px;
  min-width: 0;
}
#folder-panel > summary {
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  list-style: none;
  margin: 0 0 16px;
  padding: 0 10px;
  cursor: pointer;
}
#folder-panel > summary::after {
  content: "⌄";
  float: right;
}
#folders {
  max-height: 65vh;
  overflow: auto;
}
#folders a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border-radius: 7px;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
#folders a[aria-current="page"] {
  background: var(--active-bg);
  color: var(--active-ink);
  font-weight: 700;
}
#folders a:hover {
  background: var(--hover-bg);
}
#folders .count {
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
#folders details {
  margin-top: 2px;
}
#folders summary {
  display: flex;
  align-items: center;
  list-style: none;
  cursor: pointer;
}
#folders summary::before {
  content: "›";
  width: 13px;
  flex-shrink: 0;
  color: var(--muted);
}
#folders details[open] > summary::before {
  content: "⌄";
}
#folders summary a {
  flex: 1;
  min-width: 0;
}
#folders .children {
  padding-left: 13px;
  border-left: 1px solid var(--line);
  margin-left: 6px;
}
.sidebar-note {
  font-size: 12px;
  line-height: 1.9;
  color: var(--muted);
  margin: 28px 10px;
}
main {
  min-width: 0;
}
.utility {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 32px;
}
.text-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 8px;
  white-space: nowrap;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.12em;
  font-weight: 750;
  color: var(--blue);
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}
h1 {
  font-size: 32px;
  line-height: 1.45;
  letter-spacing: -0.035em;
  margin: 0;
  overflow-wrap: anywhere;
}
.intro {
  color: var(--muted);
  margin: 10px 0 24px;
  font-size: 15px;
}
#search-form {
  display: flex;
  gap: 8px;
  background: var(--paper);
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: var(--paper);
  color: var(--ink);
}
#search {
  flex: 1;
  border: 0;
  outline-offset: -2px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  padding: 10px 17px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.5;
  white-space: nowrap;
}
.button:hover {
  background: var(--soft-bg);
}
.button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.button.primary:hover {
  background: var(--blue-dark);
}
.list-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 28px 0 13px;
  font-size: 12px;
  color: var(--muted);
}
#result-count {
  font-weight: 650;
  color: var(--ink);
}
.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.note-card {
  display: flex;
  flex-direction: column;
  min-height: 178px;
  padding: 23px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.note-card:hover {
  border-color: var(--card-hover);
  box-shadow: 0 4px 18px var(--shadow);
}
.note-card .folder {
  font-size: 11px;
  color: var(--blue);
  line-height: 1.6;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}
.note-card h2 {
  font-size: 17px;
  line-height: 1.65;
  letter-spacing: -0.025em;
  margin: 0 0 20px;
  overflow-wrap: anywhere;
}
.note-card .card-bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}
.card-bottom .arrow {
  font-size: 18px;
  color: var(--blue);
}
.empty {
  grid-column: 1/-1;
  padding: 60px 22px;
  text-align: center;
  background: var(--paper);
  border: 1px dashed var(--dashed);
  border-radius: 10px;
  color: var(--muted);
  line-height: 1.9;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 30px 0;
  font-size: 13px;
}
.pagination a[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.4;
}
.notice {
  border: 1px solid var(--notice-line);
  background: var(--notice-bg);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
  line-height: 1.7;
  font-size: 14px;
}
.back-link {
  display: inline-block;
  font-size: 13px;
  color: var(--muted);
  padding: 8px 0;
  margin-bottom: 25px;
}
#detail-folder {
  letter-spacing: 0;
  margin-top: 4px;
}
#detail-title {
  font-size: 30px;
}
.detail-meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
  margin: 13px 0 20px;
  overflow-wrap: anywhere;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.copy-status {
  font-size: 12px;
  color: var(--blue);
  min-height: 18px;
}
#copy-fallback {
  width: 100%;
  margin-bottom: 12px;
}
.transcript {
  padding: 32px 38px;
  margin-top: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  line-height: 2;
  overflow-wrap: anywhere;
}
.transcript p {
  white-space: pre-wrap;
  margin: 0 0 24px;
}
.transcript h2,
.transcript h3 {
  font-size: 21px;
  margin: 28px 0 20px;
  line-height: 1.7;
}
.transcript .timestamp {
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  display: block;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}
.transcript a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.transcript hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 28px 0;
}
.transcript .metadata {
  font-size: 13px;
  color: var(--muted);
  margin: 6px 0;
}
.transcript strong {
  font-weight: 700;
}
footer {
  border-top: 1px solid var(--line);
  margin-top: 44px;
  padding: 22px 0 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
}
.sr-only,
.skip {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.skip:focus {
  position: fixed;
  clip: auto;
  width: auto;
  height: auto;
  z-index: 10;
  padding: 15px;
  background: var(--paper);
}
.sync-error {
  color: var(--warn);
}
@media (max-width: 850px) {
  .shell {
    gap: 24px;
    grid-template-columns: 185px minmax(0, 1fr);
    padding: 24px;
  }
  .cards {
    grid-template-columns: 1fr;
  }
  .note-card {
    min-height: 150px;
  }
}
@media (max-width: 620px) {
  .top-inner {
    padding: 17px 20px;
  }
  .brand {
    font-size: 17px;
  }
  .brand-mark {
    width: 32px;
    height: 32px;
  }
  .read-only {
    font-size: 11px;
    padding: 5px 9px;
  }
  .shell {
    display: block;
    padding: 16px 20px;
  }
  aside {
    position: static;
    padding: 0;
    background: var(--soft-bg);
    border: 1px solid var(--line);
    border-radius: 9px;
    margin: 0 0 22px;
  }
  #folder-panel > summary {
    margin: 0;
    padding: 13px 15px;
    color: var(--ink);
  }
  #folders {
    max-height: 42vh;
    padding: 0 8px 8px;
  }
  .sidebar-note {
    display: none;
  }
  .utility {
    margin-bottom: 23px;
    font-size: 11px;
  }
  h1 {
    font-size: 28px;
  }
  #detail-title {
    font-size: 25px;
  }
  .intro {
    font-size: 14px;
  }
  .list-meta {
    font-size: 11px;
    gap: 8px;
  }
  .note-card {
    padding: 20px;
  }
  .transcript {
    padding: 23px 20px;
    line-height: 1.95;
  }
  .actions .button {
    padding: 10px 12px;
  }
  .back-link {
    margin-bottom: 18px;
  }
  .eyebrow {
    font-size: 10px;
  }
  .button {
    padding: 9px 14px;
  }
  .pagination {
    gap: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
/* ---------- 실시간 검색·정렬 ---------- */
.search-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 9px 2px 0;
  line-height: 1.6;
}
.list-meta {
  align-items: center;
  margin-top: 19px;
}
.sort-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.sort-control label {
  font-size: 12px;
}
.sort-control select {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 26px 8px 10px;
  max-width: 165px;
}
.search-excerpt {
  font-size: 13px;
  line-height: 1.9;
  color: var(--muted);
  margin: 0 0 18px;
  overflow-wrap: anywhere;
}
.note-card:has(.search-excerpt) h2 {
  margin-bottom: 10px;
}
mark {
  background: var(--mark);
  color: var(--mark-ink);
  border-radius: 3px;
  padding: 0 0.08em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
#notes[aria-busy="true"] {
  opacity: 0.6;
}
#notes {
  transition: opacity 0.15s;
}
.transcript mark {
  background: var(--mark);
}
#result-count {
  min-width: 0;
}
@media (max-width: 620px) {
  .sort-control {
    gap: 5px;
  }
  .sort-control select {
    max-width: 140px;
    padding: 8px 18px 8px 8px;
  }
  .search-hint {
    font-size: 11px;
  }
  .list-meta {
    gap: 8px;
    flex-wrap: wrap;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #dfe7f0;
    --muted: #9aa8b8;
    --blue: #8cb8e0;
    --line: #2b3542;
    --paper: #172029;
    --bg: #10161d;
    --active-bg: #22344a;
    --active-ink: #cfe3f7;
    --hover-bg: #1d2a38;
    --soft-bg: #1b2531;
    --blue-dark: #6e9fcb;
    --card-hover: #3d5a77;
    --dashed: #34414f;
    --notice-line: #6b5536;
    --notice-bg: #2a2219;
    --mark: #5b4a12;
    --mark-ink: #fff1c2;
    --pill-line: #34485c;
    --warn: #e0a36f;
    --new: #f0a27c;
    --new-bg: #3a251b;
    --shadow: rgba(0, 0, 0, 0.3);
  }
  .button.primary { color: #10161d; }
}

/* ---------- 1.10.0: 읽기 도구·최근 추가 표시·앱 설치 ---------- */

.badge-new {
  display: inline-block;
  font-size: 11px;
  font-weight: 750;
  color: var(--new);
  background: var(--new-bg);
  border-radius: 5px;
  padding: 1px 7px;
  margin-right: 6px;
  vertical-align: 1px;
}
.note-card .card-top { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.note-card .card-top .folder { margin: 0; }

.reading-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.reading-tools .label { font-size: 12px; color: var(--muted); margin-right: 2px; }
.size-button {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 7px;
  min-width: 38px;
  height: 36px;
  font-weight: 700;
}
.size-button:hover { background: var(--hover-bg); }
.size-button:disabled { opacity: 0.4; cursor: not-allowed; }
.transcript { font-size: var(--reader-size); }
.font-0 { --reader-size: 15px; }
.font-1 { --reader-size: 17px; }
.font-2 { --reader-size: 19px; }
.font-3 { --reader-size: 22px; }
.font-4 { --reader-size: 25px; }

.install-button { margin-left: 8px; }

@media (max-width: 620px) {
  .reading-tools { margin-left: 0; width: 100%; }
  .font-0 { --reader-size: 14px; }
  .font-1 { --reader-size: 16px; }
  .font-2 { --reader-size: 18px; }
  .font-3 { --reader-size: 21px; }
  .font-4 { --reader-size: 24px; }
}
