/* ═══════════════════════════════════════════
   CELESTIAL GALLERY — styles.css
   Night sky · Dreamy · Ethereal
═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700&family=Noto+Serif+KR:wght@300;400;600&family=IM+Fell+English:ital@0;1&display=swap');

/* ── TOKENS ── */
:root {
  --void:           #03010a;
  --deep:           #080520;
  --midnight:       #0d0830;
  --card-bg:        rgba(14, 8, 42, 0.72);
  --card-border:    rgba(180, 150, 255, 0.18);
  --gold:           #f5d67a;
  --silver:         #c8d8f0;
  --moon:           #e8eeff;
  --purple-glow:    rgba(140, 80, 240, 0.45);
  --nebula-1:       rgba(80, 30, 160, 0.38);
  --nebula-2:       rgba(20, 60, 160, 0.32);
  --nebula-3:       rgba(180, 80, 200, 0.16);
  --accent:         #9b6bff;
  --accent-dim:     rgba(155, 107, 255, 0.35);
  --danger:         #ff6b8a;
  --success:        #6bffb8;
  --radius-card:    16px;
  --radius-pill:    40px;
  --transition:     0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--void);
  color: var(--moon);
  font-family: 'Noto Serif KR', serif;
  min-height: 100vh;
  overflow-x: hidden;
  cursor: default;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(140,80,240,0.35); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(180,120,255,0.55); }

/* ══════════════════════════════
   BACKGROUND LAYERS
══════════════════════════════ */

#starfield {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
}

.nebula-bg {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(ellipse 85% 65% at 18% 8%,  var(--nebula-1) 0%, transparent 60%),
    radial-gradient(ellipse 65% 55% at 82% 88%,  var(--nebula-2) 0%, transparent 55%),
    radial-gradient(ellipse 55% 75% at 52% 50%,  rgba(60,20,100,0.22) 0%, transparent 70%),
    radial-gradient(ellipse 45% 45% at 88% 18%,  var(--nebula-3) 0%, transparent 50%),
    radial-gradient(ellipse 35% 35% at 10% 80%,  rgba(40,0,120,0.28) 0%, transparent 50%);
  animation: nebula-drift 28s ease-in-out infinite alternate;
}

@keyframes nebula-drift {
  0%   { opacity: 0.85; transform: scale(1) rotate(0deg); }
  100% { opacity: 1;    transform: scale(1.04) rotate(0.8deg); }
}

/* Shooting stars */
.shooting-star {
  position: fixed; top: 0; left: 0;
  width: 1px; height: 90px;
  background: linear-gradient(to bottom, transparent, var(--gold), transparent);
  border-radius: 50%; opacity: 0; z-index: 2; pointer-events: none;
  transform-origin: top center;
}
@keyframes shoot {
  0%   { opacity: 0; transform: translate(0,0) rotate(32deg); }
  4%   { opacity: 1; }
  75%  { opacity: 0.5; }
  100% { opacity: 0; transform: translate(450px,340px) rotate(32deg); }
}

/* Sparkle on click */
.sparkle {
  position: fixed; pointer-events: none; z-index: 999;
  font-size: 0.9rem; line-height: 1;
  animation: sparkle-out 0.85s ease forwards;
}
@keyframes sparkle-out {
  0%   { opacity: 1; transform: translate(0,0) scale(1.2); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0); }
}

/* ══════════════════════════════
   LAYOUT
══════════════════════════════ */

.site-wrapper {
  position: relative; z-index: 10;
  max-width: 1340px; margin: 0 auto;
  padding: 0 36px 100px;
}

/* ══════════════════════════════
   HEADER
══════════════════════════════ */

header {
  text-align: center;
  padding: 72px 20px 52px;
  position: relative;
}

/* Big decorative star cluster instead of moon */
.header-star {
  position: relative;
  width: 100px; height: 100px;
  margin: 0 auto 30px;
  display: flex; align-items: center; justify-content: center;
}

.header-star .star-core {
  position: absolute;
  font-size: 3.2rem;
  filter: drop-shadow(0 0 18px rgba(245,214,122,0.9))
          drop-shadow(0 0 40px rgba(245,214,122,0.5))
          drop-shadow(0 0 80px rgba(200,150,255,0.3));
  animation: star-pulse 4s ease-in-out infinite;
}

.header-star .star-orbit {
  position: absolute;
  font-size: 1rem;
  animation: orbit 8s linear infinite;
  transform-origin: 0 50px;
  filter: drop-shadow(0 0 6px rgba(200,170,255,0.8));
}

.header-star .star-orbit:nth-child(2) { animation-delay: -2s; }
.header-star .star-orbit:nth-child(3) { animation-delay: -4s; }
.header-star .star-orbit:nth-child(4) { animation-delay: -6s; }

@keyframes star-pulse {
  0%,100% { transform: scale(1);    filter: drop-shadow(0 0 18px rgba(245,214,122,0.9)) drop-shadow(0 0 40px rgba(245,214,122,0.5)); }
  50%      { transform: scale(1.1); filter: drop-shadow(0 0 28px rgba(245,214,122,1))   drop-shadow(0 0 70px rgba(245,214,122,0.7)) drop-shadow(0 0 120px rgba(200,150,255,0.4)); }
}

@keyframes orbit {
  0%   { transform: rotate(0deg)   translateX(48px) rotate(0deg); }
  100% { transform: rotate(360deg) translateX(48px) rotate(-360deg); }
}

