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

:root {
  --berry-pink: #FF6B9D;
  --electric-purple: #9D4EDD;
  --soft-teal: #2DD4BF;
  --dark-bg: #0D0D14;
  --card-bg: rgba(20, 20, 35, 0.85);
  --text-primary: #E8E8F0;
  --text-secondary: #8888A0;
  --gradient-1: linear-gradient(135deg, var(--berry-pink), var(--electric-purple));
  --gradient-2: linear-gradient(135deg, var(--electric-purple), var(--soft-teal));
}

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--dark-bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

.app-container {
  min-height: 100vh;
  position: relative;
}

.grid-bg {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(rgba(157, 78, 221, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(157, 78, 221, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: 0;
}

/* Header */
.header {
  padding: 2rem 1rem;
  text-align: center;
  position: relative;
  z-index: 1;
}

.header-content {
  max-width: 800px;
  margin: 0 auto;
}

.title {
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 700;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  display: inline-block;
}

.title-emoji {
  -webkit-text-fill-color: initial;
}

.glitch-text {
  animation: glitch 3s infinite;
}

@keyframes glitch {
  0%, 90%, 100% { text-shadow: none; }
  92% { text-shadow: 2px 0 var(--berry-pink), -2px 0 var(--soft-teal); }
  94% { text-shadow: -2px 0 var(--berry-pink), 2px 0 var(--soft-teal); }
  96% { text-shadow: 2px 2px var(--electric-purple); }
  98% { text-shadow: none; }
}

.berry-pulse {
  display: inline-block;
  animation: pulse 1s ease-in-out infinite;
  margin-left: 0.5rem;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.8; }
}

.tagline {
  font-style: italic;
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.bug-counter {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--soft-teal);
  padding: 0.5rem 1rem;
  background: rgba(45, 212, 191, 0.1);
  border-radius: 20px;
  display: inline-block;
}

/* Main Content */
.main-content {
  padding: 1rem;
  position: relative;
  z-index: 1;
}

.content-wrapper {
  max-width: 700px;
  margin: 0 auto;
}

/* Glass Card */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(157, 78, 221, 0.2);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Input Section */
.input-card {
  position: relative;
}

.bug-input {
  width: 100%;
  min-height: 150px;
  background: rgba(13, 13, 20, 0.6);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 1rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  color: var(--text-primary);
  resize: vertical;
  transition: all 0.3s ease;
}

.bug-input:focus {
  outline: none;
  border-color: var(--electric-purple);
  box-shadow: 0 0 20px rgba(157, 78, 221, 0.3);
}

.bug-input::placeholder {
  color: var(--text-secondary);
}

.bug-input.sympathy-shake {
  animation: shake 0.5s ease-in-out;
  border-color: var(--berry-pink);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
}

.char-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.fix-button {
  padding: 0.875rem 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  background: var(--gradient-1);
  border: none;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.fix-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(255, 107, 157, 0.4);
}

.fix-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.fix-button.fixing {
  background: var(--gradient-2);
}

/* Fixing Zone */
.fixing-zone {
  position: relative;
  overflow: hidden;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.symbols-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.floating-symbol {
  position: absolute;
  font-family: 'JetBrains Mono', monospace;
  color: var(--electric-purple);
  opacity: 0.4;
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0% { transform: translateY(100%) rotate(0deg); opacity: 0; }
  10% { opacity: 0.4; }
  90% { opacity: 0.4; }
  100% { transform: translateY(-100vh) rotate(360deg); opacity: 0; }
}

.progress-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 80%;
  max-width: 300px;
  z-index: 1;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-1);
  border-radius: 4px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: var(--soft-teal);
  min-width: 40px;
}

.status-message {
  margin-top: 1.5rem;
  font-style: italic;
  color: var(--text-secondary);
  text-align: center;
  animation: fadeIn 0.5s ease;
  z-index: 1;
}

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

/* Solution Card */
.solution-card {
  animation: slideUp 0.5s ease;
}

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

.solution-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.solution-header h3 {
  font-size: 1.3rem;
  color: var(--soft-teal);
}

.confidence-meter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.confidence-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--berry-pink);
  font-size: 1.1rem;
}

.fix-text {
  font-size: 1.1rem;
  line-height: 1.6;
  padding: 1rem;
  background: rgba(157, 78, 221, 0.1);
  border-radius: 8px;
  border-left: 3px solid var(--electric-purple);
  margin-bottom: 1.5rem;
}

.diff-section {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 600px) {
  .diff-section {
    grid-template-columns: 1fr 1fr;
  }
}

.diff-before, .diff-after {
  padding: 0.75rem;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  overflow-x: auto;
}

.diff-before {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.diff-after {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.diff-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.diff-before .diff-label { color: #EF4444; }
.diff-after .diff-label { color: #22C55E; }

.diff-before pre, .diff-after pre {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

.rating-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.rating-section > span {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.rating-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.rate-btn {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-family: 'Space Grotesk', sans-serif;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.rate-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.rate-btn.active {
  background: var(--gradient-1);
  border-color: transparent;
}

.copy-btn {
  width: 100%;
  padding: 0.75rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  background: rgba(45, 212, 191, 0.1);
  border: 1px solid var(--soft-teal);
  border-radius: 8px;
  color: var(--soft-teal);
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background: rgba(45, 212, 191, 0.2);
}

/* History Toggle */
.history-toggle {
  position: fixed;
  bottom: 5rem;
  right: 1rem;
  padding: 0.75rem 1.25rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(157, 78, 221, 0.3);
  border-radius: 30px;
  color: var(--text-primary);
  cursor: pointer;
  z-index: 100;
  transition: all 0.3s ease;
}

.history-toggle:hover {
  background: rgba(157, 78, 221, 0.2);
}

/* History Sidebar */
.history-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  max-width: 90vw;
  height: 100vh;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border-left: 1px solid rgba(157, 78, 221, 0.2);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 200;
  display: flex;
  flex-direction: column;
}

.history-sidebar.open {
  transform: translateX(0);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.history-header h3 {
  font-size: 1.1rem;
}

.close-sidebar {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1rem;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.no-history {
  color: var(--text-secondary);
  text-align: center;
  font-style: italic;
  padding: 2rem;
}

.history-item {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  border-left: 2px solid var(--electric-purple);
}

.history-bug {
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.history-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
}

.history-confidence {
  font-family: 'JetBrains Mono', monospace;
  color: var(--berry-pink);
  font-weight: 600;
}

.history-time {
  color: var(--text-secondary);
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  position: relative;
  z-index: 1;
}

.footer a {
  color: var(--berry-pink);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.footer a:hover {
  color: var(--soft-teal);
}

.footer p {
  margin: 0.25rem 0;
}

.disclaimer {
  font-style: italic;
  font-size: 0.75rem;
  margin-top: 0.5rem !important;
}

/* Responsive */
@media (max-width: 480px) {
  .header {
    padding: 1.5rem 1rem;
  }
  
  .fix-button {
    width: 100%;
    margin-top: 0.5rem;
  }
  
  .input-footer {
    flex-direction: column;
    align-items: stretch;
  }
  
  .char-count {
    text-align: right;
  }
  
  .rating-buttons {
    justify-content: center;
  }
  
  .rate-btn {
    font-size: 0.75rem;
    padding: 0.4rem 0.75rem;
  }
}