/* title.css — 타이틀 화면, 프롤로그 (아침 안개 낀 마을) */

.title-screen,
.prologue-screen {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(#f7efdc 0%, #efe2c4 55%, #e3cfa6 100%);
}
/* 멀리 보이는 마을 지붕 (픽셀 실루엣, images/ui/town-*.svg) */
.title-screen::before,
.title-screen::after,
.prologue-screen::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background-repeat: repeat-x;
  background-position: left bottom;
  image-rendering: pixelated;
}
.title-screen::before,
.prologue-screen::before { height: 180px; background-image: var(--town-far, url('../images/ui/town-far.svg')); background-size: 720px 180px; opacity: 0.75; }
.title-screen::after { height: 120px; background-image: var(--town-near, url('../images/ui/town-near.svg')); background-size: 480px 120px; background-position: 120px bottom; }

/* 흘러가는 안개 */
.fog {
  position: absolute;
  inset: -20% -50%;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 30% 9% at 20% 78%, rgba(255, 255, 255, 0.75), transparent 70%),
    radial-gradient(ellipse 26% 8% at 62% 86%, rgba(255, 255, 255, 0.7), transparent 70%),
    radial-gradient(ellipse 34% 10% at 88% 74%, rgba(255, 255, 255, 0.6), transparent 70%);
  animation: fog-drift 40s linear infinite;
}
.fog-2 { top: -6%; opacity: 0.7; animation-duration: 58s; animation-direction: reverse; }
@keyframes fog-drift { from { transform: translateX(-12%); } to { transform: translateX(12%); } }
@media (prefers-reduced-motion: reduce) { .fog { animation: none; } }

.title-box {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  text-align: center;
  animation: rise-in 1s ease-out;
}
.title-box .cauldron-sprite { --scale: 3; margin-bottom: -6px; }
.title-ornament { color: var(--wood-light); font-size: 16px; letter-spacing: 0.7em; margin-left: 0.7em; }
.title-main {
  margin: 4px 0 4px;
  font-family: var(--font-title);
  font-weight: 400;
  font-size: clamp(40px, 6.5vw, 72px);
  line-height: 1.2;
  letter-spacing: 0.1em;
  color: var(--ink);
  text-shadow: 0 3px 0 var(--paper-edge);
}
.title-sub { margin: 0 0 30px; color: var(--ink-2); font-size: 16px; letter-spacing: 0.04em; }
.title-buttons { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.title-buttons .btn { min-width: 230px; }
@keyframes rise-in { from { opacity: 0; transform: translateY(14px); } }

/* ───────── 프롤로그: 낡은 편지지 ───────── */
.prologue-screen { cursor: pointer; }
.prologue-box {
  --face: var(--paper);
  --line: var(--wood-dark);
  position: relative;
  z-index: 2;
  width: min(660px, calc(100% - 40px));
  padding: 26px 30px 18px;
  cursor: default;
  background-image: repeating-linear-gradient(transparent 0 37px, rgba(61, 106, 134, 0.14) 37px 38px);
  background-position: 0 30px;
}
.prologue-text {
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 10px 20px;
  font-size: 20px;
  line-height: 1.9;
  text-align: center;
  color: var(--ink);
}
.prologue-text.is-in { animation: text-in 1s ease-out; }
@keyframes text-in { from { opacity: 0; transform: translateY(6px); } }
.prologue-controls { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 10px; border-top: 2px dotted rgba(139, 90, 52, 0.35); }
.prologue-counter { margin-right: auto; color: var(--ink-soft); font-size: 13px; }

/* 이어하기 버튼: 저장 요약을 작은 글씨로 */
.btn-continue { display: flex; flex-direction: column; align-items: center; gap: 0; line-height: 1.3; }
.btn-continue small { font-size: 12.5px; color: var(--ink-soft); }

/* 만든 사람들 · 라이선스 (credits.js) */
.title-buttons .btn-credits { min-width: 0; margin-top: 4px; font-size: 13px; opacity: 0.85; }
.credits-modal { width: min(620px, 94vw); max-height: 86vh; display: flex; flex-direction: column; }
.credits-lead { margin: 0 0 10px; font-size: 13.5px; color: var(--ink-soft); }
.credits-scroll { flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; }
.credits-group + .credits-group { margin-top: 12px; }
.credits-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.credit-row { padding: 8px 12px; background: #fffaf0; box-shadow: 0 0 0 2px var(--paper-edge); }
.credit-head { display: flex; align-items: baseline; gap: 8px; }
.credit-name { flex: 1; }
.credit-license { padding: 0 6px; background: #efe6d2; font-size: 12px; color: #5b4632; white-space: nowrap; }
.credit-author { font-size: 13px; color: var(--ink-2); }
.credit-text { margin-top: 4px; font-size: 12.5px; white-space: pre-wrap; color: #5b4632; }
.credit-url { display: block; margin-top: 2px; font-size: 12px; color: var(--blue); word-break: break-all; }

/* 서버 저장 · 공방 로그인 (cloudLogin.js) */
.title-cloud { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-soft); }
.title-cloud.is-on { color: #2f6f8f; font-weight: 700; }
.login-modal { width: min(440px, 92vw); }
.login-lead { margin: 0 0 10px; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.login-modal .name-input { width: 100%; margin-bottom: 8px; }
.pass-row { display: flex; gap: 6px; align-items: center; }
.pass-row .name-input { flex: 1; letter-spacing: 3px; font-family: monospace; margin-bottom: 0; }
.pass-row + .pass-row, .pass-rules + .pass-row { margin-top: 8px; }
.pass-rules { list-style: none; margin: 6px 0 0; padding: 0; display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-soft); }
.pass-rules li::before { content: '○ '; }
.pass-rules li.is-ok { color: var(--green, #3f7a4f); font-weight: 700; }
.pass-rules li.is-ok::before { content: '✔ '; }
.login-error { min-height: 1.4em; margin: 8px 0 0; font-size: 13px; color: var(--red-dark, #8b2f22); }
.slot-modal { width: min(500px, 94vw); }
.slot-list { list-style: none; margin: 0 0 6px; padding: 0; max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.slot-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #fffaf0; box-shadow: 0 0 0 2px var(--paper-edge); }
.slot-no { min-width: 2.6em; font-family: var(--font-title); font-size: 20px; color: var(--red-dark, #8b2f22); }
.slot-info { flex: 1; }
.slot-main { font-weight: 700; }
.slot-when { font-size: 12px; color: var(--ink-soft); }
.slot-empty { padding: 12px; text-align: center; color: var(--ink-soft); font-size: 14px; }
.guide-modal { width: min(480px, 92vw); }
.guide-head { display: flex; align-items: center; gap: 10px; }
.guide-head .modal-title { margin: 0; }
.guide-icon { display: grid; place-items: center; width: 40px; height: 40px; font-size: 22px; background: #eef3f6; box-shadow: 0 0 0 2px #2f6f8f; }
.guide-body { min-height: 96px; display: flex; align-items: center; }
.guide-text { margin: 12px 0; font-size: 15.5px; line-height: 1.8; animation: talk-in 0.3s ease-out; }
