:root {
  --ink: #1c1712;
  --ink-soft: #4a4036;
  --paper: #f3eadc;
  --cream: #faf6ee;
  --gold: #b8894a;
  --gold-2: #d4b483;
  --wine: #7a2e2e;
  --line: rgba(28, 23, 18, 0.12);
  --shadow: 0 24px 60px rgba(28, 23, 18, 0.18);
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", Tahoma, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #e8d3a8 0%, transparent 55%),
    radial-gradient(900px 400px at 110% 0%, #c9b496 0%, transparent 50%),
    linear-gradient(180deg, #d8cbb6 0%, #cbbba4 100%);
}

button,
input,
textarea {
  font-family: inherit;
}

button {
  cursor: pointer;
}

::selection {
  background: #e8c98a;
}

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(160deg, #8b3b2e, #1c1712);
  color: var(--cream);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(28, 23, 18, 0.25);
}

.brand h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.2rem;
}

.brand p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.chip {
  border: 1px solid var(--line);
  background: rgba(250, 246, 238, 0.7);
  color: var(--ink-soft);
  font-size: 0.75rem;
  padding: 8px 12px;
  border-radius: 999px;
}

.landing {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 12px 20px 48px;
}

.hero {
  width: min(920px, 100%);
  background: var(--cream);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}

.hero-copy {
  padding: 48px 40px 40px;
}

.eyebrow {
  color: var(--wine);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 600;
  margin: 0 0 12px;
}

.hero-copy h2 {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.12;
  margin: 0 0 16px;
}

.hero-copy h2 em {
  font-style: italic;
  color: #6b4420;
}

.lede {
  margin: 0 0 28px;
  color: var(--ink-soft);
  line-height: 1.6;
  max-width: 38ch;
}

.drop {
  border: 1.5px dashed rgba(184, 137, 74, 0.7);
  background: linear-gradient(180deg, #fffaf1, var(--paper));
  border-radius: 18px;
  padding: 28px 22px;
  text-align: center;
}

.drop.active {
  border-color: var(--wine);
  background: #fff6e6;
}

.drop strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.15rem;
  margin-bottom: 6px;
}

.drop span {
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.file-btn {
  margin-top: 16px;
  background: var(--ink);
  color: var(--cream);
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 500;
}

.ghost {
  margin-top: 10px;
  background: transparent;
  border: 0;
  color: var(--wine);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.hidden-input {
  display: none;
}

.error {
  color: var(--wine);
  font-size: 0.85rem;
  margin: 12px 0 0;
}

.status {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.cover {
  background:
    linear-gradient(165deg, rgba(28, 23, 18, 0.08), transparent 40%),
    repeating-linear-gradient(90deg, #3a2418 0 14px, #2a1810 14px 16px);
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 28px;
}

.book-3d {
  width: min(260px, 70%);
  aspect-ratio: 3 / 4.2;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.28) 0 12px, transparent 12px),
    linear-gradient(160deg, #7a2e2e, #2b1610);
  color: #f4e6c8;
  border-radius: 4px 12px 12px 4px;
  padding: 28px 22px 22px 32px;
  box-shadow: 14px 18px 40px rgba(28, 23, 18, 0.35);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.book-3d small {
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.7;
  font-size: 0.62rem;
}

.book-3d b {
  font-family: var(--serif);
  font-size: 1.55rem;
  line-height: 1.2;
}

.book-3d i {
  font-style: italic;
  opacity: 0.8;
  font-size: 0.88rem;
}

.studio {
  flex: 1;
  display: grid;
  grid-template-columns: 240px 1fr 360px;
  gap: 14px;
  padding: 0 18px 18px;
  min-height: 0;
}

.panel {
  background: var(--cream);
  border-radius: 22px;
  box-shadow: 0 10px 28px rgba(28, 23, 18, 0.12);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel h3 {
  margin: 0;
  padding: 16px 18px 10px;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.meta {
  padding: 0 18px 12px;
}

.meta strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.05rem;
}

.meta span {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.chapters {
  overflow: auto;
  padding: 0 10px 14px;
}

.chapters button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 10px;
  color: var(--ink);
}

.chapters button:hover,
.chapters button.active {
  background: var(--paper);
}

.chapters button.active {
  box-shadow: inset 3px 0 0 var(--gold);
}

.chapters em {
  display: block;
  font-style: normal;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.reset {
  margin: auto 12px 12px;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 12px;
  padding: 10px;
}

.reader {
  padding: 28px 36px 40px;
  overflow: auto;
}

.reader header {
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  padding-bottom: 14px;
}

.reader header p {
  margin: 0;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--gold);
}

.reader h2 {
  font-family: var(--serif);
  font-size: 1.7rem;
  margin: 6px 0 0;
}

.prose {
  font-family: var(--serif);
  font-size: 1.12rem;
  line-height: 1.85;
  white-space: pre-wrap;
  max-width: 62ch;
}

.chat {
  background: linear-gradient(180deg, #1f1a16, #161210);
  color: #f3eadc;
}

.chat h3 {
  color: #d4b483;
}

.thread {
  flex: 1;
  overflow: auto;
  padding: 8px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bubble {
  max-width: 92%;
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.bubble.assistant {
  background: rgba(243, 234, 220, 0.08);
  border: 1px solid rgba(212, 180, 131, 0.2);
}

.bubble.user {
  margin-left: auto;
  background: #b8894a;
  color: #1c1712;
}

.composer {
  padding: 12px;
  border-top: 1px solid rgba(243, 234, 220, 0.08);
  display: grid;
  gap: 8px;
}

.composer textarea {
  resize: none;
  min-height: 74px;
  border-radius: 14px;
  border: 1px solid rgba(243, 234, 220, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: #f3eadc;
  padding: 12px;
}

.send {
  background: var(--gold);
  color: #1c1712;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
}

.send:disabled {
  opacity: 0.5;
}

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

.hint {
  font-size: 0.72rem;
  color: #cbbba4;
}

.prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 8px;
}

.prompts button {
  border: 1px solid rgba(212, 180, 131, 0.28);
  background: transparent;
  color: #e8d3a8;
  border-radius: 999px;
  font-size: 0.72rem;
  padding: 6px 10px;
}

[hidden] {
  display: none !important;
}

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

  .hero-inner {
    grid-template-columns: 1fr;
  }

  .cover {
    display: none;
  }
}
