/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #241d17;
  --bg-light: #2e2520;
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f5f0eb;
  --text-secondary: rgba(245, 240, 235, 0.6);
  --text-muted: rgba(245, 240, 235, 0.35);
  --fake-start: #00b894;
  --fake-end: #00cec9;
  --real-start: #e84393;
  --real-end: #d63384;
  --suspicious-color: #fdcb6e;
  --finding-dot: #e17055;
  --feedback-correct: #00b894;
  --feedback-wrong: #fdcb6e;
  --radius: 24px;
  --radius-sm: 16px;
  --radius-xs: 12px;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

#app {
  width: 100%;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

/* Screen transitions */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 0 20px 40px;
  opacity: 0;
  transform: translateX(30px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.screen.exit {
  opacity: 0;
  transform: translateX(-30px);
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  padding: 16px 0;
  gap: 12px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.back-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  border-radius: 12px;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-btn:hover {
  background: var(--card-bg);
}

.app-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Upload Zone */
.upload-zone {
  background: var(--card-bg);
  border: 2px dashed var(--card-border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.3s, background 0.3s;
  margin-top: 8px;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.upload-icon {
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.upload-text {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.upload-subtext {
  font-size: 13px;
  color: var(--text-secondary);
}

/* URL Input */
.url-input-wrapper {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.url-input {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xs);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.2s;
}

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

.url-input:focus {
  border-color: rgba(255, 255, 255, 0.2);
}

.url-submit {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xs);
  padding: 12px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.url-submit:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Examples */
.examples-section {
  margin-top: 32px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.examples-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.example-card {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  transition: transform 0.2s, border-color 0.2s;
}

.example-card:hover {
  transform: scale(1.03);
  border-color: rgba(255, 255, 255, 0.15);
}

.example-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.example-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  font-size: 11px;
  font-weight: 500;
  color: white;
}

/* Spectrum Preview (Home) */
.spectrum-preview {
  margin-top: 32px;
  padding: 16px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  display: none;
}

.spectrum-preview.visible {
  display: block;
}

.spectrum-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.spectrum-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.spectrum-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--real-start), var(--fake-start));
  transition: width 0.5s ease;
  width: 50%;
}

.spectrum-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Guess Screen */
.guess-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 16px;
}

.image-preview-container {
  width: 100%;
  max-height: 320px;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
}

.image-preview-container.small {
  width: 160px;
  max-height: 160px;
  border-radius: var(--radius-sm);
  margin: 0 auto 24px;
}

.image-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.guess-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.guess-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

/* Guess Buttons - Stacked vertically per Figma */
.guess-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.guess-btn {
  width: 100%;
  padding: 18px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 17px;
  font-weight: 600;
  font-family: var(--font-body);
  color: white;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.guess-btn:active {
  transform: scale(0.97);
}

/* Fake button = green/teal (top) per Figma */
.fake-btn {
  background: linear-gradient(135deg, var(--fake-start), var(--fake-end));
  box-shadow: 0 4px 20px rgba(0, 184, 148, 0.3);
}

.fake-btn:hover {
  box-shadow: 0 6px 28px rgba(0, 184, 148, 0.45);
}

/* Real button = pink/magenta (bottom) per Figma */
.real-btn {
  background: linear-gradient(135deg, var(--real-start), var(--real-end));
  box-shadow: 0 4px 20px rgba(232, 67, 147, 0.3);
}

.real-btn:hover {
  box-shadow: 0 6px 28px rgba(232, 67, 147, 0.45);
}

.guess-btn-icon {
  display: flex;
  align-items: center;
}

/* Analyzing Screen */
.analyzing-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 40px;
}

.analyzing-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 32px;
}

.analysis-checklist {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card-bg);
  border-radius: var(--radius-xs);
  border: 1px solid var(--card-border);
  font-size: 14px;
  font-weight: 500;
  opacity: 0.4;
  transition: opacity 0.3s;
}

.check-item.active {
  opacity: 1;
}

.check-item.done {
  opacity: 1;
}

.check-item.done .check-spinner {
  border: none;
  background: var(--fake-start);
  animation: none;
}

.check-item.done .check-spinner::after {
  content: '';
  display: block;
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  position: absolute;
  top: 3px;
  left: 6px;
}

.check-spinner {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  position: relative;
}

.check-item.active .check-spinner {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ====================== */
/* Result Screen (consolidated) */
/* ====================== */
.result-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 16px;
  padding-bottom: 40px;
}

.result-image {
  margin-bottom: 16px;
}

/* Feedback */
.result-feedback {
  text-align: center;
  margin-bottom: 24px;
}

