:root {
  color-scheme: light;

  /* sidebar (dark, editorial) */
  --navy: #131a29;
  --navy-2: #1b2338;
  --navy-3: #232c45;
  --navy-line: rgba(233, 231, 223, 0.1);
  --cream: #ece8dd;
  --cream-muted: #8891a6;

  /* accent */
  --gold: #c9a15a;
  --gold-strong: #ddb670;
  --gold-soft: rgba(201, 161, 90, 0.14);

  /* main reading area (warm, light) */
  --ink: #201d18;
  --muted: #726b5e;
  --line: #e7e1d2;
  --paper: #fffdf8;
  --panel: #f6f2e9;
  --accent: #a97c34;
  --accent-soft: #f3e6cc;
  --danger: #b3453a;

  --shadow-sm: 0 2px 10px rgba(38, 28, 10, 0.07);
  --shadow: 0 24px 56px rgba(20, 15, 5, 0.18);
  --radius: 12px;

  --font-body: "Pretendard", "Segoe UI", "Malgun Gothic", system-ui, sans-serif;
  --font-display: "Noto Serif KR", "Malgun Gothic", serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  background: var(--panel);
  color: var(--ink);
  font-family: var(--font-body);
}

button,
input,
a {
  font: inherit;
}

/* ---------- Library sidebar ---------- */

.library {
  min-height: 0;
  height: 100%;
  padding: 22px 14px;
  background: linear-gradient(180deg, var(--navy) 0%, #0f1521 100%);
  color: var(--cream);
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--navy-line);
  cursor: pointer;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
}

h1,
h2,
p {
  margin: 0;
}

.brand h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #f6f3ea;
}

.brand p {
  font-size: 11.5px;
  color: var(--cream-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-top: 3px;
}

.title-group small,
.empty-state {
  color: var(--muted);
  font-size: 13px;
}

.brand > div {
  min-width: 0;
  flex: 1;
}

.admin-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--navy-line);
  background: var(--navy-2);
  border-radius: var(--radius);
}

.admin-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.admin-badge {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--gold-strong);
  letter-spacing: 0.01em;
}

.admin-logout-btn {
  border: 0;
  background: none;
  color: var(--cream-muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
}

.admin-logout-btn:hover {
  color: var(--gold-strong);
}

.upload-box {
  border: 1.5px dashed rgba(201, 161, 90, 0.45);
  border-radius: 9px;
  padding: 13px;
  text-align: center;
  color: var(--gold-strong);
  background: rgba(201, 161, 90, 0.06);
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
  transition: background 120ms ease, border-color 120ms ease;
  display: block;
}

.upload-box:hover {
  background: rgba(201, 161, 90, 0.14);
  border-color: var(--gold);
}

.upload-box input {
  display: none;
}

.upload-progress {
  margin-top: 10px;
}

.upload-progress-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.upload-progress-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(201, 161, 90, 0.16);
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--gold);
  transition: width 150ms ease;
}

.search-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--cream-muted);
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  border: 1px solid var(--navy-line);
  border-radius: 9px;
  padding: 9px 34px;
  background: var(--navy-2);
  color: var(--cream);
  outline: none;
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  transition: border-color 120ms ease, background 120ms ease;
}

.search-wrap input::placeholder {
  color: var(--cream-muted);
  font-weight: 700;
}

.search-wrap input:focus {
  border-color: var(--gold);
  background: var(--navy-3);
}

.book-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.book-list::-webkit-scrollbar {
  display: none;
}

.book-item {
  border: 1px solid var(--navy-line);
  border-left: 3px solid transparent;
  border-radius: 9px;
  background: var(--navy-2);
  display: flex;
  align-items: stretch;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.book-item:hover {
  background: var(--navy-3);
  transform: translateY(-1px);
}

.book-item.active {
  border-left-color: var(--gold);
  background: var(--navy-3);
}

.book-item-main {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
  border-radius: 0 8px 8px 0;
  color: var(--cream);
}

.book-item-main strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-item-delete {
  border: 0;
  background: none;
  color: var(--cream-muted);
  width: 36px;
  flex-shrink: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: 0 8px 8px 0;
  transition: background 120ms ease, color 120ms ease;
}

.book-item-delete:hover {
  background: rgba(179, 69, 58, 0.18);
  color: #e2938b;
}

.book-toc-matches {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: -2px 0 4px 10px;
  padding-left: 10px;
  border-left: 2px solid var(--navy-line);
}

.book-toc-match {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  background: none;
  padding: 6px 8px;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  color: var(--cream-muted);
}

.book-toc-match:hover {
  background: var(--gold-soft);
  color: var(--gold-strong);
}

.book-toc-match-title {
  font-size: 12px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-toc-match-page {
  font-size: 10.5px;
  flex-shrink: 0;
  color: var(--cream-muted);
}

.empty-state {
  line-height: 1.5;
  text-align: center;
  padding: 18px 6px;
  color: var(--cream-muted);
}

.library-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--navy-line);
}

