* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  color: #2a2a2a;
  background: #FFF8F0;
}

/* AO3-style header bar */
.ao3-header-bar {
  background: linear-gradient(180deg, #990000 0%, #6b0000 100%);
  border-bottom: 3px solid #4a0000;
}

/* Drop zone styling */
.drop-zone {
  border: 2.5px dashed #990000;
  border-radius: 8px;
  transition: all 0.3s ease;
  background: rgba(153, 0, 0, 0.02);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: #6b0000;
  background: rgba(153, 0, 0, 0.06);
  transform: scale(1.005);
}

/* Polaroid-style image preview */
.polaroid {
  background: white;
  padding: 12px 12px 32px 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.08);
  transform: rotate(-1deg);
  transition: transform 0.3s ease;
}

.polaroid:hover {
  transform: rotate(0deg);
}

/* Tag pill styling */
.tag-pill {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px 3px;
  border-radius: 4px;
  font-size: 0.82rem;
  cursor: default;
  transition: all 0.15s ease;
  line-height: 1.5;
}

.tag-pill-meta {
  background: #f0f0f0;
  color: #555;
  border: 1px solid #ddd;
}

.tag-pill-selectable {
  background: #f0f0f0;
  color: #555;
  border: 1px solid #ccc;
  cursor: pointer;
  user-select: none;
}

.tag-pill-selectable:hover {
  background: #e0e0e0;
}

.tag-pill-selectable.selected {
  background: #990000;
  color: white;
  border-color: #6b0000;
}

/* AO3 button */
.ao3-btn {
  background: #990000;
  color: white;
  border: none;
  padding: 10px 28px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Source Sans 3', system-ui, sans-serif;
}

.ao3-btn:hover {
  background: #6b0000;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(153, 0, 0, 0.3);
}

.ao3-btn:active {
  transform: translateY(0);
}

.ao3-btn:disabled {
  background: #999;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.ao3-btn-outline {
  background: transparent;
  color: #990000;
  border: 2px solid #990000;
  padding: 8px 20px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Source Sans 3', system-ui, sans-serif;
}

.ao3-btn-outline:hover {
  background: #990000;
  color: white;
}

/* Story metadata block */
.meta-block {
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 16px 20px;
  margin: 16px 0;
}

.meta-label {
  font-weight: 700;
  color: #333;
  font-size: 0.85rem;
  text-transform: capitalize;
  display: inline-block;
  min-width: 110px;
}

/* Story body */
.story-body {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 1.15rem;
  line-height: 1.9;
  color: #2a2a2a;
}

.story-body em {
  font-style: italic;
}

/* Fade in animation */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-slide-up {
  animation: fadeSlideUp 0.6s ease-out forwards;
}

/* Loading dots animation */
@keyframes pulse {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}

.loading-dot {
  animation: pulse 1.4s infinite;
}

.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

/* Kudos button */
.kudos-btn {
  background: white;
  border: 2px solid #990000;
  color: #990000;
  padding: 8px 24px;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 0.95rem;
}

.kudos-btn:hover {
  background: #990000;
  color: white;
  transform: scale(1.05);
}

.kudos-btn.kudosed {
  background: #990000;
  color: white;
}

/* Confetti */
@keyframes confettiFall {
  0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.confetti-piece {
  position: fixed;
  top: 0;
  width: 10px;
  height: 10px;
  animation: confettiFall 3s ease-in forwards;
  z-index: 9999;
  pointer-events: none;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #FFF8F0;
}
::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* AO3 work skin-like divider */
.ao3-divider {
  border: none;
  border-top: 1px solid #ccc;
  margin: 20px 0;
}

/* Mood selector */
.mood-option {
  padding: 6px 16px;
  border-radius: 20px;
  border: 2px solid #ddd;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  font-weight: 500;
}

.mood-option:hover {
  border-color: #990000;
  color: #990000;
}

.mood-option.selected {
  border-color: #990000;
  background: #990000;
  color: white;
}

/* History sidebar item */
.history-item {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background 0.15s;
}

.history-item:hover {
  background: rgba(153, 0, 0, 0.05);
}

/* Copy toast */
@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast {
  animation: toastIn 0.3s ease-out;
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 10px 24px;
  border-radius: 8px;
  z-index: 9999;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}