/* ============================================================
   모아 — AI 독서토론 도우미
   공통 스타일: 랜딩 / 대화 / 생각정리카드 / 인쇄
   ============================================================ */

@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");

:root {
  /* 팔레트 — 도서관의 따뜻한 종이와 잉크 */
  --paper: #fbf7f0;
  --paper-2: #f5efe3;
  --card: #fffdf9;
  --ink: #22201c;
  --ink-soft: #5b564d;
  --ink-mute: #8a8377;
  --line: #e6ddcd;
  --line-strong: #d3c7b2;

  --teal: #186f65;
  --teal-deep: #0f5250;
  --teal-soft: #e3f0ec;
  --amber: #f0a92e;
  --amber-soft: #fdf1d8;
  --coral: #d9634a;
  --coral-soft: #fbe6e0;
  --violet: #6b5bd2;

  --radius-s: 10px;
  --radius: 16px;
  --radius-l: 26px;

  --shadow-s: 0 1px 2px rgba(34, 32, 28, 0.05), 0 4px 12px rgba(34, 32, 28, 0.05);
  --shadow: 0 2px 6px rgba(34, 32, 28, 0.06), 0 14px 34px rgba(34, 32, 28, 0.08);
  --shadow-l: 0 8px 20px rgba(34, 32, 28, 0.08), 0 30px 60px rgba(34, 32, 28, 0.12);

  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --font-serif: "Nanum Myeongjo", "Apple SD Gothic Neo", Georgia, serif;

  --wrap: 1120px;
  --header-h: 68px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(circle at 12% 8%, rgba(240, 169, 46, 0.1), transparent 42%),
    radial-gradient(circle at 88% 4%, rgba(24, 111, 101, 0.09), transparent 40%);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-wrap: break-word;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.02em;
  font-weight: 800;
}

p {
  margin: 0;
}

a {
  color: var(--teal-deep);
  text-decoration-color: rgba(24, 111, 101, 0.35);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: currentColor;
}

img,
svg {
  max-width: 100%;
  display: block;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

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

button {
  cursor: pointer;
  border: 0;
  background: none;
}

:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 2px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 50%;
  top: -100px;
  transform: translateX(-50%);
  z-index: 200;
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-s);
  transition: top 0.2s;
}

.skip-link:focus {
  top: 10px;
}

/* ---------- 공통 레이아웃 ---------- */
.wrap {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
}

@media (max-width: 640px) {
  .wrap {
    width: min(100% - 2rem, var(--wrap));
  }
}

.section {
  padding: clamp(3rem, 7vw, 5.5rem) 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--teal);
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  background: var(--amber);
  border-radius: 2px;
}

.section-title {
  font-size: clamp(1.55rem, 4vw, 2.35rem);
  margin: 0.6rem 0 0.85rem;
}

.section-lead {
  color: var(--ink-soft);
  font-size: clamp(0.98rem, 2.2vw, 1.06rem);
  max-width: 62ch;
}

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.98rem;
  line-height: 1.2;
  text-decoration: none;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background-color 0.14s ease,
    color 0.14s ease, border-color 0.14s ease;
  border: 2px solid transparent;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--teal-deep);
  color: #fff;
  box-shadow: 0 6px 0 rgba(15, 82, 80, 0.22);
}

.btn--primary:hover {
  background: #0b403e;
  box-shadow: 0 6px 0 rgba(15, 82, 80, 0.3);
}

.btn--amber {
  background: var(--amber);
  color: #3a2a06;
  box-shadow: 0 6px 0 rgba(198, 132, 17, 0.32);
}

.btn--amber:hover {
  background: #f5b747;
}

.btn--ghost {
  background: var(--card);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn--ghost:hover {
  border-color: var(--teal);
  color: var(--teal-deep);
  background: #fff;
}

.btn--quiet {
  padding: 0.55rem 0.95rem;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--paper-2);
}

.btn--quiet:hover {
  color: var(--ink);
  background: var(--line);
}

