:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef2ff;
  color: #172033;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --ink-muted: #64748b;
  --brand: #4f46e5;
  --brand-strong: #312e81;
  --ring: rgba(79, 70, 229, 0.28);
  --shadow: 0 24px 80px rgba(30, 41, 59, 0.16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(129, 140, 248, 0.34), transparent 32rem),
    radial-gradient(circle at 75% 10%, rgba(45, 212, 191, 0.24), transparent 26rem),
    linear-gradient(135deg, #f8fafc 0%, #eef2ff 52%, #e0f2fe 100%);
}

button,
input { font: inherit; }

code {
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 0.5rem;
  background: rgba(99, 102, 241, 0.08);
  padding: 0.08rem 0.35rem;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.hero {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 32px;
  background: linear-gradient(135deg, rgba(255,255,255,.92), rgba(255,255,255,.62));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.nav,
.hero-grid,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav {
  padding: 22px 28px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.nav a {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  color: white;
}

.hero-grid {
  align-items: stretch;
  padding: 44px 34px 38px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--brand);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  max-width: 800px;
  margin: 0;
  color: #0f172a;
  font-size: clamp(2.4rem, 6vw, 5.35rem);
  line-height: 0.94;
  letter-spacing: -0.075em;
}

.hero-copy {
  max-width: 690px;
  margin: 24px 0 0;
  color: #475569;
  font-size: 1.08rem;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 30px;
}

.primary-action,
.secondary-button,
.ghost-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  padding: 0 22px;
  cursor: pointer;
  font-weight: 900;
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.primary-action {
  background: linear-gradient(135deg, #4f46e5, #0891b2);
  color: white;
  box-shadow: 0 16px 35px rgba(79, 70, 229, 0.3);
}

.primary-action input { display: none; }
.secondary-button { background: #0f172a; color: white; }
.ghost-button { border: 1px solid rgba(79, 70, 229, 0.16); background: white; color: var(--brand); }
.secondary-button:disabled { cursor: not-allowed; opacity: .45; }
.primary-action:hover,
.secondary-button:not(:disabled):hover,
.ghost-button:hover { transform: translateY(-2px); }

.stats-card {
  display: grid;
  min-width: 230px;
  gap: 14px;
}

.stats-card div {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 24px;
  background: rgba(255,255,255,.72);
  padding: 18px;
}

.stats-card span {
  display: block;
  color: var(--brand-strong);
  font-size: 2.2rem;
  font-weight: 950;
}

.stats-card small {
  color: var(--ink-muted);
  font-weight: 800;
}

main { padding-top: 22px; }

.drop-zone {
  border: 2px dashed rgba(79, 70, 229, 0.38);
  border-radius: 28px;
  background: rgba(255,255,255,.62);
  padding: 44px 24px;
  text-align: center;
  outline: none;
  transition: .2s ease;
}

.drop-zone.is-dragging,
.drop-zone:focus-visible {
  border-color: #4f46e5;
  box-shadow: 0 0 0 8px var(--ring);
  transform: translateY(-2px);
}

.drop-icon {
  display: inline-grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 26px;
  background: #eef2ff;
  color: var(--brand);
  font-size: 2.4rem;
  font-weight: 900;
}

.drop-zone h2 { margin: 18px 0 8px; font-size: clamp(1.5rem, 4vw, 2.3rem); }
.drop-zone p { margin: 0; color: var(--ink-muted); }

.toolbar {
  margin: 20px 0;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 24px;
  background: var(--surface);
  padding: 16px;
}

.toolbar div { flex: 1; }
.toolbar label {
  display: block;
  margin: 0 0 6px 4px;
  color: var(--ink-muted);
  font-size: .82rem;
  font-weight: 900;
}

.toolbar input {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 16px;
  padding: 14px 16px;
  outline: none;
}

.toolbar input:focus { box-shadow: 0 0 0 5px var(--ring); border-color: var(--brand); }

.message-log {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.message {
  margin: 0;
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255,255,255,.7);
  color: #475569;
}

.message.success { color: #047857; background: rgba(209, 250, 229, .72); }
.message.warning { color: #92400e; background: rgba(254, 243, 199, .8); }
.message.error { color: #b91c1c; background: rgba(254, 226, 226, .8); }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 22px;
}

.page-card {
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 28px;
  background: var(--surface-strong);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.1);
}

.page-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  padding: 16px;
}

.page-meta h3 { margin: 3px 0 4px; font-size: 1.05rem; }
.notebook,
.page-id { margin: 0; color: var(--ink-muted); font-size: .8rem; font-weight: 800; }

.download-link {
  align-self: start;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--brand);
  padding: 8px 12px;
  font-size: .8rem;
  font-weight: 900;
  text-decoration: none;
}

.preview-frame {
  height: 420px;
  overflow: auto;
  background:
    linear-gradient(45deg, rgba(148,163,184,.16) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148,163,184,.16) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148,163,184,.16) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148,163,184,.16) 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
  padding: 18px;
}

.preview-frame svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin: auto;
  background: white;
  box-shadow: 0 8px 25px rgba(15, 23, 42, .14);
}

@media (max-width: 760px) {
  .hero-grid,
  .toolbar,
  .nav { flex-direction: column; align-items: stretch; }
  .hero-grid { padding: 30px 22px; }
  .stats-card { grid-template-columns: repeat(3, 1fr); min-width: 0; }
  .stats-card div { padding: 12px; }
  .stats-card span { font-size: 1.55rem; }
}