.site-title {
  font-family: 'Cinzel Decorative', cursive;
  font-size: clamp(1.7rem, 4.5vw, 3rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  background: linear-gradient(135deg, #f5d67a 0%, #e8eeff 35%, #c8a8ff 65%, #f5d67a 100%);
  background-size: 250% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 7s linear infinite;
}

@keyframes shimmer {
  0%   { background-position: 0% center; }
  100% { background-position: 250% center; }
}

.site-subtitle {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  color: rgba(200,216,240,0.6);
  font-size: 0.95rem;
  margin-top: 10px;
  letter-spacing: 0.14em;
}

.header-divider {
  width: 260px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200,170,255,0.5), rgba(245,214,122,0.65), rgba(200,170,255,0.5), transparent);
  margin: 24px auto 0;
}

/* ══════════════════════════════
   TABS
══════════════════════════════ */

.tabs-row {
  display: flex; gap: 10px; overflow-x: auto; padding: 6px 6px 20px;
  scrollbar-width: none; -ms-overflow-style: none;
  justify-content: center; flex-wrap: wrap;
  margin-bottom: 44px;
}
.tabs-row::-webkit-scrollbar { display: none; }

.tab-btn {
  flex-shrink: 0; display: flex; align-items: center; gap: 10px;
  padding: 10px 22px;
  border: 1px solid rgba(180,150,255,0.22);
  border-radius: var(--radius-pill);
  background: rgba(18,10,48,0.55);
  color: rgba(200,216,240,0.68);
  font-family: 'Noto Serif KR', serif; font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  backdrop-filter: blur(12px);
  position: relative; overflow: hidden;
  user-select: none;
}

.tab-btn::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(130,65,225,0.32), rgba(60,120,230,0.22));
  opacity: 0; transition: opacity var(--transition);
}

.tab-btn:hover { color: var(--moon); border-color: rgba(180,150,255,0.48); transform: translateY(-2px); }
.tab-btn:hover::before { opacity: 0.7; }

.tab-btn.active {
  color: var(--moon);
  border-color: rgba(180,150,255,0.72);
  box-shadow: 0 0 22px rgba(140,80,240,0.45), inset 0 0 22px rgba(100,60,180,0.25);
  transform: translateY(-2px);
}
.tab-btn.active::before { opacity: 1; }

.tab-emoji {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  border: 1.5px solid rgba(180,150,255,0.38);
  background: linear-gradient(135deg, rgba(74,32,128,0.8), rgba(26,58,138,0.8));
  flex-shrink: 0;
}

.tab-add-btn {
  flex-shrink: 0; display: flex; align-items: center; gap: 7px;
  padding: 10px 20px;
  border: 1px dashed rgba(180,150,255,0.32);
  border-radius: var(--radius-pill);
  background: transparent;
  color: rgba(200,216,240,0.48);
  font-family: 'Noto Serif KR', serif; font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.28s ease;
}

.tab-add-btn:hover { color: var(--moon); border-color: rgba(180,150,255,0.6); }

/* ══════════════════════════════
   GALLERY PANEL
══════════════════════════════ */

.gallery-panel { display: none; }
.gallery-panel.active {
  display: block;
  animation: panel-in 0.48s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Char info bar */
.char-info-bar {
  display: flex; align-items: center; gap: 26px;
  margin-bottom: 36px; padding: 22px 30px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 50px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.05);
  flex-wrap: wrap; gap: 20px;
}

.char-avatar {
  width: 76px; height: 76px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 2.2rem;
  border: 2.5px solid rgba(180,150,255,0.48);
  box-shadow: 0 0 24px rgba(140,80,240,0.45);
  flex-shrink: 0;
  background: linear-gradient(135deg, #2d0e60, #0e2560, #1a0a50);
  position: relative; overflow: hidden;
}

.char-avatar img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}

.char-meta { flex: 1; min-width: 180px; }

.char-name {
  font-family: 'Cinzel Decorative', cursive;
  font-size: 1.25rem; color: var(--gold); margin-bottom: 5px;
}

.char-desc {
  font-size: 0.85rem; color: rgba(200,216,240,0.58);
  font-style: italic; line-height: 1.6;
}

.char-actions { display: flex; gap: 9px; align-items: center; flex-shrink: 0; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(15,8,40,0.7);
  border: 1px solid rgba(180,150,255,0.24);
  color: rgba(200,216,240,0.6);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; cursor: pointer;
  transition: all 0.22s ease;
  backdrop-filter: blur(6px);
}

.icon-btn:hover          { color: var(--moon); border-color: rgba(180,150,255,0.55); background: rgba(100,50,200,0.3); transform: scale(1.08); }
.icon-btn.danger:hover   { color: var(--danger); border-color: rgba(255,107,138,0.5); background: rgba(180,20,60,0.25); }
.icon-btn.success:hover  { color: var(--success); border-color: rgba(107,255,184,0.5); background: rgba(20,120,80,0.25); }

.char-stat { text-align: center; flex-shrink: 0; }
.char-stat-n { font-family: 'Cinzel Decorative', cursive; font-size: 1.35rem; color: var(--silver); }
.char-stat-l { font-size: 0.7rem; color: rgba(200,216,240,0.4); text-transform: uppercase; letter-spacing: 0.1em; }

