/* ============================================
   Pi Hai 七色坊 - 主样式表
   深色调 · 艺术风 · 简洁设计
   ============================================ */

/* --- CSS Variables --- */
:root {
  --bg-primary: #1a1410;
  --bg-secondary: #231e18;
  --bg-card: #2a231c;
  --bg-hover: #352d24;
  --text-primary: #e8d5b7;
  --text-secondary: #b8a88a;
  --text-muted: #7a6b50;
  --accent: #c9a96e;
  --accent-glow: #d4a94e;
  --border: #3a3228;
  --shadow: 0 4px 24px rgba(0,0,0,0.5);
  --inner-glow: inset 0 1px 0 rgba(255,255,255,0.05);
  --radius: 8px;
  --radius-sm: 4px;
  --transition: 0.3s ease;
  --font-serif: 'Georgia', 'Times New Roman', 'SimSun', serif;
  --font-sans: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', sans-serif;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(201,169,110,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(201,169,110,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(180,140,100,0.05) 0%, transparent 50%);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--accent-glow); }

img { max-width: 100%; height: auto; }

/* --- Header Bar --- */
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 40px;
  background: rgba(26,20,16,0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-logo {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: var(--text-primary);
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-user {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all var(--transition);
  text-decoration: none;
  font-family: inherit;
}
.btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
}
.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--accent-glow);
  color: var(--bg-primary);
}
.btn-danger {
  border-color: #8b3a3a;
  color: #d47373;
}
.btn-danger:hover {
  background: #3a2020;
  border-color: #d47373;
}
.btn-sm {
  padding: 4px 12px;
  font-size: 0.8rem;
}
.btn-icon {
  padding: 6px 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition);
}
.btn-icon:hover { color: var(--text-primary); }

/* --- Forms --- */
.form-group {
  margin-bottom: 16px;
}
.form-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color var(--transition);
}
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201,169,110,0.15);
}
.form-input::placeholder { color: var(--text-muted); }
textarea.form-input {
  resize: vertical;
  min-height: 120px;
  font-family: var(--font-serif);
}

/* --- Modal --- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active {
  display: flex;
}
.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow);
}
.modal-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  margin-bottom: 20px;
  color: var(--text-primary);
}
.modal-close {
  float: right;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
}
.modal-close:hover { color: var(--text-primary); }

/* --- Home Page --- */
.home-container {
  position: relative;
  min-height: calc(100vh - 60px);
  padding: 30px 40px 60px;
  overflow: hidden;
}

/* Canvas for draggable elements */
.home-canvas {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 160px);
}

.home-element {
  position: absolute;
  cursor: default;
  transition: filter 0.2s;
  user-select: none;
}
.home-element img {
  display: block;
  max-width: none;
}

/* Editable state */
.home-editing .home-element {
  cursor: move;
  outline: 1px dashed transparent;
  transition: outline 0.2s;
}
.home-editing .home-element:hover {
  outline-color: var(--accent);
}
.home-editing .home-element.selected {
  outline: 2px solid var(--accent);
  box-shadow: 0 0 12px rgba(201,169,110,0.3);
}

/* Site Title */
.site-title {
  font-family: var(--font-serif);
  font-size: 3.2rem;
  color: #e8d5b7;
  text-shadow:
    2px 3px 0px rgba(0,0,0,0.4),
    0 0 30px rgba(200,160,100,0.3),
    inset 0 0 10px rgba(255,255,255,0.05);
  letter-spacing: 0.05em;
  -webkit-text-stroke: 0.5px rgba(180,150,120,0.3);
  filter: drop-shadow(3px 4px 2px rgba(0,0,0,0.5));
}

/* Subtitle */
.site-subtitle {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: #b8a88a;
  letter-spacing: 0.15em;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.4);
}

/* Tagline */
.site-tagline {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: #9a8b70;
  font-style: italic;
}

/* Navigation Cards */
.nav-section {
  display: flex;
  justify-content: center;
  gap: 40px;
  padding: 60px 0;
  flex-wrap: wrap;
}