.result-feedback .feedback-text {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.result-feedback .feedback-text.correct {
  color: var(--feedback-correct);
}

.result-feedback .feedback-text.wrong {
  color: var(--feedback-wrong);
}

.result-feedback .feedback-subtext {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Three-way verdict tabs */
.verdict-tabs {
  display: flex;
  width: 100%;
  gap: 0;
  border-radius: var(--radius-xs);
  overflow: hidden;
  border: 1px solid var(--card-border);
  margin-bottom: 20px;
}

.verdict-tab {
  flex: 1;
  padding: 14px 8px;
  border: none;
  background: var(--card-bg);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-body);
  letter-spacing: 0.05em;
  cursor: default;
  transition: background 0.3s, color 0.3s;
  text-align: center;
}

.verdict-tab + .verdict-tab {
  border-left: 1px solid var(--card-border);
}

.verdict-tab.active[data-verdict="real"] {
  background: rgba(0, 184, 148, 0.2);
  color: var(--fake-start);
}

.verdict-tab.active[data-verdict="suspicious"] {
  background: rgba(253, 203, 110, 0.2);
  color: var(--suspicious-color);
}

.verdict-tab.active[data-verdict="fake"] {
  background: rgba(232, 67, 147, 0.2);
  color: var(--real-start);
}

/* Confidence section */
.confidence-section {
  width: 100%;
  margin-bottom: 28px;
}

.confidence-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.confidence-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.confidence-value {
  font-size: 13px;
  font-weight: 600;
}

.confidence-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease;
}

.confidence-fill.verdict-real {
  background: linear-gradient(90deg, var(--fake-start), var(--fake-end));
}

.confidence-fill.verdict-suspicious {
  background: linear-gradient(90deg, #f39c12, var(--suspicious-color));
}

.confidence-fill.verdict-fake {
  background: linear-gradient(90deg, var(--real-start), var(--real-end));
}

/* Findings section */
.findings-section {
  width: 100%;
  margin-bottom: 28px;
}

.findings-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.findings-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.finding-card {
  padding: 16px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.finding-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

/* All finding dots are orange per Figma */
.severity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  min-width: 10px;
  background: var(--finding-dot);
}

.finding-title {
  font-size: 14px;
  font-weight: 600;
}

.finding-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Spectrum section (inline in result) */
.spectrum-section {
  width: 100%;
  margin-bottom: 28px;
}

.spectrum-section-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.spectrum-card-inline {
  padding: 24px 20px;
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  text-align: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.spectrum-score-inline {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--real-start), var(--fake-start));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.spectrum-desc-inline {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.spectrum-bar-large {
  height: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  overflow: visible;
  position: relative;
}

.spectrum-fill-large {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--real-start), var(--fake-start));
  transition: width 0.8s ease;
  width: 50%;
}

.spectrum-marker {
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: left 0.8s ease;
}

.spectrum-labels-large {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Teen explanation section */
.teen-section {
  width: 100%;
  margin-bottom: 24px;
}

.teen-toggle-btn {
  width: 100%;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(232, 67, 147, 0.12), rgba(0, 184, 148, 0.12));
  border: 1px solid rgba(232, 67, 147, 0.2);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.2s;
}

.teen-toggle-btn:hover {
  background: linear-gradient(135deg, rgba(232, 67, 147, 0.22), rgba(0, 184, 148, 0.22));
}

.chevron-icon {
  margin-left: auto;
  transition: transform 0.3s;
}

.teen-section.expanded .chevron-icon {
  transform: rotate(180deg);
}

.teen-explanation-expandable {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  background: var(--card-bg);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-primary);
}

.teen-section.expanded .teen-explanation-expandable {
  max-height: 500px;
  padding: 20px;
  border: 1px solid var(--card-border);
  border-top: none;
}

.teen-explanation-expandable p {
  margin-bottom: 12px;
}

.teen-explanation-expandable p:last-child {
  margin-bottom: 0;
}

/* Buttons */
.primary-btn {
  width: 100%;
  padding: 16px 24px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.primary-btn:active {
  transform: scale(0.98);
}

.try-another-btn {
  margin-top: 8px;
}

/* Loading states */
.loading-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* Responsive */
@media (max-width: 375px) {
  .screen {
    padding: 0 16px 32px;
  }

  .guess-title {
    font-size: 20px;
  }

  .guess-btn {
    padding: 16px 20px;
    font-size: 15px;
  }

  .examples-grid {
    gap: 8px;
  }
}

/* Scrollbar */
.screen::-webkit-scrollbar {
  width: 4px;
}

.screen::-webkit-scrollbar-track {
  background: transparent;
}

.screen::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

/* Error state */
.error-message {
  padding: 16px;
  background: rgba(232, 67, 147, 0.1);
  border: 1px solid rgba(232, 67, 147, 0.2);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 14px;
  text-align: center;
  margin-top: 16px;
}
