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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #333;
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  background: white;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

header {
  text-align: center;
  margin-bottom: 40px;
}

header h1 {
  font-size: 3rem;
  color: #667eea;
  margin-bottom: 10px;
}

.tagline {
  font-size: 1.1rem;
  color: #666;
  font-style: italic;
}

.subtitle {
  font-size: 0.9rem;
  color: #888;
  margin-top: 5px;
}

.step {
  display: none;
}

.step.active {
  display: block;
  animation: fadeIn 0.5s;
}

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

h2 {
  color: #333;
  margin-bottom: 20px;
  font-size: 1.8rem;
}

textarea {
  width: 100%;
  padding: 15px;
  border: 2px solid #ddd;
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.3s;
}

textarea:focus {
  outline: none;
  border-color: #667eea;
}

.stats {
  margin: 10px 0;
  color: #666;
  font-size: 0.9rem;
  display: flex;
  gap: 10px;
  align-items: center;
}

.stats .separator {
  color: #ddd;
  font-weight: 300;
}

.btn-primary,
.btn-secondary,
.btn-copy {
  padding: 12px 30px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin: 10px 5px;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
  background: #e0e0e0;
  color: #333;
}

.btn-secondary:hover {
  background: #d0d0d0;
}

.btn-copy {
  background: #4caf50;
  color: white;
  display: block;
  margin: 15px auto 0;
}

.quiz-intro {
  background: #f0f4ff;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  border-left: 4px solid #667eea;
}

#quizContainer {
  margin: 20px 0;
}

.quiz-question {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 15px;
  border: 2px solid #ddd;
}

.quiz-question h3 {
  color: #667eea;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.quiz-question input {
  width: 100%;
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  margin-top: 10px;
}

.quiz-question input:focus {
  outline: none;
  border-color: #667eea;
}

.quiz-actions {
  text-align: center;
  margin-top: 20px;
}

#quizResults {
  background: #f0f4ff;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
}

#quizResults.passed {
  background: #e8f5e9;
  border-left: 4px solid #4caf50;
}

#quizResults.failed {
  background: #ffebee;
  border-left: 4px solid #f44336;
}

.comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 20px 0;
}

@media (max-width: 768px) {
  .comparison {
    grid-template-columns: 1fr;
  }
}

.text-box {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 10px;
  border: 2px solid #ddd;
}

.text-box.success {
  background: #e8f5e9;
  border-color: #4caf50;
}

.text-box h3 {
  color: #333;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.text-box p {
  color: #555;
  line-height: 1.6;
  font-size: 0.95rem;
  max-height: 300px;
  overflow-y: auto;
}

.improvement {
  text-align: center;
  font-size: 1.3rem;
  color: #4caf50;
  margin: 20px 0;
}

.improvement .word-diff {
  font-size: 1.1rem;
  color: #667eea;
  margin-top: 10px;
}

.word-stats {
  text-align: center;
  padding: 8px;
  font-size: 0.85rem;
  color: #888;
  background: rgba(0,0,0,0.03);
  border-radius: 5px;
  margin-top: 10px;
}

.loading {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  flex-direction: column;
  color: white;
}

.loading.active {
  display: flex;
}

.spinner {
  border: 4px solid rgba(255,255,255,0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.error {
  background: #ffebee;
  color: #c62828;
  padding: 15px;
  border-radius: 8px;
  margin: 20px 0;
  display: none;
  border-left: 4px solid #f44336;
}

.error.active {
  display: block;
}

footer {
  text-align: center;
  color: white;
  margin-top: 30px;
  font-size: 0.9rem;
}

footer p {
  opacity: 0.8;
}

/* Flash Summary */
.flash-summary {
  background: #f0f4ff;
  padding: 20px;
  border-radius: 10px;
  border-left: 4px solid #667eea;
  margin: 20px 0;
}

.flash-summary h3 {
  color: #667eea;
  margin-bottom: 15px;
  font-size: 1.1rem;
}

.flash-summary ul {
  list-style: none;
  padding: 0;
}

.flash-summary li {
  padding: 8px 0 8px 20px;
  position: relative;
  line-height: 1.6;
}

.flash-summary li:before {
  content: "💡";
  position: absolute;
  left: 0;
}

.flash-summary .keywords {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #ddd;
  font-size: 0.9rem;
  color: #666;
}

/* Payment Section */
.payment-section {
  background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
  padding: 30px;
  border-radius: 15px;
  margin: 30px 0;
  border: 3px solid #ffc107;
  box-shadow: 0 5px 20px rgba(255, 193, 7, 0.3);
}

.payment-section h2 {
  color: #856404;
  text-align: center;
  margin-bottom: 10px;
}

#countdown {
  color: #d32f2f;
  font-weight: bold;
  font-size: 1.3em;
}

.payment-warning {
  text-align: center;
  color: #856404;
  font-size: 1rem;
  margin: 15px 0 25px 0;
  line-height: 1.6;
}

.payment-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 20px 0;
}