.nav-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 30px 50px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.4s ease;
  box-shadow: var(--inner-glow);
  text-decoration: none;
}
.nav-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.5), 0 0 20px rgba(201,169,110,0.1);
}
.nav-card-icon {
  font-size: 2.5rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
.nav-card-label {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: #d4c4a8;
  letter-spacing: 0.2em;
}

/* Footer */
.home-footer {
  text-align: center;
  padding: 30px 0 50px;
}
.footer-text {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: #7a6b50;
  font-style: italic;
}

/* --- Edit Toolbar (Super User) --- */
.edit-toolbar {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.edit-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.edit-btn:hover {
  background: var(--accent);
  color: var(--bg-primary);
  transform: scale(1.1);
}
.edit-btn.active {
  background: var(--accent);
  color: var(--bg-primary);
}

.edit-panel {
  display: none;
  position: fixed;
  bottom: 80px;
  right: 30px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  width: 280px;
  box-shadow: var(--shadow);
  z-index: 1499;
}
.edit-panel.active { display: block; }
.edit-panel h4 {
  font-size: 0.9rem;
  margin-bottom: 12px;
  color: var(--text-secondary);
}
.edit-panel .control-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  align-items: center;
}
.edit-panel .control-row label {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 48px;
}
.edit-panel input[type="range"],
.edit-panel input[type="number"],
.edit-panel select {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

/* --- Content Pages --- */
.content-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.page-title {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  color: var(--text-primary);
  text-shadow: 1px 2px 4px rgba(0,0,0,0.4);
}

/* --- Article / Literature --- */
.article-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--inner-glow);
}
.article-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.article-card-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: var(--text-primary);
  margin-bottom: 10px;
}
.article-card-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.article-card-excerpt {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 8px;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Article Detail */
.article-detail {
  max-width: 800px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}
.article-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: var(--text-primary);
  margin-bottom: 8px;
  text-shadow: 1px 2px 4px rgba(0,0,0,0.4);
}
.article-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.article-body {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--text-secondary);
  white-space: pre-wrap;
  margin-bottom: 40px;
}
.article-body p {
  margin-bottom: 16px;
}
.article-body img {
  border-radius: var(--radius);
  margin: 16px 0;
}

/* --- Photo Gallery --- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}
@media (max-width: 1200px) { .photo-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px) { .photo-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .photo-grid { grid-template-columns: repeat(2, 1fr); } }

.photo-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
}
.photo-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.photo-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  background: var(--bg-primary);
}
.photo-card-title {
  padding: 10px 12px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Photo Detail */
.photo-detail {
  max-width: 1000px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}
.photo-full {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: var(--radius);
  background: var(--bg-primary);
}
.photo-detail-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--text-primary);
  margin: 16px 0 8px;
  text-align: center;
}
.photo-description {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 30px;
  text-align: center;
  font-family: var(--font-serif);
}

/* --- Music Page --- */
.music-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.music-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}
.music-item:hover {
  border-color: var(--accent);
}
.music-play-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.music-play-btn:hover {
  background: var(--accent);
  color: var(--bg-primary);
}
.music-play-btn.playing {
  background: var(--accent);
  color: var(--bg-primary);
}
.music-title {
  flex: 1;
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--text-primary);
}
.music-source-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  background: var(--bg-primary);
  border-radius: 10px;
  color: var(--text-muted);
}

/* Music Detail */
.music-detail {
  max-width: 700px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}
.music-detail-title {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  color: var(--text-primary);
  margin-bottom: 20px;
  text-align: center;
}
.music-player-section {
  text-align: center;
  margin-bottom: 24px;
}
.music-description {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 30px;
  font-family: var(--font-serif);
  text-align: center;
}

