/* ══════════════════════════════════════════
   Reset & Tokens
══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Deep teal — main brand */
  --teal-900: #0a3832;
  --teal-800: #0f4a42;
  --teal-700: #155c52;
  --teal-600: #1a6e62;
  --teal-400: #2d9e8e;
  --teal-200: #8ed4ca;
  --teal-100: #c4eae6;
  --teal-50:  #edf4f2;

  /* Blush pink accent */
  --blush-400: #e8a0a8;
  --blush-300: #f0bec4;
  --blush-200: #f7d8db;
  --blush-100: #fceef0;

  /* Sage green — card surfaces */
  --cream-50:  #f4f7f5;
  --cream-100: #e6ede9;
  --cream-200: #cdd9d2;
  --cream-400: #90afa4;
  --cream-600: #5a7a70;

  /* Text */
  --text-on-dark: #f0faf9;
  --text-muted-dark: rgba(240,250,249,0.65);
  --text-primary: #1a2e2c;
  --text-secondary: #4a6560;
  --text-tertiary: #8aaba6;

  /* Fonts */
  --font-serif: 'Cormorant Garamond', 'Noto Serif KR', Georgia, serif;
  --font-sans:  'Noto Sans KR', sans-serif;

  /* Radius */
  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  28px;
  --radius-pill: 999px;
}

html { font-size: clamp(14px, 1vw, 16px); scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  background: var(--teal-800);
}

/* ── Decorative background pattern (subtle leaf/wave lines) ── */
.bg-pattern {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.bg-pattern::before {
  content: '';
  position: absolute;
  inset: -20%;
  background-image:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(45,158,142,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 90% 80%, rgba(10,56,50,0.4) 0%, transparent 60%);
}
.bg-pattern::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600'%3E%3Cpath d='M100,300 Q200,100 300,300 Q400,500 500,300' fill='none' stroke='rgba(255,255,255,0.04)' stroke-width='1.5'/%3E%3Cpath d='M0,200 Q150,50 300,200 Q450,350 600,200' fill='none' stroke='rgba(255,255,255,0.03)' stroke-width='1'/%3E%3Cpath d='M50,450 Q200,280 350,450 Q480,600 600,450' fill='none' stroke='rgba(255,255,255,0.04)' stroke-width='1.5'/%3E%3C/svg%3E");
  background-size: 600px 600px;
  opacity: 0.6;
}

/* ══════════════════════════════════════════
   Header
══════════════════════════════════════════ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,56,50,0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.header-inner {
  width: 100%;
  padding: 0 15%;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.cross-icon {
  width: 26px; height: 34px;
  position: relative; flex-shrink: 0;
}
.cross-v, .cross-h {
  position: absolute;
  background: var(--blush-300);
  border-radius: 2px;
}
.cross-v { width: 3px; height: 34px; left: 11.5px; top: 0; }
.cross-h { width: 26px; height: 3px; left: 0; top: 11px; }

.logo-text { display: flex; flex-direction: column; line-height: 1.25; align-items: center; }
.logo-ko {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 500;
  color: var(--text-on-dark);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.logo-en {
  font-size: 9.5px;
  color: var(--text-muted-dark);
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.tab-nav {
  display: flex;
  gap: 4px;
  flex: 1;
  justify-content: center;
}

.tab-btn {
  padding: 8px 22px;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--text-muted-dark);
  background: transparent;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.tab-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-on-dark);
}
.tab-btn.active {
  background: var(--blush-300);
  color: var(--teal-900);
  font-weight: 600;
}

.save-btn {
  padding: 9px 22px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--teal-900);
  background: var(--blush-300);
  border: 1.5px solid var(--blush-300);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.18s;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}
.save-btn:hover {
  background: var(--blush-400);
  border-color: var(--blush-400);
}

/* ══════════════════════════════════════════
   Main layout
══════════════════════════════════════════ */
.main-wrap {
  width: 100%;
  padding: 2.5rem 15% 5rem;
  position: relative;
  z-index: 1;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-grid {
  display: grid;
  grid-template-columns: 1fr 390px;
  gap: 1.75rem;
  align-items: start;
}

.panel-left { display: flex; flex-direction: column; gap: 1rem; }

/* ══════════════════════════════════════════
   Cards
══════════════════════════════════════════ */
.card {
  background: var(--cream-100);
  border: 1px solid var(--cream-200);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}
.card + .card { margin-top: 1rem; }

.card-single {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--teal-800);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.01em;
}

