/* ═══════════════════════════════════════════════════════════
   모모와 다락방의 수상한 요괴들 — 편지 이벤트 웹앱
   디자인 컨셉: 세토내해 수채화 + 복숭아빛 여름 + 손그림 감성
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+KR:wght@300;400;500&family=Noto+Sans+KR:wght@300;400;500;700&family=Gaegu:wght@300;400;700&display=swap');

:root {
  /* ── 복숭아 팔레트 (모모의 색) ── */
  --peach-light:  #fde8e0;
  --peach:        #f0a898;
  --peach-mid:    #e07868;
  --peach-deep:   #c05848;

  /* ── 세토내해 ── */
  --sea-sky:      #c8dfe8;
  --sea-horizon:  #7ab8cc;
  --sea-water:    #4a90a8;
  --sea-deep:     #2a6880;

  /* ── 요괴 컬러 ── */
  --iwa-blue:     #6898b8;   /* 이와: 파란 도포 */
  --kawa-olive:   #8a9a60;   /* 카와: 올리브 */
  --mame-purple:  #9878a8;   /* 마메: 보라빛 */

  /* ── 편지지 ── */
  --paper:        #fefcf4;
  --paper-aged:   #f8f2e4;
  --paper-line:   rgba(160,130,90,0.18);
  --paper-margin: rgba(220,120,100,0.30);
  --ink:          #2c2018;
  --ink-faded:    #6a5040;

  /* ── UI 기능색 ── */
  --accent:       #e07868;   /* 복숭아 강조 */
  --accent-dark:  #b85848;
  --blue-accent:  #4a90a8;   /* 바다 강조 */
  --text-dark:    #1e1810;
  --text-mid:     #4a3828;
  --text-muted:   #8a7060;
  --text-sea:     #2a5868;

  --r:    14px;
  --r-sm:  8px;
}

/* ── RESET ──────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box; margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html { height: 100%; }
body {
  min-height: 100%; overscroll-behavior: none;
  font-family: 'Noto Sans KR', sans-serif;
}

/* ═══════════════════════════════════════════════════════════
   APP SHELL — 수채화 세토내해 배경
   ═══════════════════════════════════════════════════════════ */
#app {
  width: 100%; max-width: 390px; margin: 0 auto;
  min-height: 100vh; min-height: 100dvh;
  position: relative; overflow-x: hidden;
  background-color: var(--sea-sky);
}

/* 수채화 배경 레이어 */
#app-bg {
  position: fixed; inset: 0;
  max-width: 390px; left: 50%; transform: translateX(-50%);
  z-index: 0; pointer-events: none;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════
   SCREENS
   ═══════════════════════════════════════════════════════════ */
.scr {
  display: none; flex-direction: column; align-items: stretch;
  min-height: 100vh; min-height: 100dvh;
  position: relative; z-index: 2;
}
.scr.on { display: flex; }

/* ═══════════════════════════════════════════════════════════
   TOPBAR — 영화 타이틀 분위기
   ═══════════════════════════════════════════════════════════ */
.topbar {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 44px 20px 0; position: relative;
}

/* 영화 배지 — 복숭아 포인트 */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,0.55);
  border: 1.5px solid rgba(224,120,104,0.35);
  border-radius: 20px; padding: 4px 14px;
  font-size: 10px; letter-spacing: .06em;
  color: var(--peach-mid);
  font-family: 'Noto Sans KR', sans-serif;
}
.badge::before { content: '🍑'; font-size: 10px; }

/* 타이틀 */
.page-title {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 21px; font-weight: 700;
  color: var(--text-dark); text-align: center; line-height: 1.6;
}

.page-sub {
  font-size: 12px; color: var(--text-mid);
  text-align: center; line-height: 1.9; font-weight: 300;
  padding: 0 12px;
}

/* 메인 이벤트명 (박스 없이 타이포로 강조) */
.event-headline {
  margin: 20px 0 0; text-align: center;
  font-family: 'Do Hyeon', 'Noto Sans KR', sans-serif;
  font-size: 34px; font-weight: 400; line-height: 0.92; letter-spacing: 0.01em;
  color: #1a1a1a;
  text-shadow: 0 1px 3px rgba(255,255,255,0.75);
}
/* 메인 이벤트명 이미지 */
.event-title-img {
  display: block; width: min(295px, 86vw); height: auto; margin: 18px auto 0;
  filter: drop-shadow(0 2px 5px rgba(70,100,130,0.28));
}
/* 제목과 설명을 나누는 물결 구분선 */
.headline-wave { display: block; width: 56px; height: 8px; margin: 14px auto 18px; opacity: 0.7; }