/* ── CONTROLS BAR ── */
.controls-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 22px; flex-wrap: wrap;
}

.sort-group { display: flex; gap: 7px; }

.sort-btn {
  padding: 8px 16px;
  border: 1px solid rgba(180,150,255,0.22);
  border-radius: var(--radius-pill);
  background: rgba(18,10,48,0.5);
  color: rgba(200,216,240,0.55);
  font-family: 'Noto Serif KR', serif; font-size: 0.8rem;
  cursor: pointer; transition: all 0.25s ease;
}

.sort-btn:hover, .sort-btn.active {
  color: var(--moon); border-color: rgba(180,150,255,0.5);
  background: rgba(100,50,200,0.25);
  box-shadow: 0 0 12px rgba(120,60,200,0.2);
}

.view-group { display: flex; gap: 6px; }

.view-btn {
  width: 34px; height: 34px;
  border: 1px solid rgba(180,150,255,0.22);
  border-radius: 9px; background: rgba(18,10,48,0.5);
  color: rgba(200,216,240,0.48);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 0.88rem; transition: all 0.22s ease;
}
.view-btn:hover, .view-btn.active {
  color: var(--moon); border-color: rgba(180,150,255,0.5); background: rgba(80,40,160,0.3);
}

.photo-count { font-size: 0.8rem; color: rgba(200,216,240,0.4); letter-spacing: 0.05em; }

/* ── UPLOAD AREA ── */
.upload-area {
  display: block;
  border: 2px dashed rgba(180,150,255,0.28);
  border-radius: 15px; padding: 26px;
  text-align: center; margin-bottom: 30px;
  cursor: pointer; transition: all 0.3s ease;
  background: rgba(12,6,36,0.3); backdrop-filter: blur(8px);
}

.upload-area:hover, .upload-area.drag-over {
  border-color: rgba(180,150,255,0.65);
  background: rgba(80,40,160,0.16);
  box-shadow: 0 0 34px rgba(120,60,200,0.22);
}

.upload-icon { font-size: 1.8rem; margin-bottom: 7px; opacity: 0.7; }
.upload-text { font-size: 0.88rem; color: rgba(200,216,240,0.58); }
.upload-text span { color: rgba(180,150,255,0.92); font-weight: 600; }
.upload-input { display: none; }

/* ══════════════════════════════
   PHOTO GRID
══════════════════════════════ */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 18px;
}

.photo-grid.list-view { grid-template-columns: 1fr; gap: 12px; }

/* Individual card */
.photo-card {
  position: relative;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  opacity: 0;
  animation: card-appear 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes card-appear {
  from { opacity: 0; transform: scale(0.88) translateY(20px) rotate(-0.5deg); }
  to   { opacity: 1; transform: scale(1) translateY(0) rotate(0deg); }
}

.photo-card:hover {
  transform: translateY(-8px) scale(1.025);
  box-shadow: 0 24px 70px rgba(0,0,0,0.65), 0 0 38px rgba(130,65,220,0.35);
  border-color: rgba(180,150,255,0.46);
  z-index: 5;
}

/* Image wrapper for parallax-like tilt */
.photo-card-img-wrap {
  overflow: hidden;
  position: relative;
}

.photo-card img {
  width: 100%; aspect-ratio: 3/4;
  object-fit: cover; display: block;
  transition: transform 0.55s ease;
}

.photo-grid.list-view .photo-card img { aspect-ratio: 16/6; }

.photo-card:hover img { transform: scale(1.07); }

.photo-placeholder {
  width: 100%; aspect-ratio: 3/4;
  background: linear-gradient(160deg, #180a44, #0a1852, #220a54);
  display: flex; align-items: center; justify-content: center;
  font-size: 3.5rem; opacity: 0.45;
  transition: transform 0.55s ease;
}

.photo-grid.list-view .photo-placeholder { aspect-ratio: 16/6; }
.photo-card:hover .photo-placeholder { transform: scale(1.07); }

/* Gradient overlay (always subtle, stronger on hover) */
.photo-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(
    to top,
    rgba(4,1,18,0.95) 0%,
    rgba(4,1,18,0.55) 38%,
    transparent 70%
  );
  opacity: 0.5;
  transition: opacity var(--transition);
}

.photo-card:hover .photo-overlay { opacity: 1; }

/* Top action buttons */
.photo-card-actions {
  position: absolute; top: 10px; right: 10px;
  display: flex; gap: 5px;
  opacity: 0; transition: opacity 0.28s ease;
  z-index: 3;
}

.photo-card:hover .photo-card-actions { opacity: 1; }

/* Bottom title row */
.photo-card-foot {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 10px 14px 12px;
  z-index: 2;
}

.photo-card-title {
  font-size: 0.87rem; color: var(--moon); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 2px;
}

.photo-card-date { font-size: 0.7rem; color: rgba(200,216,240,0.5); }

/* Sparkle star that appears on new card */
.card-new-badge {
  position: absolute; top: 9px; left: 11px;
  font-size: 0.75rem; color: var(--gold);
  filter: drop-shadow(0 0 5px rgba(245,214,122,0.8));
  animation: badge-pulse 2s ease-in-out infinite;
  z-index: 3;
}
@keyframes badge-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ── DETAIL PANEL ── */
.photo-detail {
  background: rgba(10,5,32,0.82);
  border: 1px solid rgba(180,150,255,0.2);
  border-radius: 14px;
  padding: 18px 22px;
  margin-top: 10px;
  backdrop-filter: blur(16px);
  animation: detail-in 0.38s cubic-bezier(0.22,1,0.36,1) forwards;
}

@keyframes detail-in {
  from { opacity: 0; transform: translateY(-8px); max-height: 0; }
  to   { opacity: 1; transform: translateY(0);    max-height: 500px; }
}

.detail-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; flex-wrap: wrap; gap: 8px;
}

