:root {
  color-scheme: dark;
  --hero-title-size: 72px;
  --bg: #0b0e16;
  --surface: rgba(17, 22, 34, 0.88);
  --surface-strong: rgba(12, 16, 28, 0.96);
  --surface-soft: rgba(20, 26, 41, 0.72);
  --line: rgba(150, 181, 255, 0.16);
  --line-strong: rgba(255, 130, 88, 0.28);
  --ink: #eef3ff;
  --muted: #9ba8c7;
  --accent: #ff7844;
  --accent-cool: #62d0ff;
  --accent-soft: #8f9cff;
  --radius: 10px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(98, 208, 255, 0.12), transparent 28%),
    radial-gradient(circle at 85% 12%, rgba(255, 120, 68, 0.18), transparent 22%),
    linear-gradient(180deg, #090c13 0%, #0e1321 58%, #090b12 100%);
}

body[data-page="home"]:not(.is-ready) [data-hero-kicker],
body[data-page="home"]:not(.is-ready) [data-hero-title],
body[data-page="home"]:not(.is-ready) [data-hero-text],
body[data-page="home"]:not(.is-ready) [data-featured-title],
body[data-page="home"]:not(.is-ready) [data-featured-text],
body[data-page="home"]:not(.is-ready) [data-featured-date] {
  visibility: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

img {
  max-width: 100%;
}

.site-header,
.admin-topbar {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 5vw, 56px);
  color: var(--ink);
  background: linear-gradient(180deg, rgba(7, 10, 17, 0.84), rgba(7, 10, 17, 0.12));
  backdrop-filter: blur(18px);
}

.brand {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 2.4vw, 36px);
  font-weight: 700;
  line-height: 1;
}

.nav,
.hero-actions,
.admin-actions,
.utility-actions,
.background-actions,
.image-field-actions,
.filters,
.reader-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.nav a,
.button,
.filter,
.icon-button,
.thumb-button,
.reader-nav {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  min-height: 42px;
  padding: 11px 18px;
  cursor: pointer;
  background: rgba(12, 16, 28, 0.46);
  color: inherit;
  backdrop-filter: blur(12px);
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.button.small {
  min-height: 34px;
  padding: 8px 14px;
}

.button:hover,
.filter:hover,
.icon-button:hover,
.nav a:hover,
.thumb-button:hover,
.reader-nav:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 120, 68, 0.42);
}

.button.primary,
.filter.is-active,
.thumb-button.is-active {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent), #d84e2b);
  color: #fff7f3;
}

.button.ghost {
  background: rgba(12, 16, 28, 0.1);
}

.button.danger {
  border-color: #d14c49;
  background: #d14c49;
  color: #fff;
}

.icon-button {
  width: 44px;
  padding: 0;
  font-size: 26px;
  line-height: 1;
}

.hero {
  position: relative;
  min-height: 96svh;
  overflow: hidden;
  background: #060910;
}

.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(5, 7, 13, 0.9) 0%, rgba(5, 7, 13, 0.58) 38%, rgba(5, 7, 13, 0.2) 100%),
    linear-gradient(180deg, rgba(5, 7, 13, 0.18) 0%, rgba(5, 7, 13, 0.74) 100%);
}

.hero-grid {
  position: relative;
  min-height: 96svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: clamp(24px, 4vw, 56px);
  align-items: end;
  padding: 120px clamp(18px, 6vw, 80px) 56px;
}

.hero-copy {
  max-width: 760px;
}

