/* ── Analyze page ────────────────────────────────────────── */

#analyze-output-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#analyze-meta-area .meta-area {
  border-bottom: none;
}

.analyze-meta-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  line-height: 1.5;
}

.analyze-input-wrap {
  padding: 1rem 1.25rem 0;
}

.analyze-textarea {
  width: 100%;
  min-height: 14rem;
  resize: vertical;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--font-mono), ui-monospace, monospace;
  font-size: 0.8125rem;
  line-height: 1.55;
  padding: 0.85rem 1rem;
  outline: none;
  transition: border-color 0.15s;
  display: block;
}

.analyze-textarea:focus { border-color: var(--green-border); }
.analyze-textarea::placeholder { color: var(--text-dim); }

.analyze-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.65rem 1.25rem;
}

.analyze-lang-select {
  font-family: var(--font-mono), ui-monospace, monospace;
  font-size: 0.75rem;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
  flex-shrink: 0;
}

.analyze-lang-select:focus { border-color: var(--green-border); }

.analyze-controls-hint {
  font-size: 0.6875rem;
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
}

.analyze-clear-btn {
  font-family: var(--font-mono), ui-monospace, monospace;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--silver-border);
  border-radius: var(--r-sm);
  padding: 0.25rem 0.65rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.analyze-clear-btn:hover { color: var(--text); border-color: var(--border-strong); }

.analyze-run-btn {
  font-size: 0.75rem;
  padding: 0.3rem 0.85rem;
  flex-shrink: 0;
}

.analyze-confirm {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.analyze-confirm-text {
  font-size: 0.6875rem;
  color: var(--text-muted);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .analyze-controls { gap: 0.5rem; }
  .analyze-lang-select { flex: 1 1 auto; }
  .analyze-controls-hint {
    order: 10;
    flex: 1 1 100%;
  }
}

/* ── Toolbar ─────────────────────────────────────────────── */

.toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  position: sticky;
  bottom: 0;
  margin: 0 -1.5rem -1.5rem;
  padding: 0.6rem 1.5rem 0.75rem;
  background: linear-gradient(to bottom, transparent 0, var(--bg) 0.75rem);
  z-index: 10;
}

/* ── Toolbar buttons (.btn) — larger than code-area buttons ─── */
.btn { font-size: 0.8125rem; }

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); padding: 0.5rem 1.25rem; }
.btn-primary:not(:disabled):hover { opacity: 0.85; color: #fff; background: var(--accent); border-color: var(--accent); }

.btn-secondary { padding: 0.45rem 1rem; }
.btn-secondary.btn-copied { color: var(--green); border-color: var(--green-border); }

/* Toolbar inner groups */
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Nav row: Prev left, Next right; Next stays right even when Prev is hidden */
.toolbar-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* Prev: same size as Next, margin-right:auto pushes Next to far right */
#prev-btn { padding: 0.5rem 1.25rem; margin-right: auto; }

/* ── Site about (collapsible) ────────────────────────────── */

/* ── Prose pages (About, Privacy, Terms) ────────────────── */

.prose-page {
  width: 100%;
  padding: 1.5rem 2rem 2rem;
  background: var(--surface-raised);
  border: 1px solid var(--gold-border);
  border-radius: var(--r-lg);
  box-shadow: 0 0 24px var(--gold-glow), inset 0 1px 0 rgba(255,220,100,0.04);
}

.prose-page h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 1.25rem;
}
.prose-body h2:not(:first-child) {
  margin-top: 2rem;
}

.prose-page h3 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-label);
  margin: 1.5rem 0 0.4rem;
}

.prose-page p {
  font-size: 0.875rem;
  line-height: 1.8;
  color: var(--text-muted);
  margin: 0 0 0.6rem;
}

.prose-link {
  color: var(--gold);
  text-decoration: none;
}
.prose-link:hover { text-decoration: underline; }

/* ── Settings page ───────────────────────────────────────── */

.prose-body {
  max-width: 65ch;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 2.5rem;
}

.about-col h2 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gold);
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--gold-border);
}

.about-col p {
  font-size: 0.875rem;
  line-height: 1.75;
  color: var(--text-muted);
  margin: 0 0 0.6rem;
  text-align: justify;
  hyphens: auto;
}