/* ══════════════════════════════════════════
   Form elements
══════════════════════════════════════════ */
.field { margin-bottom: 1rem; }
.field:last-child { margin-bottom: 0; }

label {
  display: block;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

input[type=text],
input[type=date],
input[type=email],
textarea,
select {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  background: #ffffff;
  border: 1.5px solid var(--cream-200);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  line-height: 1.5;
}
input:focus, textarea:focus {
  border-color: var(--teal-400);
  box-shadow: 0 0 0 3px rgba(45,158,142,0.12);
}
textarea { resize: vertical; line-height: 1.75; }

.form-row.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ══════════════════════════════════════════
   Photo zone
══════════════════════════════════════════ */
.photo-zone {
  border: 1.5px dashed var(--cream-400);
  border-radius: var(--radius-md);
  background: var(--cream-100);
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 0.18s, background 0.18s;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-zone:hover { border-color: var(--teal-400); background: var(--teal-50); }
.photo-zone input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
  z-index: 1;
}
#main-photo-preview {
  position: relative; z-index: 2;
}
.photo-remove {
  position: relative; z-index: 3;
}

.photo-icon {
  width: 44px; height: 44px;
  background: var(--teal-100);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 10px;
  color: var(--teal-600);
}
.photo-icon svg { width: 20px; height: 20px; }

.photo-hint { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.photo-hint span { color: var(--teal-600); font-weight: 500; }

.photo-preview-wrap { display: none; width: 100%; padding: 0.75rem; }
.photo-preview-wrap img {
  width: 100%; border-radius: var(--radius-md);
  max-height: 200px; object-fit: cover; display: block;
}
.photo-remove {
  margin-top: 8px;
  font-size: 12px; color: var(--text-secondary);
  background: var(--cream-100); border: none;
  border-radius: var(--radius-pill); padding: 4px 12px; cursor: pointer;
}
.photo-remove:hover { background: var(--blush-100); color: var(--teal-700); }

.section-hint { font-size: 12px; color: var(--text-tertiary); margin-bottom: 10px; line-height: 1.5; }
.photo-zone.small { min-height: 80px; padding: 1rem; }

/* ══════════════════════════════════════════
   Buttons
══════════════════════════════════════════ */
.btn {
  padding: 10px 24px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.18s;
  border: 1.5px solid transparent;
  white-space: nowrap;
}
.btn-primary {
  background: var(--blush-300);
  color: var(--teal-900);
  border-color: var(--blush-300);
  box-shadow: 0 2px 8px rgba(240,190,196,0.4);
}
.btn-primary:hover { background: var(--blush-400); border-color: var(--blush-400); box-shadow: 0 4px 12px rgba(240,190,196,0.5); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--teal-700);
  border-color: var(--teal-400);
}
.btn-ghost:hover { background: var(--teal-50); border-color: var(--teal-600); color: var(--teal-900); }

.btn.full-width { width: 100%; }

.btn-ai {
  background: var(--teal-700);
  color: #fff;
  border-color: var(--teal-700);
  box-shadow: 0 2px 8px rgba(10,56,50,0.25);
}
.btn-ai:hover { background: var(--teal-900); border-color: var(--teal-900); }