.kicker,
.eyebrow {
  display: block;
  color: var(--accent-cool);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero h1,
.section h2,
.login-card h1,
.admin-panel h1,
.admin-panel h2,
.reader-meta h1 {
  margin: 14px 0 18px;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0;
}

.hero h1 {
  font-size: clamp(42px, min(7vw, var(--hero-title-size)), 102px);
  line-height: 0.94;
}

.hero p {
  max-width: 620px;
  margin: 0;
  color: rgba(238, 243, 255, 0.82);
  font-size: clamp(18px, 1.5vw, 22px);
  line-height: 1.58;
}

.hero-panel,
.release-card,
.world-card,
.about-panel,
.admin-panel,
.login-card,
.reader-meta,
.reader-page-frame,
.reader-meta-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-panel {
  display: grid;
  gap: 12px;
  padding: 22px;
}

.hero-panel span,
.release-meta span,
.world-card span,
.reader-meta-panel span {
  color: var(--accent-cool);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-panel strong {
  font-size: 30px;
  line-height: 1.06;
}

.hero-panel p,
.world-card p,
.about-copy p,
.footer p,
.footer-meta span,
.admin-topbar span,
.panel-head p,
.utility-panel p,
.reader-meta p {
  color: var(--muted);
  line-height: 1.55;
}

.hero-panel b,
.release-bottom b {
  color: #fff4c2;
}

.section {
  padding: clamp(62px, 8vw, 110px) clamp(18px, 5vw, 56px);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.section h2,
.admin-panel h1 {
  font-size: clamp(34px, 4vw, 60px);
  line-height: 1;
}

.release-grid,
.worlds-grid {
  display: grid;
  gap: 18px;
}

.release-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.worlds-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.release-card {
  min-height: 100%;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(98, 208, 255, 0.06), transparent 26%),
    var(--surface-strong);
}

.release-image {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
}

.release-cover-link {
  display: block;
  overflow: hidden;
}

.release-cover-link[aria-disabled="true"],
.release-title-link[aria-disabled="true"] {
  pointer-events: none;
}

.release-cover-link:hover .release-image,
.release-title-link:hover {
  opacity: 0.92;
}

.release-card h3,
.world-card h3 {
  margin: 16px 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  line-height: 0.98;
}

.release-title-link {
  display: inline-block;
}

.release-card h3 em {
  display: block;
  color: var(--accent);
  font-style: normal;
  font-size: 18px;
  margin-top: 10px;
}

.release-card > :not(img) {
  padding-left: 18px;
  padding-right: 18px;
}

.release-meta,
.release-bottom,
.release-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.release-meta {
  margin-top: 16px;
}

.subtitle {
  color: #e2e8fb;
}

.release-bottom,
.release-actions {
  margin: 18px 0 18px;
}

.page-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(8, 12, 20, 0.56);
}

.world-card,
.about-panel {
  padding: 22px;
}

.about-section {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 420px);
  gap: 20px;
}

.about-panel {
  display: grid;
  gap: 18px;
}

.about-panel strong,
.reader-meta-panel strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
}

.footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 0 56px 48px;
}

.footer-meta {
  text-align: right;
}

.admin-body.is-locked {
  overflow: hidden;
}

.login-screen {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card,
.admin-panel {
  width: min(100%, 1240px);
  padding: 28px;
}

.login-card {
  display: grid;
  gap: 16px;
  max-width: 460px;
}

.login-card label,
.settings-form label,
.item-fields label,
.password-form label {
  display: grid;
  gap: 8px;
  color: #dbe6ff;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  color: var(--ink);
  background: rgba(10, 13, 24, 0.72);
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(255, 120, 68, 0.58);
  box-shadow: 0 0 0 3px rgba(255, 120, 68, 0.12);
}

.login-error {
  color: #ffb8a3;
}

.admin-shell {
  display: grid;
  gap: 18px;
  padding: 110px 18px 32px;
  place-items: center;
}

.panel-head,
.panel-head.compact {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.panel-head.compact h2 {
  font-size: 32px;
  margin-bottom: 0;
}

.settings-form,
.item-fields,
.password-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.settings-form .wide,
.item-fields .wide {
  grid-column: 1 / -1;
}

.background-editor,
.image-field,
.pages-block {
  display: grid;
  gap: 16px;
}

.background-preview,
.admin-image-preview {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 20, 0.72);
  object-fit: cover;
}

.background-preview {
  max-height: 420px;
}

.admin-image-preview {
  width: min(220px, 100%);
  aspect-ratio: 3 / 4;
  justify-self: start;
}

.admin-image-empty,
.reader-empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(8, 12, 20, 0.56);
}

