/* =========================================================
   Reasonable Doubt — critique.css
   Dark theme: #0E1117 bg / #F0F2F8 text / #1A4ECC primary / #E87500 orange
   ========================================================= */

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

html { font-size: 16px; }

body {
  background: #0E1117;
  color: #F0F2F8;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, textarea, select { font: inherit; }

/* ----- Nav ----- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #12161f;
  border-bottom: 1px solid #1e2a3c;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #F0F2F8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-logo .tm {
  font-size: 0.6rem;
  vertical-align: super;
  color: #9BA3BA;
  font-weight: 400;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-link {
  font-size: 0.875rem;
  color: #9BA3BA;
  transition: color 0.15s;
}

.nav-link:hover { color: #F0F2F8; }

.nav-signin {
  font-size: 0.875rem;
  font-weight: 500;
  color: #F0F2F8;
  background: #1A4ECC;
  border-radius: 6px;
  padding: 6px 14px;
  transition: background 0.15s;
}

.nav-signin:hover { background: #1640B0; }

.nav-user {
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
}

.nav-user.visible { display: flex; }

#navEmail {
  color: #9BA3BA;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 4px;
  background: #1e2a3c;
  color: #6b9eff;
}

.plan-badge.paid {
  background: #1a3a1a;
  color: #4caf50;
}

.nav-signout {
  font-size: 0.8rem;
  color: #9BA3BA;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #1e2a3c;
  transition: border-color 0.15s, color 0.15s;
}

.nav-signout:hover { color: #F0F2F8; border-color: #4a6fa5; }

/* ----- App layout ----- */
.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

/* ----- Input panel (left, ~45%) ----- */
.input-panel {
  flex: 0 0 44%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9BA3BA;
}

textarea {
  width: 100%;
  min-height: 360px;
  resize: vertical;
  background: #12161f;
  color: #F0F2F8;
  border: 1px solid #1e2a3c;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 0.9375rem;
  line-height: 1.6;
  outline: none;
  transition: border-color 0.15s;
}

textarea::placeholder { color: #3a4055; }

textarea:focus { border-color: #1A4ECC; }

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

.char-count {
  font-size: 0.8125rem;
  color: #4a6fa5;
  font-variant-numeric: tabular-nums;
}

.char-count.valid { color: #2ea043; }
.char-count.over  { color: #e05252; }

.analyze-btn {
  background: #1A4ECC;
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 10px 28px;
  border-radius: 7px;
  transition: background 0.15s, opacity 0.15s;
}

.analyze-btn:hover:not(:disabled) { background: #1640B0; }

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

.input-error {
  font-size: 0.875rem;
  color: #e05252;
  min-height: 1.25rem;
}

.usage-note {
  font-size: 0.75rem;
  color: #4a6fa5;
  flex: 1;
  text-align: right;
  padding-right: 14px;
}

/* ----- Example pills ----- */
.example-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  margin-bottom: 16px;
}

.example-pills .pill-label {
  font-size: 0.7rem;
  color: #4a6fa5;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  width: 100%;
  margin-bottom: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid;
  transition: filter 0.15s, transform 0.1s;
  background: none;
  font-family: inherit;
}
.pill:hover { filter: brightness(1.4); transform: translateY(-1px); }

.pill .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.pill-use { border-color: rgba(46,160,67,0.3); color: #2ea043; background: rgba(46,160,67,0.08); }
.pill-use .dot { background: #2ea043; }

.pill-caution { border-color: rgba(212,160,23,0.3); color: #d4a017; background: rgba(212,160,23,0.08); }
.pill-caution .dot { background: #d4a017; }

.pill-challenge { border-color: rgba(232,117,0,0.3); color: #e87500; background: rgba(232,117,0,0.08); }
.pill-challenge .dot { background: #e87500; }

.pill-reject { border-color: rgba(224,82,82,0.3); color: #e05252; background: rgba(224,82,82,0.08); }
.pill-reject .dot { background: #e05252; }

/* ----- Result panel (right, ~40%) ----- */
.result-panel {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 360px;
  display: flex;
  flex-direction: column;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 48px 24px;
  text-align: center;
  color: #4a6fa5;
  flex: 1;
}

.empty-state p {
  font-size: 0.9375rem;
  max-width: 260px;
  line-height: 1.5;
}

/* Radar placeholder */
.radar-wrap {
  width: 360px;
  height: 360px;
  flex-shrink: 0;
}

.radar-wrap canvas,
.radar-wrap svg {
  width: 100%;
  height: 100%;
}

/* Loading state */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 48px 24px;
  text-align: center;
  flex: 1;
}

.loading-text {
  font-size: 0.9375rem;
  color: #9BA3BA;
  animation: pulse-text 1.8s ease-in-out infinite;
}

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

/* ----- Verdict row ----- */
.verdict-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.verdict-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 4px 10px;
  border-radius: 5px;
}

.verdict-use            { background: #1a3a1a; color: #4caf50; }
.verdict-use_with_caution { background: #2a2a0a; color: #d4b800; }
.verdict-challenge      { background: #2a1a0a; color: #e87500; }
.verdict-reject         { background: #3a0a0a; color: #e05252; }

/* ----- Scores toggle + panel ----- */
.scores-toggle {
  font-size: 0.8125rem;
  color: #4a6fa5;
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-bottom: 6px;
  display: inline-block;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.scores-toggle:hover { color: #6b9eff; }

.scores-panel {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: #12161f;
  border: 1px solid #1e2a3c;
  border-radius: 7px;
}

.scores-panel.visible { display: flex; }

.score-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-name {
  font-size: 0.75rem;
  color: #9BA3BA;
  width: 130px;
  flex-shrink: 0;
  text-transform: capitalize;
}

.score-bar-bg {
  flex: 1;
  height: 6px;
  background: #1e2a3c;
  border-radius: 3px;
  overflow: hidden;
}

.score-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.score-val {
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  width: 18px;
  text-align: right;
  background: none !important;
}

.score-low  { background: #2ea043; color: #2ea043; }
.score-mid  { background: #e87500; color: #e87500; }
.score-high { background: #e05252; color: #e05252; }

/* ----- Sign-in prompt ----- */
.signin-prompt {
  font-size: 0.875rem;
  color: #9BA3BA;
  text-align: center;
  padding: 12px 16px;
  background: #12161f;
  border: 1px solid #1e2a3c;
  border-radius: 7px;
  margin-bottom: 14px;
}

.signin-prompt a,
.signin-prompt button {
  color: #6b9eff;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
}

.signin-prompt a:hover,
.signin-prompt button:hover { color: #93b4ff; }

/* ----- Blurred content ----- */
.blurred-content { transition: filter 0.3s; }
.blurred-content.blurred { filter: blur(5px); user-select: none; pointer-events: none; }

.detail-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #4a6fa5;
  margin-bottom: 4px;
}

.detail-text {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #F0F2F8;
  margin-bottom: 14px;
}

.analysis-toggle {
  display: block;
  background: none;
  border: 1px solid #1e2a3c;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.75rem;
  color: #9BA3BA;
  cursor: pointer;
  margin-bottom: 12px;
}
.analysis-toggle:hover { color: #6b9eff; border-color: #6b9eff; }
.analysis-body {
  font-size: 0.85rem;
  line-height: 1.7;
  color: #9BA3BA;
  margin-bottom: 14px;
}
.analysis-body p {
  margin: 0 0 10px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.tag {
  font-size: 0.75rem;
  background: #1e2a3a;
  color: #6b9eff;
  padding: 3px 8px;
  border-radius: 4px;
}

/* ----- Action row ----- */
.action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.action-btn {
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #1e2a3c;
  background: #12161f;
  color: #9BA3BA;
  transition: border-color 0.15s, color 0.15s;
}

.action-btn:hover { border-color: #4a6fa5; color: #F0F2F8; }

.action-link {
  font-size: 0.8125rem;
  color: #4a6fa5;
  text-decoration: underline;
  text-underline-offset: 2px;
  background: none;
  border: none;
  padding: 4px 0;
  cursor: pointer;
}

.action-link:hover { color: #6b9eff; }

/* ----- Share sheet ----- */
.share-sheet {
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  padding: 14px;
  background: #12161f;
  border: 1px solid #1e2a3c;
  border-radius: 8px;
}

.share-sheet.visible { display: flex; }

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

.share-dest {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 6px;
  border-radius: 6px;
  border: 1px solid #1e2a3c;
  background: #0E1117;
  font-size: 0.75rem;
  color: #9BA3BA;
  transition: border-color 0.15s, color 0.15s;
  cursor: pointer;
}

.share-dest:hover:not(.disabled) { border-color: #4a6fa5; color: #F0F2F8; }

.share-dest.disabled { opacity: 0.35; cursor: not-allowed; }

.share-pic-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: #9BA3BA;
}

.share-pic-row input[type="checkbox"] { accent-color: #1A4ECC; }

.ratio-selector {
  display: none;
  gap: 6px;
  margin-left: auto;
}

.ratio-selector.visible { display: flex; }

.ratio-btn {
  font-size: 0.75rem;
  padding: 3px 9px;
  border-radius: 4px;
  border: 1px solid #1e2a3c;
  background: #0E1117;
  color: #9BA3BA;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.ratio-btn:hover { border-color: #4a6fa5; color: #F0F2F8; }
.ratio-btn.active { background: #1A4ECC; border-color: #1A4ECC; color: #fff; }

/* ----- Feedback sheet ----- */
.fb-sheet,
.br-sheet {
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  padding: 14px;
  background: #12161f;
  border: 1px solid #1e2a3c;
  border-radius: 8px;
}

.fb-sheet.visible,
.br-sheet.visible { display: flex; }

.fb-stars {
  display: flex;
  gap: 4px;
}

.fb-star {
  font-size: 1.375rem;
  color: #3a4055;
  cursor: pointer;
  transition: color 0.1s;
  line-height: 1;
}

.fb-star:hover,
.fb-star.active { color: #e87500; }

.fb-field {
  width: 100%;
  background: #0E1117;
  color: #F0F2F8;
  border: 1px solid #1e2a3c;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.875rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}

.fb-field::placeholder { color: #3a4055; }
.fb-field:focus { border-color: #1A4ECC; }

.fb-select {
  width: 100%;
  background: #0E1117;
  color: #F0F2F8;
  border: 1px solid #1e2a3c;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 0.875rem;
  outline: none;
  appearance: none;
  cursor: pointer;
}

.fb-submit {
  align-self: flex-end;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 6px;
  background: #1A4ECC;
  color: #fff;
  transition: background 0.15s;
}

.fb-submit:hover { background: #1640B0; }

.fb-error { font-size: 0.8125rem; color: #e05252; }
.fb-ok    { font-size: 0.8125rem; color: #2ea043; }

/* ----- Auth modal ----- */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.show { display: flex; }

.modal {
  background: #12161f;
  border: 1px solid #1e2a3c;
  border-radius: 12px;
  padding: 32px 28px 28px;
  width: 100%;
  max-width: 400px;
  position: relative;
  animation: modal-in 0.2s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 1.375rem;
  line-height: 1;
  color: #9BA3BA;
  background: none;
  border: none;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.modal-close:hover { color: #F0F2F8; background: #1e2a3c; }

.modal h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.modal-sub {
  font-size: 0.875rem;
  color: #9BA3BA;
  margin-bottom: 20px;
}

.modal-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: #4a6fa5;
  font-size: 0.8125rem;
}

.modal-divider::before,
.modal-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #1e2a3c;
}

.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border-radius: 7px;
  border: 1px solid #1e2a3c;
  background: #0E1117;
  color: #F0F2F8;
  font-size: 0.9375rem;
  font-weight: 500;
  margin-bottom: 10px;
  transition: border-color 0.15s, background 0.15s;
}

.oauth-btn:hover { border-color: #4a6fa5; background: #12161f; }

.email-row {
  display: flex;
  gap: 8px;
}

.email-input {
  flex: 1;
  background: #0E1117;
  color: #F0F2F8;
  border: 1px solid #1e2a3c;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.15s;
}

.email-input::placeholder { color: #3a4055; }
.email-input:focus { border-color: #1A4ECC; }

.email-send {
  font-size: 0.875rem;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 6px;
  background: #1A4ECC;
  color: #fff;
  white-space: nowrap;
  transition: background 0.15s;
}

.email-send:hover { background: #1640B0; }

.otp-msg {
  font-size: 0.875rem;
  color: #9BA3BA;
  margin-bottom: 10px;
}

.otp-input {
  width: 100%;
  background: #0E1117;
  color: #F0F2F8;
  border: 1px solid #1e2a3c;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 1.25rem;
  letter-spacing: 0.25em;
  text-align: center;
  outline: none;
  margin-bottom: 10px;
  transition: border-color 0.15s;
}

.otp-input:focus { border-color: #1A4ECC; }

.otp-verify {
  width: 100%;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 10px;
  border-radius: 6px;
  background: #1A4ECC;
  color: #fff;
  transition: background 0.15s;
}

.otp-verify:hover { background: #1640B0; }

.modal-error {
  font-size: 0.8125rem;
  color: #e05252;
  margin-top: 10px;
  min-height: 1.25rem;
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
  .app {
    flex-direction: column;
    padding: 20px 16px;
    gap: 20px;
  }

  .input-panel {
    flex: none;
    width: 100%;
  }

  .result-panel {
    width: 100%;
    min-height: 200px;
  }

  textarea {
    min-height: 220px;
  }

  .nav-inner {
    padding: 0 16px;
  }

  #navEmail {
    display: none;
  }

  .share-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .score-name {
    width: 100px;
  }
}
