:root {
  --bg: #FAF7F2;
  --text: #1A1A1A;
  --muted: #999;
  --border: #E5E0D8;
  --card: #FFFFFF;
  --accent: #C41E3A;
  --serif: 'Libre Baskerville', Georgia, serif;
  --display: 'Playfair Display', Georgia, serif;
  --mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--serif); background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── HEADER ── */
.header { text-align: center; padding: 32px 24px 0; }
.header-sub { font-family: var(--mono); font-size: 11px; letter-spacing: 4px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.header h1 { font-family: var(--display); font-size: clamp(28px, 5vw, 48px); font-weight: 900; line-height: 1; letter-spacing: -1px; }
.header h1 em { font-style: italic; color: var(--accent); }
.header-line { width: 60px; height: 3px; background: var(--text); margin: 12px auto; }
.header-ai { font-family: var(--mono); font-size: 10px; letter-spacing: 3px; color: var(--muted); text-transform: uppercase; }

/* ── NAV ── */
nav { display: flex; justify-content: center; gap: 8px; margin-top: 32px; border-bottom: 1px solid var(--border); }
nav button, nav a.nav-link { cursor: pointer; padding: 8px 16px; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; border: none; background: none; font-family: var(--mono); color: var(--muted); transition: color 0.3s; position: relative; text-decoration: none; }
nav button:hover, nav button.active, nav a.nav-link:hover, nav a.nav-link.active { color: var(--text); }
nav button.active::after, nav a.nav-link.active::after { content: ''; position: absolute; bottom: 0; left: 16px; right: 16px; height: 2px; background: var(--accent); }

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

/* ── TOPIC BANNER ── */
.topic-banner { text-align: center; margin-bottom: 48px; padding: 32px 24px; background: linear-gradient(135deg, #1A1A1A, #2C2C2C); color: var(--bg); position: relative; overflow: hidden; }
.topic-banner::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.02) 10px, rgba(255,255,255,0.02) 20px); }
.topic-banner .date { font-family: var(--mono); font-size: 11px; letter-spacing: 3px; color: #888; margin-bottom: 12px; position: relative; }
.topic-banner h2 { font-family: var(--display); font-size: clamp(22px, 4vw, 36px); font-weight: 700; font-style: italic; line-height: 1.3; position: relative; }

/* ── WRITER CARDS ── */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 28px; margin-bottom: 56px; }
.card { background: var(--card); border: 1px solid var(--border); overflow: hidden; transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1); animation: fadeUp 0.6s ease-out both; }
.card:hover { transform: translateY(-8px); box-shadow: 0 20px 60px rgba(0,0,0,0.12); }
.card:nth-child(2) { animation-delay: 0.15s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card-stripe { height: 5px; }
.card-body { padding: 28px; }
.card-header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.avatar { width: 52px; height: 52px; border-radius: 50%; color: white; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 16px; flex-shrink: 0; }
.card-name { font-family: var(--display); font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.card-bio { font-family: var(--mono); font-size: 10px; letter-spacing: 1px; color: var(--muted); }
.card-preview { font-size: 15px; line-height: 1.7; color: #555; font-style: italic; }
.card-footer { margin-top: 20px; }
.card-actions { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.read-btn { cursor: pointer; border: none; font-family: var(--mono); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; padding: 8px 16px; transition: all 0.3s; color: white; text-decoration: none; display: inline-block; }
.read-btn:hover { opacity: 0.85; transform: translateX(4px); }
.share-btn { cursor: pointer; border: 1px solid var(--border); background: var(--card); font-family: var(--mono); font-size: 11px; letter-spacing: 1px; padding: 7px 12px; transition: all 0.3s; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.share-btn:hover { border-color: var(--text); color: var(--text); }
.vote-area { display: flex; align-items: center; gap: 10px; }
.vote-pct { font-family: var(--mono); font-size: 13px; font-weight: 500; animation: fadeIn 0.5s ease; }
.vote-btn { transition: all 0.3s; cursor: pointer; border: 2px solid; background: transparent; padding: 8px 24px; font-family: var(--serif); font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.vote-btn:hover:not(:disabled) { transform: scale(1.05); color: white !important; }
.vote-btn:disabled { opacity: 0.5; cursor: default; }
.vote-bar { height: 4px; background: #F0EDE8; }
.vote-bar-fill { height: 100%; transition: width 0.8s cubic-bezier(0.23, 1, 0.32, 1); }

/* ── SCOREBOARD ── */
.scoreboard { text-align: center; padding: 32px; background: var(--card); border: 1px solid var(--border); animation: fadeUp 0.6s ease; }
.scoreboard-title { font-family: var(--mono); font-size: 11px; letter-spacing: 3px; color: var(--muted); margin-bottom: 8px; }
.scoreboard-summary { font-family: var(--mono); font-size: 11px; letter-spacing: 1px; color: var(--muted); margin-bottom: 16px; }
.scoreboard-items { display: flex; justify-content: center; gap: 40px; flex-wrap: wrap; }
.scoreboard-item { text-align: center; }
.scoreboard-emoji { font-size: 36px; margin-bottom: 4px; }
.scoreboard-votes { font-family: var(--mono); font-size: 22px; font-weight: 500; margin-top: 4px; }
.scoreboard-label { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ── ARTICLE OVERLAY ── */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(8px); z-index: 100; display: flex; justify-content: flex-end; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.overlay.open { opacity: 1; pointer-events: auto; }
.panel { width: 100%; max-width: 640px; background: var(--bg); height: 100%; overflow-y: auto; padding: 48px 40px; transform: translateX(100%); transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1); }
.overlay.open .panel { transform: translateX(0); }
.panel-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 32px; }
.panel-tag { display: inline-block; padding: 4px 12px; font-family: var(--mono); font-size: 10px; letter-spacing: 1px; font-weight: 500; }
.close-btn { cursor: pointer; background: none; border: 2px solid var(--text); width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 20px; transition: all 0.3s; color: var(--text); }
.close-btn:hover { background: var(--text); color: var(--bg); }
.panel-writer { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.panel-writer-name { font-family: var(--display); font-size: 28px; font-weight: 700; }
.panel-writer-tag { font-style: italic; color: var(--muted); font-size: 14px; }
.panel-divider { width: 100%; height: 1px; background: var(--border); margin-bottom: 28px; }
.panel-topic { font-family: var(--display); font-size: 22px; font-weight: 700; font-style: italic; margin-bottom: 28px; line-height: 1.4; }
.panel-content { font-size: 16px; line-height: 2; white-space: pre-wrap; color: #333; }
.panel-footer { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.panel-votes { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ── ARCHIVE ── */
.archive-title { font-family: var(--display); font-size: 32px; font-weight: 700; margin-bottom: 32px; text-align: center; }
.archive-item { background: var(--card); border: 1px solid var(--border); padding: 24px 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; animation: fadeUp 0.5s ease both; text-decoration: none; color: inherit; }
.archive-item:nth-child(2) { animation-delay: 0.1s; }
.archive-item:nth-child(3) { animation-delay: 0.2s; }
.archive-date { font-family: var(--mono); font-size: 11px; letter-spacing: 2px; color: var(--muted); margin-bottom: 6px; }
.archive-topic { font-family: var(--display); font-size: 18px; font-weight: 700; }
.archive-right { display: flex; align-items: center; gap: 16px; }
.archive-bar { display: flex; height: 8px; width: 180px; overflow: hidden; border-radius: 4px; }
.archive-winner { font-family: var(--mono); font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 6px; }

/* ── ABOUT ── */
.about { max-width: 600px; margin: 0 auto; }
.about-title { font-family: var(--display); font-size: 32px; font-weight: 700; margin-bottom: 32px; text-align: center; }
.about-step { display: flex; gap: 24px; margin-bottom: 36px; animation: fadeUp 0.5s ease both; }
.about-num { font-family: var(--display); font-size: 48px; font-weight: 900; color: var(--border); line-height: 1; width: 64px; flex-shrink: 0; }
.about-step h3 { font-family: var(--display); font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.about-step p { font-size: 15px; line-height: 1.7; color: #666; }
.about-warning { margin-top: 40px; padding: 24px; background: #FFF8E7; border: 1px solid #F0DCA0; font-size: 14px; line-height: 1.7; color: #8B6914; }

/* ── LOADING ── */
.loading { text-align: center; padding: 80px 24px; }
.loading-spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 16px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-family: var(--mono); font-size: 13px; color: var(--muted); letter-spacing: 2px; }

.not-ready { text-align: center; padding: 80px 24px; }
.not-ready h2 { font-family: var(--display); font-size: 28px; margin-bottom: 12px; }
.not-ready p { color: var(--muted); font-size: 15px; }

/* ── FOOTER ── */
footer { text-align: center; padding: 32px 24px; border-top: 1px solid var(--border); background: var(--card); }
footer .brand { font-family: var(--display); font-size: 18px; font-weight: 700; margin-bottom: 12px; }
footer .brand em { color: var(--accent); font-style: italic; }
footer .disclaimer { font-family: var(--mono); font-size: 10px; letter-spacing: 2px; color: var(--muted); }

/* ── SSR ARTICLE PAGE ── */
.article-page { max-width: 720px; margin: 0 auto; padding: 40px 24px 80px; }
.article-meta { font-family: var(--mono); font-size: 10px; letter-spacing: 3px; color: var(--muted); margin-bottom: 12px; text-transform: uppercase; }
.article-writer { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.article-writer-name { font-family: var(--display); font-size: 28px; font-weight: 700; }
.article-writer-tag { font-style: italic; color: var(--muted); font-size: 14px; }
.article-topic { font-family: var(--display); font-size: 26px; font-weight: 700; font-style: italic; margin-bottom: 28px; line-height: 1.4; }
.article-body { font-size: 16px; line-height: 2; white-space: pre-wrap; color: #333; margin-bottom: 40px; }
.article-stats { padding: 24px; background: var(--card); border: 1px solid var(--border); margin-bottom: 32px; }
.article-stats-row { display: flex; justify-content: center; gap: 32px; flex-wrap: wrap; }
.article-stat { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: center; }
.article-stat strong { display: block; font-size: 20px; color: var(--text); margin-bottom: 2px; }
.other-articles { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); }
.other-articles h3 { font-family: var(--display); font-size: 20px; font-weight: 700; margin-bottom: 16px; }
.other-article-link { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 8px; background: var(--card); border: 1px solid var(--border); text-decoration: none; color: inherit; transition: all 0.3s; }
.other-article-link:hover { transform: translateX(4px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.cta-vote { display: block; text-align: center; margin-top: 32px; padding: 16px 32px; font-family: var(--mono); font-size: 13px; letter-spacing: 2px; text-transform: uppercase; text-decoration: none; border: 2px solid var(--accent); color: var(--accent); transition: all 0.3s; }
.cta-vote:hover { background: var(--accent); color: white; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 640px) {
  .panel { padding: 32px 20px; }
  .cards { grid-template-columns: 1fr; }
  .archive-bar { width: 120px; }
  .article-page { padding: 24px 16px 60px; }
}
