/* ==========================================================
   톰 리들의 일기장 — 스타일시트
   미학: 어두운 가죽 + 묵은 양피지 + 잉크 번짐
   ========================================================== */

:root {
  /* 색채 — 가죽 / 양피지 / 잉크 */
  --leather-deep: #1a120b;
  --leather-mid: #2c1f14;
  --leather-edge: #0d0805;
  --leather-stitch: #3a2a1a;
  --brass: #8a6a3a;
  --brass-light: #b89556;
  --brass-shine: #d4b06b;

  --parchment-1: #efe3c2;
  --parchment-2: #e6d6ad;
  --parchment-3: #d8c08a;
  --parchment-shadow: #8a6f3e;
  --parchment-stain: #b08542;

  --ink-deep: #1a0e08;
  --ink-mid: #2b1a0e;
  --ink-faded: #5a3a1f;
  --ink-blood: #5e1a14;

  --gold: #b8893a;
  --gold-shine: #e6c073;

  /* 타이포 */
  --f-display: "IM Fell English", "Cormorant Garamond", serif;
  --f-script: "Nanum Pen Script", cursive;
  --f-body: "Nanum Myeongjo", "Cormorant Garamond", serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100vh;
  font-family: var(--f-body);
  color: var(--ink-deep);
  background: var(--leather-edge);
  overflow-x: hidden;
}

body {
  /* 어두운 책상 위 분위기 */
  background:
    radial-gradient(ellipse at 50% 20%, #2a1d10 0%, #14100a 55%, #07050a 100%),
    #14100a;
  background-attachment: fixed;
  position: relative;
  padding: 2rem 1rem 4rem;
}

/* 비네트 */
.bg-vignette {
  position: fixed; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.7) 100%);
  z-index: 1;
}

/* 먼지 입자 텍스처 */
.bg-dust {
  position: fixed; inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(184, 137, 58, 0.08) 1px, transparent 1px),
    radial-gradient(rgba(184, 137, 58, 0.05) 1px, transparent 1px);
  background-size: 80px 80px, 50px 50px;
  background-position: 0 0, 25px 25px;
  z-index: 1;
  opacity: 0.6;
}

/* 떠다니는 잉크 입자 */
.ink-particles {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 2;
}
.ink-particles span {
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20,10,5,0.6), transparent 70%);
  animation: float 22s linear infinite;
  opacity: 0;
}
.ink-particles span:nth-child(1) { left: 8%;  animation-delay: 0s;   animation-duration: 28s; }
.ink-particles span:nth-child(2) { left: 22%; animation-delay: 4s;   animation-duration: 24s; }
.ink-particles span:nth-child(3) { left: 35%; animation-delay: 8s;   animation-duration: 30s; }
.ink-particles span:nth-child(4) { left: 48%; animation-delay: 2s;   animation-duration: 26s; }
.ink-particles span:nth-child(5) { left: 60%; animation-delay: 6s;   animation-duration: 22s; }
.ink-particles span:nth-child(6) { left: 72%; animation-delay: 10s;  animation-duration: 28s; }
.ink-particles span:nth-child(7) { left: 84%; animation-delay: 1s;   animation-duration: 26s; }
.ink-particles span:nth-child(8) { left: 92%; animation-delay: 5s;   animation-duration: 24s; }
.ink-particles span:nth-child(9) { left: 15%; animation-delay: 12s;  animation-duration: 30s; }
.ink-particles span:nth-child(10){ left: 65%; animation-delay: 15s;  animation-duration: 28s; }

@keyframes float {
  0%   { transform: translateY(110vh) translateX(0)   scale(0.6); opacity: 0; }
  10%  { opacity: 0.5; }
  50%  { transform: translateY(50vh)  translateX(20px) scale(1.0); opacity: 0.7; }
  90%  { opacity: 0.4; }
  100% { transform: translateY(-10vh) translateX(-15px) scale(0.4); opacity: 0; }
}

