:root {
  --paper: #f3efe5;
  --paper-deep: #e7dfcf;
  --ink: #17201d;
  --muted: #66706a;
  --line: #c7c0b3;
  --red: #ba3d2f;
  --navy: #1c2f3f;
  --green: #426c52;
  --white: #fffdfa;
  --serif: "Gowun Batang", serif;
  --sans: "Manrope", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); font-size: 16px; }
a { color: inherit; }
button, textarea { font: inherit; }
button { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.test-strip { display: flex; justify-content: center; align-items: center; gap: 14px; min-height: 38px; padding: 8px 5vw; color: #fff; background: var(--red); font-size: 12px; letter-spacing: .02em; }
.test-strip strong { padding-right: 14px; border-right: 1px solid rgba(255,255,255,.4); font-size: 11px; letter-spacing: .16em; }
.site-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 76px; padding: 0 5vw; border-bottom: 1px solid var(--line); background: rgba(243,239,229,.94); backdrop-filter: blur(12px); }
.brand { display: inline-flex; gap: 7px; align-items: center; font-family: var(--serif); font-size: 20px; font-weight: 700; text-decoration: none; }
.brand-mark { color: var(--red); }
nav { display: flex; gap: 28px; }
nav a { font-size: 13px; font-weight: 700; text-decoration: none; }

main, footer { width: min(1480px, 100%); margin: 0 auto; }
.hero { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(280px,.65fr); gap: clamp(40px,8vw,130px); align-items: end; min-height: 570px; padding: clamp(78px,10vw,145px) 7vw 90px; border-bottom: 1px solid var(--line); }
.eyebrow, .section-index { margin: 0 0 25px; color: var(--red); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.hero h1, h2 { margin: 0; font-family: var(--serif); font-weight: 700; letter-spacing: -.04em; }
.hero h1 { max-width: 880px; font-size: clamp(48px,6.7vw,94px); line-height: 1.08; }
.hero h1 em { color: var(--red); font-style: normal; }
.hero-copy { max-width: 670px; margin: 32px 0; color: #45504b; font-family: var(--serif); font-size: 20px; line-height: 1.8; }
.primary-button { display: inline-flex; align-items: center; gap: 22px; padding: 17px 22px; color: #fff; background: var(--ink); font-size: 13px; font-weight: 800; text-decoration: none; }
.hero-note { padding: 28px 0 0; border-top: 3px solid var(--ink); }
.hero-note .note-number { color: var(--red); font-size: 11px; font-weight: 800; }
.hero-note p { margin: 34px 0 18px; color: var(--muted); font-size: 14px; line-height: 1.8; }
.hero-note strong { font-family: var(--serif); font-size: clamp(24px,2.4vw,36px); line-height: 1.45; }

.workspace-wrap { padding: 110px 5vw; background: var(--white); }
.workspace-heading { display: grid; grid-template-columns: 1fr minmax(260px,420px); gap: 40px; align-items: end; max-width: 1320px; margin: 0 auto 50px; }
.workspace-heading h2, .guide h2, .prototype-note h2, .copyright-note h2 { font-size: clamp(40px,5vw,70px); line-height: 1.12; }
.workspace-heading > p { margin: 0; color: var(--muted); line-height: 1.75; }
.ai-workspace { display: grid; grid-template-columns: minmax(230px,330px) minmax(0,1fr); min-height: 720px; max-width: 1320px; margin: 0 auto; overflow: hidden; border: 1px solid #a9a397; box-shadow: 0 28px 80px rgba(32,39,35,.12); }
.library-panel { background: #eae4d8; border-right: 1px solid #a9a397; }
.panel-label { display: flex; justify-content: space-between; align-items: center; min-height: 78px; padding: 0 24px; border-bottom: 1px solid #a9a397; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.panel-label small { color: var(--muted); font-size: 10px; }
.book-list { padding: 10px; }
.book-option { display: grid; grid-template-columns: 34px 1fr; gap: 10px; width: 100%; padding: 18px 14px; border: 0; border-bottom: 1px solid rgba(105,102,94,.24); background: transparent; text-align: left; cursor: pointer; transition: background .18s,color .18s; }
.book-option:hover { background: rgba(255,255,255,.55); }
.book-option.is-selected { color: #fff; background: var(--navy); }
.book-number { padding-top: 2px; color: var(--red); font-size: 10px; font-weight: 800; }
.book-option.is-selected .book-number { color: #f1a599; }
.book-option strong, .book-option small { display: block; }
.book-option strong { font-family: var(--serif); font-size: 17px; }
.book-option small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.book-option.is-selected small { color: #cbd4d8; }

.chat-panel { display: grid; grid-template-rows: auto 1fr auto; min-width: 0; background: #faf8f3; }
.chat-header { display: flex; justify-content: space-between; gap: 30px; align-items: center; min-height: 116px; padding: 20px 30px; border-bottom: 1px solid #c9c4ba; }
.chat-header small { color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.connection-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #4f9668; box-shadow: 0 0 0 4px rgba(79,150,104,.12); }
.chat-header h3 { margin: 8px 0 2px; font-family: var(--serif); font-size: 27px; }
.chat-header p { margin: 0; color: var(--muted); font-size: 11px; }
.chat-header a { flex: 0 0 auto; color: var(--red); font-size: 11px; font-weight: 800; text-underline-offset: 4px; }
.chat-log { min-height: 380px; max-height: 505px; padding: 36px 30px; overflow-y: auto; }
.message { display: grid; grid-template-columns: 68px minmax(0,1fr); gap: 14px; max-width: 830px; margin-bottom: 30px; }
.message-label { padding-top: 13px; color: var(--red); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.message > div { padding: 17px 19px; border: 1px solid #d6d0c5; background: #fff; }
.message p { margin: 0; font-family: var(--serif); font-size: 17px; line-height: 1.75; }
.message small { display: block; margin-top: 10px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.user-message { margin-left: auto; grid-template-columns: 35px minmax(0,1fr); }
.user-message .message-label { color: var(--navy); }
.user-message > div { color: #fff; border-color: var(--navy); background: var(--navy); }
.message details { margin-top: 14px; padding-top: 13px; border-top: 1px solid #e1ddd5; }
.message summary { color: var(--green); font-size: 11px; font-weight: 800; cursor: pointer; }
.message ul { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.thinking-message i { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: #829087; animation: blink 1s infinite alternate; }
.thinking-message i:nth-child(2) { animation-delay: .2s; }
.thinking-message i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { from { opacity: .2; transform: translateY(2px); } to { opacity: 1; transform: translateY(-2px); } }

.question-form { padding: 24px 30px 20px; border-top: 1px solid #c9c4ba; background: #f0ebe1; }
.question-form label { display: block; margin-bottom: 10px; font-size: 11px; font-weight: 800; }
.input-row { display: grid; grid-template-columns: 1fr auto; border: 1px solid #918b80; background: #fff; }
textarea { width: 100%; min-height: 78px; padding: 16px 18px; resize: none; color: var(--ink); border: 0; outline: 0; background: transparent; font-family: var(--serif); font-size: 16px; line-height: 1.55; }
textarea::placeholder { color: #949a96; }
.input-row button { display: flex; min-width: 120px; flex-direction: column; justify-content: center; align-items: center; gap: 6px; border: 0; color: #fff; background: var(--red); cursor: pointer; }
.input-row button span { font-size: 11px; font-weight: 800; }
.input-row button b { font-size: 20px; }
.input-row button:disabled { opacity: .55; cursor: wait; }
.question-form > p { margin: 8px 0 0; color: var(--muted); font-size: 10px; text-align: right; }

.guide { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(50px,8vw,130px); padding: 110px 7vw; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.guide ol { margin: 0; padding: 0; list-style: none; }
.guide li { display: grid; grid-template-columns: 55px 1fr; gap: 18px; padding: 26px 0; border-top: 1px solid var(--line); }
.guide li:last-child { border-bottom: 1px solid var(--line); }
.guide li > span { color: var(--red); font-size: 11px; font-weight: 800; }
.guide strong { font-family: var(--serif); font-size: 24px; }
.guide li p { margin: 8px 0 0; color: var(--muted); line-height: 1.7; }
.prototype-note, .copyright-note { display: grid; grid-template-columns: .32fr 1fr; gap: 50px; padding: 100px 7vw; }
.prototype-note { color: #f7f2e8; background: var(--navy); }
.prototype-note .section-index { color: #e98b7e; }
.prototype-note > div, .copyright-note > div { max-width: 900px; }
.prototype-note p:last-child, .copyright-note p { margin: 28px 0 0; color: #cdd5d8; font-family: var(--serif); font-size: 18px; line-height: 1.9; }
.copyright-note { background: var(--paper-deep); }
.copyright-note p { color: #56605b; }
.copyright-note a { display: inline-block; margin-top: 25px; color: var(--red); font-size: 12px; font-weight: 800; }
footer { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 30px; align-items: center; min-height: 150px; padding: 30px 5vw; background: var(--ink); color: #fff; }
footer > p { margin: 0; color: #bdc6c1; font-family: var(--serif); text-align: center; }
.footer-status { font-family: var(--sans); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-align: right; }

@media (max-width: 900px) {
  nav { display: none; }
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .hero-note { max-width: 440px; }
  .workspace-heading, .guide { grid-template-columns: 1fr; }
  .ai-workspace { grid-template-columns: 1fr; }
  .library-panel { border-right: 0; border-bottom: 1px solid #a9a397; }
  .book-list { display: grid; grid-template-columns: repeat(2,1fr); }
  .book-option { border-right: 1px solid rgba(105,102,94,.24); }
  .prototype-note, .copyright-note { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .test-strip { align-items: flex-start; gap: 8px; padding: 9px 16px; line-height: 1.5; }
  .test-strip strong { flex: 0 0 auto; }
  .site-header { min-height: 64px; padding: 0 20px; }
  .hero { padding: 70px 22px; }
  .hero h1 { font-size: 45px; }
  .hero-copy { font-size: 17px; }
  .workspace-wrap { padding: 78px 16px; }
  .workspace-heading { margin-bottom: 32px; }
  .workspace-heading h2, .guide h2, .prototype-note h2, .copyright-note h2 { font-size: 39px; }
  .book-list { grid-template-columns: 1fr; max-height: 330px; overflow-y: auto; }
  .ai-workspace { min-height: auto; }
  .chat-header { padding: 18px; }
  .chat-log { min-height: 420px; padding: 26px 16px; }
  .message { grid-template-columns: 1fr; gap: 6px; }
  .message-label { padding: 0; }
  .user-message { grid-template-columns: 1fr; }
  .question-form { padding: 18px 14px; }
  .input-row { grid-template-columns: 1fr; }
  .input-row button { min-height: 52px; flex-direction: row; }
  .guide, .prototype-note, .copyright-note { padding: 78px 22px; }
  footer { grid-template-columns: 1fr; padding: 45px 20px; text-align: center; }
  .footer-status { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