.detail-title {
  font-family: 'Cinzel Decorative', cursive;
  font-size: 1rem; color: var(--gold);
}

.detail-date { font-size: 0.78rem; color: rgba(200,216,240,0.5); font-style: italic; }

.detail-desc {
  font-size: 0.88rem; color: rgba(200,216,240,0.72);
  line-height: 1.7; margin-bottom: 12px; white-space: pre-wrap;
}

.detail-desc.empty { color: rgba(200,216,240,0.3); font-style: italic; }

.detail-actions { display: flex; gap: 8px; }

.detail-btn {
  padding: 6px 14px;
  border-radius: 20px; font-size: 0.78rem;
  font-family: 'Noto Serif KR', serif;
  border: 1px solid rgba(180,150,255,0.25);
  background: rgba(20,10,50,0.6); color: rgba(200,216,240,0.65);
  cursor: pointer; transition: all 0.22s ease;
}

.detail-btn:hover          { color: var(--moon); border-color: rgba(180,150,255,0.5); }
.detail-btn.edit-btn:hover { background: rgba(80,40,160,0.35); }
.detail-btn.del-btn:hover  { color: var(--danger); border-color: rgba(255,107,138,0.45); background: rgba(150,20,50,0.2); }

/* Detail edit form */
.detail-edit-form { display: flex; flex-direction: column; gap: 10px; }

.detail-input, .detail-textarea {
  background: rgba(8,4,24,0.8);
  border: 1px solid rgba(180,150,255,0.28);
  border-radius: 9px; padding: 9px 13px;
  color: var(--moon); font-family: 'Noto Serif KR', serif; font-size: 0.88rem;
  outline: none; transition: border-color 0.22s ease, box-shadow 0.22s ease;
}
.detail-input:focus, .detail-textarea:focus {
  border-color: rgba(180,150,255,0.6); box-shadow: 0 0 14px rgba(120,60,200,0.22);
}
.detail-textarea { resize: vertical; min-height: 90px; }

.detail-edit-actions { display: flex; gap: 8px; }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center; padding: 90px 20px;
  color: rgba(200,216,240,0.36);
}
.empty-icon { font-size: 3.8rem; margin-bottom: 16px; opacity: 0.45; }
.empty-text { font-size: 1rem; margin-bottom: 5px; }
.empty-sub  { font-size: 0.82rem; opacity: 0.7; }

/* ══════════════════════════════
   LIGHTBOX
══════════════════════════════ */

.lightbox {
  display: none; position: fixed; inset: 0; z-index: 1000;
  flex-direction: column; align-items: center; justify-content: center;
  background: #000;
}

.lightbox.open {
  display: flex;
  animation: lb-in 0.28s ease;
}

/* fullscreen pseudo-element fill */
.lightbox:-webkit-full-screen { width: 100%; height: 100%; }
.lightbox:fullscreen           { width: 100%; height: 100%; }

@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }

.lb-content {
  display: flex; flex-direction: column; align-items: center;
  width: 100%; height: 100%;
  padding: 60px 80px 80px;
  gap: 0;
}

.lb-content img {
  flex: 1; min-height: 0;
  max-width: 100%; object-fit: contain;
  animation: lb-img-in 0.36s cubic-bezier(0.22,1,0.36,1);
  cursor: zoom-in;
}

.lb-content img.zoomed {
  object-fit: none;
  cursor: zoom-out;
  max-width: none;
}

@keyframes lb-img-in {
  from { transform: scale(0.94); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

/* Info bar at bottom */
.lb-info {
  flex-shrink: 0;
  text-align: center;
  padding: 16px 20px 0;
  max-width: 700px;
}

.lb-title {
  font-family: 'Cinzel Decorative', cursive;
  font-size: 1rem; color: var(--gold);
  margin-bottom: 4px;
}

.lb-date {
  font-size: 0.78rem; color: rgba(200,216,240,0.45);
  margin-bottom: 6px;
}

.lb-desc {
  font-size: 0.88rem; color: rgba(200,216,240,0.65);
  line-height: 1.6; font-style: italic;
}

.lb-close {
  position: absolute; top: 18px; right: 18px;
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(18,10,50,0.85); border: 1px solid rgba(180,150,255,0.3);
  color: var(--silver); font-size: 1.1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease; backdrop-filter: blur(8px);
  z-index: 2;
}
.lb-close:hover { background: rgba(120,60,200,0.6); color: white; transform: scale(1.08); }

.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(18,10,50,0.75); border: 1px solid rgba(180,150,255,0.28);
  color: var(--silver); font-size: 1.8rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease; backdrop-filter: blur(8px);
  z-index: 2;
}
.lb-nav:hover { background: rgba(120,60,200,0.55); color: white; }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }

.lb-counter {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  font-size: 0.8rem; color: rgba(200,216,240,0.45);
  background: rgba(10,5,30,0.65); padding: 5px 14px; border-radius: 20px;
  backdrop-filter: blur(8px); z-index: 2;
}

