:root {
  --bg: #070a12;
  --card: rgba(255, 255, 255, 0.06);
  --card-2: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.12);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.72);
  --muted-2: rgba(255, 255, 255, 0.55);
  --accent: #7c5cff;
  --accent-2: #2de2e6;
  --accent-3: #ff3d7f;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 700px at 20% 12%, rgba(124, 92, 255, 0.34), transparent 55%),
    radial-gradient(1000px 700px at 80% 10%, rgba(45, 226, 230, 0.22), transparent 60%),
    radial-gradient(1000px 700px at 50% 95%, rgba(255, 61, 127, 0.14), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 30%),
    var(--bg);
  overflow-x: hidden;
}

.top {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(12px);
  background: rgba(7, 10, 18, 0.68);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.top-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 950;
  letter-spacing: -0.03em;
}

.logo-link {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  text-decoration: none;
  color: inherit;
}

.logo-sub {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.65);
}

.logo-badge {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.22), rgba(45, 226, 230, 0.14));
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.92);
}

.logo-title {
  font-size: 16px;
}

.links {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  justify-content: flex-end;
}

.links-row,
.links-sub {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.pill {
  text-decoration: none;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  padding: 9px 12px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.pill:hover {
  background: rgba(255, 255, 255, 0.1);
}

.pill-primary {
  border-color: rgba(124, 92, 255, 0.32);
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.18), rgba(45, 226, 230, 0.08));
}

.pill-retro {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.10) 0,
      rgba(255, 255, 255, 0.10) 10px,
      rgba(255, 255, 255, 0.04) 10px,
      rgba(255, 255, 255, 0.04) 20px
    );
  border: 1px dashed rgba(255, 255, 255, 0.40);
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.35);
  transform: translateY(-1px);
  font-family: ui-serif, Georgia, "Times New Roman", Times, serif;
  letter-spacing: 0.01em;
}

.pill-retro:hover {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.14) 0,
      rgba(255, 255, 255, 0.14) 10px,
      rgba(255, 255, 255, 0.06) 10px,
      rgba(255, 255, 255, 0.06) 20px
    );
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 14px 40px;
}

.hero {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  box-shadow: var(--shadow);
  border-radius: 22px;
  padding: 18px 18px 16px;
  position: relative;
  overflow: hidden;
  max-width: 980px;
  margin: 0 auto;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -120px -120px auto auto;
  width: 260px;
  height: 260px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, rgba(45, 226, 230, 0.55), transparent 60%);
  filter: blur(2px);
  opacity: 0.65;
}

.hero-title {
  margin: 0;
  font-size: clamp(26px, 4vw, 48px);
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.hero-sub {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 70ch;
  font-weight: 650;
  line-height: 1.5;
}

.grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.panel {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  max-width: 980px;
  margin: 0 auto;
}

.panel-header {
  padding: 12px 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.panel-header strong {
  letter-spacing: -0.02em;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 850;
  cursor: pointer;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.page-input {
  width: 90px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.25);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 800;
}

.book-wrap {
  padding: 14px;
}

.book-frame {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.2);
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.55);
  position: relative;
  overflow: hidden;
  max-width: 560px;
  margin: 0 auto;
}

.book-glow {
  position: absolute;
  inset: -2px;
  pointer-events: none;
  background:
    radial-gradient(900px 320px at 25% 10%, rgba(124, 92, 255, 0.18), transparent 60%),
    radial-gradient(900px 320px at 75% 20%, rgba(45, 226, 230, 0.14), transparent 60%),
    radial-gradient(900px 320px at 40% 90%, rgba(255, 61, 127, 0.12), transparent 60%);
}

#book {
  width: 100%;
  height: 720px;
}

.page img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #ffffff;
}

.side {
  padding: 12px;
}

.callout {
  padding: 12px 12px 10px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.22);
}

.callout-title {
  font-weight: 950;
  letter-spacing: -0.02em;
  margin: 0;
}

.callout p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
  font-weight: 650;
}

.small {
  margin-top: 10px;
  color: var(--muted-2);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 650;
}

.dialog {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(7, 10, 18, 0.96);
  color: var(--text);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.75);
  max-width: min(1100px, 94vw);
  width: 1100px;
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
}

.dialog-header {
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dialog-title {
  font-weight: 950;
  letter-spacing: -0.02em;
}

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

.thumb {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  padding: 8px;
  cursor: pointer;
  color: var(--text);
}

.thumb:hover {
  background: rgba(255, 255, 255, 0.08);
}

.thumb img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  background: rgba(255, 255, 255, 0.04);
}

.thumb-label {
  margin-top: 8px;
  font-weight: 850;
  font-size: 12px;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.82);
}

.page-dialog {
  width: min(1200px, 96vw);
  max-width: min(1200px, 96vw);
}

.color-wrap {
  padding: 12px;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 12px;
  align-items: start;
}

.color-tools {
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tool-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 900;
}

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

.swatch {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  height: 26px;
  cursor: pointer;
}

.swatch-active {
  outline: 2px solid rgba(45, 226, 230, 0.8);
  outline-offset: 2px;
}

.tool-muted {
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 650;
}

.canvas-stage {
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  padding: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
}

#colorCanvas {
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  touch-action: none;
}

.color-nav {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.page-select {
  appearance: none;
  -webkit-appearance: none;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.25);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 850;
  padding: 10px 12px;
  max-width: 260px;
}

.transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(1200px 800px at 10% 10%, rgba(124, 92, 255, 0.75), transparent 55%),
    radial-gradient(1200px 800px at 90% 20%, rgba(45, 226, 230, 0.55), transparent 60%),
    radial-gradient(1200px 800px at 50% 92%, rgba(255, 61, 127, 0.35), transparent 60%),
    rgba(0, 0, 0, 0.85);
  transform: translateY(12px) scale(0.98);
  transition: opacity 360ms ease, transform 360ms ease;
}

.transition-overlay.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@media (max-width: 980px) {
  .color-wrap {
    grid-template-columns: 1fr;
  }
  #book {
    height: 640px;
  }
}

@media (max-width: 720px) {
  .links {
    align-items: flex-start;
  }
  .links-row,
  .links-sub {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .transition-overlay {
    transition: none;
  }
}