.btn--sm {
  padding: 0.6rem 1.05rem;
  font-size: 0.88rem;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ---------- 헤더 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(251, 247, 240, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(230, 221, 205, 0.85);
}

.site-header__inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--ink);
}

.brand__mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--teal-deep);
  color: var(--amber);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.24);
}

.brand__mark svg {
  width: 21px;
  height: 21px;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand__name {
  font-weight: 900;
  font-size: 1.06rem;
  letter-spacing: -0.01em;
}

.brand__sub {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.35rem;
}

.nav a {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-decoration: none;
}

.nav a:hover {
  color: var(--teal-deep);
}

@media (max-width: 860px) {
  .nav a:not(.btn) {
    display: none;
  }
}

/* ---------- 히어로 ---------- */
.hero {
  padding: clamp(2.5rem, 6vw, 4.6rem) 0 clamp(2.5rem, 5vw, 4rem);
}

.hero__grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

@media (max-width: 940px) {
  .hero__grid {
    grid-template-columns: 1fr;
    gap: 2.6rem;
  }
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--teal-soft);
  color: var(--teal-deep);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(24, 111, 101, 0.18);
}

.hero h1 {
  font-size: clamp(2.1rem, 5.6vw, 3.5rem);
  margin: 1.1rem 0 0;
  letter-spacing: -0.035em;
  line-height: 1.18;
}

.hero h1 em {
  font-style: normal;
  position: relative;
  color: var(--teal-deep);
  z-index: 0;
}

.hero h1 em::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  bottom: 0.06em;
  height: 0.34em;
  background: var(--amber);
  opacity: 0.5;
  border-radius: 4px;
  z-index: -1;
}

.hero__desc {
  margin-top: 1.2rem;
  font-size: clamp(1rem, 2.4vw, 1.1rem);
  color: var(--ink-soft);
  max-width: 40ch;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.9rem;
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  margin-top: 1.6rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-mute);
  list-style: none;
}

.hero__meta li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.hero__meta svg {
  width: 15px;
  height: 15px;
  color: var(--teal);
}

/* 히어로 오른쪽: 대화 미리보기 카드 */
.preview-stack {
  position: relative;
  padding: 0.6rem;
}

.preview-stack::before {
  content: "";
  position: absolute;
  inset: 6% 2% -1% 6%;
  background: var(--amber-soft);
  border: 2px solid var(--amber);
  border-radius: var(--radius-l);
  transform: rotate(-2.4deg);
  z-index: 0;
  opacity: 0.85;
}

.chat-preview {
  position: relative;
  z-index: 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-l);
  overflow: hidden;
}

.chat-preview__head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fffdf9, var(--paper-2));
}

.chat-preview__head strong {
  font-size: 0.92rem;
}

.chat-preview__head span {
  display: block;
  font-size: 0.72rem;
  color: var(--ink-mute);
  font-weight: 600;
}

.chat-preview__body {
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  background: repeating-linear-gradient(
    180deg,
    transparent 0 37px,
    rgba(230, 221, 205, 0.5) 37px 38px
  );
}

.bubble {
  max-width: 88%;
  padding: 0.68rem 0.95rem;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.6;
  box-shadow: var(--shadow-s);
}

.bubble--ai {
  align-self: flex-start;
  background: var(--teal-soft);
  border: 1px solid rgba(24, 111, 101, 0.16);
  border-bottom-left-radius: 5px;
  color: #123f3a;
}

.bubble--me {
  align-self: flex-end;
  background: var(--amber-soft);
  border: 1px solid rgba(240, 169, 46, 0.4);
  border-bottom-right-radius: 5px;
  color: #5b3f06;
}

.bubble--small {
  font-size: 0.8rem;
  opacity: 0.92;
}

/* ---------- 아바타 ---------- */
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-weight: 900;
  font-size: 0.82rem;
  background: var(--teal-deep);
  color: var(--amber);
}

.avatar--sm {
  width: 26px;
  height: 26px;
  font-size: 0.68rem;
}