/* ══════════════════════════════
   MODALS (shared)
══════════════════════════════ */

.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 600;
  align-items: center; justify-content: center;
  background: rgba(1,0,10,0.82); backdrop-filter: blur(14px);
}
.modal-overlay.open { display: flex; animation: lb-in 0.28s ease; }

.modal-box {
  background: linear-gradient(160deg, #0e0828 0%, #06031a 100%);
  border: 1px solid rgba(180,150,255,0.32);
  border-radius: 22px; padding: 36px;
  width: min(500px, 92vw);
  box-shadow: 0 32px 90px rgba(0,0,0,0.75), 0 0 50px rgba(80,40,160,0.3),
              inset 0 1px 0 rgba(255,255,255,0.06);
  animation: modal-pop 0.34s cubic-bezier(0.22,1,0.36,1);
}

@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.88) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-title {
  font-family: 'Cinzel Decorative', cursive;
  font-size: 1.15rem; color: var(--gold);
  margin-bottom: 26px; text-align: center;
}

.form-group { margin-bottom: 18px; }

.form-label {
  display: block; font-size: 0.78rem;
  color: rgba(200,216,240,0.55); margin-bottom: 7px;
  letter-spacing: 0.07em; text-transform: uppercase;
}

.form-input, .form-textarea {
  width: 100%; padding: 11px 14px;
  background: rgba(8,4,24,0.75);
  border: 1px solid rgba(180,150,255,0.24); border-radius: 10px;
  color: var(--moon); font-family: 'Noto Serif KR', serif; font-size: 0.9rem;
  outline: none; transition: border-color 0.24s ease, box-shadow 0.24s ease;
}
.form-input:focus, .form-textarea:focus {
  border-color: rgba(180,150,255,0.62); box-shadow: 0 0 18px rgba(120,60,200,0.25);
}
.form-textarea { resize: vertical; min-height: 95px; }

/* Password input with show/hide */
.pw-wrap { position: relative; }
.pw-wrap .form-input { padding-right: 42px; }
.pw-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: rgba(200,216,240,0.45);
  cursor: pointer; font-size: 0.9rem; padding: 0;
  transition: color 0.2s ease;
}
.pw-toggle:hover { color: var(--moon); }

/* Emoji picker */
.emoji-picker { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 9px; }

.emoji-opt {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(18,10,50,0.55); border: 1px solid rgba(180,150,255,0.18);
  font-size: 1.1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.emoji-opt:hover, .emoji-opt.selected {
  background: rgba(100,50,200,0.42); border-color: rgba(180,150,255,0.62);
  transform: scale(1.12);
}

/* Modal action buttons */
.modal-actions { display: flex; gap: 12px; margin-top: 28px; }

.btn-primary {
  flex: 1; padding: 12px; border-radius: 11px;
  background: linear-gradient(135deg, #7030d8, #2e5ec8);
  border: none; color: white;
  font-family: 'Noto Serif KR', serif; font-size: 0.9rem;
  cursor: pointer; transition: all 0.25s ease;
  box-shadow: 0 5px 22px rgba(100,50,200,0.42);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 9px 32px rgba(100,50,200,0.65); }

.btn-secondary {
  flex: 1; padding: 12px; border-radius: 11px;
  background: rgba(18,10,50,0.6);
  border: 1px solid rgba(180,150,255,0.24);
  color: rgba(200,216,240,0.7);
  font-family: 'Noto Serif KR', serif; font-size: 0.9rem;
  cursor: pointer; transition: all 0.25s ease;
}
.btn-secondary:hover { color: var(--moon); border-color: rgba(180,150,255,0.5); }

.btn-danger {
  flex: 1; padding: 12px; border-radius: 11px;
  background: rgba(150,20,50,0.3);
  border: 1px solid rgba(255,107,138,0.35);
  color: var(--danger);
  font-family: 'Noto Serif KR', serif; font-size: 0.9rem;
  cursor: pointer; transition: all 0.25s ease;
}
.btn-danger:hover { background: rgba(180,30,70,0.5); border-color: rgba(255,107,138,0.65); }

/* ── PASSWORD GATE ── */
.pw-gate {
  position: fixed; inset: 0; z-index: 800;
  display: none; align-items: center; justify-content: center;
  background: rgba(1,0,10,0.88); backdrop-filter: blur(18px);
}
.pw-gate.open { display: flex; animation: lb-in 0.28s ease; }

.pw-gate-box {
  background: linear-gradient(160deg, #0e0828, #06031a);
  border: 1px solid rgba(180,150,255,0.3); border-radius: 22px;
  padding: 38px; width: min(420px, 90vw);
  box-shadow: 0 30px 80px rgba(0,0,0,0.7), 0 0 50px rgba(80,40,160,0.3);
  text-align: center; animation: modal-pop 0.4s cubic-bezier(0.22,1,0.36,1);
}

.pw-gate-icon { font-size: 2.8rem; margin-bottom: 14px; filter: drop-shadow(0 0 14px rgba(245,214,122,0.6)); }
.pw-gate-title { font-family: 'Cinzel Decorative', cursive; font-size: 1.1rem; color: var(--gold); margin-bottom: 8px; }
.pw-gate-sub   { font-size: 0.84rem; color: rgba(200,216,240,0.5); margin-bottom: 22px; }

.pw-error {
  font-size: 0.82rem; color: var(--danger);
  margin-top: 10px; min-height: 18px;
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-5px); }
  40%,80% { transform: translateX(5px); }
}

/* Confirm dialog */
.confirm-box .modal-title { color: var(--danger); }
.confirm-msg { font-size: 0.9rem; color: rgba(200,216,240,0.65); text-align: center; margin-bottom: 8px; line-height: 1.6; }

/* Toast */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(80px);
  z-index: 2000;
  background: rgba(14,8,42,0.92); backdrop-filter: blur(12px);
  border: 1px solid rgba(180,150,255,0.3); border-radius: 30px;
  padding: 11px 24px; font-size: 0.87rem; color: var(--moon);
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  transition: transform 0.38s cubic-bezier(0.22,1,0.36,1), opacity 0.38s ease;
  opacity: 0; pointer-events: none; white-space: nowrap;
}

