@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800;900&display=swap');

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

:root {
  --font: 'Nunito', 'Segoe UI', sans-serif;
  --dark: #0f172a;
  --text: #334155;
  --muted: #94a3b8;
  --border: #e2e8f0;
  --white: #ffffff;
  --shadow-sm: 0 1px 8px rgba(15,23,42,0.06);
  --shadow: 0 4px 24px rgba(15,23,42,0.09);
  --shadow-lg: 0 8px 40px rgba(15,23,42,0.13);
  --radius: 22px;
  --radius-sm: 14px;
  --radius-xs: 8px;
  --art: #f472b6;       --art-soft: #fce7f3;
  --reading: #14b8a6;   --reading-soft: #ccfbf1;
  --house: #f97316;     --house-soft: #ffedd5;
  --fun: #8b5cf6;       --fun-soft: #ede9fe;
  --stories: #3b82f6;   --stories-soft: #dbeafe;
  --memory: #d97706;    --memory-soft: #fef3c7;
  --guestbook: #ec4899; --guestbook-soft: #fce7f3;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 60% at top left,    #fce4ec 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at top right,   #ede7f6 0%, transparent 60%),
    radial-gradient(ellipse 70% 60% at bottom left, #e0f7fa 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at bottom right,#f9fbe7 0%, transparent 60%),
    #fdf8ff;
  background-attachment: fixed;
}

/* ── Decorative floats ── */
.deco {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  user-select: none;
}
.deco.cloud { font-size: 64px; animation: float 7s ease-in-out infinite; }
.deco.star  { font-size: 28px; animation: float 5s ease-in-out infinite; }
.deco.heart { font-size: 22px; animation: float 6s ease-in-out infinite 1s; }
.deco.cloud-pink  { color: #f9a8d4; top: 24px;  left: 16px; }
.deco.cloud-blue  { color: #93c5fd; top: 18px;  right: 16px; }
.deco.star-yellow { color: #fde68a; bottom: 28px; left: 24px; }
.deco.heart-pink  { color: #fda4af; bottom: 40px; right: 28px; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-14px); }
}

/* ── Page wrapper ── */
.page {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

/* ── Site header ── */
.site-header {
  text-align: center;
  margin-bottom: 36px;
}
.site-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.site-title {
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 900;
  color: var(--dark);
  letter-spacing: -1px;
  line-height: 1.1;
  margin-bottom: 12px;
}
.site-subtitle {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 500;
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Card ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

/* ── Homepage two-column layout ── */
.home-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 780px) {
  .home-grid { grid-template-columns: 1fr; }
}

/* ── Magic Map ── */
.magic-map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.magic-map-title { font-size: 1.2rem; font-weight: 800; color: var(--dark); }
.magic-map-sub   { font-size: 0.8rem; color: var(--muted); font-weight: 500; margin-top: 2px; }
.magic-map-icon  { font-size: 28px; }

.magic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.room-card {
  border-radius: var(--radius-sm);
  padding: 14px;
  text-decoration: none;
  display: block;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  border: 1.5px solid transparent;
  background: #fafafa;
}
.room-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.room-card.art     { grid-column: 1; grid-row: 1; border-color: var(--art); background: var(--art-soft); }
.room-card.reading { grid-column: 3; grid-row: 1; }
.room-card.house   { grid-column: 2; grid-row: 2; }
.room-card.fun     { grid-column: 1; grid-row: 3; }
.room-card.stories { grid-column: 3; grid-row: 3; }
.room-card.memory  { grid-column: 2; grid-row: 4; }

.room-card-icons { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 22px; }
.room-card-name  { font-size: 0.9rem; font-weight: 800; color: var(--dark); margin-bottom: 3px; }
.room-card-desc  { font-size: 0.75rem; color: var(--muted); font-weight: 500; line-height: 1.4; }

/* ── Right panel ── */
.right-panel { display: flex; flex-direction: column; gap: 16px; }

.panel-room-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-room-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  background: var(--art-soft);
}
.panel-room-name { font-size: 1.4rem; font-weight: 900; color: var(--dark); }
.panel-room-desc { font-size: 0.82rem; color: var(--muted); font-weight: 500; }

/* ── Gallery grid ── */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.gallery-item {
  border-radius: var(--radius-xs);
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--border);
  position: relative;
}
.gallery-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}
.gallery-item:hover img { transform: scale(1.04); }
.gallery-item-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.55));
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 20px 8px 6px;
}

.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.gallery-empty .empty-icon { font-size: 48px; margin-bottom: 8px; }
.gallery-empty p { font-size: 0.9rem; font-weight: 600; }

/* ── Checklist ── */
.checklist { display: flex; flex-direction: column; gap: 8px; }
.checklist-title { font-weight: 800; color: var(--dark); font-size: 0.95rem; margin-bottom: 6px; }
.check-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.82rem; font-weight: 600; color: var(--text);
}
.check-item::before {
  content: '✦';
  color: var(--art);
  flex-shrink: 0;
}