/* 흔들리는 촛불 빛 */
.candle-glow {
  position: fixed;
  bottom: -120px;
  right: -120px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(255,180,90,0.18) 0%, rgba(255,150,60,0.08) 30%, transparent 70%);
  pointer-events: none;
  z-index: 1;
  animation: candleFlicker 4s ease-in-out infinite;
}
@keyframes candleFlicker {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50%      { opacity: 1.0;  transform: scale(1.05); }
  72%      { opacity: 0.7;  transform: scale(0.97); }
}

/* ==============================
   헤더
   ============================== */
.masthead {
  position: relative;
  z-index: 5;
  text-align: center;
  padding: 1rem 1rem 2.5rem;
  color: var(--brass-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
.masthead-mark {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 0.95rem;
  letter-spacing: 0.5em;
  color: var(--brass);
  opacity: 0.8;
}
.masthead-title {
  font-family: var(--f-display);
  font-weight: 400;
  letter-spacing: 0.04em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  line-height: 1;
}
.title-script {
  font-family: var(--f-script);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  color: var(--gold-shine);
  text-shadow: 0 2px 12px rgba(184, 137, 58, 0.3);
  font-style: normal;
  letter-spacing: 0.02em;
}
.title-sub {
  font-family: var(--f-display);
  font-size: 0.8rem;
  letter-spacing: 0.4em;
  color: var(--brass);
  text-transform: uppercase;
}
.masthead-year {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  color: var(--brass);
  opacity: 0.7;
}

/* ==============================
   일기장 본체
   ============================== */
.diary-stage {
  position: relative;
  z-index: 5;
  max-width: 1180px;
  margin: 0 auto;
}

.book {
  position: relative;
  border-radius: 6px;
  /* 가죽 텍스처 — 그라데이션 + 패턴 */
  background:
    /* 가죽 미세 결 */
    repeating-radial-gradient(
      circle at 23% 38%,
      rgba(255,255,255,0.025) 0,
      rgba(255,255,255,0.025) 1px,
      transparent 1px,
      transparent 5px
    ),
    repeating-radial-gradient(
      circle at 71% 67%,
      rgba(0,0,0,0.04) 0,
      rgba(0,0,0,0.04) 1px,
      transparent 1px,
      transparent 7px
    ),
    /* 가죽 명암 */
    radial-gradient(ellipse at 30% 20%, var(--leather-mid) 0%, var(--leather-deep) 60%, var(--leather-edge) 100%);
  background-color: var(--leather-deep);
  padding: 28px;
  box-shadow:
    0 30px 80px rgba(0,0,0,0.7),
    0 10px 30px rgba(0,0,0,0.5),
    inset 0 0 40px rgba(0,0,0,0.5),
    inset 0 0 0 2px rgba(0,0,0,0.6),
    inset 0 0 0 4px var(--leather-stitch);
}

/* 가죽 모서리 황동 장식 */
.book-corner {
  position: absolute;
  width: 56px; height: 56px;
  background:
    linear-gradient(135deg, var(--brass-shine) 0%, var(--brass) 40%, var(--leather-edge) 80%);
  pointer-events: none;
  z-index: 2;
  box-shadow:
    inset 1px 1px 0 rgba(255,220,150,0.35),
    inset -2px -2px 4px rgba(0,0,0,0.4),
    1px 1px 6px rgba(0,0,0,0.4);
}
.book-corner::after {
  content: "✦";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: rgba(60,30,10,0.7);
}
.book-corner--tl { top: -4px; left: -4px;  clip-path: polygon(0 0, 100% 0, 0 100%); }
.book-corner--tr { top: -4px; right: -4px; clip-path: polygon(100% 0, 100% 100%, 0 0); }
.book-corner--bl { bottom: -4px; left: -4px;  clip-path: polygon(0 0, 0 100%, 100% 100%); }
.book-corner--br { bottom: -4px; right: -4px; clip-path: polygon(100% 100%, 100% 0, 0 100%); }
.book-corner--tl::after, .book-corner--bl::after { transform: translate(-30%, 30%); }
.book-corner--tr::after, .book-corner--br::after { transform: translate(30%, 30%); }
.book-corner--bl::after, .book-corner--br::after { transform: translate(0, -30%) translateX(0); }

/* 명판 (TOM MARVOLO RIDDLE) */
.book-plate {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  background:
    linear-gradient(180deg, var(--brass-shine) 0%, var(--brass) 50%, #5e4520 100%);
  color: var(--leather-deep);
  padding: 0.5rem 1.6rem;
  border-radius: 3px;
  font-family: var(--f-display);
  font-weight: 600;
  letter-spacing: 0.35em;
  font-size: 0.9rem;
  box-shadow:
    0 4px 12px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,220,150,0.5),
    inset 0 -1px 2px rgba(0,0,0,0.4);
  z-index: 3;
  white-space: nowrap;
}

/* 책 펼침면 */
.spread {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  background: var(--parchment-2);
  border-radius: 2px;
  min-height: 720px;
  box-shadow:
    inset 0 0 30px rgba(80,50,20,0.4),
    inset 0 0 80px rgba(80,50,20,0.2);
  overflow: hidden;
}

/* 양쪽 페이지 공통 */
.page {
  position: relative;
  padding: 2.5rem 2.2rem;
  /* 양피지 텍스처 */
  background:
    /* 얼룩 */
    radial-gradient(ellipse 200px 100px at 20% 80%, rgba(176,133,66,0.15) 0%, transparent 60%),
    radial-gradient(ellipse 150px 80px at 80% 30%, rgba(140,90,40,0.1) 0%, transparent 60%),
    radial-gradient(ellipse 100px 60px at 60% 90%, rgba(176,133,66,0.12) 0%, transparent 60%),
    /* 양피지 결 */
    repeating-linear-gradient(
      92deg,
      transparent 0,
      transparent 18px,
      rgba(140,100,50,0.04) 18px,
      rgba(140,100,50,0.04) 19px
    ),
    /* 베이스 */
    linear-gradient(180deg, var(--parchment-1) 0%, var(--parchment-2) 50%, var(--parchment-3) 100%);
}

/* 책등 그림자가 페이지에 드리움 */
.page--left {
  box-shadow: inset -20px 0 30px -10px rgba(80,50,20,0.35);
}
.page--right {
  box-shadow: inset 20px 0 30px -10px rgba(80,50,20,0.35);
}

/* 책등 */
.spine {
  width: 16px;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.4) 0%, rgba(60,40,20,0.3) 50%, rgba(0,0,0,0.4) 100%);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  padding: 2rem 0;
}
.spine-stitch {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--leather-stitch);
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.6);
}

