* {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #fafaf9;
}

body.dark {
  background-color: #09090b;
}

/* Header */
.header-bar {
  background: linear-gradient(135deg, #ea580c 0%, #dc2626 50%, #c2410c 100%);
  border-bottom: 2px solid rgba(0,0,0,0.15);
  box-shadow: 0 4px 24px rgba(234, 88, 12, 0.25);
}

.logo-icon {
  font-size: 2rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  animation: gentle-bob 3s ease-in-out infinite;
}

@keyframes gentle-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.badge {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  color: white;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.2);
}

.mode-toggle {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.mode-toggle:hover {
  background: rgba(255,255,255,0.25);
  transform: scale(1.05);
}

/* Input */
.input-wrapper {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  border: 2px solid #e4e4e7;
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper:focus-within {
  border-color: #ea580c;
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.15);
}

.input-wrapper.dark {
  background: #18181b;
  border-color: #27272a;
}

.input-wrapper.dark:focus-within {
  border-color: #ea580c;
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.2);
}

.input-prefix {
  padding: 12px 0 12px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 16px;
  color: #ea580c;
  user-select: none;
}

/* Generate Button */
.generate-btn {
  padding: 12px 24px;
  background: linear-gradient(135deg, #ea580c, #dc2626);
  color: white;
  font-weight: 700;
  font-size: 14px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.3);
  white-space: nowrap;
}

.generate-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(234, 88, 12, 0.4);
}

.generate-btn:active:not(:disabled) {
  transform: translateY(0);
}

.generate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-icon {
  font-size: 16px;
}

/* Lucky Button */
.lucky-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  color: #71717a;
  transition: color 0.2s;
  padding: 6px 12px;
  border-radius: 8px;
}

.lucky-btn:hover:not(:disabled) {
  color: #ea580c;
  background: rgba(234, 88, 12, 0.05);
}

.lucky-btn.dark:hover:not(:disabled) {
  background: rgba(234, 88, 12, 0.1);
}

.lucky-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Loading */
.loading-berry {
  font-size: 4rem;
  animation: spin-berry 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

@keyframes spin-berry {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}

.loading-text {
  animation: pulse-text 2s ease-in-out infinite;
}

@keyframes pulse-text {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.loading-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ea580c;
  animation: dot-bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0.32s; }

@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* Error */
.error-icon {
  animation: gentle-bob 2s ease-in-out infinite;
}

/* Share Button */
.share-btn {
  padding: 8px 16px;
  background: rgba(234, 88, 12, 0.1);
  color: #ea580c;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid rgba(234, 88, 12, 0.2);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.share-btn:hover {
  background: rgba(234, 88, 12, 0.2);
  border-color: rgba(234, 88, 12, 0.4);
}

/* Recent Chips */
.recent-chip {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  border: 1px solid #e4e4e7;
  background: white;
  color: #ea580c;
  cursor: pointer;
  transition: all 0.2s;
}

.recent-chip:hover {
  border-color: #ea580c;
  background: rgba(234, 88, 12, 0.05);
  transform: translateY(-1px);
}

.recent-chip.dark {
  background: #18181b;
  border-color: #27272a;
}

.recent-chip.dark:hover {
  border-color: #ea580c;
  background: rgba(234, 88, 12, 0.1);
}

/* Toast */
.toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: #18181b;
  color: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  font-size: 14px;
  font-weight: 500;
  z-index: 100;
  animation: toast-in 0.3s ease-out;
  border: 1px solid #27272a;
}

