*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button { -webkit-appearance: none; appearance: none; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: 'Cormorant Unicase', serif;
}

/* ── fullscreen background ── */
#bg {
  position: fixed;
  inset: 0;
  background: url('img/background.png') 0px 0px / cover no-repeat;
  cursor: grab;
  z-index: 0;
}

#bg:active {
  cursor: grabbing;
}

/* ── moon button ── */
#moon-btn {
  position: fixed;
  aspect-ratio: 1;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 10;
  transition: filter 0.4s;
}

#moon-btn:hover {
  filter: drop-shadow(0 0 28px rgba(255, 255, 200, 0.9));
}

#moon-btn::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 200, 0.3);
  animation: moonhint 3s ease-in-out infinite;
}

@keyframes moonhint {
  0%, 100% { opacity: 0.15; transform: scale(1); }
  50%       { opacity: 0.6;  transform: scale(1.1); }
}

/* ── star buttons ──
   The button is small (just the bright core hitbox).
   The image overflows at 3× size so the glow looks natural. */
.star-btn {
  position: fixed;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 10;
  padding: 0;
  overflow: visible;
  border-radius: 50%;
}

.star-btn img {
  position: absolute;
  width: 300%;
  height: 300%;
  top: -100%;
  left: -100%;
  pointer-events: none;
  opacity: 0.85;
  transition: opacity 0.4s, transform 0.4s;
  display: block;
}

.star-btn:hover img {
  opacity: 1;
  transform: scale(1.3);
}

/* ── tree button (invisible — cursor hint only) ── */
#tree-btn {
  position: fixed;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 10;
  border-radius: 35% 35% 15% 15%;
  transition: background 0.4s;
}

#tree-btn:hover {
  background: rgba(200, 255, 160, 0.05);
}

/* ── overlay backdrop ── */
#overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

#overlay.open {
  opacity: 1;
  pointer-events: all;
}

#overlay-veil {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 24, 0.6);
  backdrop-filter: blur(8px);
}

/* ── panel shell ── */
#panel {
  position: relative;
  z-index: 1;
  width: min(660px, 92vw);
  max-height: 80vh;
  background: rgba(6, 11, 32, 0.92);
  border: 1px solid rgba(180, 200, 255, 0.15);
  border-radius: 4px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.03) inset,
    0 0 80px rgba(80, 120, 220, 0.1),
    0 30px 80px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(0);
  transition: transform 0.5s ease;
}

#overlay:not(.open) #panel {
  transform: translateY(20px);
}

/* ── panel content switching ──
   display: contents makes the wrapper transparent to layout so
   .panel-header and .panel-body become direct flex children of
   #panel — exactly like a single-panel structure. */
.panel-content {
  display: none;
}

.panel-content.active {
  display: contents;
}

/* ── shared panel header ── */
.panel-header {
  padding: 1.5rem 1.75rem 1.25rem;
  border-bottom: 1px solid rgba(180, 200, 255, 0.08);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-shrink: 0;
}

.panel-header h1 {
  font-size: 1.15rem;
  font-weight: 400;
  font-style: italic;
  color: #c8d8f5;
  letter-spacing: 0.04em;
}

.panel-header h1 em {
  color: #d4a853;
  font-style: normal;
}

.close-btn {
  background: none;
  border: none;
  color: rgba(180, 200, 255, 0.35);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}
.close-btn:hover { color: #c8d8f5; }

/* ── scrollable panel body ── */
.panel-body {
  overflow-y: auto;
  padding: 1.25rem 1.75rem 1.75rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 144, 213, 0.2) transparent;
}

.panel-body::-webkit-scrollbar { width: 3px; }
.panel-body::-webkit-scrollbar-track { background: transparent; }
.panel-body::-webkit-scrollbar-thumb { background: rgba(100,144,213,0.2); border-radius: 2px; }

/* ── book entry (reading list) ── */
.book-entry {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 1.25rem;
  align-items: start;
  padding: 1.25rem 0;
  border-bottom: 1px solid rgba(180, 200, 255, 0.07);
}

.book-entry:first-child { padding-top: 0.25rem; }
.book-entry:last-child  { border-bottom: none; }

/* shared cover styles */
.cover, .book-detail-cover {
  border-radius: 2px;
  border: 1px solid rgba(180, 200, 255, 0.12);
  background: linear-gradient(140deg, #1a2f6e 0%, #0a1530 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.cover {
  width: 80px;
  aspect-ratio: 2/3;
  box-shadow: 3px 4px 18px rgba(0,0,0,0.55), -1px 0 0 rgba(255,255,255,0.04);
  font-size: 1.6rem;
}

.cover img, .book-detail-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* spine glint */
.cover::after, .book-detail-cover::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: linear-gradient(to right, rgba(255,255,255,0.09), transparent);
  pointer-events: none;
}

