:root {
  --bg: #fdf6ec;
  --bg-soft: #fff;
  --ink: #2b1d3a;
  --ink-soft: #6b5b7a;
  --purple: #4b2e83;
  --purple-deep: #2e1a52;
  --amber: #ffb43c;
  --amber-deep: #ff8c1a;
  --pink: #ff6f9c;
  --line: #ece1d2;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(75, 46, 131, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
  scroll-behavior: smooth;
}

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

img { max-width: 100%; display: block; }

.site-header {
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-deep) 100%);
  color: #fff;
  padding: 28px 24px 22px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.site-header::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 0%, rgba(255, 180, 60, 0.25), transparent 55%);
  pointer-events: none;
}

.site-title {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  letter-spacing: 0.04em;
  margin: 0;
  font-weight: 800;
  text-transform: uppercase;
  background: linear-gradient(90deg, #ffd98a, var(--amber));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.site-tagline {
  margin: 6px 0 0;
  color: #e6dcf7;
  font-size: 1rem;
  letter-spacing: 0.03em;
}

nav.main-nav {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
  position: relative;
  z-index: 1;
}

nav.main-nav a {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.2s ease, transform 0.2s ease;
}

nav.main-nav a:hover,
nav.main-nav a.active {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--purple-deep);
  transform: translateY(-2px);
}

a.nav-login-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.2s ease, transform 0.2s ease;
  margin-left: auto;
}

a.nav-login-btn:hover {
  background: rgba(255,255,255,0.22);
  transform: translateY(-2px);
}

a.nav-logout-btn {
  margin-left: 6px;
  background: rgba(255,80,80,0.18);
  border-color: rgba(255,100,100,0.4);
}

/* Admin page */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 28px;
}

.admin-card {
  background: var(--bg-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  border-top: 4px solid var(--purple);
}

.admin-card h2 {
  margin: 0 0 20px;
  color: var(--purple-deep);
  font-size: 1.3rem;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--bg);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--purple);
}

.form-group textarea { resize: vertical; min-height: 80px; }

.form-hint {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 4px;
}

.output-box {
  background: var(--ink);
  color: #e8dff7;
  border-radius: 8px;
  padding: 14px;
  font-family: monospace;
  font-size: 0.82rem;
  white-space: pre;
  overflow-x: auto;
  margin-top: 16px;
  display: none;
}

.output-box.visible { display: block; }

.poll-preview {
  background: linear-gradient(135deg, #fff4e0, #ffe6ee);
  border-radius: 10px;
  padding: 18px;
  margin-top: 16px;
  display: none;
}

.poll-preview.visible { display: block; }

.poll-option-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
}

.poll-option-row input { flex: 1; }

.poll-option-row button {
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 1rem;
}

.login-card {
  max-width: 400px;
  margin: 60px auto;
  background: var(--bg-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px;
  text-align: center;
}

.login-card h2 {
  color: var(--purple-deep);
  margin: 0 0 8px;
}

.login-card p {
  color: var(--ink-soft);
  margin: 0 0 24px;
}

.login-error {
  color: #c0392b;
  font-size: 0.9rem;
  margin-top: 10px;
  display: none;
}

.login-error.visible { display: block; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.6rem;
  color: var(--purple-deep);
}

.section-heading .meta {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.latest-page-card {
  background: var(--bg-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  text-align: center;
}

.latest-page-card img {
  margin: 0 auto 18px;
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.15);
}

.latest-page-card .page-caption {
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.button-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary {
  background: linear-gradient(90deg, var(--amber), var(--amber-deep));
  color: var(--purple-deep);
  box-shadow: 0 6px 18px rgba(255, 140, 26, 0.4);
}

.btn-secondary {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 6px 18px rgba(75, 46, 131, 0.3);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.2);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 36px;
}

.feature-card {
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--amber);
}

.feature-card h3 {
  margin: 0 0 8px;
  color: var(--purple-deep);
}

.feature-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 22px;
}

.gallery-item {
  background: var(--bg-soft);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 32px rgba(75, 46, 131, 0.2);
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: var(--line);
}

.gallery-item .info {
  padding: 12px 14px;
}

.gallery-item .info .chapter {
  color: var(--amber-deep);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.gallery-item .info .title {
  font-weight: 700;
  color: var(--purple-deep);
  margin: 2px 0 4px;
}

.gallery-item .info .date {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/* Votes */
.vote-card {
  background: var(--bg-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  text-align: center;
}

.vote-card iframe,
.vote-card .embed-placeholder {
  width: 100%;
  min-height: 420px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #fff4e0, #ffe6ee);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 0.95rem;
  padding: 20px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
}

.site-footer {
  text-align: center;
  padding: 30px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 10, 35, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 30px;
  z-index: 100;
}

.lightbox.open { display: flex; }

.lightbox img {
  max-height: 90vh;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 32px;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  background: none;
  border: none;
}