.library-footer p {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--cream-muted);
  letter-spacing: 0.01em;
  text-align: center;
  white-space: nowrap;
}

#adminTrigger {
  cursor: pointer;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 12, 6, 0.55);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 16px;
}

.modal {
  width: min(320px, 100%);
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.modal input[type="password"] {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  background: #fff;
  color: var(--ink);
}

.modal input[type="password"]:focus {
  border-color: var(--accent);
}

.modal-error {
  margin: 0;
  font-size: 12.5px;
  color: var(--danger);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
}

.modal-wide {
  width: min(900px, 100%);
  max-height: 82vh;
  overflow-y: auto;
}

.proposal-columns {
  display: flex;
  gap: 12px;
}

.proposal-card {
  flex: 1;
  min-width: 0;
  height: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.proposal-card-accent {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.proposal-card-head {
  display: flex;
  align-items: center;
}

.proposal-card-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
}

.proposal-card-badge-accent {
  color: var(--accent);
  border-color: var(--accent);
}

.proposal-body {
  flex: 1;
  min-height: 0;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink);
  overflow-y: auto;
}

.proposal-body.muted {
  color: var(--muted);
  white-space: pre-wrap;
}

.ai-loading {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}

.ai-loading .loading-dots {
  margin-top: 0;
}

.ai-loading-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.proposal-body > *:first-child {
  margin-top: 0;
}

.proposal-body > *:last-child {
  margin-bottom: 0;
}

.proposal-body h1,
.proposal-body h2,
.proposal-body h3,
.proposal-body h4 {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  margin: 14px 0 6px;
}

.proposal-body p {
  margin: 8px 0;
}

.proposal-body ul,
.proposal-body ol {
  margin: 8px 0;
  padding-left: 20px;
}

.proposal-body li {
  margin: 4px 0;
}

.proposal-body strong {
  color: var(--accent);
  font-weight: 700;
}

.proposal-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 14px 0;
}

.proposal-body code {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12.5px;
}

