* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  outline: none;
}

*:focus,
*:focus-visible {
  outline: none;
  box-shadow: none;
}

:root {
  --primary-bg: #1E1610;
  --secondary-bg: rgba(30, 20, 15, 0.7);
  --hover-bg: #853D3D;
  --text-color: #fff;
  --border-color: #4A3A33;
  --font-family: 'Lora', serif;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ===== BASE ===== */
html,
body {
  margin: 0;
  padding: 0;
  background: #000;
  font-family: var(--font-family);
  color: #e0e0e0;
  height: 100%;
  overflow: hidden;
  outline: none;
  border: none;
}

body.logged-in {
  background: #0a0a0a url('../images/goya-witches-sabbath.jpg') center center / cover no-repeat fixed;
  overflow-y: auto;
}

body.logged-in::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 0;
}

body.logged-in .main-content {
  position: relative;
  z-index: 1;
}

/* ===== CANVAS ===== */
#lamp-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  cursor: pointer;
}

/* ===== PUBLIC FOOTER ===== */
.public-footer {
  position: fixed;
  bottom: 20px;
  width: 100%;
  text-align: center;
  z-index: 10;
  color: #333;
  font-family: 'Lora', serif;
  font-size: 0.9rem;
  letter-spacing: 1px;
  user-select: none;
  pointer-events: none;
}

.public-footer span {
  pointer-events: auto;
  cursor: default;
  transition: color 0.3s ease;
}

.public-footer span:hover {
  color: #555;
}

/* ===== PRIVATE POEMS SECTION ===== */
.main-content {
  position: relative;
  z-index: 1;
}

.private-header {
  text-align: center;
  margin-bottom: 40px;
  font-size: 2rem;
  font-weight: normal;
  letter-spacing: 2px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 20px;
}

.poems-section {
  width: 100%;
  min-height: 100vh;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
}

.poems-content-scroll {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.poems-container {
  padding: 20px;
  max-width: 800px;
  margin: 0 auto;
}

.poem-item {
  background: var(--secondary-bg);
  border-radius: 8px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s, opacity 0.3s;
}

.poem-item.hidden {
  display: none;
}

.poem-bar {
  width: 100%;
  background: var(--primary-bg);
  color: var(--text-color);
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: 1.3rem;
  transition: background 0.3s, color 0.3s;
}

.poem-bar:hover,
.poem-bar:focus {
  background: var(--hover-bg);
  color: #F9F6F2;
}

.poem-title {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.arrow {
  font-size: 1.2rem;
  color: var(--text-color);
  transition: transform 0.3s;
}

.arrow.rotated {
  transform: rotate(180deg);
}

.poem-content {
  overflow: hidden;
  background: var(--secondary-bg);
  padding: 0 20px;
  transition: max-height 0.35s ease;
  max-height: 0;
}

.poem-content p {
  padding: 15px 0;
  font-size: 1.1rem;
  color: #F2F2F2;
  line-height: 1.6;
}

.site-footer {
  background: var(--primary-bg);
  text-align: center;
  padding: 15px 0;
  border-top: 1px solid var(--border-color);
}

.footer-text {
  user-select: none;
  font-size: 0.9rem;
}

.error-message {
  color: #ff8a80;
  margin-top: 10px;
}

/* ===== ACCORDION ANIMATION ===== */
.poem-content {
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.poem-item.active .poem-content {
  padding: 0 20px;
}

.poem-item.active .poem-bar {
  background: var(--hover-bg);
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  .poems-container {
    padding: 12px;
  }

  .private-header {
    font-size: 1.5rem;
    margin-bottom: 24px;
    padding-bottom: 14px;
  }

  .poem-bar {
    padding: 12px 16px;
    font-size: 1.1rem;
  }

  .poem-title {
    font-size: 1.1rem;
  }

  .poem-content p {
    font-size: 1rem;
    line-height: 1.5;
  }

  .public-footer {
    bottom: 12px;
    font-size: 0.8rem;
  }
}

/* ===== ADMIN PANEL ===== */
.admin-panel {
  max-width: 800px;
  margin: 30px auto 20px;
  padding: 0 20px;
}

.admin-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: block;
  margin: 0 auto;
}

.admin-toggle:hover {
  background: var(--hover-bg);
  transform: rotate(45deg);
}

.admin-toggle.open {
  transform: rotate(45deg);
  background: var(--hover-bg);
}

.admin-form {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-form input,
.admin-form textarea {
  padding: 12px 16px;
  background: rgba(30, 20, 15, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  font-family: var(--font-family);
  font-size: 1rem;
  border-radius: 6px;
  resize: vertical;
  transition: border-color 0.3s;
}

.admin-form input:focus,
.admin-form textarea:focus {
  border-color: var(--hover-bg);
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-btn {
  padding: 10px 24px;
  background: var(--hover-bg);
  color: var(--text-color);
  border: none;
  border-radius: 6px;
  font-family: var(--font-family);
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.3s;
}

.admin-btn:hover {
  opacity: 0.85;
}

#poem-status {
  font-size: 0.9rem;
  color: #aaa;
}