/* ---------- 문제/기능 카드 ---------- */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.15rem;
  margin-top: 2.4rem;
}

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-s);
}

.card--problem .card__num {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--coral);
  letter-spacing: 0.06em;
}

.card h3 {
  font-size: 1.08rem;
  margin: 0.55rem 0 0.55rem;
}

.card p {
  color: var(--ink-soft);
  font-size: 0.94rem;
  line-height: 1.72;
}

.card__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--teal-soft);
  color: var(--teal-deep);
  margin-bottom: 0.9rem;
}

.card__icon svg {
  width: 21px;
  height: 21px;
}

.card__icon--amber {
  background: var(--amber-soft);
  color: #96650a;
}

.card__icon--coral {
  background: var(--coral-soft);
  color: #a33a24;
}

/* 인용 블록 */
.quote-band {
  background: var(--teal-deep);
  color: #eaf3ef;
  border-radius: var(--radius-l);
  padding: clamp(2rem, 5vw, 3.4rem);
  position: relative;
  overflow: hidden;
}

.quote-band::after {
  content: "";
  position: absolute;
  right: -60px;
  bottom: -70px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgba(240, 169, 46, 0.16);
}

.quote-band blockquote {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 3.4vw, 1.85rem);
  line-height: 1.6;
  font-weight: 700;
  max-width: 30ch;
  position: relative;
  z-index: 1;
}

.quote-band p {
  margin-top: 1.1rem;
  color: rgba(234, 243, 239, 0.75);
  font-size: 0.95rem;
  max-width: 46ch;
  position: relative;
  z-index: 1;
}

/* ---------- 단계 안내 ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 2.4rem;
  list-style: none;
  counter-reset: step;
}

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

.steps li {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.4rem 1.5rem;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  top: -14px;
  left: 1.3rem;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--amber);
  color: #3a2a06;
  font-weight: 900;
  font-size: 0.9rem;
  display: grid;
  place-items: center;
  border: 3px solid var(--paper);
}

.steps h3 {
  margin-top: 0.45rem;
  font-size: 1.02rem;
}

.steps p {
  margin-top: 0.45rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* 6단계 흐름 칩 */
.flow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.8rem;
  list-style: none;
}

.flow li {
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0.42rem 0.9rem;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
}

.flow li span {
  color: var(--teal);
  margin-right: 0.3rem;
  font-weight: 900;
}

/* ---------- 시작 폼 ---------- */
.start-panel {
  margin-top: 2.2rem;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  overflow: hidden;
}

@media (max-width: 900px) {
  .start-panel {
    grid-template-columns: 1fr;
  }
}

.start-form {
  padding: clamp(1.5rem, 4vw, 2.4rem);
}

.field {
  margin-bottom: 1.35rem;
}

.field label,
.field .label {
  display: block;
  font-weight: 800;
  font-size: 0.92rem;
  margin-bottom: 0.5rem;
}

.field .hint {
  display: block;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--ink-mute);
  margin-top: 0.4rem;
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border-radius: var(--radius-s);
  border: 2px solid var(--line-strong);
  background: #fff;
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder,
.textarea::placeholder {
  color: #b3a999;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(24, 111, 101, 0.12);
  outline: none;
}

.textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.65;
}

.segmented {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.62rem 1.05rem;
  border-radius: 999px;
  border: 2px solid var(--line-strong);
  background: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink-soft);
  cursor: pointer;
  margin: 0;
  transition: all 0.15s ease;
}

.segmented input:checked + label {
  background: var(--teal-soft);
  border-color: var(--teal);
  color: var(--teal-deep);
  font-weight: 800;
}