@media (max-width: 600px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem 0;
  }
}

/* .settings-page now fills the full card width — rows use flex space-between */

.settings-section { margin-top: 0.5rem; }

.settings-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-label);
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--silver-border);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--silver-border);
}
.settings-row:last-child { border-bottom: none; }

.settings-row-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.settings-row-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.settings-row-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.settings-theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  font-size: 0.8125rem;
  padding: 0.35rem 0.75rem;
}

/* ── Theme picker (3-way segmented control) ─────────────── */
.theme-picker {
  display: flex;
  gap: 0;
  border: 1px solid var(--silver-border);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.theme-opt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  background: transparent;
  border: none;
  border-right: 1px solid var(--silver-border);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.theme-opt:last-child { border-right: none; }
.theme-opt:hover:not(.active) { background: var(--silver-glow); color: var(--text); }
.theme-opt.active {
  background: var(--gold-dim);
  color: var(--gold);
  cursor: default;
}

.settings-font-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.settings-font-size-label {
  font-size: 0.8125rem;
  font-family: var(--font-mono), ui-monospace, monospace;
  color: var(--text-label);
  min-width: 2.8rem;
  text-align: center;
}

/* ── Footer ──────────────────────────────────────────────── */

.footer {
  text-align: center;
  padding: 0.9rem 1.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--gold-border);
  background: var(--surface-raised);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.2rem 0.5rem;
}

.footer-row-stats { min-height: 0; }

.footer .status-bar { min-height: 0; }

.footer-sep { color: var(--text-dim); }

/* ── Code fullscreen overlay ─────────────────────────────── */

.code-fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  animation: scr-modal-in 0.15s ease;
}

.code-fullscreen-overlay.hidden { display: none; }

.code-fullscreen-box {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: min(92vw, 1100px);
  max-height: 88vh;
  background: var(--surface-raised);
  border: 1px solid var(--gold-border);
  border-radius: var(--r-lg);
  box-shadow: 0 0 60px rgba(0,0,0,0.6), 0 0 30px var(--gold-glow);
  overflow: hidden;
  animation: scr-modal-up 0.15s ease;
}

.code-fullscreen-box > pre {
  flex: 1;
  overflow: auto;
  margin: 0;
  border-radius: 0;
  padding: 1rem 1.5rem;
  line-height: 1.55;
  max-height: none;
}

.fullscreen-btn { opacity: 0.7; }
.fullscreen-btn:hover { opacity: 1; }

/* ── Confirm modal ───────────────────────────────────────── */

.scr-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: scr-modal-in 0.15s ease;
}

@keyframes scr-modal-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.scr-modal {
  background: var(--surface-raised);
  border: 1px solid var(--gold-border);
  border-radius: var(--r-lg);
  box-shadow: 0 0 40px rgba(0,0,0,0.5), 0 0 24px var(--gold-glow);
  padding: 1.5rem 1.75rem;
  max-width: 380px;
  width: 100%;
  animation: scr-modal-up 0.15s ease;
}

@keyframes scr-modal-up {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.scr-modal-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.scr-modal-msg {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.scr-modal-btns {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.scr-modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

/* Field badge shown in the modal title */
.scr-report-field {
  display: inline-block;
  font-family: var(--font-mono), ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold);
  background: var(--gold-dim);
  border: 1px solid var(--gold-border);
  border-radius: var(--r-sm);
  padding: 0.1rem 0.45rem;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.scr-report-select,
.scr-report-note {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--gold-border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--font-mono), ui-monospace, monospace;
  font-size: 0.78rem;
  padding: 0.45rem 0.7rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.scr-report-select:focus,
.scr-report-note:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-dim);
}

/* Custom select — suppress native arrow, inject themed chevron */
.scr-report-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%23d4a017' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  cursor: pointer;
}
.scr-report-select option {
  background: var(--surface-raised);
  color: var(--text);
}

/* Single-line note input */
.scr-report-note {
  line-height: 1.5;
  color: var(--text-label);
}
.scr-report-note::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

/* ── Utility ─────────────────────────────────────────────── */

.hidden { display: none !important; }

/* Visually hidden but available to screen readers. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Reduced motion ──────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