/* 영화 개봉일 (로고 아래) — 행간 축소 */
.release-date {
  margin-top: 1px; text-align: center; line-height: 1.2;
  font-size: 12.5px; font-weight: 700; color: #10697f; letter-spacing: 0.01em;
}
/* 이벤트 기간 (검정) */
.event-period {
  margin: 8px 0 18px; text-align: center;
  font-size: 12px; font-weight: 600; color: #1a1a1a;
  text-shadow: 0 1px 2px rgba(255,255,255,0.7);
}
/* 당첨자 발표 안내 (응모 화면) */
.event-announce {
  margin: -8px 0 16px; text-align: center;
  font-size: 12px; font-weight: 600; color: var(--peach-deep);
  line-height: 1.6; text-shadow: 0 1px 2px rgba(255,255,255,0.7);
}
/* 각 페이지 작은 로고 */
.page-logo {
  display: block; width: 96px; height: auto; object-fit: contain; margin: 0 auto;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.14));
}
.sea-logo {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 50%; transform: translateX(-50%);
  width: 84px; z-index: 15;
  filter: drop-shadow(0 2px 7px rgba(0,0,0,0.4));
}
/* 서브 설명 1 (리드) */
.event-lead {
  font-size: 13.5px !important; font-weight: 500 !important;
  color: var(--text-mid); line-height: 1.75 !important; text-align: center;
}
/* 서브 설명 2 */
.event-sub2 {
  margin-top: 8px; text-align: center;
  font-size: 12px; font-weight: 500; color: var(--text-muted);
}

