/* Aegics identity: pure black, sharp corners, extralight type, purple accent. */
:root {
  --purple: #a68bfb;
  --purple-dim: rgba(166, 139, 251, 0.14);
  --ink: #f4f4f5;
  --ink-dim: #a1a1aa;
  --ink-faint: #71717a;
  --line: #27272a;
  --panel: #0a0a0b;
}

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

html, body { background: #000; color: var(--ink); }
body {
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 300;
  min-height: 100vh;
}

::selection { background: var(--purple); color: #000; }

.shell { max-width: 1060px; margin: 0 auto; padding: 48px 32px 96px; }

/* ---------- header ---------- */
header { display: flex; align-items: baseline; gap: 14px; margin-bottom: 56px; }
.logo-star { color: var(--purple); font-size: 26px; font-weight: 300; }
h1 { font-weight: 200; font-size: 26px; letter-spacing: 0.34em; }
.tagline { color: var(--ink-faint); font-size: 13px; letter-spacing: 0.08em; margin-left: auto; }

/* ---------- auth ---------- */
.user-chip { margin-left: 18px; font-size: 12px; color: var(--ink-faint); display: inline-flex; gap: 12px; align-items: baseline; }
.link-btn {
  background: none; border: none; color: var(--ink-dim); font: inherit; font-size: 11px;
  letter-spacing: 0.16em; cursor: pointer; border-bottom: 1px solid var(--line); padding: 0;
}
.link-btn:hover { color: var(--purple); border-color: var(--purple); }
.auth-screen { display: flex; justify-content: center; padding: 64px 0; }
.denied-box { max-width: 460px; text-align: center; font-size: 15px; line-height: 1.6; }
.denied-box .logo-star { display: block; font-size: 30px; margin-bottom: 18px; }
.denied-box .dim { color: var(--ink-faint); font-size: 13px; margin-top: 10px; }
.denied-box code { color: var(--purple); font-family: monospace; font-size: 13px; }

/* ---------- mode switch ---------- */
.modes { display: inline-flex; border: 1px solid var(--line); margin-bottom: 28px; }
.mode-btn {
  background: none; border: none; color: var(--ink-dim); font: inherit;
  font-size: 13px; letter-spacing: 0.22em; padding: 12px 30px; cursor: pointer;
  transition: color .18s, background .18s;
}
.mode-btn.active { background: var(--purple-dim); color: var(--purple); }
.mode-btn:not(.active):hover { color: var(--ink); }

/* ---------- inputs ---------- */
.input-row { display: flex; gap: 14px; }
input[type="url"], input[type="text"], textarea {
  background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  font: inherit; font-size: 15px; padding: 14px 16px; flex: 1; outline: none;
  transition: border-color .18s, box-shadow .18s;
}
input:focus, textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 1px var(--purple), 0 0 24px rgba(166,139,251,.12);
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }

/* tactile buttons — press down, spring back */
.btn {
  background: var(--purple); border: none; color: #000; font: inherit;
  font-weight: 400; font-size: 13px; letter-spacing: 0.2em; padding: 14px 34px;
  cursor: pointer; position: relative;
  transition: transform .08s ease, box-shadow .18s, background .18s;
}
.btn:hover { box-shadow: 0 0 28px rgba(166,139,251,.45); }
.btn:active { transform: translateY(2px) scale(0.97); }
.btn:disabled { opacity: .35; cursor: default; box-shadow: none; }

.btn-ghost {
  background: none; border: 1px solid var(--line); color: var(--ink-dim);
}
.btn-ghost:hover { border-color: var(--purple); color: var(--purple); box-shadow: 0 0 18px rgba(166,139,251,.2); }

/* ---------- dropzone ---------- */
.dropzone {
  border: 1px dashed #3f3f46; padding: 56px 24px; text-align: center;
  color: var(--ink-dim); cursor: pointer; transition: border-color .18s, background .18s;
  font-size: 14px; letter-spacing: 0.06em;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--purple); background: rgba(166,139,251,.05); color: var(--ink);
}
.dropzone .dz-icon { display: block; font-size: 26px; color: var(--purple); margin-bottom: 12px; }

