:root{
  --bg-overlay: rgba(6,12,28,0.45);
  --card-bg: rgba(20, 20, 25, 0.4);
  --accent: rgba(255,245,235,0.92);
  --muted: rgba(255,245,235,0.7);
  --radius: 24px;
}

* {box-sizing: border-box}
html,body{
  height:100%; margin:0;
  font-family: "Inter", sans-serif;
  color:var(--accent);
  overflow: hidden;
}

body{
  background-color:#05060a;
  background-position:center center;
  background-size:cover;
  transition: background-image 1s ease-in-out; 
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
}
body::after{
  content:""; position:fixed; inset:0;
  background: radial-gradient(circle, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.8) 100%);
  pointer-events:none; z-index: 0;
}

/* EFFECTS */
.grain {
  position: fixed; inset:0; pointer-events: none; z-index: 1; opacity: 0.04;
  background-image: url("https://grainy-gradients.vercel.app/noise.svg");
  filter: contrast(170%) brightness(100%);
}

.rain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background-image: url('https://raw.githubusercontent.com/frontend-assets/overlays/master/rain.png');
  animation: rain 1s linear infinite;
  opacity: 0; /* Hidden by default */
  transition: opacity 2s;
}
@keyframes rain { 0% {background-position: 0 0;} 100% {background-position: 10px 600px;} }

.app{
  width:100%; padding:20px;
  display:flex; flex-direction: column; align-items:center; justify-content:center;
  gap: 20px; position: relative; z-index: 10;
  transition: opacity 0.5s;
}

/* ZEN MODE: Hides everything except Quote/Time */
body.zen-active .header-area, 
body.zen-active .attribution,
body.zen-active .meta,
body.zen-active .next-change {
  opacity: 0; pointer-events: none;
}
body.zen-active .card {
  background: transparent; box-shadow: none; border: none; backdrop-filter: none;
}
body.zen-active .toolbar {
  opacity: 0.2; /* Dim tools in Zen mode */
}
body.zen-active .toolbar:hover { opacity: 1; }


/* CARD */
.card{
  width:clamp(300px, 90vw, 850px);
  background: var(--card-bg);
  border-radius:var(--radius);
  padding:40px 48px;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  text-align: center;
  transition: all 0.5s ease;
}

.meta{ display:flex; justify-content:space-between; margin-bottom:24px; border-bottom:1px solid rgba(255,255,255,0.1); padding-bottom:16px; }
.time{ font-size:2rem; font-family:"Playfair Display", serif; }
.period{ font-size:0.85rem; text-transform:uppercase; color:var(--muted); letter-spacing:1px; margin-top:10px;}

.quote{
  font-family:"Playfair Display", serif; font-size:clamp(1.4rem, 2.5vw, 2rem);
  margin:0 0 24px 0; font-style:italic; min-height:120px;
  display:flex; align-items:center; justify-content:center;
}
.author{ display:block; text-align:right; margin-bottom:30px; color:var(--muted); font-size:0.95rem; }
.author-name { color: var(--accent); font-weight: 600; }

/* NEW TOOLBAR */
.toolbar{
  display:flex; justify-content:center; gap:16px; margin-top:20px;
}
.tool-btn{
  background: rgba(255,255,255,0.1); border:0; color:white;
  width: 44px; height: 44px; border-radius: 50%;
  cursor: pointer; transition: all 0.2s;
  display:flex; align-items:center; justify-content:center; font-size: 1.2rem;
}
.tool-btn:hover{ background: rgba(255,255,255,0.25); transform: translateY(-2px); }

/* JOURNAL */
.journal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; opacity: 1; transition: opacity 0.3s;
}
.journal-overlay.hidden { opacity: 0; pointer-events: none; }
.journal-card {
  background: #1a1a1a; padding: 40px; border-radius: 20px;
  width: 90%; max-width: 500px;
}
.journal-card h2 { margin-top: 0; font-family: "Playfair Display", serif; }
textarea {
  width: 100%; height: 200px; background: #222; border: 1px solid #333;
  color: #ddd; padding: 15px; font-family: "Inter", sans-serif;
  border-radius: 10px; margin: 15px 0; resize: none; font-size: 1rem;
}
.btn-primary {
  background: white; color: black; border: 0; padding: 10px 20px;
  border-radius: 20px; cursor: pointer; font-weight: 600;
}

.attribution{ margin-top:30px; font-size:0.7rem; color:rgba(255,255,255,0.4); }
.attribution a{ color:rgba(255,255,255,0.6); text-decoration:none; }

.fade-out { opacity:0; transform: scale(0.98); transition: 0.5s; }
.fade-in { opacity:1; transform: scale(1); transition: 0.8s; }

/* ... Keep your existing CSS ... */

/* NEW: Music Menu Popup */
.music-menu {
  position: absolute;
  bottom: 80px; /* Above toolbar */
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 20, 25, 0.95);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 12px;
  width: 200px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  z-index: 50;
  opacity: 1;
  transition: all 0.2s ease;
}
.music-menu.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(10px);
}
.music-header {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 4px;
}
#track-list {
  list-style: none; padding: 0; margin: 0;
}
.track-item {
  padding: 8px 10px;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 6px;
  color: var(--accent);
  transition: background 0.2s;
  display: flex; justify-content: space-between;
}
.track-item:hover { background: rgba(255,255,255,0.1); }
.track-item.active { color: #ffd700; font-weight: 600; }

/* MODAL STYLES (Shared by Journal & Admin) */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; opacity: 1; transition: opacity 0.3s;
}
.overlay.hidden { opacity: 0; pointer-events: none; }

.modal-card {
  background: #1a1a1a; padding: 40px; border-radius: 20px;
  width: 90%; max-width: 500px; text-align: center;
  border: 1px solid rgba(255,255,255,0.1);
}
.modal-card h2 { margin-top: 0; font-family: "Playfair Display", serif; }

select {
  width: 100%; padding: 12px; background: #222; color: #fff;
  border: 1px solid #444; border-radius: 8px; margin: 15px 0;
}
/* --- LEGAL PAGES STYLING --- */
body.legal-page {
  background: #0a0a0a; /* Solid dark background for readability */
  display: block;
  overflow-y: auto; /* Allow scrolling */
  padding: 40px 20px;
}

.legal-container {
  max-width: 800px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.05);
  padding: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.legal-container h1 {
  font-family: "Playfair Display", serif;
  font-size: 2.5rem;
  margin-top: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 20px;
  margin-bottom: 30px;
}

.legal-container h2 {
  font-family: "Playfair Display", serif;
  font-size: 1.5rem;
  margin-top: 30px;
  color: #fff;
}

.legal-container p, .legal-container li {
  font-family: "Inter", sans-serif;
  line-height: 1.6;
  color: #ccc;
  font-size: 1rem;
  margin-bottom: 15px;
}

.legal-container ul {
  padding-left: 20px;
}

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 16px;
  border-radius: 20px;
  transition: all 0.2s;
}

.back-link:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(-2px);
}