/* 이벤트 안내 카피 + 참여 CTA 박스 */
.event-copy {
  margin-top: 10px; text-align: center;
  font-size: 13px; font-weight: 700; color: var(--peach-mid);
}
.event-cta {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: calc(100% - 8px); max-width: 330px;
  margin: 18px auto 4px;
  background: linear-gradient(135deg, #ff9385, #e0685a);
  color: #fff; border: none; border-radius: 14px;
  padding: 12px 16px; font-size: 13.5px; font-weight: 700; line-height: 1.4;
  font-family: 'Noto Sans KR', sans-serif;
  box-shadow: 0 4px 14px rgba(224,104,90,0.34);
  cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.event-cta b { font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }
.event-cta:active { transform: scale(0.98); box-shadow: 0 2px 8px rgba(224,104,90,0.30); }

/* 전송 버튼 라벨(문구가 길어 살짝 축소) */
#send-btn-label { font-size: 14px; letter-spacing: 0; white-space: nowrap; }

/* 이벤트 경품 안내 섹션 */
.prize-section { padding: 24px 18px 42px; }
.prize-title {
  font-size: 17px; font-weight: 800; text-align: center;
  color: var(--text-dark); font-family: 'Noto Sans KR', sans-serif;
  text-shadow: 0 1px 3px rgba(255,255,255,0.9);
}
.prize-sub {
  font-size: 12.5px; color: var(--text-mid); text-align: center;
  margin: 5px 0 16px; font-weight: 500;
  text-shadow: 0 1px 2px rgba(255,255,255,0.85);
}
.prize-list {
  display: flex; flex-direction: column; gap: 10px;
  max-width: 360px; margin: 0 auto;
}

/* 대표 경품(숙박권) — 크게 강조 */
.prize-hero {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, #fff4e6 0%, #ffe3d0 55%, #ffd0b8 100%);
  border: 1.5px solid #f0a878;
  border-radius: 18px; padding: 20px 16px 16px;
  box-shadow: 0 6px 22px rgba(224,120,80,0.24);
  margin-bottom: 12px; overflow: hidden;
}
.hero-ribbon {
  position: absolute; top: 0; left: 0;
  background: linear-gradient(135deg, #ff8a5c, #e0563c);
  color: #fff; font-size: 11px; font-weight: 800;
  padding: 5px 14px 6px 12px; border-radius: 0 0 12px 0;
  box-shadow: 0 2px 6px rgba(200,70,40,0.3); letter-spacing: 0.03em;
}
.prize-hero-img {
  width: 106px; height: 106px; object-fit: contain; flex-shrink: 0;
  filter: drop-shadow(0 3px 9px rgba(0,0,0,0.20)); margin-top: 8px;
}
.prize-hero-info { flex: 1; min-width: 0; margin-top: 8px; }
.prize-hero-tag { font-size: 12.5px; font-weight: 700; color: #a85838; }
.prize-hero-amt {
  font-size: 24px; font-weight: 900; color: #d0442a; line-height: 1.1;
  margin: 3px 0 9px; font-family: 'Noto Sans KR', sans-serif;
}
.prize-hero-count {
  display: inline-block; background: #c0402a; color: #fff;
  font-size: 12.5px; font-weight: 800; border-radius: 999px;
  padding: 6px 15px; box-shadow: 0 2px 6px rgba(160,50,30,0.28);
}
.prize-item {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(160,130,90,0.16);
  border-radius: 14px; padding: 10px 13px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.prize-img {
  width: 66px; height: 66px; object-fit: contain; flex-shrink: 0;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.12));
}
.prize-info { flex: 1; min-width: 0; }
.prize-name {
  font-size: 13px; font-weight: 700; line-height: 1.35;
  color: var(--text-dark);
}
.prize-count {
  flex-shrink: 0; background: var(--peach-mid); color: #fff;
  font-size: 12px; font-weight: 800; border-radius: 999px;
  padding: 6px 12px; white-space: nowrap;
  box-shadow: 0 2px 6px rgba(192,88,72,0.22);
}

/* ═══════════════════════════════════════════════════════════
   LETTER CARD — 실제 편지지 재현
   ═══════════════════════════════════════════════════════════ */
.card-wrap {
  margin: 18px 14px 0; flex: 1;
  display: flex; flex-direction: column;
}

.lcard {
  background: var(--paper);
  border-radius: var(--r) var(--r) 0 0;
  flex: 1; position: relative; overflow: visible;
  /* 편지지 종이 느낌 그림자 */
  box-shadow:
    0 -6px 28px rgba(80,40,20,0.12),
    0 -1px 0 rgba(160,130,90,0.15),
    inset 0 0 0 1px rgba(200,170,130,0.20);
}

/* 편지지 줄선 */
.lcard::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(
      transparent, transparent 35px,
      var(--paper-line) 36px
    );
  background-size: 100% 36px;
  background-position: 0 88px;
  pointer-events: none; z-index: 1;
}

/* 빨간 여백선 */
.lcard::after {
  content: '';
  position: absolute; top: 0; left: 42px; bottom: 0; width: 1px;
  background: var(--paper-margin);
  pointer-events: none; z-index: 1;
}

/* ── To. 수신인 ─────────────────────────────────────────── */
.letter-to-row {
  display: flex; align-items: center; gap: 8px;
  padding: 13px 16px 12px;
  border-bottom: 1.5px solid rgba(224,120,104,0.25);
  background: rgba(254,228,216,0.55);
  position: relative; z-index: 2;
}
.to-label {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 15px; color: var(--peach-deep);
  white-space: nowrap; font-weight: 700;
  letter-spacing: 0.05em;
  min-width: 36px;
}
.to-input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: 'Gaegu', cursive; font-size: 19px; color: var(--ink);
  font-weight: 400;
}
.to-input::placeholder { color: rgba(160,100,80,0.40); font-style: italic; font-size: 16px; }

/* ── 탭 바 ───────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  border-bottom: 1px solid rgba(160,130,90,0.14);
  background: rgba(254,252,244,0.96);
  position: relative; z-index: 2;
}
.tbtn {
  flex: 1; background: none; border: none;
  border-bottom: 2.5px solid transparent;
  padding: 10px 2px; font-size: 11px;
  color: var(--text-muted); cursor: pointer;
  font-family: 'Noto Sans KR', sans-serif;
  transition: all .2s; white-space: nowrap;
}
.tbtn.on {
  color: var(--peach-mid);
  border-bottom-color: var(--peach);
  font-weight: 500;
  background: rgba(224,120,104,0.05);
}

/* ── 탭 패널 ──────────────────────────────────────────────── */
.tab-pane { display: none; flex-direction: column; flex: 1; }
.tab-pane.on { display: flex; }

/* ── Textarea — 손글씨 느낌 ──────────────────────────────── */
.lta {
  width: 100%; min-height: 44vw;
  background: transparent; border: none; outline: none; resize: none;
  padding: 14px 16px 14px 50px;
  font-family: 'Gaegu', cursive;
  font-size: 22px; line-height: 36px;
  color: var(--ink); font-weight: 400;
  position: relative; z-index: 2;
}
.lta::placeholder {
  color: rgba(160,110,80,0.32);
  font-style: italic; font-size: 19px;
  line-height: 36px;
}

/* ── 그리기 캔버스 ───────────────────────────────────────── */
#dc, #rdc {
  display: block; width: 100%;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='3' fill='%23c05848' opacity='0.8'/%3E%3C/svg%3E") 10 10, crosshair;
  touch-action: none; background: transparent; z-index: 2;
}