/* 페이지 가장자리 (긁히고 닳은 효과) */
.page-edge {
  position: absolute;
  top: 0; bottom: 0;
  width: 14px;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 8px,
      rgba(140,100,50,0.18) 8px,
      rgba(140,100,50,0.18) 9px
    );
}
.page-edge--left  { left: 0; background: linear-gradient(90deg, rgba(140,100,50,0.4), transparent); }
.page-edge--right { right: 0; background: linear-gradient(-90deg, rgba(140,100,50,0.4), transparent); }

/* ==============================
   페이지 컨텐츠
   ============================== */
.page-content {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  font-family: var(--f-display);
  font-style: italic;
  color: var(--ink-faded);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  margin-bottom: 1.6rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid rgba(90, 58, 31, 0.25);
}
.page-divider {
  color: var(--gold);
  font-size: 0.7rem;
}
.page-num {
  text-transform: uppercase;
  font-size: 0.75rem;
}
.page-label {
  letter-spacing: 0.35em;
  font-weight: 500;
}

/* 깃펜 아이콘 */
.quill-icon {
  width: 80px;
  margin: 0.5rem auto 1.2rem;
  color: var(--ink-faded);
  opacity: 0.7;
  transform: rotate(-12deg);
  transition: transform 0.4s ease;
}
.quill-icon:hover { transform: rotate(-8deg) scale(1.05); }