.segmented input:focus-visible + label {
  outline: 3px solid var(--violet);
  outline-offset: 2px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.chip {
  padding: 0.38rem 0.8rem;
  border-radius: 999px;
  background: var(--paper-2);
  border: 1px dashed var(--line-strong);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
  transition: all 0.15s ease;
}

.chip:hover {
  background: var(--amber-soft);
  border-color: var(--amber);
  color: #6b4a08;
}

.start-aside {
  background: var(--teal-deep);
  color: #eaf3ef;
  padding: clamp(1.5rem, 4vw, 2.4rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  overflow: hidden;
}

.start-aside::after {
  content: "";
  position: absolute;
  left: -40px;
  top: -50px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: rgba(240, 169, 46, 0.14);
}

.start-aside h3 {
  font-size: 1.1rem;
  position: relative;
  z-index: 1;
}

.start-aside ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  position: relative;
  z-index: 1;
}

.start-aside li {
  display: flex;
  gap: 0.7rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: rgba(234, 243, 239, 0.9);
}

.start-aside li strong {
  color: #fff;
  display: block;
  font-size: 0.92rem;
}

.start-aside li svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin-top: 3px;
  color: var(--amber);
}

.privacy-note {
  margin-top: auto;
  font-size: 0.78rem;
  line-height: 1.6;
  color: rgba(234, 243, 239, 0.62);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: 1rem;
  position: relative;
  z-index: 1;
}

/* ---------- 최근 기록 ---------- */
.records-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.record-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1.8rem;
}

.record-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow-s);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.record-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.record-card__book {
  font-weight: 900;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.record-card__book svg {
  width: 16px;
  height: 16px;
  color: var(--teal);
  flex: 0 0 auto;
}

.record-card__sentence {
  font-family: var(--font-serif);
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.record-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--ink-mute);
  font-weight: 700;
}

.tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-deep);
}

.tag--amber {
  background: var(--amber-soft);
  color: #8a5c06;
}

.empty-state {
  margin-top: 1.8rem;
  padding: 2rem;
  text-align: center;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink-mute);
  font-size: 0.92rem;
  background: rgba(255, 253, 249, 0.6);
}

/* ---------- 기대효과 ---------- */
.benefit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-top: 2.2rem;
  list-style: none;
}

.benefit-grid li {
  padding: 1.3rem;
  border-radius: var(--radius);
  background: linear-gradient(160deg, #fffdf9, var(--paper-2));
  border: 1px solid var(--line);
}

.benefit-grid strong {
  display: block;
  font-size: 0.98rem;
  margin-bottom: 0.4rem;
}

.benefit-grid p {
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* ---------- 푸터 ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 2.4rem 0 3rem;
  margin-top: 3rem;
  background: rgba(245, 239, 227, 0.5);
}

.site-footer__inner {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: flex-start;
}

.site-footer p {
  font-size: 0.84rem;
  color: var(--ink-mute);
  line-height: 1.7;
  max-width: 46ch;
}

.site-footer .small-links {
  display: flex;
  gap: 1rem;
  font-size: 0.84rem;
  font-weight: 700;
}

/* ============================================================
   대화 화면 (discuss.html)
   ============================================================ */
.discuss-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.discuss-main {
  flex: 1;
  padding: 1.6rem 0 2.5rem;
}

.discuss-shell {
  width: min(100% - 2.5rem, 900px);
  margin-inline: auto;
}

@media (max-width: 640px) {
  .discuss-shell {
    width: min(100% - 1.6rem, 900px);
  }
}

/* 진행 표시 */
.progress-bar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1.15rem;
  box-shadow: var(--shadow-s);
  margin-bottom: 1rem;
}

.progress-bar__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.7rem;
}

.progress-bar__book {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 0.92rem;
  min-width: 0;
}

.progress-bar__book span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 34ch;
}

.progress-bar__book svg {
  width: 16px;
  height: 16px;
  color: var(--teal);
  flex: 0 0 auto;
}

.progress-bar__count {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--ink-mute);
  white-space: nowrap;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--paper-2);
  overflow: hidden;
  display: flex;
  gap: 3px;
}

.progress-track span {
  flex: 1;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background-color 0.3s ease;
}

.progress-track span.is-done {
  background: var(--teal);
}

.progress-track span.is-active {
  background: var(--amber);
}