.dtool {
  padding: 10px 12px;
  display: flex; gap: 8px; align-items: center;
  border-top: 1px solid rgba(160,130,90,0.12);
  background: rgba(254,248,240,0.98);
  flex-wrap: wrap;
}
.cdot {
  width: 26px; height: 26px; border-radius: 50%;
  cursor: pointer; border: 2.5px solid transparent;
  transition: transform .15s; flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.cdot.on { border-color: var(--ink); transform: scale(1.18); }
.bsr {
  -webkit-appearance: none; flex: 1; height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--peach) 0%, rgba(160,130,90,0.2) 100%);
  outline: none; cursor: pointer;
}
.bsr::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px;
  border-radius: 50%; background: var(--peach-mid); cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.clrbtn {
  background: none; border: 1px dashed rgba(160,100,80,0.35);
  border-radius: 8px; padding: 6px 11px;
  font-size: 12px; color: var(--peach-mid); cursor: pointer;
}
/* 이동/그리기 모드 토글 버튼 */
.modebtn {
  background: rgba(160,130,90,0.10);
  border: 1px solid rgba(160,130,90,0.30);
  border-radius: 8px; padding: 6px 11px;
  font-size: 12px; color: var(--text-mid, #6a5a48); cursor: pointer;
  transition: background .15s;
}
.modebtn.on {
  background: var(--peach-mid, #e07868);
  border-color: var(--peach-mid, #e07868);
  color: #fff;
}

/* ── 꾸미기 탭 ───────────────────────────────────────────── */
.sticker-area { display: flex; flex-direction: column; padding-bottom: 4px; }

.preview-wrap {
  position: relative; margin: 10px 12px 0;
  border-radius: var(--r-sm); overflow: hidden;
  border: 1px dashed rgba(160,130,90,0.28);
}
.preview-wrap canvas { display: block; width: 100%; }
#sticker-layer { position: absolute; inset: 0; pointer-events: none; }
#sticker-layer .placed-sticker { pointer-events: auto; }
.placed-sticker {
  position: absolute; font-size: 28px;
  cursor: move; user-select: none; touch-action: none; line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.15));
}

.sticker-grid {
  display: grid; grid-template-columns: repeat(6,1fr);
  gap: 6px; padding: 6px 0 4px;
}
.sticker-btn {
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(160,130,90,0.18);
  border-radius: var(--r-sm); padding: 7px 2px;
  font-size: 22px; cursor: pointer;
  transition: transform .15s, box-shadow .15s; text-align: center;
}
.sticker-btn:active { transform: scale(1.22); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }

/* ── 영화 스틸컷 춤 장면 ──────────────────────────────────── */
.dance-still-wrap {
  position: relative;
  width: min(340px, 88vw);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.40);
}
.dance-still {
  display: block;
  width: 100%;
  height: auto;
  transform-origin: 60% 55%;
  animation: danceKenBurns 6s ease-in-out infinite alternate;
}
/* 어두운 배경과 자연스럽게 어우러지도록 가장자리 비네팅 */
.dance-still-wrap::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 38px 8px rgba(26,56,72,0.55);
  background: linear-gradient(180deg, rgba(26,56,72,0.10) 0%, rgba(26,56,72,0) 28%, rgba(26,56,72,0.18) 100%);
}
@keyframes danceKenBurns {
  0%   { transform: scale(1.0)  translate(0, 0); }
  100% { transform: scale(1.06) translate(-1.5%, -1%); }
}
/* 하늘로 떠오르는 편지 */
.dance-fly-letter {
  position: absolute;
  left: 50%; bottom: 14%;
  font-size: 26px;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.35));
  animation: danceLetterFly 2.6s ease-in infinite;
}
@keyframes danceLetterFly {
  0%   { transform: translate(-50%, 0)      rotate(-6deg); opacity: 0; }
  18%  { opacity: 1; }
  70%  { opacity: 0.85; }
  100% { transform: translate(-30%, -260px) rotate(14deg); opacity: 0; }
}
/* 반짝임 */
.dance-spark {
  position: absolute;
  color: #f8e8a8;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  animation: danceSpark 1.6s ease-in-out infinite;
}
.dance-spark.s1 { top: 16%; left: 22%; animation-delay: .2s; color:#f8e8a8; }
.dance-spark.s2 { top: 28%; right: 18%; animation-delay: .7s; color:#f0c0b0; }
.dance-spark.s3 { top: 12%; right: 34%; font-size: 10px; animation-delay: 1.1s; color:#cfe8f2; }
@keyframes danceSpark {
  0%, 100% { opacity: 0; transform: scale(0.6); }
  50%      { opacity: 1; transform: scale(1); }
}

/* ── From. 서명 ──────────────────────────────────────────── */
.letter-from-row {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 16px 14px;
  border-top: 1.5px solid rgba(224,120,104,0.22);
  background: rgba(254,228,216,0.45);
  position: relative; z-index: 2;
}
.from-label {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 14px; color: var(--peach-deep);
  white-space: nowrap; font-weight: 700;
  letter-spacing: 0.05em;
  min-width: 52px;
}
.from-input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: 'Gaegu', cursive; font-size: 17px; color: var(--ink);
  font-weight: 400;
}
.from-input::placeholder { color: rgba(160,100,80,0.38); font-style: italic; font-size: 15px; }

/* ═══════════════════════════════════════════════════════════
   BOTTOM BUTTON
   ═══════════════════════════════════════════════════════════ */
.bot-area { padding: 13px 14px 34px; background: var(--paper); }

.sendbtn {
  width: 100%;
  background: var(--peach-mid);
  color: #fff; border: none; border-radius: 40px;
  padding: 15px; font-size: 15px;
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow:
    0 4px 0 var(--peach-deep),
    0 6px 16px rgba(192,88,72,0.28);
  transition: transform .15s, box-shadow .15s;
  letter-spacing: 0.04em;
}
.sendbtn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--peach-deep), 0 2px 6px rgba(192,88,72,0.20);
}