/* ── Guestbook entries ── */
.guestbook-entry {
  background: var(--guestbook-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.guestbook-entry-name { font-weight: 800; font-size: 0.9rem; color: var(--dark); }
.guestbook-entry-msg  { font-size: 0.85rem; color: var(--text); margin-top: 4px; line-height: 1.5; }
.guestbook-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  background: white;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

/* ── Upload zone ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 12px;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--art);
  background: var(--art-soft);
}
.upload-zone input[type=file] { display: none; }
.upload-zone-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.upload-zone-label span { color: var(--art); text-decoration: underline; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: 12px;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.btn:hover  { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn-primary   { background: var(--dark); color: white; width: 100%; }
.btn-art       { background: var(--art); color: white; }
.btn-reading   { background: var(--reading); color: white; }
.btn-fun       { background: var(--fun); color: white; }
.btn-stories   { background: var(--stories); color: white; }
.btn-memory    { background: var(--memory); color: white; }
.btn-ghost     { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-danger    { background: #fee2e2; color: #dc2626; }
.btn-sm        { padding: 7px 14px; font-size: 0.8rem; border-radius: 8px; }
.btn:disabled  { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── Form elements ── */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 5px;
}
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--dark);
  background: white;
  transition: border-color 0.15s;
  outline: none;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--art);
}
.form-textarea { resize: vertical; min-height: 90px; }

/* ── Page header (room pages) ── */
.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}
.back-btn {
  display: flex; align-items: center; gap: 5px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  transition: color 0.15s;
  flex-shrink: 0;
}
.back-btn:hover { color: var(--dark); }
.page-title-wrap { flex: 1; }
.page-icon {
  width: 52px; height: 52px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}
.page-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 900;
  color: var(--dark);
  letter-spacing: -0.5px;
}
.page-desc { font-size: 0.85rem; color: var(--muted); font-weight: 500; margin-top: 2px; }

/* ── Room page two-col ── */
.room-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 860px) {
  .room-layout { grid-template-columns: 1fr; }
}

/* ── Pill / badge ── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.pill-art { background: var(--art-soft); color: var(--art); }

/* ── Lightbox ── */
.lightbox {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lightbox.open { display: flex; }
.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  object-fit: contain;
}
.lightbox-close {
  position: absolute; top: 20px; right: 20px;
  background: white; border: none; border-radius: 50%;
  width: 40px; height: 40px;
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.4);
  z-index: 900;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white;
  border-radius: var(--radius);
  padding: 28px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.modal-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--dark);
  margin-bottom: 6px;
}
.modal-sub {
  font-size: 0.83rem;
  color: var(--muted);
  margin-bottom: 20px;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--dark);
  color: white;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  z-index: 2000;
  transition: transform 0.3s ease;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: #16a34a; }
.toast.error   { background: #dc2626; }

/* ── Star rating ── */
.stars { display: flex; gap: 3px; }
.star-btn {
  background: none; border: none; cursor: pointer;
  font-size: 22px; padding: 0;
  color: #d1d5db;
  transition: color 0.1s;
}
.star-btn.active, .star-btn:hover { color: #fbbf24; }

/* ── Book card ── */
.book-card {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px;
  background: var(--reading-soft);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.book-spine {
  width: 48px; height: 68px;
  border-radius: 6px;
  background: var(--reading);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}
.book-meta { flex: 1; }
.book-title  { font-weight: 800; font-size: 0.95rem; color: var(--dark); }
.book-author { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.book-notes  { font-size: 0.82rem; color: var(--text); margin-top: 5px; line-height: 1.5; }

/* ── Story card ── */
.story-card {
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  padding: 18px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.story-card:hover { border-color: var(--stories); box-shadow: var(--shadow-sm); }
.story-title  { font-size: 1rem; font-weight: 800; color: var(--dark); margin-bottom: 4px; }
.story-excerpt{ font-size: 0.83rem; color: var(--muted); line-height: 1.5; }
.story-date   { font-size: 0.75rem; color: var(--muted); margin-top: 8px; font-weight: 600; }

/* ── Memory card ── */
.memory-card {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1.5px solid var(--border);
  transition: transform 0.18s;
}
.memory-card:hover { transform: translateY(-2px); }
.memory-img {
  width: 100%; height: 140px;
  object-fit: cover;
  background: var(--memory-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
}
.memory-body { padding: 14px; }
.memory-title { font-weight: 800; color: var(--dark); font-size: 0.9rem; }
.memory-date  { font-size: 0.75rem; color: var(--muted); font-weight: 600; margin-top: 2px; }
.memory-desc  { font-size: 0.82rem; color: var(--text); margin-top: 6px; line-height: 1.4; }

/* ── Admin ── */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.admin-tab {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: white;
  color: var(--muted);
  transition: all 0.15s;
}
.admin-tab.active {
  background: var(--dark);
  color: white;
  border-color: var(--dark);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.admin-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 700;
  border-bottom: 1.5px solid var(--border);
}
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-panel { display: none; }
.admin-panel.active { display: block; }

/* ── Fun zone ── */
.joke-box {
  background: var(--fun-soft);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
}
.joke-q { font-size: 1rem; font-weight: 700; color: var(--dark); margin-bottom: 16px; }
.joke-a {
  font-size: 1.1rem; font-weight: 800; color: var(--fun);
  min-height: 32px;
  transition: opacity 0.3s;
}
.activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.activity-card {
  background: white;
  border-radius: var(--radius-sm);
  padding: 20px 14px;
  text-align: center;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.activity-card:hover { transform: translateY(-3px); border-color: var(--fun); }
.activity-icon { font-size: 36px; margin-bottom: 8px; }
.activity-name { font-size: 0.85rem; font-weight: 700; color: var(--dark); }

/* ── Responsive ── */
@media (max-width: 520px) {
  .page { padding: 20px 14px 50px; }
  .card { padding: 18px; }
  .room-card { padding: 12px 10px; }
  .room-card-name { font-size: 0.8rem; }
  .deco.cloud { font-size: 44px; }
}