.action-row {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* ══════════════════════════════════════════
   Pill groups (lang toggle)
══════════════════════════════════════════ */
.pill-group { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  padding: 7px 18px;
  font-family: var(--font-sans);
  font-size: 15px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  border: 1.5px solid var(--cream-200);
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.15s;
  letter-spacing: 0.02em;
}
.pill:hover { border-color: var(--teal-400); color: var(--teal-700); background: var(--teal-50); }
.pill.active {
  background: var(--teal-700);
  color: #fff;
  border-color: var(--teal-700);
  font-weight: 500;
}

/* ══════════════════════════════════════════
   Tone cards
══════════════════════════════════════════ */
.tone-cards { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.tone-card {
  border: 1px solid var(--cream-200);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  text-align: center;
  transition: all 0.18s;
  background: var(--cream-50);
}
.tone-card:hover { border-color: var(--teal-400); background: var(--teal-50); }
.tone-card.selected {
  border-color: var(--teal-600);
  background: var(--teal-50);
  box-shadow: inset 0 0 0 1px var(--teal-200);
}
.tone-name { font-size: 14px; font-weight: 500; color: var(--text-primary); margin-bottom: 3px; }
.tone-desc { font-size: 11px; color: var(--text-tertiary); }

/* ══════════════════════════════════════════
   AI result
══════════════════════════════════════════ */
.ai-result {
  background: var(--cream-100);
  border: 1px solid var(--cream-200);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.85;
  white-space: pre-wrap;
  min-height: 120px;
}

.ai-spinner {
  display: none;
  width: 16px; height: 16px;
  border: 2px solid var(--teal-100);
  border-top-color: var(--teal-600);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: auto;
}
.ai-spinner.active { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════
   Live preview sidebar
══════════════════════════════════════════ */
.live-preview-wrap { position: sticky; top: 80px; }
.live-preview-label {
  font-size: 11px; font-weight: 500;
  color: var(--text-muted-dark);
  text-transform: uppercase; letter-spacing: 0.07em;
  margin-bottom: 10px;
}

/* ══════════════════════════════════════════
   Letter preview
══════════════════════════════════════════ */
.letter-preview {
  background: var(--cream-50);
  border: 1px solid var(--cream-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(10,56,50,0.18);
}
.letter-preview.mini { font-size: 12px; }
.letter-preview.full { width: 100%; font-size: 15px; }

.lp-header {
  background: var(--teal-800);
  position: relative;
  overflow: hidden;
  height: 420px;
}
.letter-preview.mini .lp-header { height: 160px; }
.lp-header-overlay {
  display: none;
}
/* 로고 */
.lp-logo {
  position: absolute; top: 18px; right: 20px;
  display: flex; align-items: center; gap: 10px; z-index: 3;
}
.lp-logo-cross { width: 22px; height: 36px; position: relative; flex-shrink: 0; }
.lp-logo-cross::before, .lp-logo-cross::after {
  content: ''; position: absolute; background: var(--blush-300); border-radius: 2px;
}
.lp-logo-cross::before { width: 3px; height: 36px; left: 9.5px; top: 0; }
.lp-logo-cross::after  { width: 22px; height: 3px; left: 0; top: 11px; }
.lp-logo-text { display: flex; flex-direction: column; line-height: 1.35; }
.lp-logo-name {
  font-family: var(--font-serif); font-size: 16px; font-weight: 500;
  color: var(--text-on-dark); letter-spacing: 0.14em; text-transform: uppercase;
}
.lp-logo-sub {
  font-size: 9px; color: var(--text-muted-dark);
  letter-spacing: 0.26em; text-transform: uppercase;
}
/* 제목/날짜 바 */
.lp-title-bar {
  background: var(--cream-100);
  padding: 1.25rem 2rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--cream-200);
}
.letter-preview.mini .lp-title-bar { padding: 0.75rem 1rem 0.6rem; }

.lp-title {
  font-family: var(--font-serif);
  font-size: 1.4em;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.lp-title.large { font-size: 2em; line-height: 1.2; }
.lp-date { font-size: 0.85em; color: var(--text-secondary); margin-top: 4px; }

.lp-body { padding: 1.5rem; }
.letter-preview.full .lp-body { padding: 2rem 2.5rem; }
.letter-preview.mini .lp-body { padding: 1rem; }

.lp-greeting {
  font-style: italic;
  font-size: 0.9em;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}
.lp-text { color: var(--text-primary); line-height: 1.85; white-space: pre-wrap; }

.lp-prayer {
  margin-top: 1.5rem;
  background: var(--teal-50);
  border-left: 3px solid var(--teal-400);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.lp-prayer-title {
  font-size: 0.72em;
  font-weight: 500;
  color: var(--teal-700);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 8px;
}
.lp-prayer-items div { color: var(--teal-800); line-height: 2; font-size: 0.9em; }

.lp-footer {
  text-align: center;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--cream-200);
  font-size: 0.85em;
  color: var(--text-secondary);
  font-style: italic;
}

/* ══════════════════════════════════════════
   Preview tab controls
══════════════════════════════════════════ */
.preview-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 10px;
}
.preview-controls .pill {
  background: rgba(255,255,255,0.12);
  color: var(--text-on-dark);
  border-color: rgba(255,255,255,0.25);
}
.preview-controls .pill:hover {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.4);
  color: white;
}
.preview-controls .pill.active {
  background: var(--blush-300);
  color: var(--teal-900);
  border-color: var(--blush-300);
}
.preview-actions { display: flex; gap: 10px; }
.preview-actions .btn-ghost {
  background: rgba(255,255,255,0.12);
  color: var(--text-on-dark);
  border-color: rgba(255,255,255,0.25);
}
.preview-actions .btn-ghost:hover {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.4);
}
.preview-actions .btn-primary {
  background: var(--blush-300);
  color: var(--teal-900);
  border-color: var(--blush-300);
}
.preview-actions .btn-primary:hover {
  background: var(--blush-400);
  border-color: var(--blush-400);
}

/* ══════════════════════════════════════════
   Templates tab
══════════════════════════════════════════ */
.quick-templates { display: flex; flex-direction: column; gap: 10px; }
.qt-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--cream-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.18s;
  background: var(--cream-50);
}
.qt-item:hover { border-color: var(--teal-400); background: var(--teal-50); }
.qt-icon { font-size: 22px; flex-shrink: 0; }
.qt-title { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.qt-desc { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

.saved-list-grid { display: flex; flex-direction: column; gap: 8px; }
.saved-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border: 1px solid var(--cream-200);
  border-radius: var(--radius-md);
  cursor: pointer; transition: all 0.18s;
  background: var(--cream-50);
}
.saved-item:hover { border-color: var(--teal-400); background: var(--teal-50); }
.saved-item-title { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.saved-item-date { font-size: 12px; color: var(--text-tertiary); }
.saved-item-del {
  font-size: 12px; color: var(--text-tertiary);
  background: none; border: none; cursor: pointer; padding: 4px 8px; border-radius: 4px;
}
.saved-item-del:hover { background: var(--blush-100); color: var(--teal-700); }

.empty-msg {
  text-align: center; color: var(--text-tertiary);
  font-size: 14px; padding: 2rem 0; line-height: 1.8;
}

/* ══════════════════════════════════════════
   Body blocks editor
══════════════════════════════════════════ */
.body-block {
  border: 1px solid var(--teal-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 10px;
  background: white;
  position: relative;
}
.body-block-header {
  padding: 0.6rem 1rem;
  background: var(--cream-100);
  border-bottom: 1px solid var(--cream-200);
}
.body-block-header {
  display: flex; align-items: center;
  justify-content: space-between;
}
.body-block-num {
  font-size: 11px; font-weight: 500;
  color: var(--teal-600);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.drag-handle {
  font-size: 16px;
  color: var(--text-tertiary);
  cursor: grab;
  line-height: 1;
  padding: 0 2px;
  user-select: none;
}
.drag-handle:active { cursor: grabbing; }
.body-block.dragging {
  opacity: 0.4;
  border-style: dashed;
}
.body-block.drag-over {
  border-color: var(--teal-400);
  box-shadow: 0 0 0 2px var(--teal-200);
}
.body-block-del {
  font-size: 12px; color: var(--text-tertiary);
  background: none; border: none; cursor: pointer;
  padding: 2px 8px; border-radius: 4px; font-family: var(--font-sans);
}
.body-block-del:hover { background: var(--blush-100); color: var(--teal-700); }

.body-block-photos {
  margin-top: 10px;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.block-photo-wrap {
  position: relative; width: 60px; height: 60px;
  cursor: grab;
}
.block-photo-wrap:active { cursor: grabbing; }
.block-photo-wrap.dragging { opacity: 0.4; }
.block-photo-wrap.drag-over { outline: 2px solid var(--teal-400); border-radius: var(--radius-sm); }
.photo-drag-hint {
  position: absolute; bottom: 2px; left: 2px;
  font-size: 10px; color: white;
  background: rgba(0,0,0,0.45);
  border-radius: 3px; padding: 0 2px;
  z-index: 10; pointer-events: none;
  line-height: 1.4;
}
.block-photo-wrap img {
  width: 100%; height: 100%;
  object-fit: cover; border-radius: var(--radius-sm); display: block;
}
.block-photo-wrap .rm {
  position: absolute; top: 2px; right: 2px;
  width: 20px; height: 20px;
  background: rgba(0,0,0,0.55); color: white;
  border: none; border-radius: 50%;
  font-size: 11px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
}
.block-photo-wrap .rm:hover { background: rgba(0,0,0,0.8); }
.block-add-photo {
  width: 60px; height: 60px;
  border: 1.5px dashed var(--cream-400);
  border-radius: var(--radius-sm);
  background: var(--cream-100);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.15s;
  color: var(--teal-500);
}
.block-add-photo:hover { border-color: var(--teal-400); background: var(--teal-50); }
.block-add-photo svg { width: 20px; height: 20px; }

.add-block-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 13px;
  background: transparent;
  border: 1.5px dashed var(--cream-400);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 15px; color: var(--text-secondary);
  margin-top: 4px; transition: all 0.15s;
  justify-content: center;
  letter-spacing: 0.02em;
}
.add-block-btn:hover { border-color: var(--teal-400); color: var(--teal-700); background: var(--teal-50); }
.add-block-plus { font-size: 20px; color: var(--teal-400); line-height: 1; }

/* ══════════════════════════════════════════
   Prayer items editor
══════════════════════════════════════════ */
.prayer-item-block {
  display: flex; gap: 8px; margin-bottom: 10px; align-items: flex-start;
}
.prayer-item-header {
  display: flex; flex-direction: column;
  align-items: center; gap: 4px; padding-top: 9px; flex-shrink: 0;
}
.prayer-num {
  font-size: 13px; font-weight: 500;
  color: var(--teal-600); min-width: 20px; text-align: center;
}
.prayer-item-fields { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.prayer-item-fields input {
  width: 100%; font-family: var(--font-sans); font-size: 14px;
  color: var(--text-primary); background: var(--cream-50);
  border: 1px solid var(--cream-200); border-radius: var(--radius-md);
  padding: 8px 12px; outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.prayer-item-fields input:focus {
  border-color: var(--teal-400);
  box-shadow: 0 0 0 3px rgba(45,158,142,0.12);
}
.prayer-item-fields input::placeholder { color: var(--text-tertiary); font-size: 13px; }
.prayer-item-del {
  width: 20px; height: 20px;
  background: none; border: none; cursor: pointer;
  color: var(--text-tertiary); font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; flex-shrink: 0; margin-top: 2px;
}
.prayer-item-del:hover { background: var(--blush-100); color: var(--teal-700); }

/* ══════════════════════════════════════════
   Preview body blocks — photos
══════════════════════════════════════════ */
.pv-block { margin-bottom: 1.75rem; }
.pv-block-text {
  color: var(--text-primary); line-height: 1.85;
  white-space: pre-wrap; margin-bottom: 0.85rem;
}
.pv-block-photos { display: grid; gap: 6px; }
.pv-block-photos.p1 { grid-template-columns: 1fr; }
.pv-block-photos.p2 { grid-template-columns: 1fr 1fr; }
.pv-block-photos.p3 { grid-template-columns: 1fr 1fr 1fr; }
.pv-block-photos.p4 { grid-template-columns: 1fr 1fr; }
.pv-block-photos img {
  width: 100%; border-radius: var(--radius-md);
  object-fit: cover; object-position: center; display: block;
  aspect-ratio: auto; max-height: 420px;
}
.pv-block-photos.p1 img { max-height: 540px; object-fit: contain; background: var(--cream-100); }
.pv-block-photos.p2 img,
.pv-block-photos.p3 img,
.pv-block-photos.p4 img { height: 260px; object-fit: cover; }

/* ── Photo layout options (fixed heights, no responsive override) ── */
.pv-block-photos.layout-full { grid-template-columns: 1fr; }
.pv-block-photos.layout-full img { height: 400px !important; max-height: none !important; object-fit: cover; }

.pv-block-photos.layout-half { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-block-photos.layout-half img { width: calc(50% - 3px) !important; height: 260px !important; max-height: none !important; object-fit: cover; border-radius: var(--radius-md); }

.pv-block-photos.layout-grid { grid-template-columns: 1fr 1fr; }
.pv-block-photos.layout-grid img { height: 220px !important; max-height: none !important; object-fit: cover; }

@media (max-width: 680px) {
  .pv-block-photos.layout-half { display: grid !important; grid-template-columns: 1fr !important; }
  .pv-block-photos.layout-half img { width: 100% !important; height: 280px !important; }
  .pv-block-photos.layout-grid { grid-template-columns: 1fr !important; }
  .pv-block-photos.layout-grid img { height: 280px !important; }
}

/* layout picker in editor */
.photo-layout-picker { display: flex; align-items: center; gap: 6px; margin: 8px 0 6px; }
.photo-layout-picker .layout-label { font-size: 11px; color: var(--text-tertiary); }
.layout-btn {
  padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 500;
  border: 1px solid var(--cream-200); background: white; color: var(--text-secondary);
  cursor: pointer; transition: all 0.15s;
}
.layout-btn.active { background: var(--teal-800); color: white; border-color: var(--teal-800); }

/* translate button */
.translate-btn {
  padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 500;
  border: 1px solid var(--teal-400); background: white; color: var(--teal-700);
  cursor: pointer; transition: all 0.15s;
}
.translate-btn:hover { background: var(--teal-50); }
.translate-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Block lang sections ── */
.block-lang-section {
  padding: 0.85rem 1rem;
}
.block-lang-section.ko {
  background: var(--teal-50);
  border-top: 1px solid var(--cream-200);
}
.block-lang-section.en {
  background: var(--blush-100);
  border-top: 1px solid var(--cream-200);
}
.block-lang-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}
.block-lang-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px 7px;
  border-radius: 999px;
}
.ko .block-lang-tag {
  background: var(--teal-100);
  color: var(--teal-800);
}
.en .block-lang-tag {
  background: var(--blush-200);
  color: #7a3040;
}

/* ── Format toolbar (B / I / U) ── */
.format-toolbar {
  display: flex;
  gap: 2px;
  align-items: center;
}
.fmt-btn {
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--cream-200);
  background: white;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.6;
  transition: background 0.12s;
  user-select: none;
}
.fmt-btn:hover { background: var(--teal-50); color: var(--teal-800); }
.fmt-btn b { font-weight: 700; }
.fmt-btn i { font-style: italic; }
.fmt-btn u { text-decoration: underline; }

/* ── Color palette ── */
.color-palette {
  display: flex;
  gap: 3px;
  align-items: center;
}
.fmt-sep {
  color: var(--cream-200);
  font-size: 13px;
  padding: 0 1px;
  user-select: none;
}
.color-swatch {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.15);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: transform 0.1s, border-color 0.1s;
}
.color-swatch:hover {
  transform: scale(1.25);
  border-color: rgba(0,0,0,0.4);
}
.color-picker-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

/* ── Contenteditable block editor ── */
.block-editor {
  min-height: 80px;
  max-height: 360px;
  overflow-y: auto;
  padding: 8px 10px;
  border: 1px solid var(--cream-200);
  border-radius: 8px;
  background: white;
  color: var(--text-primary) !important;
  caret-color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.8;
  word-break: break-word;
  outline: none;
  transition: border-color 0.15s;
  margin-top: 4px;
}
.block-editor:focus {
  border-color: var(--teal-400);
}
.block-editor:empty::before {
  content: attr(placeholder);
  color: var(--text-tertiary);
  pointer-events: none;
  display: block;
}

/* main photo */
#fv-main-img {
  width: 100%; max-height: 560px;
  object-fit: contain; background: var(--cream-100); display: block;
}
#lp-main-img {
  width: 100%; max-height: 160px;
  object-fit: contain; background: var(--cream-100); display: block;
}

/* ══════════════════════════════════════════
   Photo grid (edit thumbnails)
══════════════════════════════════════════ */
.photo-count-badge {
  font-size: 11px; background: var(--teal-100);
  color: var(--teal-800); padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans); font-weight: 500;
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px; margin-top: 10px;
}
.photo-grid-item {
  position: relative; aspect-ratio: 1;
  border-radius: var(--radius-md); overflow: hidden; background: var(--cream-100);
}
.photo-grid-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-grid-item .remove-btn {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px;
  background: rgba(10,56,50,0.7); color: white;
  border: none; border-radius: 50%; font-size: 11px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1;
}
.photo-grid-item .remove-btn:hover { background: var(--teal-700); }