/* --- Comments --- */
.comments-section {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid var(--border);
}
.comments-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--text-primary);
  margin-bottom: 20px;
}
.comment-form {
  margin-bottom: 24px;
}
.comment-form textarea {
  width: 100%;
  padding: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  font-size: 0.95rem;
}
.comment-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.comment-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.comment-item {
  padding: 14px 0;
  border-bottom: 1px solid rgba(58,50,40,0.5);
}
.comment-item:last-child {
  border-bottom: none;
}
.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.comment-author {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.9rem;
}
.comment-author .super-badge {
  font-size: 0.7rem;
  color: var(--accent-glow);
  margin-left: 4px;
}
.comment-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.comment-body {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}
.comment-actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}
.comment-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0;
  transition: color var(--transition);
}
.comment-actions button:hover { color: var(--text-primary); }
.comment-actions button.danger:hover { color: #d47373; }

.comment-edit-form {
  margin-top: 8px;
}
.comment-edit-form textarea {
  width: 100%;
  padding: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
}
.comment-hidden {
  opacity: 0.4;
  font-style: italic;
}

/* --- Login / Register --- */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding: 40px 20px;
}
.auth-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.auth-card h2 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 24px;
}
.auth-switch {
  text-align: center;
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.auth-switch a {
  color: var(--accent);
}
.auth-error {
  background: rgba(180,60,60,0.15);
  border: 1px solid rgba(180,60,60,0.3);
  color: #d47373;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.auth-success {
  background: rgba(60,160,80,0.15);
  border: 1px solid rgba(60,160,80,0.3);
  color: #6dcf8a;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

/* --- Admin Panel --- */
.admin-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}
.admin-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.admin-section h3 {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* User Management */
.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.user-table th, .user-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.user-table th {
  color: var(--text-muted);
  font-weight: normal;
  font-size: 0.8rem;
}
.user-table td {
  color: var(--text-secondary);
}
.badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
}
.badge-super { background: rgba(201,169,110,0.2); color: var(--accent); }
.badge-user { background: rgba(180,180,180,0.15); color: #999; }
.badge-banned { background: rgba(180,60,60,0.15); color: #d47373; }
.badge-muted { background: rgba(200,150,50,0.15); color: #c89632; }

/* --- Background Paper Styles --- */
.bg-paper-ruled {
  background: linear-gradient(to bottom, var(--bg-secondary), var(--bg-secondary) 29px, rgba(58,50,40,0.3) 30px);
  background-size: 100% 30px;
}
.bg-paper-grid {
  background-image:
    linear-gradient(rgba(58,50,40,0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(58,50,40,0.3) 1px, transparent 1px);
  background-size: 30px 30px;
}
.bg-pattern-floral {
  background-color: var(--bg-secondary);
  background-image:
    radial-gradient(circle at 20% 30%, rgba(201,169,110,0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(201,169,110,0.05) 0%, transparent 50%);
}

/* --- Toast / Notifications --- */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  padding: 12px 20px;
  border-radius: var(--radius);
  color: #fff;
  font-size: 0.9rem;
  animation: slideIn 0.3s ease;
  box-shadow: var(--shadow);
}
.toast-success { background: #2d6a4f; }
.toast-error { background: #8b3a3a; }
.toast-info { background: #3a5a8b; }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* --- Loading Spinner --- */
.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Responsive --- */
@media (max-width: 768px) {
  /* ===== 手机端：流式布局，覆盖所有绝对定位 ===== */

  .home-container { padding: 20px 16px 60px; overflow: visible; }

  .home-canvas {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: auto;
    gap: 12px;
    padding: 20px 0;
  }

  .home-element {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    text-align: center;
    max-width: 100%;
  }
  .home-element img { max-width: 100%; height: auto !important; }

  .site-title { font-size: 2rem !important; }
  .site-subtitle { font-size: 1.1rem !important; }
  .site-tagline { font-size: 0.9rem !important; }

  .nav-section {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    gap: 6px !important;
    padding: 10px 0 !important;
    width: 100% !important;
    flex-wrap: nowrap !important;
    margin-top: 8px;
  }
  .nav-card {
    padding: 14px 8px !important;
    min-width: 0;
    flex: 1 1 auto;
  }
  .nav-card-icon { font-size: 1.6rem !important; }
  .nav-card-label { font-size: 0.9rem !important; letter-spacing: 0.05em !important; }

  .home-footer {
    position: relative !important;
    left: auto !important;
    bottom: auto !important;
    transform: none !important;
    padding: 12px 0 !important;
    margin-top: 8px;
  }
  .footer-text { font-size: 0.8rem; }

  .content-page { padding: 20px 12px 40px; }
  .page-title { font-size: 1.4rem; }
  .header-bar { padding: 10px 16px; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
}

/* File upload area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 16px;
}
.upload-area:hover, .upload-area.dragover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(201,169,110,0.05);
}
.upload-area input[type="file"] {
  display: none;
}

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
  transition: color var(--transition);
}
.back-link:hover { color: var(--accent); }

/* Editor toolbar for rich text */
.editor-toolbar {
  display: flex;
  gap: 4px;
  padding: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  flex-wrap: wrap;
}
.editor-toolbar button {
  padding: 4px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all var(--transition);
}
.editor-toolbar button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Pill toggle */
.pill-group {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}
.pill {
  padding: 6px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition);
}
.pill:hover { color: var(--text-secondary); }
.pill.active {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

/* Hide music controls for non-logged-in (just play button visible) */
.music-player-hidden audio {
  display: none;
}

/* ===== FIX: Hide duplicate nav text elements on home page ===== */
.home-element.nav_literature,
.home-element.nav_photography,
.home-element.nav_music {
  display: none;
}
.home-editing .home-element.nav_literature,
.home-editing .home-element.nav_photography,
.home-editing .home-element.nav_music {
  display: none;
}

/* ===== FIX: Rich text editor for literature ===== */
.rich-editor-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-secondary);
}
.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 8px 10px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.rich-toolbar button {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.rich-toolbar button:hover {
  background: var(--accent);
  color: var(--bg-primary);
}
.rich-toolbar select {
  height: 32px;
  padding: 0 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
}
.rich-toolbar .separator {
  width: 1px;
  margin: 4px 6px;
  background: var(--border);
}
.rich-editor {
  min-height: 450px;
  padding: 20px;
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--text-primary);
  outline: none;
  overflow-y: auto;
  max-height: 600px;
}
.rich-editor:empty:before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}
.rich-editor img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 8px 0;
}
.rich-editor h1 { font-size: 1.8rem; margin: 16px 0 8px; }
.rich-editor h2 { font-size: 1.5rem; margin: 14px 0 6px; }
.rich-editor h3 { font-size: 1.25rem; margin: 12px 0 4px; }
.rich-editor blockquote {
  border-left: 3px solid var(--accent);
  padding: 8px 16px;
  margin: 12px 0;
  color: var(--text-secondary);
  background: rgba(201,169,110,0.05);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.rich-editor a { color: var(--accent); }
.rich-editor ul, .rich-editor ol { padding-left: 24px; margin: 8px 0; }
.rich-editor hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ===== FIX: Photo lightbox ===== */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.92);
  cursor: zoom-out;
  justify-content: center;
  align-items: center;
}
.lightbox-overlay.active { display: flex; }
.lightbox-overlay img {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 0 40px rgba(0,0,0,0.6);
}
.lightbox-close {
  position: fixed;
  top: 20px;
  right: 24px;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  z-index: 10000;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.lightbox-close:hover { opacity: 1; }

/* ===== FIX: Article detail content styles ===== */
.article-content {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 2;
  color: var(--text-primary);
  padding: 24px;
  word-wrap: break-word;
}
.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 12px 0;
}
.article-content h1, .article-content h2, .article-content h3 {
  margin: 20px 0 10px;
}
.article-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 10px 20px;
  margin: 16px 0;
  color: var(--text-secondary);
  background: rgba(201,169,110,0.05);
}
.article-content p { margin: 8px 0; }
.article-content a { color: var(--accent); }

/* ===== FIX: Guest badge & card actions ===== */
.guest-badge {
  font-size: 0.7rem;
  color: #8e8e8e;
  margin-left: 4px;
  background: rgba(150,150,150,0.15);
  padding: 1px 6px;
  border-radius: 8px;
}
.photo-card-wrap .card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}
.photo-card-wrap:hover .card-actions {
  opacity: 1;
}
.photo-card-wrap .card-actions .btn {
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
}
.photo-card-wrap .card-actions .btn:hover {
  background: var(--accent);
  color: var(--bg-primary);
}
.photo-card-wrap .card-actions .btn-danger {
  background: rgba(180,60,60,0.15);
  border-color: rgba(180,60,60,0.3);
  color: #d47373;
}
.photo-card-wrap .card-actions .btn-danger:hover {
  background: #8b3a3a;
  color: #fff;
}