@keyframes rock { 0%,100%{transform:rotate(-8deg);}50%{transform:rotate(8deg);} }
.rk { display: inline-block; animation: rock 2s ease-in-out infinite; }

/* ═══════════════════════════════════════════════════════════
   SEA SCREENS
   ═══════════════════════════════════════════════════════════ */
#s-anim, #s-sea, #s-shared { padding: 0; overflow: hidden; }
.sea-canvas-box { position: relative; width: 100%; height: 100vh; height: 100dvh; }
.sea-canvas-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* 바다 하단 오버레이 */
.sea-sheet {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 390px; z-index: 20;
  padding: 52px 16px 36px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: linear-gradient(to top, rgba(20,28,36,0.82) 0%, rgba(20,28,36,0) 100%);
}

.sea-pill {
  width: 100%; border-radius: 14px;
  background: rgba(254,252,244,0.90);
  border: 1px solid rgba(224,168,160,0.40);
  padding: 12px 18px; text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.sea-pill p {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 13px; color: var(--text-dark); line-height: 1.9;
}
.sea-pill .sub { font-size: 11px; color: var(--text-muted); }

/* 복숭아 버튼 */
.evbtn {
  width: 100%; border: none; border-radius: 40px; padding: 14px;
  font-size: 13px; font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer; letter-spacing: 0.04em; transition: transform .15s;
  background: var(--peach-mid); color: #fff;
  box-shadow: 0 3px 0 var(--peach-deep), 0 5px 14px rgba(192,88,72,0.25);
}
.evbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--peach-deep); }

