/* ============================================================
   Music Radio — Apple Human Interface Guidelines (Light Mode)
   ============================================================ */

:root {
  --bg: #F5F5F7;
  --card: #FFFFFF;
  --text: #1D1D1F;
  --text-2: #6E6E73;
  --text-3: #86868B;
  --line: rgba(0, 0, 0, 0.08);
  --radius: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 14px 34px rgba(0, 0, 0, 0.10);
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display",
    "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --font-serif: "Playfair Display", "New York", "Iowan Old Style",
    "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-slogan: "Cormorant Garamond", "Playfair Display", "New York",
    "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --nav-h: 60px;
  --player-h: 84px;
  --accent: #0071E3;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  padding-bottom: calc(var(--player-h) + 28px);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* push the footer to the absolute bottom even on short pages */
main {
  flex: 1 0 auto;
  width: 100%;
}

/* home: center the slogan + card group vertically in the free space */
body[data-page="home"] main {
  display: flex;
  flex-direction: column;
}
body[data-page="home"] .hero { margin-top: auto; }
body[data-page="home"] .portal-grid { margin-bottom: auto; }

a { color: inherit; text-decoration: none; }

/* per-page accent */
body[data-page="home"] { --accent: #0071E3; }
body[data-page="classical"] { --accent: #A67C1E; }
body[data-page="jazz"] { --accent: #8E44AD; }
body[data-page="vibes"] { --accent: #0E7C86; }
body[data-page="favorites"] { --accent: #FF3B30; }

/* ---------- Navigation (frosted glass) ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  margin-right: 8px;
}
.nav-brand .logo { color: var(--text); flex: 0 0 auto; }
.nav-brand .logo rect { fill: currentColor; }

.nav-links { display: flex; gap: 2px; margin-left: auto; }
.nav-links a {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  color: var(--text-2);
  transition: background 0.18s ease, color 0.18s ease;
}
.nav-links a:hover { background: rgba(0, 0, 0, 0.05); color: var(--text); }
.nav-links a.active { background: var(--text); color: #fff; }

.lang-wrap { margin-left: 10px; }
.lang-wrap select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  cursor: pointer;
}

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 24px 20px 40px; }
.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 5.5vw, 3.4rem);
  font-weight: 600;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
  color: var(--text);
  animation: fadeInUp 1.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.hero h1.slogan {
  font-family: var(--font-slogan);
  font-size: clamp(2.6rem, 6vw, 3.9rem);
  font-weight: 500;
  letter-spacing: 0.005em;
  line-height: 1.12;
  animation: elegantFadeUp 4s ease-out forwards;
}
.hero p {
  font-size: 1.1rem;
  color: var(--text-2);
  margin: 0;
  animation: elegantFadeUp 4s ease-out 0.7s both;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes elegantFadeUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* subpages breathe wider: sidebar + content share a roomier canvas */
body[data-page="classical"] .wrap,
body[data-page="jazz"] .wrap,
body[data-page="vibes"] .wrap { max-width: 1280px; }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 12px 0 4px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 0.88rem;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.back-btn:hover { transform: translateX(-2px); box-shadow: var(--shadow); }

/* ---------- Sections & cards ---------- */
.station-section { margin: 10px 0 30px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 26px 0 12px;
}
.section-head h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.section-head .count { font-size: 0.85rem; color: var(--text-3); }

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

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 22px 24px;
  min-height: 104px;
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.card.playing { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.card .c-name {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.3;
  padding-right: 8px;
}
.card .c-meta { font-size: 0.8rem; color: var(--text-3); margin-top: 6px; }

/* Favorites heart (bottom-right of each station card) */
.card-heart {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-3);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.card-heart svg path {
  fill: transparent;
  stroke: currentColor;
  stroke-width: 1.7;
  transition: fill 0.15s ease;
}
.card-heart:hover { transform: scale(1.12); background: rgba(255, 59, 48, 0.10); color: #FF3B30; }
/* Favorited state: STRICTLY solid red regardless of hover state or device.
   Applied PERMANENTLY as a class, never via :hover/:active. */
.card-heart.is-favorited,
.card-heart.is-favorited:hover {
  fill: #ff3b30 !important;
  color: #ff3b30 !important;
  background: rgba(255, 59, 48, 0.10);
  border: none;
}
.card-heart.is-favorited svg path,
.card-heart.is-favorited:hover svg path {
  fill: #ff3b30 !important;
  stroke: #ff3b30 !important;
}
.card-heart.pop { animation: heartPop 0.3s ease; }
.card .c-meta { padding-right: 36px; }

@keyframes heartPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ---------- View All ---------- */
.view-all {
  display: block;
  margin: 18px auto 0;
  padding: 11px 26px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.18s ease, transform 0.18s ease;
}
.view-all:hover { background: #fafafa; transform: translateY(-1px); }

/* ---------- Category navigation (sticky sidebar → mobile pills) ---------- */
.category-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
  margin: 20px 0 44px;
}

.category-nav {
  position: sticky;
  top: calc(var(--nav-h) + 18px);
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: calc(100vh - var(--nav-h) - var(--player-h) - 36px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-width: thin;
}

.category-nav button {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.25;
  text-align: left;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.category-nav button .cat-label { font-weight: 600; }
.category-nav button .cat-count {
  font-size: 0.74rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
.category-nav button:hover { background: rgba(0, 0, 0, 0.045); color: var(--text); }
.category-nav button.active {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}
.category-nav button.active .cat-count { color: rgba(255, 255, 255, 0.68); }

.category-main { min-width: 0; }

/* content fade when switching category */
@keyframes stationFade {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.station-fade { animation: stationFade 0.28s cubic-bezier(0.16, 1, 0.3, 1) both; }

@media (prefers-reduced-motion: reduce) {
  .station-fade { animation: none; }
  .portal, .portal:hover { transition: none; transform: none; }
}

@media (max-width: 860px) {
  .category-layout {
    grid-template-columns: 1fr;
    gap: 4px;
    margin: 12px 0 32px;
  }
  .category-nav {
    position: sticky;
    top: var(--nav-h);
    z-index: 40;
    flex-direction: row;
    gap: 8px;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 10px 0;
    background: var(--bg);
  }
  .category-nav::-webkit-scrollbar { display: none; }
  .category-nav button {
    flex: 0 0 auto;
    width: auto;
    border-radius: 999px;
    border-color: var(--line);
    background: var(--card);
    color: var(--text);
    padding: 8px 15px;
    font-size: 0.86rem;
  }
  .category-nav button:hover { background: var(--card); }
  .category-nav button.active { background: var(--text); color: #fff; }
  .category-main { padding-top: 8px; }
}

/* ---------- Home portals ---------- */
.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: stretch;
  gap: 20px;
  margin: 20px 0 44px;
  perspective: 1200px;
}
.portal {
  border-radius: 20px;
  padding: 32px 28px;
  min-height: 220px;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  color: var(--text);
  box-shadow: var(--shadow);
  transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease-out;
  will-change: transform;
}
.portal:hover {
  transform: rotateX(3deg) rotateY(-6deg) scale(1.02);
  box-shadow: 0 26px 52px rgba(0, 0, 0, 0.12);
}
.portal h2 { margin: 0 0 6px; font-size: 1.6rem; letter-spacing: -0.01em; position: relative; z-index: 1; }
.portal p { margin: 0; font-size: 0.92rem; color: var(--text-2); line-height: 1.45; position: relative; z-index: 1; }
.portal.classical { background: linear-gradient(135deg, #faf3e6, #f0e0c2); }
.portal.jazz { background: linear-gradient(135deg, #f2ecf5, #e3d2ea); }
.portal.vibes { background: linear-gradient(135deg, #e6f2f2, #cfe6e4); }

/* Watermark background images (subtle, right-anchored, cropped) */
.portal::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 60%;
  background-size: cover;
  background-position: center right;
  background-repeat: no-repeat;
  opacity: 0.10;
  pointer-events: none;
  z-index: 0;
}
.portal.classical::after { background-image: url("../assets/cello-bg.jpg"); }
.portal.jazz::after { background-image: url("../assets/sax-bg.jpg"); }
.portal.vibes::after { background-image: url("../assets/cafes-bg.jpg"); }

/* ---------- Footer ---------- */
.site-footer {
  width: 100%;
  max-width: 1080px;
  margin: 30px auto 0;
  padding: 20px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-3);
}
.visitor-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  margin-bottom: 14px;
  font-size: 0.82rem;
  color: var(--text-2);
}

/* ---------- Persistent audio player (light frosted) ---------- */
.audio-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--player-h);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  color: var(--text);
}

.audio-bar .np { min-width: 0; flex: 0 1 280px; }
.audio-bar .np .np-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
}
.audio-bar .np .np-name {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.audio-bar .np .np-name.empty { color: var(--text-3); font-weight: 400; }

.audio-bar .controls { display: flex; align-items: center; gap: 10px; }
.audio-bar .btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  background: var(--text);
  color: #fff;
  font-size: 1rem;
  transition: transform 0.12s ease, background 0.15s ease;
}
.audio-bar .btn:hover { background: #000; }
.audio-bar .btn:active { transform: scale(0.94); }
.audio-bar .btn.playing { background: var(--accent); }

/* Buffering: hide the play/pause glyph and show a subtle spinner */
.audio-bar .btn.buffering [data-icon] { display: none; }
.audio-bar .btn.buffering::before {
  content: "";
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.audio-bar .status { font-size: 0.78rem; color: var(--text-3); flex: 0 0 auto; }
.audio-bar .vol { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.audio-bar .vol input[type="range"] { width: 90px; accent-color: var(--text); }

.spin {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.15);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .audio-bar { gap: 10px; padding: 0 12px; }
  .audio-bar .np { flex: 0 1 140px; }
  .audio-bar .vol { display: none; }
  .nav-brand { font-size: 0.95rem; }
  .nav-links a { padding: 6px 10px; font-size: 0.82rem; }
  .grid { grid-template-columns: 1fr; }
  .hero { padding: 24px 16px 28px; }
}

/* ---------- Auth (Supabase) ---------- */
.auth-area {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 10px;
}

.auth-signin,
.auth-signout,
.auth-chip {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, background 0.18s ease, color 0.18s ease,
    opacity 0.15s ease;
}
.auth-signin:active,
.auth-signout:active { transform: scale(0.96); }

.auth-signin {
  background: var(--accent);
  color: #fff;
}
.auth-signin:hover { opacity: 0.9; }

.auth-signout {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-2);
}
.auth-signout:hover { background: rgba(0, 0, 0, 0.05); color: var(--text); }

.auth-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
  font-weight: 500;
  cursor: default;
}

/* modal overlay */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.auth-overlay[hidden] { display: none; }

.auth-modal {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: 20px;
  padding: 32px 28px 26px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.16);
  animation: authFade 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes authFade {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-2);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
.auth-close:hover { background: rgba(0, 0, 0, 0.1); }

.auth-title { margin: 0 0 6px; font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em; }
.auth-sub { margin: 0 0 22px; font-size: 0.88rem; color: var(--text-2); }

.auth-label {
  display: block;
  margin: 0 0 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
}

.auth-input {
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
  background: var(--card);
}

.auth-error,
.auth-note {
  margin: 0 0 14px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.4;
}
.auth-error { background: rgba(215, 0, 21, 0.08); color: #c7000f; }
.auth-note { background: rgba(0, 113, 227, 0.08); color: var(--accent); }
.auth-error[hidden], .auth-note[hidden] { display: none; }

.auth-submit {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.auth-submit:hover { opacity: 0.9; }
.auth-submit:active { transform: scale(0.98); }
.auth-submit:disabled { opacity: 0.55; cursor: default; }

.auth-switch { margin: 18px 0 0; text-align: center; }
.auth-switch button {
  background: none;
  border: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.auth-switch button:hover { text-decoration: underline; }

/* Honeypot: visually hidden, but a real text input (bots fill it, humans never see it) */
.hp-field {
  opacity: 0;
  position: absolute;
  z-index: -1;
  left: -9999px;
  pointer-events: none;
}

/* Toast (HIG-style dark pill, top center under the nav) */
.toast {
  position: fixed;
  top: calc(var(--nav-h) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: var(--text);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  z-index: 300;
  max-width: min(92vw, 440px);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-error {
  background: #B00020;
  font-size: 0.8rem;
  line-height: 1.4;
  text-align: left;
  word-break: break-word;
}

/* "My Favorites" header link (visible only when signed in) */
.nav-links .nav-favorites::before { content: "♥ "; }

/* Favorites page */
.fav-empty {
  text-align: center;
  color: var(--text-3);
  font-size: 0.9rem;
  padding: 40px 0;
}

/* sign-up success panel (email confirmation pending) */
.auth-success { text-align: center; padding: 4px 0 2px; }
.auth-success-badge {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(52, 199, 89, 0.12);
  color: #34c759;
  font-size: 1.6rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
}
.auth-success-msg {
  margin: 0 0 20px;
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.5;
}

@media (max-width: 640px) {
  .auth-chip { max-width: 96px; }
  .auth-signout { padding: 6px 10px; font-size: 0.78rem; }
  .auth-signin { padding: 6px 12px; font-size: 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-modal { animation: none; }
  .guestbook-modal { animation: none; }
}

/* ---------- Guestbook (Supabase) ---------- */
.nav-guestbook {
  margin-left: 10px;
  padding: 7px 14px;
  border-radius: 999px;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s ease, transform 0.15s ease;
}
.nav-guestbook:hover { background: rgba(0, 0, 0, 0.1); }
.nav-guestbook:active { transform: scale(0.96); }

.guestbook-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.guestbook-overlay[hidden] { display: none; }

.guestbook-modal {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: min(80vh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 20px;
  padding: 28px 26px 22px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.16);
  animation: authFade 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.guestbook-head { padding-right: 34px; }
.guestbook-title { margin: 0 0 4px; font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em; }
.guestbook-sub { margin: 0; font-size: 0.88rem; color: var(--text-2); }

.guestbook-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-top: 16px;
}

.gb-textarea { resize: vertical; min-height: 84px; }

.gb-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  scrollbar-width: thin;
}
.gb-empty { text-align: center; color: var(--text-3); font-size: 0.85rem; padding: 14px 0; }
.gb-item {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.03);
  margin-bottom: 10px;
}
.gb-item-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 3px;
}
.gb-item-name { font-weight: 600; font-size: 0.85rem; color: var(--text); }
.gb-item-time { font-size: 0.7rem; color: var(--text-3); white-space: nowrap; }
.gb-item-text { margin: 0; font-size: 0.9rem; color: var(--text-2); line-height: 1.45; word-break: break-word; }

/* ---------- Mobile header (≤768px): wrap into two rows, keep every control visible ---------- */
@media (max-width: 768px) {
  .site-nav {
    position: static;
    flex-wrap: wrap;
    height: auto;
    padding: 8px 12px;
    row-gap: 6px;
  }
  .nav-brand { font-size: 0.92rem; }
  .nav-links {
    order: 5;
    width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
    gap: 2px;
  }
  .nav-links a { padding: 6px 11px; font-size: 0.8rem; }
  .lang-wrap { order: 2; margin-left: auto; }
  .lang-wrap select { padding: 5px 10px; font-size: 0.75rem; }
  .auth-area { order: 3; margin-left: 8px; }
  .nav-guestbook { order: 4; margin-left: 8px; padding: 6px 11px; font-size: 0.78rem; }
  .auth-chip { max-width: 90px; }
  .auth-signout { padding: 5px 10px; font-size: 0.75rem; }
  .auth-signin { padding: 5px 11px; font-size: 0.78rem; }
  .category-nav { top: 0; }
}