.step-labels {
  display: flex;
  justify-content: space-between;
  gap: 0.25rem;
  margin-top: 0.5rem;
  list-style: none;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-mute);
  text-align: center;
}

.step-labels li {
  flex: 1;
  min-width: 0;
}

.step-labels li.is-active {
  color: var(--teal-deep);
}

@media (max-width: 600px) {
  .step-labels li span {
    display: none;
  }
}

/* 대화 영역 */
.chat-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-log {
  padding: 1.4rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
  min-height: 380px;
  max-height: min(58vh, 620px);
  overflow-y: auto;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

@media (max-width: 640px) {
  .chat-log {
    padding: 1.1rem 0.9rem;
    min-height: 320px;
    max-height: none;
  }
}

.msg {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  animation: msgIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .msg {
    animation: none;
  }
  html {
    scroll-behavior: auto;
  }
}

.msg--me {
  flex-direction: row-reverse;
}

.msg__body {
  max-width: min(78%, 56ch);
}

@media (max-width: 640px) {
  .msg__body {
    max-width: 84%;
  }
}

.msg__name {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--ink-mute);
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.msg--me .msg__name {
  justify-content: flex-end;
}

.msg__bubble {
  padding: 0.8rem 1rem;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.72;
  background: var(--teal-soft);
  border: 1px solid rgba(24, 111, 101, 0.16);
  border-top-left-radius: 6px;
  color: #143f3a;
  box-shadow: var(--shadow-s);
  white-space: pre-wrap;
}

.msg--me .msg__bubble {
  background: var(--amber-soft);
  border-color: rgba(240, 169, 46, 0.45);
  border-top-left-radius: 18px;
  border-top-right-radius: 6px;
  color: #4f3708;
}

.msg__bubble strong {
  font-weight: 800;
  color: var(--teal-deep);
  background: linear-gradient(180deg, transparent 62%, rgba(240, 169, 46, 0.45) 62%);
}

.msg__bubble .bubble-lead {
  display: block;
  font-weight: 800;
  margin-bottom: 0.3rem;
}

.msg__meta {
  font-size: 0.72rem;
  color: var(--ink-mute);
  margin-top: 0.35rem;
  font-weight: 600;
}

.msg--me .msg__meta {
  text-align: right;
}

/* 타이핑 표시 */
.typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 0.9rem 1.05rem;
}

.typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  opacity: 0.5;
  animation: typing 1.1s infinite ease-in-out;
}

.typing i:nth-child(2) {
  animation-delay: 0.16s;
}

.typing i:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* 입력 영역 */
.composer {
  border-top: 1px solid var(--line);
  padding: 1rem 1.2rem 1.15rem;
  background: linear-gradient(180deg, #fffdf9, var(--paper-2));
}

@media (max-width: 640px) {
  .composer {
    padding: 0.85rem;
  }
}

.composer__row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-end;
}

.composer textarea {
  flex: 1;
  resize: none;
  min-height: 56px;
  max-height: 180px;
  padding: 0.8rem 0.95rem;
  border-radius: 14px;
  border: 2px solid var(--line-strong);
  background: #fff;
  font-size: 1rem;
  line-height: 1.6;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.composer textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(24, 111, 101, 0.12);
  outline: none;
}

.composer__send {
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: var(--teal-deep);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 0 rgba(15, 82, 80, 0.28);
  transition: background-color 0.15s ease, transform 0.12s ease;
}

.composer__send:hover:not(:disabled) {
  background: #0b403e;
}

.composer__send:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(15, 82, 80, 0.28);
}

.composer__send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.composer__send svg {
  width: 22px;
  height: 22px;
}

.composer__tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.7rem;
}

.composer__hint {
  font-size: 0.76rem;
  color: var(--ink-mute);
  font-weight: 600;
  margin-left: auto;
  text-align: right;
}

@media (max-width: 640px) {
  .composer__hint {
    display: none;
  }
}

/* 도움말 카드 */
.help-card {
  margin-top: 0.7rem;
  background: var(--amber-soft);
  border: 1px solid rgba(240, 169, 46, 0.5);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  animation: msgIn 0.28s ease both;
}