.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { border-color: rgba(107,255,184,0.45); }
.toast.error   { border-color: rgba(255,107,138,0.45); }

/* ══════════════════════════════
   RESPONSIVE — TABLET (≤ 900px)
══════════════════════════════ */

@media (max-width: 900px) {
  .site-wrapper { padding: 0 20px 80px; }

  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
  }

  .char-info-bar { gap: 16px; padding: 18px 22px; }

  .modal-box { width: min(460px, 92vw); }
}

/* ══════════════════════════════
   RESPONSIVE — MOBILE (≤ 600px)
══════════════════════════════ */

@media (max-width: 600px) {

  /* 헤더 */
  .site-wrapper { padding: 0 14px 80px; }

  header { padding: 44px 14px 34px; }

  .header-star { width: 70px; height: 70px; }
  .header-star .star-core { font-size: 2.4rem; }

  .site-title { font-size: clamp(1.4rem, 7vw, 2rem); letter-spacing: 0.06em; }
  .site-subtitle { font-size: 0.82rem; letter-spacing: 0.08em; }
  .header-divider { width: 180px; }

  /* 탭 — 가로 스크롤, 줄바꿈 없음 */
  .tabs-row {
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding: 4px 0 14px;
    gap: 8px;
    margin-bottom: 28px;
    /* 스크롤 힌트 페이드 */
    -webkit-mask-image: linear-gradient(90deg, black 85%, transparent 100%);
    mask-image: linear-gradient(90deg, black 85%, transparent 100%);
  }

  .tab-btn {
    padding: 9px 16px;
    font-size: 0.82rem;
    flex-shrink: 0;
  }

  .tab-emoji { width: 26px; height: 26px; font-size: 0.88rem; }

  .tab-add-btn { padding: 9px 14px; font-size: 0.78rem; flex-shrink: 0; }

  /* 캐릭터 정보바 */
  .char-info-bar {
    padding: 14px 16px;
    gap: 12px;
  }

  .char-avatar {
    width: 54px; height: 54px; font-size: 1.6rem;
  }

  .char-name { font-size: 1.05rem; }
  .char-desc { font-size: 0.78rem; }

  .char-stat-n { font-size: 1.1rem; }
  .char-stat-l { font-size: 0.65rem; }

  .icon-btn { width: 32px; height: 32px; font-size: 0.82rem; }

  /* 업로드 영역 */
  .upload-area { padding: 20px 16px; margin-bottom: 20px; }
  .upload-icon { font-size: 1.5rem; }
  .upload-text { font-size: 0.82rem; }

  /* 정렬 / 뷰 컨트롤 */
  .controls-bar { gap: 8px; margin-bottom: 14px; }
  .sort-btn { padding: 7px 12px; font-size: 0.75rem; }
  .view-btn { width: 30px; height: 30px; font-size: 0.82rem; }
  .photo-count { font-size: 0.75rem; }

  /* 사진 그리드 — 모바일은 2열 고정 */
  .photo-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  /* 목록 뷰는 1열 */
  .photo-grid.list-view { grid-template-columns: 1fr; gap: 10px; }
  .photo-grid.list-view .photo-card img,
  .photo-grid.list-view .photo-placeholder { aspect-ratio: 16/7; }

  /* 카드 */
  .photo-card { border-radius: 12px; }
  .photo-card-title { font-size: 0.78rem; }
  .photo-card-date  { font-size: 0.65rem; }
  .photo-card-foot  { padding: 8px 10px 10px; }

  /* 카드 액션 버튼 — 항상 살짝 보이게 */
  .photo-card-actions { opacity: 0.85; }
  .card-action-btn { width: 26px; height: 26px; font-size: 0.72rem; }

  /* 디테일 패널 */
  .photo-detail { padding: 14px 16px; border-radius: 12px; }
  .detail-title { font-size: 0.88rem; }
  .detail-date  { font-size: 0.72rem; }
  .detail-desc  { font-size: 0.82rem; }
  .detail-btn   { padding: 5px 12px; font-size: 0.75rem; }

  /* 라이트박스 */
  .lb-content { padding: 48px 44px 70px; }
  .lb-close { top: 12px; right: 12px; width: 38px; height: 38px; font-size: 1rem; }
  .lb-nav   { width: 38px; height: 38px; font-size: 1.4rem; }
  .lb-prev  { left: 6px; }
  .lb-next  { right: 6px; }
  .lb-title { font-size: 0.88rem; }
  .lb-desc  { font-size: 0.8rem; }
  .lb-counter { font-size: 0.75rem; padding: 4px 12px; bottom: 14px; }

  /* 모달 */
  .modal-box { padding: 24px 18px; border-radius: 18px; width: 94vw; }
  .modal-title { font-size: 1rem; margin-bottom: 20px; }
  .form-label { font-size: 0.75rem; }
  .form-input, .form-textarea { padding: 10px 12px; font-size: 0.85rem; }
  .form-textarea { min-height: 80px; }
  .emoji-opt { width: 34px; height: 34px; font-size: 1rem; }
  .btn-primary, .btn-secondary, .btn-danger { padding: 11px; font-size: 0.85rem; }
  .modal-actions { gap: 9px; margin-top: 22px; }

  /* 비밀번호 게이트 */
  .pw-gate-box { padding: 30px 20px; border-radius: 18px; }
  .pw-gate-icon  { font-size: 2.2rem; }
  .pw-gate-title { font-size: 0.95rem; }
  .pw-gate-sub   { font-size: 0.78rem; }

  /* 토스트 */
  .toast { font-size: 0.8rem; padding: 9px 18px; bottom: 20px; white-space: normal; text-align: center; max-width: 85vw; }

  /* 빈 상태 */
  .empty-state { padding: 60px 16px; }
  .empty-icon { font-size: 2.8rem; }
  .empty-text { font-size: 0.9rem; }
}