.page-prompt {
  text-align: center;
  font-family: var(--f-script);
  font-size: 1.6rem;
  line-height: 1.4;
  color: var(--ink-mid);
  margin-bottom: 1.6rem;
}
.page-prompt em {
  font-style: italic;
  color: var(--ink-blood);
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 1.4rem;
}

/* 입력창 */
.ask-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-wrap {
  position: relative;
}

#questionInput {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  padding: 0.6rem 0.4rem;
  font-family: var(--f-script);
  font-size: 1.55rem;
  line-height: 1.45;
  color: var(--ink-deep);
  /* 점선 가이드 라인 (양피지 줄선) */
  background-image: repeating-linear-gradient(
    transparent,
    transparent 35px,
    rgba(90,58,31,0.18) 35px,
    rgba(90,58,31,0.18) 36px
  );
  background-attachment: local;
}
#questionInput::placeholder {
  color: var(--ink-faded);
  opacity: 0.55;
  font-style: italic;
}

/* 입력창이 잠금/페이드되는 상태 (제출 중) */
#questionInput.is-fading {
  transition: color 1.2s ease, opacity 1.2s ease;
  color: rgba(20,14,8,0.15);
  opacity: 0.5;
}

.input-underline {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(90,58,31,0.4), transparent);
  margin-top: 0.3rem;
}

.form-row {
  display: flex;
  gap: 0.7rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}

/* 버튼 */
.btn {
  flex: 1;
  min-width: 0;
  position: relative;
  padding: 0.8rem 1.1rem;
  font-family: var(--f-display);
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 2px;
  white-space: nowrap;
}
.btn-icon { font-size: 1.1rem; }

.btn--ink {
  background: linear-gradient(180deg, var(--ink-mid) 0%, var(--ink-deep) 100%);
  color: var(--parchment-1);
  border: 1px solid rgba(0,0,0,0.4);
  box-shadow:
    0 3px 0 rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,220,150,0.15);
}
.btn--ink:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow:
    0 5px 8px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,220,150,0.2);
}
.btn--ink:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.3);
}
.btn--ink:disabled {
  opacity: 0.5;
  cursor: wait;
}

.btn--ghost {
  background: transparent;
  color: var(--ink-faded);
  border: 1px dashed rgba(90,58,31,0.5);
}
.btn--ghost:hover:not(:disabled) {
  background: rgba(176,133,66,0.12);
  color: var(--ink-deep);
  border-style: solid;
}
.btn--ghost:disabled { opacity: 0.5; cursor: wait; }

.form-hint {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 0.8rem;
  color: var(--ink-faded);
  text-align: center;
  margin-top: 0.4rem;
  opacity: 0.75;
}

/* 지난 기록 토글 */
.history-toggle {
  margin-top: auto;
  padding-top: 1.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--f-display);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink-faded);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: color 0.2s ease;
}
.history-toggle:hover { color: var(--ink-blood); }
.history-icon { font-size: 1.1rem; }

/* ==============================
   답변 영역 (오른쪽 페이지)
   ============================== */
.page-header--right {
  /* 같은 스타일 */
}

.answer-area {
  flex: 1;
  position: relative;
  min-height: 480px;
  padding: 0.5rem 0;
}