.add-more-btn {
  margin-top: 8px; font-size: 13px; color: var(--teal-600);
  background: transparent; border: 1px dashed var(--teal-200);
  border-radius: var(--radius-pill); padding: 5px 14px;
  cursor: pointer; font-family: var(--font-sans); transition: all 0.15s;
}
.add-more-btn:hover { background: var(--teal-50); border-color: var(--teal-400); }

/* ══════════════════════════════════════════
   Print & PDF
══════════════════════════════════════════ */
@media print {
  .site-header, .tab-nav, .save-btn,
  .preview-controls, .live-preview-wrap,
  #tab-edit, #tab-ai, #tab-templates { display: none !important; }
  #tab-preview { display: block !important; }
  .main-wrap { padding: 0; background: white; }
  body, .bg-pattern { background: white; }
  .letter-preview.full { border: none; border-radius: 0; font-size: 13pt; box-shadow: none; }
}

/* 인쇄 전용 — 이미지 없이 딥틸 단색 */
body.print-only .lp-header {
  background-image: none !important;
  background-color: var(--teal-800) !important;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
body.print-only .lp-header::before { display: none; }

/* PDF 저장 — 이미지 포함, 컬러 그대로 */
body.print-pdf .lp-header {
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
body.print-pdf .lp-header::before {
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* ══════════════════════════════════════════
   Responsive
══════════════════════════════════════════ */
@media (min-width: 1600px) {
  .main-wrap { padding: 3rem 15% 6rem; }
  .panel-grid { grid-template-columns: 1fr 440px; gap: 2rem; }
  .letter-preview.full { font-size: 17px; }
  .letter-preview.full .lp-header { padding: 3rem 3rem 2.5rem; }
  .letter-preview.full .lp-body { padding: 2.5rem 3.5rem; }
  .lp-title.large { font-size: 2.2em; }
  .card { padding: 2rem; }
  .pv-block-photos.p2 img,
  .pv-block-photos.p3 img,
  .pv-block-photos.p4 img { height: 320px; }
  #fv-main-img { max-height: 640px; }
}

@media (min-width: 1280px) and (max-width: 1599px) {
  .main-wrap { padding: 2.5rem 15% 5rem; }
  .panel-grid { grid-template-columns: 1fr 420px; gap: 1.75rem; }
  .letter-preview.full { font-size: 16px; }
  .letter-preview.full .lp-body { padding: 2rem 3rem; }
  .pv-block-photos.p2 img,
  .pv-block-photos.p3 img,
  .pv-block-photos.p4 img { height: 290px; }
}

@media (min-width: 900px) and (max-width: 1279px) {
  .main-wrap { padding: 2rem 8% 4rem; }
  .header-inner { padding: 0 8%; }
  .panel-grid { grid-template-columns: 1fr 360px; gap: 1.25rem; }
  .letter-preview.full .lp-body { padding: 1.75rem 2rem; }
  .pv-block-photos.p2 img,
  .pv-block-photos.p3 img,
  .pv-block-photos.p4 img { height: 240px; }
}

@media (max-width: 900px) {
  .main-wrap { padding: 2rem 5% 4rem; }
  .header-inner { padding: 0 5%; }
  .panel-grid { grid-template-columns: 1fr; }
  .live-preview-wrap { display: none; }
  .tone-cards { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .main-wrap { padding: 1rem 5% 3rem; }
  .header-inner { gap: 8px; padding: 0 5%; }
  .logo-en { display: none; }
  .tab-btn { padding: 6px 10px; font-size: 12px; }
  .form-row.two-col { grid-template-columns: 1fr; }
  .preview-controls { flex-direction: column; align-items: flex-start; }
  .letter-preview.full .lp-header { padding: 1.5rem 1rem 1rem; }
  .letter-preview.full .lp-body { padding: 1.25rem 1rem; }
  .pv-block-photos.p3 { grid-template-columns: 1fr 1fr; }
  .pv-block-photos.p2 img,
  .pv-block-photos.p3 img,
  .pv-block-photos.p4 img { height: 140px; }
  @media (max-width: 860px) {
    .pv-block-photos.p2 img,
    .pv-block-photos.p3 img,
    .pv-block-photos.p4 img { height: 200px; }
  }
}

/* ── Support Footer ── */
.support-footer {
  margin-top: 2rem; padding: 1.25rem 0 2rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center;
}
.support-footer-copy { font-size: 13px; color: rgba(240,250,249,0.7); margin-bottom: 0.5rem; }
.support-footer-label {
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  color: rgba(240,250,249,0.45); margin-bottom: 0.75rem;
}
.support-footer-links { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.support-footer-btn {
  display: inline-block; padding: 6px 16px; border-radius: 999px;
  font-family: var(--font-sans); font-size: 12px; font-weight: 500;
  text-decoration: none; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.07); color: var(--text-on-dark);
  transition: all 0.15s;
}
.support-footer-btn:hover { background: rgba(255,255,255,0.14); }
.support-footer-btn.paypal { background: var(--blush-300); color: var(--teal-900); border-color: var(--blush-300); }
.support-footer-btn.paypal:hover { background: var(--blush-400); }
.support-footer-divider { color: rgba(255,255,255,0.2); font-size: 12px; }