@keyframes toast-in {
  0% { transform: translateX(-50%) translateY(16px); opacity: 0; }
  100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* Fade in for generated content */
.fade-in {
  animation: fade-in 0.5s ease-out;
}

@keyframes fade-in {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Reddit Content Styling */
.reddit-content {
  font-size: 14px;
  line-height: 1.6;
}

.reddit-content.dark-mode {
  background: #1a1a1b;
  color: #d7dadc;
}

.reddit-content.light-mode {
  background: #ffffff;
  color: #1c1c1c;
}

/* Subreddit Container */
.reddit-content .subreddit-container {
  padding: 1rem;
}

@media (min-width: 768px) {
  .reddit-content .subreddit-container {
    padding: 1.5rem;
  }
}

/* Header Area */
.reddit-content .subreddit-header {
  background: linear-gradient(135deg, #ea580c 0%, #dc2626 50%, #9a3412 100%);
  padding: 1.5rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  color: white;
}

.dark-mode .subreddit-header {
  background: linear-gradient(135deg, #c2410c 0%, #b91c1c 50%, #7c2d12 100%);
}

/* Stats */
.reddit-content .subreddit-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 0;
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  border-bottom: 1px solid;
  margin-bottom: 1rem;
}

.dark-mode .subreddit-stats {
  border-color: #343536;
  color: #818384;
}

.light-mode .subreddit-stats {
  border-color: #edeff1;
  color: #7c7c7c;
}

/* About Section */
.reddit-content .subreddit-about {
  padding: 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
}

.dark-mode .subreddit-about {
  background: #272729;
}

.light-mode .subreddit-about {
  background: #f6f7f8;
}

/* Posts Container */
.reddit-content .posts-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Individual Post */
.reddit-content .post-card {
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.dark-mode .post-card {
  background: #1a1a1b;
  border-color: #343536;
}

.dark-mode .post-card:hover {
  border-color: #818384;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.light-mode .post-card {
  background: #ffffff;
  border-color: #e4e4e7;
}

.light-mode .post-card:hover {
  border-color: #a1a1aa;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Post Flair */
.reddit-content .post-flair {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  margin-right: 0.5rem;
  background: #ea580c;
  color: white;
  letter-spacing: 0.02em;
}

/* Post Meta */
.reddit-content .post-meta {
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  margin-top: 0.5rem;
}

.dark-mode .post-meta {
  color: #818384;
}

.light-mode .post-meta {
  color: #7c7c7c;
}

/* Post Votes */
.reddit-content .post-votes {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 700;
  color: #ea580c;
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
}

/* Sidebar */
.reddit-content .sidebar {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid;
}

.dark-mode .sidebar {
  background: #1a1a1b;
  border-color: #343536;
}

.light-mode .sidebar {
  background: #ffffff;
  border-color: #e4e4e7;
}

/* Rule Items */
.reddit-content .rule-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid;
  font-size: 13px;
}

.reddit-content .rule-item:last-child {
  border-bottom: none;
}

.dark-mode .rule-item {
  border-color: #343536;
}

.light-mode .rule-item {
  border-color: #edeff1;
}

/* Generic styling for generated content */
.reddit-content h1, .reddit-content h2, .reddit-content h3 {
  margin-bottom: 0.75rem;
}

.reddit-content h1 {
  font-size: 1.5rem;
  font-weight: 800;
}

.reddit-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.reddit-content h3 {
  font-size: 1rem;
  font-weight: 600;
}

.reddit-content p {
  margin-bottom: 0.5rem;
}

.reddit-content ul, .reddit-content ol {
  margin-left: 1.5rem;
  margin-bottom: 0.75rem;
}

.reddit-content strong {
  font-weight: 700;
}

.reddit-content a {
  color: #ea580c;
  text-decoration: none;
}

.reddit-content a:hover {
  text-decoration: underline;
}

/* Upvote/Downvote styling */
.reddit-content .upvote {
  color: #ea580c;
}

.reddit-content .downvote {
  color: #7193ff;
}

/* Pinned post indicator */
.reddit-content .pinned {
  border-left: 3px solid #22c55e;
  padding-left: 0.75rem;
}

/* Responsive layout hints */
@media (min-width: 768px) {
  .reddit-content .layout-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
  }
}

/* Scrollbar styling for dark mode */
body.dark ::-webkit-scrollbar {
  width: 8px;
}

body.dark ::-webkit-scrollbar-track {
  background: #18181b;
}

body.dark ::-webkit-scrollbar-thumb {
  background: #3f3f46;
  border-radius: 4px;
}

body.dark ::-webkit-scrollbar-thumb:hover {
  background: #52525b;
}