/* ══════════════════════════════
   RESPONSIVE — 아주 작은 화면 (≤ 380px)
══════════════════════════════ */

@media (max-width: 380px) {
  .site-title { font-size: 1.3rem; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .tab-btn { padding: 8px 12px; font-size: 0.78rem; }
}

/* ══════════════════════════════
   터치 기기 — hover 효과 제거
   (모바일에서 hover 잔상 방지)
══════════════════════════════ */

@media (hover: none) {
  .photo-card:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--card-border);
  }
  .photo-card:hover img { transform: none; }
  .photo-card:hover .photo-overlay { opacity: 0.5; }

  /* 터치에서는 액션 버튼 항상 표시 */
  .photo-card-actions { opacity: 1 !important; }

  .tab-btn:hover  { transform: none; }
  .btn-primary:hover { transform: none; }
  .icon-btn:hover { transform: none; }
}

/* ══════════════════════════════
   서브탭 (사진 / 글)
══════════════════════════════ */

.subtabs-row {
  display: flex; gap: 8px; justify-content: center;
  margin-bottom: 32px;
}

.subtab-btn {
  padding: 9px 28px;
  border: 1px solid rgba(180,150,255,0.25);
  border-radius: var(--radius-pill);
  background: rgba(18,10,48,0.5);
  color: rgba(200,216,240,0.6);
  font-family: 'Noto Serif KR', serif; font-size: 0.9rem;
  cursor: pointer; transition: all 0.28s ease;
}

.subtab-btn.active, .subtab-btn:hover {
  color: var(--moon);
  border-color: rgba(180,150,255,0.6);
  background: rgba(80,40,160,0.3);
  box-shadow: 0 0 16px rgba(120,60,200,0.25);
}

/* ══════════════════════════════
   사진 게시물 카드
══════════════════════════════ */

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px,1fr));
  gap: 20px;
}

.post-card {
  border-radius: 16px; overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  animation: card-appear 0.5s cubic-bezier(0.22,1,0.36,1) forwards;
  opacity: 0;
}

.post-card:hover {
  transform: translateY(-6px) scale(1.015);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 30px rgba(120,60,200,0.28);
  border-color: rgba(180,150,255,0.4);
}

/* 대표 이미지 (첫 번째 사진) */
.post-thumb {
  width: 100%; aspect-ratio: 4/3;
  object-fit: cover; display: block;
  transition: transform 0.5s ease;
}
.post-card:hover .post-thumb { transform: scale(1.05); }

.post-thumb-placeholder {
  width: 100%; aspect-ratio: 4/3;
  background: linear-gradient(160deg,#180a44,#0a1852,#220a54);
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; opacity: 0.4;
}

.post-card-body {
  padding: 14px 16px 16px;
}

.post-card-title {
  font-family: 'Cinzel Decorative', cursive;
  font-size: 0.9rem; color: var(--gold);
  margin-bottom: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.post-card-meta {
  font-size: 0.75rem; color: rgba(200,216,240,0.45);
  margin-bottom: 7px;
}

.post-card-desc {
  font-size: 0.82rem; color: rgba(200,216,240,0.6);
  line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

.post-card-img-count {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem; color: rgba(200,216,240,0.45);
  margin-top: 8px;
}

/* 게시물 카드 액션 버튼 */
.post-card-actions {
  display: flex; gap: 6px;
  padding: 0 16px 14px;
}

/* ══════════════════════════════
   게시물 상세 뷰 (라이트박스 내)
══════════════════════════════ */

.post-detail {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(1,0,10,0.96); backdrop-filter: blur(22px);
  flex-direction: column; overflow-y: auto;
}
.post-detail.open { display: flex; animation: lb-in 0.3s ease; }

.post-detail-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 28px 36px 0; gap: 16px; flex-shrink: 0;
}

.post-detail-title {
  font-family: 'Cinzel Decorative', cursive;
  font-size: 1.3rem; color: var(--gold);
  margin-bottom: 5px;
}

.post-detail-date { font-size: 0.82rem; color: rgba(200,216,240,0.45); }

.post-detail-desc {
  padding: 14px 36px;
  font-size: 0.9rem; color: rgba(200,216,240,0.65);
  line-height: 1.7; flex-shrink: 0;
}

.post-detail-actions { display: flex; gap: 8px; }

/* 이미지 슬라이더 */
.post-slider {
  flex: 1; display: flex; align-items: center; justify-content: center;
  position: relative; padding: 16px 60px; min-height: 0;
}

.post-slider img {
  max-width: 100%; max-height: 65vh;
  object-fit: contain; border-radius: 10px;
  animation: lb-img-in 0.35s cubic-bezier(0.22,1,0.36,1);
}

.post-slider-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(18,10,50,0.8); border: 1px solid rgba(180,150,255,0.3);
  color: var(--silver); font-size: 1.6rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s ease;
}
.post-slider-nav:hover { background: rgba(120,60,200,0.5); color: white; }
.post-slider-prev { left: 10px; }
.post-slider-next { right: 10px; }

.post-slider-counter {
  position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%);
  font-size: 0.78rem; color: rgba(200,216,240,0.4);
  background: rgba(10,5,30,0.6); padding: 3px 12px; border-radius: 20px;
}

