*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0a0a;
  --bg-card: #111111;
  --bg-elevated: #1a1a1a;
  --text: #e8e6e3;
  --text-muted: #6b6b6b;
  --text-dim: #3a3a3a;
  --accent: #c9a84c;
  --accent-dim: #8a6e2e;
  --burn: #c94c4c;
  --burn-dim: #8a2e2e;
  --border: #1e1e1e;
  --radius: 12px;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Inter', -apple-system, sans-serif;
}

[data-theme="light"] {
  --bg: #f5f3f0;
  --bg-card: #ffffff;
  --bg-elevated: #e8e6e2;
  --text: #1a1a1a;
  --text-muted: #8a8a8a;
  --text-dim: #c0bdb8;
  --accent: #b8942e;
  --accent-dim: #d4b44c;
  --burn: #c94c4c;
  --burn-dim: #a33a3a;
  --border: #e0ddd8;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
  gap: 12px;
}

.header-end {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  cursor: pointer;
  user-select: none;
}

.theme-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 100px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-muted);
  flex-shrink: 0;
}

.theme-btn:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 400;
  cursor: pointer;
  padding: 6px 16px;
  border-radius: 100px;
  transition: all 0.2s;
}

.nav-btn:hover {
  color: var(--text);
}

.nav-btn.active {
  background: var(--bg-elevated);
  color: var(--accent);
}

main {
  flex: 1;
}

section {
  animation: fadeIn 0.4s ease;
}

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

.hidden {
  display: none !important;
}

/* Input stage */
.prompt {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.75rem;
  color: var(--text);
  margin-bottom: 24px;
  font-weight: 400;
}

.shared-context {
  background: var(--bg-card);
  border-left: 3px solid var(--accent-dim);
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.shared-context::before {
  content: 'Responding to: ';
  display: block;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 4px;
  font-style: normal;
}

#unsaid-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.2rem;
  line-height: 1.7;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}

#unsaid-input:focus {
  border-color: var(--accent-dim);
}

#unsaid-input::placeholder {
  color: var(--text-dim);
  font-style: italic;
}

.char-count {
  text-align: right;
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-top: 8px;
}

.char-count.warning { color: var(--accent-dim); }
.char-count.danger { color: var(--burn); }

/* Choice stage */
.preview-text {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  line-height: 1.7;
  color: var(--text);
  padding: 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent-dim);
  margin-bottom: 32px;
  font-style: italic;
}

.choice-prompt {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.choice-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.choice-btn {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.25s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.choice-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--text-dim);
}

.choice-btn.release:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(201, 168, 76, 0.05);
}

.choice-btn.burn:hover {
  border-color: var(--burn);
  box-shadow: 0 0 20px rgba(201, 76, 76, 0.05);
}

.choice-icon {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.choice-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 300;
}

.choice-btn.secondary {
  background: transparent;
  border-color: var(--text-dim);
  color: var(--text-muted);
}

.choice-btn.secondary:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.back-link {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 8px 0;
  transition: color 0.2s;
}

.back-link:hover { color: var(--text-muted); }

/* Animation stage */
#stage-anim {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

#anim-container {
  width: 100%;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.anim-text {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  line-height: 1.7;
  text-align: center;
  max-width: 90%;
  padding: 20px;
}

.releasing .anim-text {
  animation: floatUp 3s ease forwards;
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  50% { opacity: 0.6; transform: translateY(-40px) scale(1.02); filter: blur(0); }
  100% { opacity: 0; transform: translateY(-100px) scale(1.1); filter: blur(4px); }
}

.releasing #anim-container::after {
  content: '';
  position: absolute;
  width: 2px;
  height: 60px;
  background: linear-gradient(to top, transparent, var(--accent-dim));
  bottom: 20%;
  left: 50%;
  animation: voidBeam 3s ease forwards;
}

@keyframes voidBeam {
  0% { opacity: 0; height: 0; }
  50% { opacity: 1; height: 60px; }
  100% { opacity: 0; height: 100px; }
}

.burning .anim-text {
  animation: burnAway 2.5s ease forwards;
}

@keyframes burnAway {
  0% { opacity: 1; color: var(--text); text-shadow: none; }
  30% { opacity: 1; color: var(--burn); text-shadow: 0 0 20px rgba(201, 76, 76, 0.5); }
  60% { opacity: 0.5; color: var(--burn-dim); text-shadow: 0 0 40px rgba(201, 76, 76, 0.3); filter: blur(1px); }
  100% { opacity: 0; filter: blur(8px); transform: scale(0.9); }
}