/* ---------- working state ---------- */
.working { margin-top: 40px; }
.progress-track { height: 2px; background: var(--line); overflow: hidden; }
.progress-fill {
  height: 100%; width: 3%; background: var(--purple);
  box-shadow: 0 0 12px var(--purple); transition: width .6s ease;
}
.working-label {
  margin-top: 16px; font-size: 13px; letter-spacing: 0.14em; color: var(--ink-dim);
  animation: pulse 1.6s ease-in-out infinite;
}
.working-label .star { color: var(--purple); display: inline-block; animation: spin 2.6s linear infinite; }
@keyframes pulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- result ---------- */
.result { margin-top: 48px; animation: rise .4s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.result-title { font-weight: 200; font-size: 21px; margin-bottom: 6px; }
.result-src { font-size: 12px; color: var(--ink-faint); letter-spacing: .04em; margin-bottom: 26px; overflow-wrap: anywhere; }
.result-src a { color: var(--ink-faint); }
.result-src a:hover { color: var(--purple); }

/* revision rail */
.rev-rail { display: flex; gap: 8px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.rev-tab {
  background: none; border: 1px solid var(--line); color: var(--ink-dim); font: inherit;
  font-size: 12px; letter-spacing: 0.16em; padding: 7px 16px; cursor: pointer;
  transition: all .15s;
}
.rev-tab.active { border-color: var(--purple); color: var(--purple); background: var(--purple-dim); }
.rev-tab:not(.active):hover { color: var(--ink); }
.rev-note { font-size: 12px; color: var(--ink-faint); font-style: italic; }

.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 820px) { .result-grid { grid-template-columns: 1fr; } }

.panel { background: var(--panel); border: 1px solid var(--line); position: relative; }
.panel::before {
  content: ''; position: absolute; top: -1px; left: -1px; right: -1px; height: 3px;
  background: var(--purple);
}
.panel-inner { padding: 22px; }
.panel-label { font-size: 11px; letter-spacing: 0.28em; color: var(--ink-faint); margin-bottom: 16px; }

/* image panel */
.hero-wrap { position: relative; background: #000; }
.hero-img { width: 100%; display: block; max-height: 420px; object-fit: contain; background: #000; }
.pick-badge {
  position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.75);
  color: var(--purple); font-size: 11px; letter-spacing: 0.18em; padding: 5px 10px;
  border: 1px solid var(--purple);
}
.thumb-strip { display: flex; gap: 8px; margin-top: 14px; overflow-x: auto; padding-bottom: 4px; }
.thumb {
  flex: 0 0 auto; width: 76px; height: 54px; object-fit: cover; cursor: pointer;
  opacity: .45; border: 1px solid transparent; transition: opacity .15s, border-color .15s;
}
.thumb:hover { opacity: .85; }
.thumb.selected { opacity: 1; border-color: var(--purple); }
.thumb-ts { font-size: 10px; color: var(--ink-faint); text-align: center; margin-top: 3px; }
.rationale { font-size: 13px; color: var(--ink-faint); margin-top: 14px; line-height: 1.5; }
.rationale .star { color: var(--purple); margin-right: 6px; }
.img-meta { font-size: 12px; color: var(--ink-faint); margin-top: 12px; letter-spacing: .04em; }
.panel-actions { margin-top: 18px; display: flex; gap: 12px; align-items: center; }

/* caption panel */
.caption-text {
  font-size: 17px; line-height: 1.65; white-space: pre-wrap; min-height: 140px;
  font-weight: 300;
}
.caption-text .caret { color: var(--purple); animation: pulse 1s infinite; }
.feedback-tag { margin-top: 14px; font-size: 12px; color: var(--ink-faint); font-style: italic; }
.feedback-tag b { color: var(--ink-dim); font-weight: 400; }

/* regenerate zone */
.regen { margin-top: 30px; display: flex; gap: 12px; align-items: stretch; }
.regen input { flex: 1; }

/* transcript */
details.transcript { margin-top: 26px; border: 1px solid var(--line); }
details.transcript summary {
  padding: 12px 18px; cursor: pointer; font-size: 12px; letter-spacing: 0.2em;
  color: var(--ink-dim); list-style: none;
}
details.transcript summary::-webkit-details-marker { display: none; }
details.transcript summary:hover { color: var(--purple); }
details.transcript .transcript-body {
  padding: 4px 18px 18px; font-size: 13px; line-height: 1.7; color: var(--ink-dim);
  white-space: pre-wrap; max-height: 260px; overflow-y: auto;
}

/* ---------- history ---------- */
.history { margin-top: 72px; }
.history h2 { font-weight: 200; font-size: 14px; letter-spacing: 0.3em; color: var(--ink-faint); margin-bottom: 18px; }
.history-row {
  display: flex; align-items: baseline; gap: 16px; padding: 13px 4px;
  border-bottom: 1px solid var(--line); cursor: pointer; transition: background .15s;
}
.history-row:hover { background: rgba(166,139,251,.05); }
.history-row .h-kind { color: var(--purple); font-size: 12px; width: 52px; letter-spacing: .12em; flex-shrink: 0; }
.history-row .h-title { font-size: 14px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-row .h-meta { font-size: 12px; color: var(--ink-faint); flex-shrink: 0; }
.history-row .h-del {
  background: none; border: none; color: var(--ink-faint); cursor: pointer; font: inherit;
  font-size: 14px; padding: 0 6px; visibility: hidden;
}
.history-row:hover .h-del { visibility: visible; }
.history-row .h-del:hover { color: #f87171; }
.history-empty { color: var(--ink-faint); font-size: 13px; padding: 12px 4px; }

/* ---------- review queue ---------- */
.review-count {
  font-size: 11px; letter-spacing: 0.14em; color: var(--purple);
  border: 1px solid var(--purple); padding: 3px 10px; margin-left: 12px;
}
.pill-new {
  font-size: 10px; letter-spacing: 0.18em; color: #000; background: var(--purple);
  padding: 2px 8px; flex-shrink: 0; font-weight: 400;
}
.history-row.unreviewed .h-title { color: var(--ink); font-weight: 400; }
.review-btn { margin-left: auto; }

/* ---------- format toggle ---------- */
.format-toggle { display: inline-flex; border: 1px solid var(--line); margin-bottom: 14px; }
.format-btn {
  background: none; border: none; color: var(--ink-dim); font: inherit;
  font-size: 11px; letter-spacing: 0.18em; padding: 8px 16px; cursor: pointer;
  transition: color .15s, background .15s;
}
.format-btn.active { background: var(--purple-dim); color: var(--purple); }
.format-btn:not(.active):hover { color: var(--ink); }
.hero-img.loading { opacity: .35; }
.overlay-line { font-size: 13px; color: var(--ink-dim); margin-top: 12px; }
.overlay-line b { color: var(--ink); font-weight: 400; }

/* ---------- watches ---------- */
.watches { margin-top: 56px; }
.watches h2 { font-weight: 200; font-size: 14px; letter-spacing: 0.3em; color: var(--ink-faint); margin-bottom: 18px; }
.watch-row {
  display: flex; align-items: baseline; gap: 14px; padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}
.watch-row .w-dot { color: var(--purple); font-size: 13px; }
.watch-row .w-label { font-size: 14px; }
.watch-row .w-meta { font-size: 12px; color: var(--ink-faint); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.watch-row .h-del { visibility: visible; }
.watch-add { margin-top: 16px; }
.watch-empty { color: var(--ink-faint); font-size: 13px; padding: 10px 4px; }

/* ---------- error toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #18181b; border: 1px solid #7f1d1d; color: #fca5a5;
  padding: 14px 22px; font-size: 13px; max-width: 640px; z-index: 50;
  animation: rise .3s ease;
}
.toast.ok { border-color: var(--purple); color: var(--purple); }

.hidden { display: none !important; }
