:root {
  --bg-deep: #080c14;
  --bg: #0c1220;
  --surface: #141c2e;
  --surface-elev: #1a2540;
  --border: rgba(120, 160, 220, 0.18);
  --border-strong: rgba(120, 160, 220, 0.35);
  --text: #e8eef8;
  --muted: #8fa3c4;
  --accent: #6eb8ff;
  --accent-dim: #4a8fd4;
  --violet: #a78bfa;
  --note-bg: rgba(255, 210, 128, 0.06);
  --note-border: rgba(255, 200, 100, 0.35);
  --orig: #5eead4;
  --edit: #93c5fd;
  --warn: #fcd34d;
  --error: #f87171;
  --radius: 12px;
  --radius-sm: 8px;
  --font: "DM Sans", system-ui, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  position: relative;
}

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(110, 184, 255, 0.14), transparent),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(167, 139, 250, 0.08), transparent),
    radial-gradient(ellipse 50% 30% at 0% 80%, rgba(94, 234, 212, 0.06), transparent);
  z-index: 0;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem 1.5rem;
  padding: 1rem 1.5rem 1.1rem;
  background: rgba(12, 18, 32, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(145deg, var(--surface-elev), var(--surface));
  border: 1px solid var(--border-strong);
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--accent);
}

.brand__text h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.brand__sub {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.app-header .hint {
  flex: 1 1 220px;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  max-width: 26rem;
  line-height: 1.5;
}

.app-header .hint strong {
  color: var(--accent);
  font-weight: 600;
}

.header-actions {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.65rem;
}

.sync-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem 0.75rem;
}

.sync-status {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}

.sync--server {
  border-color: rgba(110, 184, 255, 0.35);
  color: var(--accent);
  background: rgba(110, 184, 255, 0.08);
}

.sync--local {
  border-color: rgba(252, 211, 77, 0.4);
  color: var(--warn);
  background: rgba(252, 211, 77, 0.08);
}

.sync--saving {
  color: var(--violet);
  border-color: rgba(167, 139, 250, 0.4);
  animation: pulse-soft 1s ease-in-out infinite;
}

.sync--saved {
  color: var(--orig);
  border-color: rgba(94, 234, 212, 0.4);
}

.sync--error {
  color: var(--error);
  border-color: rgba(248, 113, 113, 0.45);
}

@keyframes pulse-soft {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.65;
  }
}

.client-hint {
  font-size: 0.72rem;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  opacity: 0.85;
}

.btn {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.1s;
}

.btn:hover {
  background: var(--surface-elev);
  border-color: var(--border-strong);
}

.btn:active {
  transform: scale(0.98);
}

.btn--ghost {
  background: transparent;
}

.btn--ghost:hover {
  background: rgba(110, 184, 255, 0.1);
  border-color: rgba(110, 184, 255, 0.35);
}

.quick-nav {
  width: min(34rem, 92vw);
}

.quick-nav__label {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.quick-nav__input,
.quick-nav__select {
  width: 100%;
  font: inherit;
  font-size: 0.84rem;
  color: var(--text);
  background: rgba(8, 12, 20, 0.75);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
}

.quick-nav__input:focus,
.quick-nav__select:focus {
  outline: none;
  border-color: rgba(110, 184, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(110, 184, 255, 0.14);
}

.quick-nav__row {
  margin-top: 0.4rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
}

.status {
  position: relative;
  z-index: 1;
  padding: 0.6rem 1.5rem;
  font-size: 0.86rem;
  color: var(--muted);
}

.status.error {
  color: var(--error);
}

.changelog {
  position: relative;
  z-index: 1;
  margin: 0 1.25rem;
  padding: 1rem 1.1rem 1.15rem;
  border: 1px solid var(--border);
  background: rgba(15, 24, 42, 0.6);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.changelog__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.55rem 0.8rem;
  margin-bottom: 0.75rem;
}

.changelog__head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 700;
}

.changelog__head p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.changelog__meta {
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.changelog__intro {
  margin: 0 0 0.8rem;
  color: rgba(232, 238, 248, 0.9);
  font-size: 0.9rem;
}

.changelog__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.7rem;
}

.changelog-card {
  border: 1px solid rgba(120, 160, 220, 0.22);
  background: rgba(18, 29, 50, 0.75);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.8rem;
}

.changelog-card h3 {
  margin: 0 0 0.4rem;
  font-size: 0.9rem;
  color: var(--accent);
}

.changelog-card ul {
  margin: 0;
  padding-left: 1.1rem;
}

.changelog-card li {
  margin: 0.2rem 0;
  font-size: 0.86rem;
  color: rgba(232, 238, 248, 0.92);
}

.submission-box {
  position: relative;
  z-index: 1;
  margin: 0.85rem 1.25rem 0;
  padding: 1rem 1.1rem 1.15rem;
  border: 1px solid var(--border);
  background: rgba(15, 24, 42, 0.6);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.submission-box__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.8rem;
  margin-bottom: 0.75rem;
}

.submission-box__head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.05rem;
}