.item-editor {
  display: grid;
  gap: 18px;
}

.admin-item {
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(9, 13, 23, 0.74);
}

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

.page-list {
  display: grid;
  gap: 12px;
}

.page-row {
  display: grid;
  grid-template-columns: minmax(0, 120px) minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 12, 20, 0.56);
}

.page-thumb {
  display: grid;
  gap: 8px;
}

.page-thumb img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 10px;
}

.page-thumb span {
  color: var(--muted);
  text-align: center;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  gap: 10px;
}

.text-button {
  width: fit-content;
  color: #ffb8a3;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.image-upload input,
.import-button input {
  display: none;
}

.password-form {
  align-items: end;
}

.reader-body {
  min-height: 100svh;
}

.reader-shell {
  display: grid;
  gap: 10px;
  padding: 72px clamp(10px, 2vw, 20px) 12px;
}

.reader-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
}

.reader-meta h1 {
  margin: 2px 0 4px;
  font-size: clamp(22px, 2.2vw, 30px);
  line-height: 1;
}

.reader-meta .eyebrow {
  margin-bottom: 2px;
}

.reader-meta p {
  margin: 0;
  max-width: 880px;
  font-size: 15px;
}

.reader-meta-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
}

.reader-stage {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 10px;
}

.reader-nav {
  width: 64px;
  min-height: 64px;
  padding: 0;
  font-size: 42px;
}

.reader-nav:disabled,
.button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
  transform: none;
}

.reader-page-frame {
  min-height: calc(100svh - 112px);
  display: grid;
  place-items: center;
  padding: clamp(6px, 1vw, 12px);
  background:
    linear-gradient(180deg, rgba(98, 208, 255, 0.05), transparent 30%),
    rgba(8, 12, 20, 0.88);
  overflow: hidden;
}

.reader-page {
  max-height: 100%;
  max-width: 100%;
  width: auto;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
}

.reader-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.reader-counter {
  color: var(--muted);
  font-size: 18px;
}

.reader-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.thumb-button {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
}

.thumb-button img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 8px;
}

body.reader-immersive .reader-header,
body.reader-immersive .reader-meta,
body.reader-immersive .reader-toolbar,
body.reader-immersive .reader-thumbs {
  display: none;
}

body.reader-immersive .reader-shell {
  padding: 0;
  gap: 0;
}

body.reader-immersive .reader-stage {
  min-height: 100svh;
  grid-template-columns: 88px minmax(0, 1fr) 88px;
  gap: 0;
}

body.reader-immersive .reader-page-frame {
  min-height: 100svh;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  background: #05070d;
}

body.reader-immersive .reader-page {
  max-height: 100svh;
  max-width: 100vw;
  border-radius: 0;
}

body.reader-immersive .reader-nav {
  width: 88px;
  min-height: 100svh;
  border-radius: 0;
  border-top: none;
  border-bottom: none;
  background: rgba(5, 7, 13, 0.38);
}

@media (max-width: 1180px) {
  .release-grid,
  .worlds-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .site-header,
  .admin-topbar {
    align-items: start;
    flex-direction: column;
  }

  .hero-grid,
  .about-section,
  .reader-meta,
  .reader-stage {
    grid-template-columns: 1fr;
  }

  .reader-meta {
    align-items: start;
    gap: 10px;
  }

  .reader-meta-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .reader-stage {
    gap: 12px;
  }

  .reader-nav {
    width: 100%;
  }

  .settings-form,
  .item-fields,
  .password-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .hero h1 {
    font-size: clamp(36px, min(16vw, var(--hero-title-size)), 72px);
  }

  .release-grid,
  .worlds-grid,
  .reader-thumbs {
    grid-template-columns: 1fr;
  }

  .reader-meta-panel {
    grid-template-columns: 1fr;
  }

  .section,
  .footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .footer,
  .reader-toolbar,
  .page-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .footer-meta {
    text-align: left;
  }
}