@media (max-width: 768px) {
  .payment-options {
    grid-template-columns: 1fr;
  }
}

.payment-option {
  background: white;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  border: 2px solid #ffc107;
}

.payment-option h3 {
  color: #667eea;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.payment-option p {
  color: #666;
  margin: 10px 0;
}

.btn-instagram {
  display: inline-block;
  background: linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%);
  color: white;
  padding: 12px 25px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  margin: 10px 0;
  transition: transform 0.3s;
}

.btn-instagram:hover {
  transform: scale(1.05);
}

.qr-container {
  text-align: center;
  padding: 15px;
  background: #f9f9f9;
  border-radius: 10px;
  margin: 15px 0;
}

.qr-image {
  max-width: 180px;
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Header Actions */
.header-actions {
  margin-top: 15px;
}

.btn-icon {
  background: none;
  border: 2px solid #667eea;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s;
  margin: 0 5px;
}

.btn-icon:hover {
  background: #667eea;
  transform: scale(1.1);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 15px;
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-content.modal-large {
  max-width: 800px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 2px solid #eee;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #666;
  line-height: 1;
}

.modal-close:hover {
  color: #d32f2f;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 2px solid #eee;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-danger {
  background: #d32f2f;
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn-danger:hover {
  background: #b71c1c;
}

/* History List */
.history-list {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.history-item {
  background: #f9f9f9;
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 15px;
  border: 2px solid #eee;
  cursor: pointer;
  transition: all 0.3s;
}

.history-item:hover {
  border-color: #667eea;
  transform: translateX(5px);
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.history-item-date {
  font-size: 0.85rem;
  color: #666;
}

.history-item-score {
  background: #4caf50;
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.history-item-preview {
  font-size: 0.9rem;
  color: #555;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-empty {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}

/* Detector Results */
.detector-results {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.detector-score {
  text-align: center;
  padding: 30px;
  border-radius: 15px;
  margin-bottom: 20px;
}

.detector-score-number {
  font-size: 4rem;
  font-weight: 700;
  line-height: 1;
}

.detector-score-label {
  font-size: 1.2rem;
  margin-top: 10px;
  font-weight: 600;
}

.detector-flags {
  margin-top: 20px;
}

.detector-flag {
  background: #f9f9f9;
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 10px;
  border-left: 4px solid #ff6f00;
}

.detector-flag.high {
  border-left-color: #d32f2f;
  background: #ffebee;
}

.detector-flag.medium {
  border-left-color: #ff6f00;
  background: #fff3e0;
}

.detector-flag.low {
  border-left-color: #ffc107;
  background: #fffde7;
}

.detector-flag-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.detector-flag-name {
  font-weight: 600;
  color: #333;
}

.detector-flag-score {
  font-size: 0.85rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(0,0,0,0.1);
}

.detector-flag-issues {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.5;
}

.detector-flag-issues li {
  margin: 4px 0;
}

.detector-suggestions {
  background: #e8f5e9;
  padding: 20px;
  border-radius: 10px;
  margin-top: 20px;
}

.detector-suggestions h3 {
  color: #2e7d32;
  margin-bottom: 15px;
  font-size: 1.1rem;
}

.detector-suggestions ul {
  padding-left: 20px;
}

.detector-suggestions li {
  margin: 8px 0;
  line-height: 1.5;
  color: #333;
}

/* New LLM detector styles */
.detector-flag-severity {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  font-weight: 600;
}

.detector-flag.high .detector-flag-severity {
  background: #ffebee;
  color: #c62828;
}

.detector-flag.medium .detector-flag-severity {
  background: #fff3e0;
  color: #e65100;
}

.detector-flag.low .detector-flag-severity {
  background: #e3f2fd;
  color: #1565c0;
}

.detector-flag-excerpt {
  font-style: italic;
  color: #555;
  background: #f5f5f5;
  padding: 10px;
  border-radius: 6px;
  margin: 10px 0;
  font-size: 0.9rem;
  border-left: 3px solid #667eea;
}

.detector-flag-suggestion {
  color: #2e7d32;
  font-size: 0.85rem;
  margin-top: 8px;
}

.detector-clean {
  text-align: center;
  padding: 40px 20px;
  background: #e8f5e9;
  border-radius: 10px;
  margin-top: 20px;
}

.detector-clean p {
  color: #2e7d32;
  font-size: 1.1rem;
  font-weight: 500;
  margin: 0;
}

/* Enhanced Detector Styles */
.detector-dual-score {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 20px;
}

.detector-score-box {
  flex: 1;
  max-width: 150px;
  padding: 20px;
  border-radius: 12px;
  border: 3px solid;
  text-align: center;
  background: white;
}

.detector-verdict {
  text-align: center;
  margin-bottom: 20px;
  font-size: 1.1rem;
}

.confidence-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  margin-left: 10px;
  text-transform: uppercase;
  font-weight: 600;
}

.confidence-badge.high {
  background: #e8f5e9;
  color: #2e7d32;
}

.confidence-badge.medium {
  background: #fff3e0;
  color: #e65100;
}

.confidence-badge.low {
  background: #ffebee;
  color: #c62828;
}

.detector-summary {
  background: #f5f5f5;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-style: italic;
  color: #555;
  text-align: center;
}

.detector-quickwins {
  background: linear-gradient(135deg, #667eea20, #764ba220);
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  border-left: 4px solid #667eea;
}

.detector-quickwins h3 {
  color: #667eea;
  margin-bottom: 15px;
  font-size: 1rem;
}

.detector-quickwins ol {
  padding-left: 20px;
  margin: 0;
}

.detector-quickwins li {
  margin: 8px 0;
  line-height: 1.5;
  color: #333;
}

.detector-flag-badges {
  display: flex;
  gap: 8px;
  align-items: center;
}

.priority-badge {
  background: #667eea;
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
}

.detector-flag.missing-signal {
  border-left: 4px solid #ff9800;
}

.detector-flag.ai-pattern {
  border-left: 4px solid #f44336;
}

.detector-positives {
  background: #e8f5e9;
  padding: 20px;
  border-radius: 10px;
  margin-top: 20px;
}

.detector-positives h3 {
  color: #2e7d32;
  margin-bottom: 15px;
  font-size: 1rem;
}

.positive-item {
  padding: 10px;
  background: white;
  border-radius: 6px;
  margin-bottom: 10px;
}

.positive-item strong {
  color: #2e7d32;
}

.positive-excerpt {
  font-style: italic;
  color: #666;
  font-size: 0.9rem;
  margin-top: 5px;
}

/* Tone Selector */
.tone-selector {
  margin: 20px 0;
  padding: 20px;
  background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
  border-radius: 12px;
  border: 2px solid #e8ecff;
}

.tone-label {
  display: block;
  font-weight: 600;
  color: #333;
  margin-bottom: 15px;
  font-size: 1rem;
}

.tone-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

@media (max-width: 500px) {
  .tone-options {
    grid-template-columns: 1fr;
  }
}

.tone-option {
  cursor: pointer;
}

.tone-option input[type="radio"] {
  display: none;
}

.tone-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 15px;
  background: white;
  border: 2px solid #ddd;
  border-radius: 12px;
  transition: all 0.3s ease;
  text-align: center;
}

.tone-option:hover .tone-card {
  border-color: #667eea;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.15);
}

.tone-option.selected .tone-card,
.tone-option input:checked + .tone-card {
  border-color: #667eea;
  background: linear-gradient(135deg, #667eea10 0%, #764ba210 100%);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.2);
}

.tone-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.tone-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: #333;
  margin-bottom: 5px;
}

.tone-desc {
  font-size: 0.8rem;
  color: #666;
  line-height: 1.4;
}

/* APEX Badge */
.apex-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 10px;
}

/* Enhanced Header */
header h1 {
  font-size: 3rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
}

/* Version Badge */
.version-badge {
  display: inline-block;
  background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
  color: white;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 10px;
  vertical-align: middle;
}

/* Pulse animation for new features */
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(102, 126, 234, 0); }
  100% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0); }
}

.new-feature {
  animation: pulse 2s infinite;
}

/* Improved text box styling */
.text-box p {
  white-space: pre-wrap;
  word-break: break-word;
}

/* Loading improvements */
.loading p {
  margin-top: 20px;
  font-size: 1.1rem;
  animation: fadeInOut 1.5s ease-in-out infinite;
}

@keyframes fadeInOut {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
