:root {
  --bg-primary: #0d0d0f;
  --bg-secondary: #16161a;
  --bg-tertiary: #1e1e24;
  --text-primary: #e8e6e3;
  --text-secondary: #94929d;
  --text-muted: #5c5a66;
  --accent-green: #00ff88;
  --accent-yellow: #ffd93d;
  --accent-orange: #ff8c42;
  --accent-red: #ff4757;
  --accent-purple: #a855f7;
  --border-color: #2a2a32;
}

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

body {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-icon {
  font-size: 1.8rem;
  filter: grayscale(0.3);
}

.rules-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.rules-toggle:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--accent-green);
}

/* Main content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  gap: 1.5rem;
}

/* Rules panel */
.rules-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  animation: slideDown 0.3s ease;
}

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

.rule-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.rule-item:hover {
  color: var(--text-primary);
}

.rule-item input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.rule-item input[type="checkbox"]:checked {
  background: var(--accent-green);
  border-color: var(--accent-green);
}

.rule-item input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--bg-primary);
  font-size: 12px;
  font-weight: bold;
}

.cheat-sheet {
  background: var(--bg-tertiary);
  padding: 1rem;
  border-radius: 8px;
  border-left: 3px solid var(--accent-yellow);
}

/* Panels */
.panels-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  flex: 1;
}

@media (max-width: 900px) {
  .panels-container {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.panel-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* Input panel */
.text-input {
  flex: 1;
  min-height: 300px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  color: var(--text-primary);
  font-family: 'Crimson Pro', serif;
  font-size: 1.1rem;
  line-height: 1.8;
  resize: none;
  transition: border-color 0.2s;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent-green);
}

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

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

.char-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.analyze-btn {
  background: linear-gradient(135deg, var(--accent-green) 0%, #00cc6a 100%);
  color: var(--bg-primary);
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.analyze-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 255, 136, 0.3);
}

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

/* Results panel */
.results-panel {
  overflow: hidden;
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Stink score */
.stink-score-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.stink-emoji {
  font-size: 2.5rem;
}

.stink-details {
  flex: 1;
}

.stink-number {
  font-size: 1.5rem;
  font-weight: 700;
}

.stink-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.stink-bar-container {
  width: 100px;
  height: 8px;
  background: var(--bg-primary);
  border-radius: 4px;
  overflow: hidden;
}

.stink-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-green), var(--accent-yellow), var(--accent-orange), var(--accent-red));
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* Issues list */
.issues-list {
  flex: 1;
  overflow-y: auto;
  max-height: 300px;
  padding-right: 0.5rem;
}

.issues-list::-webkit-scrollbar {
  width: 6px;
}

.issues-list::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

.issues-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.no-issues {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
}

.issue-item {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  border-left: 3px solid var(--accent-yellow);
  animation: fadeIn 0.3s ease;
}

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

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

.issue-phrase {
  font-family: 'Crimson Pro', serif;
  font-weight: 600;
  color: var(--accent-yellow);
}

.issue-category {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cat-ai-vocabulary { border: 1px solid var(--accent-red); color: var(--accent-red); }
.cat-template-structure { border: 1px solid var(--accent-orange); color: var(--accent-orange); }
.cat-padding-phrase { border: 1px solid var(--accent-yellow); color: var(--accent-yellow); }
.cat-pacing-issues { border: 1px solid var(--accent-purple); color: var(--accent-purple); }
.cat-formatting-red-flag { border: 1px solid var(--accent-green); color: var(--accent-green); }

.issue-explanation {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.issue-suggestion {
  font-size: 0.85rem;
  color: var(--accent-green);
}

/* Rewrite section */
.rewrite-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.rewrite-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-purple) 0%, #9333ea 100%);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.rewrite-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(168, 85, 247, 0.3);
}

.rewrite-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.rewrite-output {
  margin-top: 1rem;
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 1rem;
  animation: fadeIn 0.3s ease;
}

.rewrite-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.rewrite-header h4 {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rewrite-actions {
  display: flex;
  gap: 0.5rem;
}

.action-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.action-btn:hover {
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.rewrite-text {
  font-family: 'Crimson Pro', serif;
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-primary);
  max-height: 200px;
  overflow-y: auto;
}

/* Footer */
.app-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  text-align: center;
}

.app-footer a {
  color: var(--accent-green);
  text-decoration: none;
  transition: opacity 0.2s;
}

.app-footer a:hover {
  opacity: 0.8;
}

.footer-divider {
  opacity: 0.3;
}

.footer-joke {
  font-style: italic;
  opacity: 0.6;
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .header-bar {
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
  }
  
  .main-content {
    padding: 1rem;
  }
  
  .panel {
    padding: 1rem;
  }
  
  .text-input {
    min-height: 200px;
  }
  
  .stink-score-container {
    flex-wrap: wrap;
  }
  
  .stink-bar-container {
    width: 100%;
    order: 3;
    margin-top: 0.5rem;
  }
  
  .app-footer {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .footer-divider {
    display: none;
  }
}