.book-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-top: 0.1rem;
}

.book-date {
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  color: rgba(100, 144, 213, 0.45);
  margin-bottom: 0.15rem;
}

.book-title {
  font-family: 'Almendra', serif;
  font-size: 1.05rem;
  color: #c8d8f5;
  line-height: 1.25;
}

.book-author {
  font-style: italic;
  color: #5a80c0;
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
}

.ratings {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  margin-top: 0.25rem;
}

.rating-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.rater {
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  color: #d4a853;
  min-width: 40px;
}

.stars {
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: #d4a853;
  line-height: 1;
}

.stars .empty { color: rgba(212, 168, 83, 0.2); }

/* ── book detail (star popup) ── */
.book-detail {
  padding: 0.25rem 0 0.5rem;
  display: flex;
  flex-direction: column;
}

.book-detail-header {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.book-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-top: 0.25rem;
}

.book-detail-cover {
  width: 100px;
  aspect-ratio: 2/3;
  box-shadow: 5px 6px 24px rgba(0,0,0,0.65), -1px 0 0 rgba(255,255,255,0.06);
  font-size: 2rem;
  flex-shrink: 0;
}

.book-detail-date {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: rgba(100, 144, 213, 0.5);
  margin-bottom: 0.35rem;
}

.book-detail-title {
  font-family: 'Almendra', serif;
  font-size: 1.5rem;
  color: #c8d8f5;
  line-height: 1.2;
  margin-bottom: 0.3rem;
}

.book-detail-author {
  font-style: italic;
  color: #5a80c0;
  font-size: 1rem;
  margin-bottom: 1.25rem;
}

.book-detail-divider {
  height: 1px;
  background: rgba(180, 200, 255, 0.07);
  margin-bottom: 1.1rem;
}

.book-detail-ratings {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1.25rem;
}

.book-detail-rating-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.book-detail-rater {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  color: #d4a853;
  min-width: 48px;
}

.book-detail-stars {
  font-size: 1.05rem;
  color: #d4a853;
  letter-spacing: 0.06em;
}

.book-detail-stars .empty { color: rgba(212, 168, 83, 0.2); }

.book-detail-note {
  font-family: 'La Belle Aurore', cursive;
  color: rgba(180, 200, 255, 0.5);
  font-size: 1.25rem;
  line-height: 1.65;
  border-left: 2px solid rgba(212, 168, 83, 0.2);
  padding-left: 1rem;
}

/* ── pet gallery (cat / dog) ── */
#panel:has(.panel-content.active[id^="panel-pet-"]) {
  width: min(800px, 96vw);
}

.pet-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.pet-gallery img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 2px;
  display: block;
  border: 1px solid rgba(180, 200, 255, 0.08);
  transition: opacity 0.2s, transform 0.2s;
}

.pet-gallery img:hover {
  opacity: 0.9;
  transform: scale(1.03);
}

/* invisible pet hotspot buttons */
.pet-btn {
  position: fixed;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 10;
  border-radius: 4px;
  transition: background 0.3s;
}

.pet-btn:hover {
  background: rgba(255, 230, 180, 0.08);
}

/* ── updates log (tree) ── */
.update-entry {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 1rem;
  align-items: start;
  padding: 1.1rem 0;
  border-bottom: 1px solid rgba(180, 200, 255, 0.07);
}

.update-entry:first-child { padding-top: 0.25rem; }
.update-entry:last-child  { border-bottom: none; }

.update-date {
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  color: rgba(100, 144, 213, 0.45);
  padding-top: 0.15rem;
  line-height: 1.5;
}

.update-visitor {
  display: inline-block;
  font-size: 0.58rem;
  letter-spacing: 0.15em;
  padding: 0.15em 0.55em;
  border-radius: 2px;
  margin-bottom: 0.4rem;
  line-height: 1.7;
}

.update-visitor.ioana    { border: 1px solid rgba(198, 139, 12, 0.3); color: rgba(203, 176, 5, 0.75); }
.update-visitor.dori    { border: 1px solid rgba(125, 85, 198, 0.3); color: rgba(133, 105, 212, 0.75); }

.update-desc {
  font-family: 'La Belle Aurore', cursive;
  font-size: 1.25rem;
  color: #c8d8f5;
  line-height: 1.6;
}