.submission-box__head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.submission-form label {
  display: block;
}

.submission-form label > span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.submission-form input,
.submission-form select,
.submission-form textarea {
  width: 100%;
  font: inherit;
  font-size: 0.86rem;
  color: var(--text);
  background: rgba(8, 12, 20, 0.75);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.62rem;
}

.submission-form textarea {
  resize: vertical;
  min-height: 6.5rem;
}

.submission-form input:focus,
.submission-form select:focus,
.submission-form textarea:focus {
  outline: none;
  border-color: rgba(110, 184, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(110, 184, 255, 0.14);
}

.submission-form__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.submission-form__actions {
  margin-top: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.submission-status {
  font-size: 0.82rem;
}

.submission-status--muted {
  color: var(--muted);
}

.submission-status--ok {
  color: var(--orig);
}

.submission-status--error {
  color: var(--error);
}

@media (max-width: 880px) {
  .submission-form__grid {
    grid-template-columns: 1fr;
  }
}

main {
  position: relative;
  z-index: 1;
  padding: 0 1.25rem 4rem;
  max-width: 1480px;
  margin: 0 auto;
}

.book-block {
  margin-top: 2.75rem;
}

.book-block:first-of-type {
  margin-top: 1.25rem;
}

.book-title {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 1.25rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.02em;
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.1rem;
}

.compare-grid--labels {
  margin-bottom: 0.35rem;
}

@media (max-width: 960px) {
  .compare-grid {
    grid-template-columns: 1fr;
  }

  .compare-grid--labels .col-label:last-child {
    margin-top: 0.5rem;
  }
}

.col-label {
  font-size: 0.72rem;
  margin-bottom: 0.25rem;
}

.col-label__tag {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.col-label__tag--orig {
  background: rgba(94, 234, 212, 0.12);
  color: var(--orig);
  border: 1px solid rgba(94, 234, 212, 0.25);
}

.col-label__tag--edit {
  background: rgba(147, 197, 253, 0.12);
  color: var(--edit);
  border: 1px solid rgba(147, 197, 253, 0.25);
}

.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
  min-height: 3.5rem;
  box-shadow: var(--shadow-soft);
}

.section-card.missing {
  border-style: dashed;
  border-color: rgba(143, 163, 196, 0.35);
  color: var(--muted);
  font-style: italic;
  background: rgba(20, 28, 46, 0.5);
}

.section-card.changed {
  background: rgba(22, 74, 47, 0.48);
  border-color: rgba(74, 222, 128, 0.55);
}

.section-card h3 {
  margin: 0 0 0.6rem;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.section-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.94rem;
  color: rgba(232, 238, 248, 0.92);
}

.section-body strong {
  color: #fff;
  font-weight: 600;
}

.note-box {
  grid-column: 1 / -1;
  background: var(--note-bg);
  border: 1px solid var(--note-border);
  border-left: 4px solid rgba(252, 211, 77, 0.65);
  border-radius: var(--radius);
  padding: 0.75rem 1rem 0.85rem;
  margin: -0.35rem 0 1.35rem;
  box-shadow: var(--shadow-soft);
}

.note-box.note-box--changed {
  border-left-color: rgba(74, 222, 128, 0.78);
  background: rgba(28, 80, 53, 0.32);
}

.note-box__head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.4rem;
}

.note-box__icon {
  font-size: 1rem;
  opacity: 0.85;
}

.note-box label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
  color: var(--warn);
}

.note-box textarea {
  width: 100%;
  min-height: 4.75rem;
  resize: vertical;
  font: 0.92rem var(--font);
  line-height: 1.5;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(8, 12, 20, 0.65);
  color: var(--text);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.note-box textarea::placeholder {
  color: rgba(143, 163, 196, 0.55);
}

.note-box textarea:focus {
  outline: none;
  border-color: rgba(110, 184, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(110, 184, 255, 0.15);
}

.loading {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.error-panel {
  max-width: 36rem;
  margin: 2rem auto;
  padding: 1.5rem 1.75rem;
  background: var(--surface);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.error-panel__title {
  margin: 0 0 0.75rem;
  font-weight: 700;
  color: var(--error);
}

.error-panel pre {
  background: rgba(0, 0, 0, 0.35);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 0.88rem;
}

.error-panel code {
  font-size: 0.88em;
  background: rgba(110, 184, 255, 0.12);
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
}