/* 빈 상태 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  gap: 1rem;
  color: var(--ink-faded);
  opacity: 0.85;
  padding: 3rem 1rem;
}
.seal {
  position: relative;
  width: 110px; height: 110px;
  margin-bottom: 0.5rem;
}
.seal-ring {
  position: absolute; inset: 0;
  border: 2px solid var(--ink-blood);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(120,30,20,0.7), rgba(70,15,10,0.85) 70%);
  box-shadow:
    0 4px 14px rgba(94,26,20,0.3),
    inset 0 -6px 12px rgba(0,0,0,0.4),
    inset 0 4px 8px rgba(255,180,150,0.2);
  animation: sealPulse 4s ease-in-out infinite;
}
@keyframes sealPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.03); }
}
.seal-letter {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-display);
  font-style: italic;
  font-size: 3.5rem;
  color: rgba(255,220,180,0.9);
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.empty-text {
  font-family: var(--f-script);
  font-size: 1.6rem;
  color: var(--ink-mid);
}
.empty-sub {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink-faded);
  max-width: 280px;
  line-height: 1.5;
}

/* 실제 일기 항목 */
.entry {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.entry-q-label, .entry-a-label {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  color: var(--ink-faded);
  text-transform: lowercase;
}
.entry-q {
  font-family: var(--f-script);
  font-size: 1.4rem;
  line-height: 1.5;
  color: var(--ink-mid);
  padding-left: 0.5rem;
  border-left: 2px solid rgba(94,26,20,0.4);
}
.entry-divider {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(90,58,31,0.5) 30%, rgba(90,58,31,0.5) 70%, transparent);
  margin: 0.6rem 0;
}
.entry-a {
  font-family: var(--f-body);
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--ink-deep);
  white-space: pre-wrap;
  letter-spacing: 0.01em;
  /* 잉크 글씨 분위기를 위해 약간의 텍스트 그림자 */
  text-shadow: 0 0 0.4px rgba(20,10,5,0.5);
}
.entry-a p { margin-bottom: 0.8rem; }
.entry-a p:last-child { margin-bottom: 0; }

/* 답변이 한 글자씩 떠오르는 효과 */
.entry-a .reveal-char {
  opacity: 0;
  filter: blur(4px);
  animation: revealChar 0.4s ease forwards;
}
@keyframes revealChar {
  to { opacity: 1; filter: blur(0); }
}

.entry-stamp {
  margin-top: 1rem;
  font-family: var(--f-display);
  font-style: italic;
  font-size: 0.8rem;
  color: var(--ink-blood);
  text-align: right;
  letter-spacing: 0.15em;
  opacity: 0.85;
}

/* ==============================
   페이지 네비게이션 (이전/다음 면)
   ============================== */
.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.2rem;
  margin-top: 1rem;
  border-top: 1px solid rgba(90,58,31,0.2);
  font-family: var(--f-display);
}
.page-nav-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.4rem 0.8rem;
  font-family: var(--f-display);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--ink-mid);
  transition: color 0.2s ease, transform 0.2s ease;
}
.page-nav-btn:hover:not(:disabled) {
  color: var(--ink-blood);
  transform: translateY(-1px);
}
.page-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.page-nav-counter {
  font-style: italic;
  font-size: 0.85rem;
  color: var(--ink-faded);
  letter-spacing: 0.15em;
}

/* ==============================
   페이지 넘김 애니메이션
   ============================== */
.spread.is-flipping .page--right {
  animation: pageFlip 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes pageFlip {
  0%   { transform: rotateY(0); transform-origin: left center; opacity: 1; }
  40%  { transform: rotateY(-30deg); opacity: 0.8; box-shadow: -20px 0 40px rgba(0,0,0,0.2); }
  70%  { transform: rotateY(15deg); opacity: 0.9; }
  100% { transform: rotateY(0); opacity: 1; }
}

/* ==============================
   잉크 캔버스 (질문이 종이에 스며드는 효과)
   ============================== */
.ink-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

/* ==============================
   지난 기록 드로어
   ============================== */
.history-drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  width: min(420px, 90vw);
  background:
    radial-gradient(ellipse at 30% 20%, rgba(60,40,20,0.5), transparent 60%),
    linear-gradient(180deg, var(--leather-mid) 0%, var(--leather-deep) 100%);
  border-left: 4px solid var(--brass);
  box-shadow: -20px 0 60px rgba(0,0,0,0.6);
  transform: translateX(100%);
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  overflow-y: auto;
}
.history-drawer.is-open {
  transform: translateX(0);
}
.history-drawer-inner {
  padding: 1.8rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 100%;
}
.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(184,137,58,0.3);
}
.history-head h2 {
  font-family: var(--f-script);
  font-size: 2rem;
  color: var(--gold-shine);
  font-weight: normal;
}
.history-close {
  background: transparent;
  border: 1px solid rgba(184,137,58,0.4);
  color: var(--gold-shine);
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}
.history-close:hover {
  background: var(--brass);
  color: var(--leather-deep);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  flex: 1;
}
.history-empty {
  font-family: var(--f-display);
  font-style: italic;
  color: var(--brass);
  text-align: center;
  padding: 3rem 1rem;
  opacity: 0.7;
}