.post-detail-close {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(18,10,50,0.8); border: 1px solid rgba(180,150,255,0.3);
  color: var(--silver); font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease; flex-shrink: 0;
}
.post-detail-close:hover { background: rgba(120,60,200,0.5); color: white; }

/* ══════════════════════════════
   글 목록 (블로그식)
══════════════════════════════ */

.writing-list { display: flex; flex-direction: column; gap: 14px; }

.writing-item {
  padding: 20px 24px 24px;
  background: var(--card-bg);
  border: 1px solid rgba(180,150,255,0.45);
  border-radius: 14px; cursor: pointer;
  transition: all var(--transition);
  animation: card-appear 0.5s cubic-bezier(0.22,1,0.36,1) forwards;
  opacity: 0;
  box-shadow: 0 2px 20px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.05);
}

.writing-item:hover {
  border-color: rgba(180,150,255,0.7);
  box-shadow: 0 8px 40px rgba(0,0,0,0.4), 0 0 20px rgba(120,60,200,0.2);
  transform: translateX(4px);
}

.writing-item-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px; margin-bottom: 6px;
}

.writing-item-title {
  font-family: 'Cinzel Decorative', cursive;
  font-size: 0.95rem; color: var(--gold);
  flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.writing-item-date {
  font-size: 0.75rem; color: rgba(200,216,240,0.4);
  flex-shrink: 0;
}

.writing-item-preview {
  font-size: 0.85rem; color: rgba(200,216,240,0.55);
  line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 12px;
}

.writing-item-actions {
  display: flex; flex-direction: row; gap: 7px;
}

/* ══════════════════════════════
   글 상세 모달
══════════════════════════════ */

.writing-detail-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 16px;
  margin-bottom: 20px;
}

.writing-detail-title {
  font-family: 'Cinzel Decorative', cursive;
  font-size: 1.1rem; color: var(--gold); margin-bottom: 5px;
}

.writing-detail-date {
  font-size: 0.78rem; color: rgba(200,216,240,0.45);
}

.writing-detail-body {
  font-size: 0.92rem; color: rgba(200,216,240,0.75);
  line-height: 1.85; white-space: pre-wrap;
  max-height: 65vh; overflow-y: auto;
}

/* ══════════════════════════════
   모달 넓은 버전
══════════════════════════════ */

.modal-box-wide { width: min(680px, 94vw); }

.form-textarea-tall { min-height: 200px; }

/* 이미지 미리보기 (게시물 작성 시) */
.post-img-preview {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px;
}

.post-img-preview-item {
  position: relative; width: 80px; height: 80px;
}

.post-img-preview-item img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 8px; border: 1px solid rgba(180,150,255,0.25);
}

.post-img-preview-del {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(180,20,60,0.85); color: white;
  font-size: 0.65rem; display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none;
}

.upload-area-sm { padding: 16px; margin-bottom: 0; }

/* ══════════════════════════════
   추가 버튼 (사진/글 게시물)
══════════════════════════════ */

.add-post-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px;
  border: 2px dashed rgba(180,150,255,0.3);
  border-radius: 14px; margin-bottom: 24px;
  background: transparent; color: rgba(200,216,240,0.5);
  font-family: 'Noto Serif KR', serif; font-size: 0.9rem;
  cursor: pointer; transition: all 0.25s ease;
}
.add-post-btn:hover {
  color: var(--moon); border-color: rgba(180,150,255,0.6);
  background: rgba(80,40,160,0.12);
}

/* 모바일 */
@media (max-width: 600px) {
  .post-grid { grid-template-columns: repeat(2,1fr); gap: 10px; }
  .post-detail-header { padding: 20px 16px 0; }
  .post-detail-desc   { padding: 10px 16px; }
  .post-slider        { padding: 12px 44px; }
  .post-slider-prev   { left: 4px; }
  .post-slider-next   { right: 4px; }
  .writing-item       { padding: 16px; }
  .modal-box-wide     { width: 96vw; padding: 20px 14px; }
  .form-textarea-tall { min-height: 150px; }
}