.burning #anim-container::after {
  content: '';
  position: absolute;
  bottom: 10%;
  left: 30%;
  width: 40%;
  height: 20px;
  background: radial-gradient(ellipse at center, rgba(201, 76, 76, 0.3), transparent);
  animation: emberGlow 2.5s ease forwards;
}

@keyframes emberGlow {
  0% { opacity: 0; transform: scaleY(0); }
  40% { opacity: 1; transform: scaleY(1); }
  100% { opacity: 0; transform: scaleY(0.5); }
}

.anim-done {
  text-align: center;
  animation: fadeIn 0.6s ease;
}

.done-message {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  font-style: italic;
}

.viral-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.done-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Void view */
.void-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 4px;
}

.void-subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 0.95rem;
}

.void-feed {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.void-empty {
  text-align: center;
  color: var(--text-dim);
  font-style: italic;
  padding: 60px 20px;
  font-family: var(--font-serif);
  font-size: 1.1rem;
}

.void-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.void-reset-btn {
  background: none;
  border: 1px solid var(--burn-dim);
  color: var(--burn);
  font-size: 0.75rem;
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.3s;
  flex-shrink: 0;
  margin-top: 2px;
}

.void-reset-btn:hover {
  background: var(--burn);
  color: #fff;
  border-color: var(--burn);
}

.void-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.void-filters {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 3px;
  border: 1px solid var(--border);
}

.void-filter {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.2s;
}

.void-filter:hover {
  color: var(--text);
}

.void-filter.active {
  background: var(--accent);
  color: #0a0a0a;
  font-weight: 500;
}

.void-search {
  flex: 1;
  min-width: 140px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 0.85rem;
  color: var(--text);
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s;
}

.void-search::placeholder {
  color: var(--text-dim);
}

.void-search:focus {
  border-color: var(--accent);
}

.void-message {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px 24px;
  padding-right: 48px;
  border-left: 2px solid var(--accent-dim);
  animation: fadeIn 0.5s ease forwards;
  opacity: 0;
  transition: all 0.3s;
}

.void-message:hover {
  background: var(--bg-elevated);
  border-left-color: var(--accent);
}

.void-message-text {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
  font-style: italic;
}

.void-message-time {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 8px;
  letter-spacing: 0.05em;
}

.void-message-del {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s;
  line-height: 0;
}

.void-message-del:hover {
  color: var(--burn);
  background: rgba(201,76,76,0.1);
}

.void-message-del svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* Share modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
}

.modal-content {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  max-width: 480px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: fadeIn 0.3s ease;
  z-index: 1;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover { color: var(--text); }

.card-canvas {
  width: 100%;
  max-width: 440px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.card-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.social-actions {
  justify-content: center;
  gap: 8px;
}

.social-btn {
  width: 44px;
  height: 44px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: var(--text-muted);
}

.social-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--text-dim);
  color: var(--text);
}

.social-btn.twitter:hover { color: #1d9bf0; border-color: #1d9bf0; }
.social-btn.facebook:hover { color: #1877f2; border-color: #1877f2; }
.social-btn.linkedin:hover { color: #0a66c2; border-color: #0a66c2; }
.social-btn.copy:hover { color: var(--accent); border-color: var(--accent); }

.gif-loading {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 12px;
  animation: pulse 1s ease infinite;
}

/* Footer */
footer {
  text-align: center;
  padding: 40px 0 20px;
  color: var(--text-dim);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 100px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  z-index: 300;
  transition: all 0.3s;
  opacity: 1;
}

.toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  pointer-events: none;
}

/* Shared message welcome */
.shared-welcome {
  text-align: center;
  padding: 40px 20px;
}

.shared-welcome .shared-message-text {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  line-height: 1.7;
  font-style: italic;
  color: var(--text);
  margin-bottom: 24px;
  padding: 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent-dim);
}

.shared-welcome .shared-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.shared-welcome .shared-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Reshare badge */
.reshare-badge {
  display: inline-block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 100px;
  padding: 2px 10px;
  margin-top: 8px;
}

/* Responsive */
@media (max-width: 500px) {
  #app { padding: 20px 16px; }
  header { margin-bottom: 32px; }
  .prompt { font-size: 1.3rem; }
  .choice-buttons { flex-direction: column; }
  .viral-actions { flex-direction: column; }
  .preview-text { font-size: 1.15rem; }
  .anim-text { font-size: 1.2rem; }
  .modal-content { padding: 20px; }
  .card-actions { flex-direction: column; }
}