/* 고스트 버튼 */
.ghostbtn {
  width: 100%; border-radius: 40px; padding: 12px;
  font-size: 12px; font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer; transition: all .18s;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.36);
  color: rgba(255,255,255,0.88);
}
/* 경품 응모하기 — 가장 눈에 띄는 대표 버튼(코랄) */
.prize-apply-btn {
  background: linear-gradient(135deg, #ff9385, #e0563c) !important;
  color: #fff !important;
  font-size: 15px !important; font-weight: 800 !important;
  padding: 16px !important; letter-spacing: 0.01em;
  box-shadow: 0 4px 0 #c0402a, 0 7px 20px rgba(224,86,60,0.42) !important;
  animation: prizePulse 2.4s ease-in-out infinite;
}
.prize-apply-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #c0402a, 0 4px 12px rgba(224,86,60,0.42) !important; }
@keyframes prizePulse {
  0%, 100% { box-shadow: 0 4px 0 #c0402a, 0 7px 20px rgba(224,86,60,0.40); }
  50%      { box-shadow: 0 4px 0 #c0402a, 0 7px 26px rgba(224,86,60,0.70); }
}

/* 응모 화면 안내 문구 */
.apply-notice {
  display: inline-block; margin: 10px auto 0;
  background: rgba(224,120,80,0.12); color: var(--peach-deep);
  border: 1px solid rgba(224,120,80,0.30); border-radius: 999px;
  padding: 7px 16px; font-size: 12.5px; font-weight: 700;
}

/* 완료 화면 스틸컷 + 저작권 */
.done-title {
  font-size: 25px; color: var(--peach-deep); margin-top: 2px;
  text-shadow: 0 1px 3px rgba(255,255,255,0.7);
}
.done-msg {
  font-size: 15px; font-weight: 600; color: var(--ink);
  line-height: 1.75; text-align: center; margin-top: 2px;
  text-shadow: 0 1px 2px rgba(255,255,255,0.75);
}
.done-announce {
  margin-top: 6px; text-align: center;
  font-size: 12.5px; font-weight: 600; color: var(--peach-deep);
  line-height: 1.65;
  text-shadow: 0 1px 2px rgba(255,255,255,0.75);
}
.done-still-wrap {
  position: relative; width: min(340px, 86vw);
  border-radius: 14px; overflow: hidden; margin-bottom: 4px;
  box-shadow: 0 8px 26px rgba(0,0,0,0.22);
}
.done-still { display: block; width: 100%; height: auto; }
.done-copy {
  position: absolute; right: 8px; bottom: 6px;
  font-size: 9px; color: rgba(255,255,255,0.92); letter-spacing: 0.02em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
/* 완료 화면 버튼 통일감 */
.done-btn { width: 100%; max-width: 300px; }
.done-outline {
  width: 100%; max-width: 300px;
  background: #fff; border: 1.5px solid var(--peach-mid);
  color: var(--peach-deep); border-radius: 40px; padding: 13px;
  font-size: 14px; font-weight: 700; font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer; box-shadow: 0 2px 8px rgba(192,88,72,0.12);
  transition: transform .15s, background .15s;
}
.done-outline:active { transform: translateY(1px); background: #fff4ef; }
.ghostbtn:active { background: rgba(255,255,255,0.24); }

/* ═══════════════════════════════════════════════════════════
   SHARE SCREEN
   ═══════════════════════════════════════════════════════════ */
#s-share { padding: 0; }
.share-wrap { padding: 0 14px 40px; display: flex; flex-direction: column; gap: 10px; }

.share-link-card {
  background: rgba(254,252,244,0.90);
  border-radius: var(--r);
  border: 1px solid rgba(200,160,130,0.28);
  padding: 14px;
  box-shadow: 0 2px 12px rgba(80,40,20,0.08);
}
.slinkbox {
  background: rgba(254,232,220,0.40);
  border: 1px dashed rgba(200,120,100,0.30);
  border-radius: var(--r-sm); padding: 10px 12px;
  font-size: 11px; color: var(--text-mid);
  word-break: break-all; margin-bottom: 8px; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: background .18s;
  -webkit-user-select: text; user-select: text;
}
.slinkbox:active { background: rgba(254,200,180,0.40); }
.copyhint { font-size: 11px; color: var(--kawa-olive); text-align: center; }

@keyframes floatY { 0%,100%{transform:translateY(0);}50%{transform:translateY(-10px);} }
.float-em { font-size: 48px; animation: floatY 3s ease-in-out infinite; text-align: center; }

/* ═══════════════════════════════════════════════════════════
   APPLY FORM
   ═══════════════════════════════════════════════════════════ */
.apply-wrap { padding: 12px 14px 40px; flex: 1; display: flex; flex-direction: column; }
.apply-card {
  background: rgba(254,252,244,0.92);
  border-radius: var(--r);
  border: 1px solid rgba(200,160,130,0.22);
  padding: 22px 16px;
  flex: 1; display: flex; flex-direction: column; gap: 18px;
  box-shadow: 0 4px 20px rgba(80,40,20,0.08);
}
.afield { display: flex; flex-direction: column; gap: 6px; }
.alabel {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 13px; color: var(--text-dark); font-weight: 400;
}
.req { color: var(--peach-mid); }
.ainput {
  border: none;
  border-bottom: 1.5px solid rgba(160,130,90,0.30);
  outline: none; background: transparent;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 15px; color: var(--ink);
  padding: 8px 4px; transition: border-color .18s;
}
.ainput:focus { border-bottom-color: var(--peach-mid); }
.ainput::placeholder { color: rgba(160,110,80,0.35); font-size: 13px; }
.agree-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.agree-label { display: flex; align-items: center; gap: 8px; cursor: pointer; flex: 1; }
.agree-check { width: 18px; height: 18px; accent-color: var(--peach-mid); }
.agree-txt { font-size: 12px; color: var(--text-dark); line-height: 1.5; }
.agree-detail-btn { background: none; border: none; font-size: 11px; color: var(--text-muted); cursor: pointer; white-space: nowrap; }
.agree-detail {
  font-size: 11px; color: var(--text-muted); line-height: 1.8;
  background: rgba(254,232,220,0.40); border-radius: var(--r-sm); padding: 10px 12px;
  border-left: 2px solid var(--peach);
}
.apply-err { font-size: 12px; color: var(--peach-deep); text-align: center; min-height: 16px; }

/* ═══════════════════════════════════════════════════════════
   LOADING
   ═══════════════════════════════════════════════════════════ */
#loading {
  position: fixed; inset: 0;
  background: rgba(20,14,10,0.65);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  z-index: 100; display: flex; align-items: center; justify-content: center;
}
.loading-inner { text-align: center; }
.loading-boat { font-size: 48px; display: block; animation: floatY 1.2s ease-in-out infinite; margin-bottom: 16px; }
.loading-inner p {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 14px; color: rgba(255,255,255,0.88); letter-spacing: 0.08em;
}

/* ═══════════════════════════════════════════════════════════
   UTILITY
   ═══════════════════════════════════════════════════════════ */
.gaegu { font-family: 'Gaegu', cursive !important; }
.reply-badge {
  background: rgba(254,232,220,0.70);
  border: 1px solid rgba(224,120,104,0.35);
  border-radius: 20px; padding: 4px 14px;
  font-size: 10px; color: var(--peach-mid);
  font-family: 'Noto Sans KR', sans-serif;
  align-self: center;
}

/* ═══════════════════════════════════════════════════════════
   모바일 반응형 보정
   ═══════════════════════════════════════════════════════════ */

/* 화면 짧은 기기 (SE, 갤럭시 폴드 등) */
@media (max-height: 680px) {
  .topbar { padding-top: 28px; gap: 6px; }
  .page-title { font-size: 18px; }
  .page-sub { font-size: 11px; line-height: 1.6; }
  .card-wrap { margin-top: 14px; }
  .lta { min-height: 36vw; font-size: 16px; line-height: 30px; }
  .bot-area { padding: 10px 14px 24px; }
  .sendbtn { padding: 13px; font-size: 14px; }
  .sea-sheet { padding: 44px 14px 28px; }
}

/* 화면 아주 짧은 기기 */
@media (max-height: 580px) {
  .topbar { padding-top: 20px; }
  .page-title { font-size: 16px; }
  .badge { font-size: 9px; padding: 3px 11px; }
}

/* app-bg SVG 항상 전체 영역 커버 */
#app-bg {
  position: fixed; inset: 0;
  max-width: 390px; left: 50%; transform: translateX(-50%);
  z-index: 0; pointer-events: none;
  width: 100%; height: 100%;
  overflow: hidden;
}
#app-bg svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  min-height: 100vh;
}

/* 응모 완료 화면 SVG 일러스트 모바일 크기 보정 */
#s-apply-done svg {
  max-width: 160px;
  width: 44vw;
  height: auto;
}

/* ═══════════════════════════════════════════════════════════
   수채화 번짐 화면 전환 애니메이션
   ═══════════════════════════════════════════════════════════ */

/* 번짐 오버레이 */
#ink-overlay {
  position: fixed; inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
}
#ink-overlay.spreading {
  pointer-events: all;
  animation: inkSpread 1.1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