.help-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.help-card__head strong {
  font-size: 0.88rem;
  color: #6b4a08;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.help-card__head svg {
  width: 16px;
  height: 16px;
}

.help-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.help-card li button {
  width: 100%;
  text-align: left;
  font-size: 0.88rem;
  line-height: 1.6;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(240, 169, 46, 0.55);
  color: #55400f;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.help-card li button:hover {
  background: #fffaf0;
  border-color: var(--amber);
}

/* 단계 요약 배너 */
.stage-note {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  background: var(--teal-soft);
  border-left: 4px solid var(--teal);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  padding: 0.7rem 0.9rem;
  font-size: 0.84rem;
  color: #14514a;
  line-height: 1.6;
  margin-bottom: 0.3rem;
}

.stage-note svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 3px;
}

/* 결과 카드 */
.result-wrap {
  animation: msgIn 0.4s ease both;
}

.result-card {
  background: linear-gradient(180deg, #fffdf9, #fdf8ee);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-l);
  padding: clamp(1.4rem, 4vw, 2.4rem);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.result-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: linear-gradient(90deg, var(--teal), var(--amber) 55%, var(--coral));
}

.result-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.3rem;
}

.result-card__title {
  font-size: clamp(1.3rem, 3.6vw, 1.75rem);
}

.result-card__book {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--teal-deep);
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.result-card__book svg {
  width: 15px;
  height: 15px;
}

.result-section {
  padding: 1.1rem 0;
  border-top: 1px dashed var(--line-strong);
}

.result-section:first-of-type {
  border-top: 0;
}

.result-section h3 {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.result-section h3 svg {
  width: 15px;
  height: 15px;
  color: var(--amber);
}

.result-sentence {
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 2.8vw, 1.24rem);
  line-height: 1.7;
  font-weight: 700;
  color: var(--ink);
  padding: 0.9rem 1.1rem;
  background: #fff;
  border-radius: var(--radius-s);
  border: 1px solid var(--line);
}

.result-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.result-list li {
  display: flex;
  gap: 0.55rem;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--ink-soft);
}

.result-list li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  flex: 0 0 auto;
  margin-top: 0.55rem;
}

.keyword-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.keyword {
  font-size: 0.86rem;
  font-weight: 800;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-deep);
  border: 1px solid rgba(24, 111, 101, 0.2);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 700;
  padding: 0.7rem 1.15rem;
  border-radius: 999px;
  box-shadow: var(--shadow-l);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 300;
  max-width: calc(100% - 2rem);
  text-align: center;
}

.toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 확인 대화상자 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background: rgba(34, 32, 28, 0.45);
  backdrop-filter: blur(3px);
}

.modal[hidden] {
  display: none;
}

.modal__box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.6rem;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-l);
}

.modal__box h2 {
  font-size: 1.1rem;
  margin-bottom: 0.6rem;
}

.modal__box p {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-bottom: 1.3rem;
}

.modal__actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
}

/* ============================================================
   인쇄 / PDF
   ============================================================ */
@media print {
  body {
    background: #fff;
    font-size: 12pt;
  }

  .site-header,
  .site-footer,
  .composer,
  .progress-bar,
  .help-card,
  .result-actions,
  .toast,
  .no-print {
    display: none !important;
  }

  .discuss-main,
  .chat-panel,
  .result-card {
    padding: 0;
    border: 0;
    box-shadow: none;
    background: #fff;
  }

  .chat-log {
    max-height: none;
    overflow: visible;
    padding: 0;
    gap: 10pt;
  }

  .result-card::before {
    display: none;
  }

  .result-sentence {
    border: 1px solid #ccc;
  }

  .msg__bubble {
    box-shadow: none;
    border: 1px solid #ddd;
    background: #fff !important;
    color: #000 !important;
  }

  .msg {
    break-inside: avoid;
  }

  a {
    color: #000;
  }
}