.history-item {
  background: linear-gradient(180deg, var(--parchment-1), var(--parchment-2));
  padding: 0.9rem 1rem;
  border-radius: 3px;
  cursor: pointer;
  border-left: 3px solid var(--ink-blood);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}
.history-item:hover {
  transform: translateX(-3px);
  box-shadow: -4px 4px 10px rgba(0,0,0,0.3);
}
.history-item-num {
  position: absolute;
  top: 0.5rem; right: 0.7rem;
  font-family: var(--f-display);
  font-style: italic;
  font-size: 0.75rem;
  color: var(--ink-faded);
}
.history-item-q {
  font-family: var(--f-script);
  font-size: 1.15rem;
  line-height: 1.4;
  color: var(--ink-mid);
  margin-bottom: 0.4rem;
  /* 길면 자르기 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.history-item-a {
  font-family: var(--f-body);
  font-size: 0.85rem;
  color: var(--ink-faded);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-clear {
  margin-top: 1rem;
  padding: 0.6rem 1rem;
  background: transparent;
  border: 1px dashed rgba(94,26,20,0.6);
  color: rgba(220,180,140,0.7);
  font-family: var(--f-display);
  font-style: italic;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.2s ease;
}
.history-clear:hover {
  background: rgba(94,26,20,0.4);
  color: var(--parchment-1);
  border-color: var(--ink-blood);
}

/* ==============================
   푸터
   ============================== */
.footer-mark {
  position: relative;
  z-index: 5;
  text-align: center;
  margin-top: 3rem;
  font-family: var(--f-display);
  font-style: italic;
  font-size: 0.8rem;
  color: var(--brass);
  opacity: 0.6;
  letter-spacing: 0.1em;
}
.footer-dot { margin: 0 0.6rem; }

/* ==============================
   접근성 / 유틸
   ============================== */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ==============================
   반응형 — 모바일에서는 단일 페이지로
   ============================== */
@media (max-width: 820px) {
  body { padding: 1rem 0.6rem 3rem; }
  .masthead { padding-bottom: 1.5rem; }
  .title-script { font-size: clamp(1.8rem, 8vw, 2.4rem); }
  .title-sub { font-size: 0.7rem; letter-spacing: 0.3em; }

  .book { padding: 16px; border-radius: 4px; }
  .book-corner { width: 36px; height: 36px; }
  .book-plate {
    font-size: 0.7rem;
    padding: 0.35rem 1rem;
    letter-spacing: 0.25em;
  }

  .spread {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .spine {
    width: 100%;
    height: 12px;
    flex-direction: row;
    padding: 0 1rem;
  }
  .page { padding: 1.6rem 1.2rem; }
  .page--left  { box-shadow: inset 0 -20px 30px -10px rgba(80,50,20,0.3); }
  .page--right { box-shadow: inset 0 20px 30px -10px rgba(80,50,20,0.3); }

  .page-prompt { font-size: 1.3rem; }
  #questionInput { font-size: 1.3rem; }
  .answer-area { min-height: 320px; }

  .form-row { flex-direction: column; }
  .btn { width: 100%; }

  .empty-text { font-size: 1.3rem; }
  .seal { width: 90px; height: 90px; }
  .seal-letter { font-size: 2.8rem; }
}