#ink-overlay.fading {
  animation: inkFade 0.7s ease-out forwards;
}

@keyframes inkSpread {
  0%   { opacity: 0; transform: scale(0.2); border-radius: 100%; }
  40%  { opacity: 1; transform: scale(1.0); border-radius: 60%; }
  100% { opacity: 1; transform: scale(1.8); border-radius: 0%; }
}
@keyframes inkFade {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

/* 편지 페이드인 (바다 위 등장) */
.letter-fadein {
  animation: letterRise 1.2s ease-out forwards;
}
@keyframes letterRise {
  0%   { opacity: 0; transform: translateY(24px) scale(0.92); }
  60%  { opacity: 0.85; }
  100% { opacity: 0.93; transform: translateY(0) scale(1); }
}

/* 화면 자체 페이드인 */
.screen-fadein {
  animation: screenFade 0.6s ease-out forwards;
}
@keyframes screenFade {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

/* ── 추가/수정 스타일 ──────────────────────────── */

/* 이벤트명 */
.event-name {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 12px; font-weight: 500;
  color: var(--peach-mid);
  letter-spacing: .10em;
  text-align: center;
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(224,120,104,0.30);
  border-radius: 20px;
  padding: 3px 14px;
}

/* 타이틀 행간 축소 */
.page-title {
  line-height: 1.38 !important;
  margin-bottom: 4px;
}
.page-sub {
  line-height: 1.55 !important;
  margin-bottom: 0;
}

/* ── 통합 편지지 컴포저 ────────────────────────── */
#letter-composer {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: visible;
}

/* 미리보기 캔버스 래퍼 */
#composer-preview-wrap {
  position: relative;
  flex: 1;
  min-height: 48vw;
  overflow: hidden;
  background: var(--paper, #fefcf4);
}
#composer-canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}
/* 투명 텍스트 오버레이 */
.overlay-textarea {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  padding: 14px 16px 14px 50px;
  font-family: 'Gaegu', cursive;
  font-size: 22px;
  line-height: 36px;
  color: var(--ink, #2c2018);
  font-weight: 400;
  z-index: 3;
  caret-color: var(--peach-mid, #e07868);
}
.overlay-textarea::placeholder {
  color: rgba(160,110,80,0.28);
  font-size: 16px;
}
/* 그림 레이어 */
#draw-layer {
  z-index: 4;
}
/* 스티커 레이어 */
#sticker-layer {
  z-index: 5;
}
.placed-sticker {
  position: absolute;
  font-size: 28px;
  cursor: move;
  user-select: none;
  touch-action: none;
  line-height: 1;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.15));
}

/* To/From 더 진하게 */
.to-label, .from-label {
  font-size: 15px !important;
  font-weight: 700 !important;
  color: var(--peach-deep, #c05848) !important;
  min-width: 48px;
}
.to-input, .from-input {
  font-size: 17px !important;
  font-weight: 400;
}
.letter-to-row {
  background: rgba(254,215,200,0.60) !important;
  border-bottom: 1.5px solid rgba(224,120,104,0.30) !important;
  padding: 13px 16px 12px !important;
}
.letter-from-row {
  background: rgba(254,215,200,0.45) !important;
  border-top: 1.5px solid rgba(224,120,104,0.22) !important;
  padding: 11px 16px 14px !important;
}

/* 바다 채도 낮추기 (더 진하고 차갑게) */
#sea-canvas, #shared-canvas {
  filter: saturate(0.78) brightness(0.88);
}

/* 파스텔 색상 cdot 행 구분선 */
.dtool .cdot:nth-child(7) {
  margin-left: 6px;
  border-left: 1px solid rgba(160,130,90,0.25);
  padding-left: 6px;
}