.site-footer {
  grid-column: 1 / -1;
  padding: 18px 24px;
  background: var(--paper);
  border-top: 1px solid var(--line);
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.site-footer p.copyright {
  margin-top: 2px;
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

/* ---------- Reader ---------- */

.reader {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.toolbar {
  min-height: 74px;
  padding: 14px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

.title-group {
  min-width: 0;
}

.title-group span {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-group small {
  display: block;
  margin-top: 3px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.control-divider {
  width: 1px;
  height: 22px;
  background: var(--line);
  margin: 0 4px;
}

.controls button,
.download {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  display: grid;
  place-items: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.controls button:hover:not(:disabled),
.download:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.controls button:disabled,
.download[aria-disabled="true"] {
  opacity: 0.35;
  pointer-events: none;
}

.reader-body {
  min-height: 0;
  display: flex;
}

.toc-panel {
  width: 300px;
  flex-shrink: 0;
  min-height: 0;
  background: var(--paper);
  border-right: 1px solid var(--line);
  padding: 20px 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toc-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toc-panel-head h3 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.toc-edit-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.toc-edit-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.toc-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.toc-list::-webkit-scrollbar {
  display: none;
}

.toc-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.toc-item {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: none;
  text-align: left;
  padding: 9px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink);
  cursor: pointer;
}

.toc-item::before {
  content: "";
  flex-shrink: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
}

.toc-item.active::before {
  background: var(--accent);
}

.toc-proposal-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--gold-strong);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
}

.toc-proposal-btn svg {
  position: relative;
  top: 2px;
}

.toc-proposal-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.toc-item:hover {
  background: var(--panel);
}

.toc-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.toc-empty {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}

.proposal-action-row {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toc-edit-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toc-edit-rows {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.toc-edit-rows::-webkit-scrollbar {
  display: none;
}

.toc-edit-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line);
}

.toc-edit-row-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px auto;
  gap: 6px;
  align-items: center;
}

.toc-edit-row input {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 8px;
  font-size: 12.5px;
  width: 100%;
  outline: none;
  background: #fff;
}

.toc-edit-row input:focus {
  border-color: var(--accent);
}

.toc-edit-page {
  text-align: center;
}

.toc-edit-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag-chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.tag-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tag-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.toc-edit-remove {
  border: 0;
  background: none;
  color: var(--muted);
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  cursor: pointer;
}

.toc-edit-remove:hover {
  background: #f7e3e0;
  color: var(--danger);
}

.toc-add-row-btn {
  border: 1.5px dashed #c9c0aa;
  background: none;
  color: var(--muted);
  border-radius: 7px;
  padding: 7px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.toc-add-row-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.toc-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.primary-btn,
.ghost-btn {
  border-radius: 8px;
  padding: 7px 13px;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
}

.primary-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-btn:hover {
  background: #8f6a2c;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.ghost-btn:hover {
  border-color: #c9c0aa;
  color: var(--ink);
}

.stage-wrap {
  position: relative;
  min-height: 0;
  flex: 1;
  display: grid;
  place-items: center;
  padding: 34px;
  overflow: auto;
  background:
    radial-gradient(1200px 600px at 12% 0%, rgba(201, 161, 90, 0.1), transparent 55%),
    radial-gradient(1200px 600px at 88% 100%, rgba(19, 26, 41, 0.06), transparent 55%),
    #efe9db;
}

.stage {
  width: min(100%, 1160px);
  height: 100%;
  max-height: calc(100vh - 136px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  perspective: 1600px;
}

.page {
  flex-shrink: 0;
  border-radius: 4px;
  background: var(--paper);
  box-shadow: var(--shadow);
  transition: transform 220ms ease, opacity 220ms ease;
}

.page.turning {
  transform: rotateY(-8deg) translateX(-8px);
  opacity: 0.82;
}

.welcome {
  width: min(1020px, 100%);
  padding: 44px 38px;
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.welcome-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 auto 18px;
}

.welcome-icon-badge {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
}

.welcome-icon-times {
  font-size: 18px;
  font-weight: 700;
  color: var(--muted);
}

.welcome h2 {
  font-family: var(--font-display);
  font-size: clamp(16px, 4vw, 32px);
  font-weight: 700;
  margin-bottom: 36px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.welcome p {
  color: var(--muted);
  line-height: 1.7;
}

.welcome p + p {
  margin-top: 0.9em;
}

.welcome p strong {
  font-weight: 600;
  color: var(--ink);
}

.committee-browser {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  text-align: left;
}

.committee-browser h3 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 14px;
}

.committee-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.committee-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.committee-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.committee-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.committee-view {
  position: absolute;
  inset: 0;
  width: min(980px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  text-align: left;
}

.committee-view-head {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
}

.committee-back-btn {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 6px;
}

.committee-view-tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  width: 100%;
}

.committee-view-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  align-content: start;
  gap: 8px 12px;
  padding-bottom: 16px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.committee-view-list::-webkit-scrollbar {
  display: none;
}

.committee-result-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 9px 12px;
  text-align: left;
  cursor: pointer;
}

.committee-result-item:hover {
  border-color: var(--accent);
}

.committee-result-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.committee-result-book {
  font-size: 11.5px;
  color: var(--muted);
}

.committee-empty {
  grid-column: 1 / -1;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  padding: 10px 0;
}

.loading-message {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--ink);
}

.loading-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 14px;
}

.loading-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: loading-wave 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes loading-wave {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-7px);
    opacity: 1;
  }
}

.turn-hit {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 22%;
  border: 0;
  background: transparent;
  cursor: pointer;
  z-index: 5;
}

.turn-hit.left {
  left: 0;
}

.turn-hit.right {
  right: 0;
}

.stage-toast {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translate(-50%, 8px);
  background: rgba(19, 26, 41, 0.82);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
  z-index: 10;
}

.stage-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 860px) {
  html,
  body {
    height: auto;
    overflow: visible;
  }

  body {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .library {
    height: auto;
    overflow: visible;
  }

  .reader {
    height: auto;
  }

  .book-list {
    max-height: 210px;
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .reader-body {
    flex-direction: column;
  }

  .toc-panel {
    width: auto;
    max-height: 160px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stage-wrap {
    padding: 14px;
  }

  .stage {
    max-height: calc(100vh - 260px);
  }

  .proposal-columns {
    flex-direction: column;
  }

  .proposal-card {
    height: 220px;
  }

  .committee-grid,
  .committee-view-tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .committee-view-list {
    grid-template-columns: 1fr;
  }
}
