/* ============================================================
   Anti-AI Realism Studio - stylesheet
   Theme: single dark theme (photo-lab instrument panel), locked.
   Accent: one amber safelight. Shapes: panel 12px, control 8px, pill 999px.
   ============================================================ */

@import url("./vendor/fonts.css");
@import url("./vendor/ph/regular.css");
@import url("./vendor/ph/fill.css");

:root {
  /* neutral graphite scale - one gray family, no warm/cool mix */
  --ink-950: #0b0b0c;
  --ink-900: #111113;
  --ink-880: #141417;
  --ink-850: #1a1a1d;
  --ink-800: #212126;

  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);

  --text: #e9e9ec;
  --text-2: #a3a3ab;
  --text-3: #82828b;

  /* accent: safelight amber. used identically everywhere. */
  --accent: #e8a33d;
  --accent-strong: #f4b459;
  --accent-dim: rgba(232, 163, 61, 0.14);
  --accent-line: rgba(232, 163, 61, 0.35);
  --on-accent: #1a1305;

  /* semantic state only - never decorative */
  --ok: #4fb37f;
  --ok-dim: rgba(79, 179, 127, 0.13);
  --err: #e0605f;
  --err-dim: rgba(224, 96, 95, 0.13);

  --r-panel: 12px;
  --r-control: 8px;
  --r-pill: 999px;

  --font: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  --shadow-panel: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 18px 40px -32px rgba(0, 0, 0, 0.95);
  --shadow-pop: 0 24px 60px -28px rgba(0, 0, 0, 0.9);
  --shadow-tint: 0 10px 26px -18px rgba(122, 74, 12, 0.55);

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --t: 200ms var(--ease);

  --z-grain: 60;
  --z-header: 40;
  --z-toast: 80;
  --z-modal: 90;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ink-950);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, ul, ol, figure {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

button, input, select, output {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
}

/* ---------- focus + a11y primitives ---------- */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--r-control);
  font-weight: 600;
  text-decoration: none;
  transition: top var(--t);
}

.skip-link:focus {
  top: 12px;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.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;
}

.is-hidden {
  display: none !important;
}

/* every visibility toggle in the app goes through the hidden attribute */
[hidden] {
  display: none !important;
}

/* ---------- surfaces: grain + one ambient wash ---------- */

.grain {
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

.ambient {
  position: fixed;
  inset: 0 0 auto 0;
  height: 520px;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(232, 163, 61, 0.11), transparent 70%),
    radial-gradient(700px 360px at 88% -14%, rgba(232, 163, 61, 0.05), transparent 72%);
}

/* ---------- header ---------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  height: 62px;
  background: rgba(11, 11, 12, 0.82);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--r-control);
  background: var(--ink-850);
  border: 1px solid var(--line-strong);
  color: var(--accent);
  font-size: 18px;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--ink-900);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-2);
}

.status-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
}

.status-chip[data-state="online"] {
  border-color: rgba(79, 179, 127, 0.3);
  color: var(--ok);
}

.status-chip[data-state="online"] .dot {
  background: var(--ok);
  animation: breathe 2.6s var(--ease) infinite;
}

.status-chip[data-state="offline"] {
  border-color: rgba(224, 96, 95, 0.32);
  color: var(--err);
}

.status-chip[data-state="offline"] .dot {
  background: var(--err);
}

@keyframes breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------- layout ---------- */

.app-container {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 372px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

@media (max-width: 1080px) {
  .app-container {
    grid-template-columns: 1fr;
  }
}

/* ---------- panels ---------- */

.panel {
  background: var(--ink-900);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-panel);
  padding: 18px;
  margin-bottom: 14px;
}

.panel:last-child {
  margin-bottom: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.panel-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.panel-note {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
}

/* ---------- toggles ---------- */

.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
}

.toggle-row + .toggle-row {
  border-top: 1px dashed var(--line);
}

.toggle-switch {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 22px;
  margin-top: 1px;
}

.toggle-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  border-radius: var(--r-pill);
  background: var(--ink-800);
  border: 1px solid var(--line-strong);
  transition: background var(--t), border-color var(--t);
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: var(--text-3);
  transition: transform var(--t), background var(--t);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-dim);
  border-color: var(--accent-line);
}

.toggle-switch input:checked + .toggle-slider::before {
  background: var(--accent);
  transform: translateX(16px);
}

.toggle-switch input:focus-visible + .toggle-slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.toggle-title {
  font-size: 13px;
  font-weight: 500;
}

.toggle-desc {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.35;
}

/* ---------- preset list ---------- */

.preset-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.preset-btn {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  background: var(--ink-880);
  border: 1px solid transparent;
  border-radius: var(--r-control);
  cursor: pointer;
  transition: background var(--t), border-color var(--t), transform var(--t);
}

.preset-btn:hover {
  background: var(--ink-850);
  border-color: var(--line-strong);
}

.preset-btn:active {
  transform: scale(0.99);
}

.preset-btn .preset-index {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
}

.preset-btn .preset-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.preset-title {
  font-size: 13px;
  font-weight: 600;
}

.preset-desc {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.3;
}

.preset-btn .preset-check {
  font-size: 15px;
  color: var(--accent);
  opacity: 0;
  transition: opacity var(--t);
}

.preset-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent-line);
}

.preset-btn.active .preset-index,
.preset-btn.active .preset-desc {
  color: rgba(244, 180, 89, 0.75);
}

.preset-btn.active .preset-check {
  opacity: 1;
}

/* ---------- form controls ---------- */

.field + .field {
  margin-top: 14px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 6px;
}

.styled-select {
  width: 100%;
  height: 38px;
  padding: 0 34px 0 12px;
  background: var(--ink-880);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  font-size: 13px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 256 256' fill='%236c6c75'%3E%3Cpath d='M213.66 101.66l-80 80a8 8 0 01-11.32 0l-80-80A8 8 0 0153.66 90.3L128 164.69l74.34-74.35a8 8 0 1111.32 11.32z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color var(--t), background-color var(--t);
}

.styled-select:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.styled-select option {
  background: var(--ink-880);
  color: var(--text);
}

/* ---------- accordion ---------- */

.accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}

.accordion-trigger .panel-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.accordion-arrow {
  font-size: 15px;
  color: var(--text-3);
  transition: transform var(--t), color var(--t);
}

.accordion-trigger:hover .accordion-arrow {
  color: var(--text-2);
}

.accordion-card.open .accordion-arrow {
  transform: rotate(180deg);
}

.accordion-body {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- sliders ---------- */

.slider {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.slider-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.slider-top label {
  font-size: 12px;
  color: var(--text-2);
}

.slider-val {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  min-width: 46px;
  text-align: right;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  margin: 5px 0;
  border-radius: 2px;
  background:
    linear-gradient(to right, var(--accent) 0 var(--pct, 50%), var(--ink-800) var(--pct, 50%) 100%);
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink-900);
  border: 2px solid var(--accent);
  transition: transform var(--t), background-color var(--t);
}

input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.15);
}

input[type="range"]:active::-webkit-slider-thumb {
  background: var(--accent);
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ink-900);
  border: 2px solid var(--accent);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--ink-800);
}

input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r-control);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--t), border-color var(--t), color var(--t), transform var(--t);
}

.btn:active {
  transform: translateY(1px);
}

.btn .ph {
  font-size: 16px;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-tint);
}

.btn-primary:hover {
  background: var(--accent-strong);
}

.btn-secondary {
  background: var(--ink-850);
  border-color: var(--line-strong);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--ink-800);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  padding: 0 10px;
}

.btn-ghost:hover {
  background: var(--ink-850);
  color: var(--text);
}

.btn-ghost-danger {
  background: transparent;
  border-color: var(--line);
  color: var(--text-3);
}

.btn-ghost-danger:hover {
  background: var(--err-dim);
  border-color: rgba(224, 96, 95, 0.4);
  color: var(--err);
}

.btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

/* ---------- workflow rail ---------- */

.workflow-rail {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  margin-bottom: 14px;
  background: var(--ink-900);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-panel);
  overflow-x: auto;
  scrollbar-width: none;
}

.workflow-rail::-webkit-scrollbar {
  display: none;
}

.wf-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  color: var(--text-3);
  transition: color var(--t);
}

.wf-step.active {
  color: var(--text);
}

.wf-badge {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-3);
  transition: border-color var(--t), color var(--t), background-color var(--t);
}

.wf-step.active .wf-badge {
  border-color: var(--accent-line);
  background: var(--accent-dim);
  color: var(--accent);
}

.wf-text {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.wf-line {
  flex: 1 0 14px;
  min-width: 14px;
  height: 1px;
  background: var(--line);
}

@media (max-width: 900px) {
  .workflow-rail {
    display: none;
  }
}

/* ---------- upload ---------- */

.upload-section {
  position: relative;
  padding: 34px 24px;
  background: var(--ink-900);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-panel);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t), background-color var(--t);
}

.upload-section:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

.upload-section.is-error {
  border-color: rgba(224, 96, 95, 0.45);
}

.upload-error {
  max-width: 46ch;
  margin: 12px auto 0;
  font-size: 12px;
  color: var(--err);
}

.upload-section.dragover {
  border-color: var(--accent);
  background: rgba(232, 163, 61, 0.05);
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  border-radius: var(--r-control);
  background: var(--ink-850);
  border: 1px solid var(--line-strong);
  color: var(--accent);
  font-size: 22px;
}

.upload-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.upload-sub {
  max-width: 46ch;
  margin: 6px auto 0;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}

.upload-spec {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-3);
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 20px;
  text-align: center;
}

/* ---------- action bar ---------- */

.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--ink-900);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-panel);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.file-info .ph {
  font-size: 17px;
  color: var(--text-3);
}

.file-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 34ch;
}

.file-dim {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-3);
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
}

/* ---------- batch ---------- */

.batch-section {
  display: block;
  margin-top: 14px;
  padding: 18px;
  background: var(--ink-900);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-panel);
}

.batch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.batch-head h2 {
  font-size: 14px;
  font-weight: 600;
}

.batch-title-area {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.batch-count-badge {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent);
}

.batch-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.batch-progress-wrapper {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}

.batch-progress-info {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--text-2);
}

.batch-progress-info .mono {
  color: var(--text);
}

.batch-progress-track {
  height: 3px;
  border-radius: 2px;
  background: var(--ink-800);
  overflow: hidden;
}

.batch-progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 240ms var(--ease);
}

.batch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 10px;
  max-height: 460px;
  overflow-y: auto;
  padding-right: 4px;
}

.batch-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--ink-880);
  border: 1px solid transparent;
  border-radius: var(--r-control);
  cursor: pointer;
  transition: background-color var(--t), border-color var(--t);
}

.batch-item:hover {
  background: var(--ink-850);
  border-color: var(--line-strong);
}

.batch-item.selected {
  border-color: var(--accent-line);
  background: var(--accent-dim);
}

.batch-item-top {
  display: flex;
  gap: 10px;
  align-items: center;
}

.batch-thumb {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 6px;
  object-fit: cover;
  background: var(--ink-950);
  border: 1px solid var(--line);
}

.batch-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.batch-item-name {
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.batch-item-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
}

.batch-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.batch-item-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-3);
}

.batch-item-status .ph {
  font-size: 13px;
}

.status-running { color: var(--accent); }
.status-done { color: var(--ok); }
.status-error { color: var(--err); }

.batch-gemini-tag {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--text-2);
}

.btn-item-download {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text-2);
  text-decoration: none;
  transition: background-color var(--t), color var(--t), border-color var(--t);
}

.btn-item-download:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* ---------- stage ---------- */

.stage-section {
  display: block;
  margin-top: 14px;
  padding: 16px;
  background: var(--ink-900);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-panel);
}

.gemini-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  margin-bottom: 14px;
  border-radius: var(--r-control);
  background: var(--ink-880);
  border: 1px solid var(--line-strong);
}

.gemini-banner .ph {
  font-size: 18px;
  color: var(--accent);
}

.gemini-banner h4 {
  font-size: 13px;
  font-weight: 600;
}

.gemini-banner p {
  font-size: 12px;
  color: var(--text-2);
}

.gemini-banner .banner-body {
  flex: 1;
  min-width: 0;
}

.badge-gemini {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ok);
  padding: 3px 9px;
  border: 1px solid rgba(79, 179, 127, 0.32);
  border-radius: var(--r-pill);
}

.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.stage-tabs {
  display: flex;
  gap: 18px;
}

.stage-tab {
  position: relative;
  padding: 0 0 8px;
  background: none;
  border: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  transition: color var(--t);
}

.stage-tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t);
}

.stage-tab:hover {
  color: var(--text-2);
}

.stage-tab.active {
  color: var(--text);
}

.stage-tab.active::after {
  transform: scaleX(1);
}

.stage-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-time {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-2);
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
}

/* comparison */

.comparison-container {
  position: relative;
  width: 100%;
  height: clamp(320px, 52vh, 560px);
  border-radius: var(--r-control);
  overflow: hidden;
  background: var(--ink-950);
  user-select: none;
  touch-action: pan-y;
}

.image-wrapper {
  position: absolute;
  inset: 0;
}

.image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.processed-wrapper {
  width: 50%;
  overflow: hidden;
  border-right: 1px solid var(--accent-line);
}

.tag-label {
  position: absolute;
  top: 12px;
  padding: 5px 10px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  background: rgba(11, 11, 12, 0.72);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line-strong);
  color: var(--text-2);
}

.tag-real {
  left: 12px;
  color: var(--accent);
  border-color: var(--accent-line);
}

.split-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 44px;
  margin-left: -22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ew-resize;
  z-index: 20;
}

.handle-thumb {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(11, 11, 12, 0.85);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-size: 15px;
  transition: transform var(--t), border-color var(--t);
}

.split-handle:hover .handle-thumb {
  transform: scale(1.06);
  border-color: var(--accent);
}

/* side by side */

.side-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.side-item {
  display: flex;
  flex-direction: column;
  background: var(--ink-880);
  border-radius: var(--r-control);
  overflow: hidden;
}

.side-item-head {
  padding: 9px 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--text-3);
  border-bottom: 1px solid var(--line);
}

.side-item img {
  width: 100%;
  height: clamp(240px, 38vh, 400px);
  object-fit: contain;
  background: var(--ink-950);
}

/* ---------- inspector ---------- */

.inspector-section {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

@media (max-width: 900px) {
  .inspector-section {
    grid-template-columns: 1fr;
  }
}

.inspector-card {
  background: var(--ink-900);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-panel);
  padding: 18px;
}

.inspector-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
}

.inspector-head .ph {
  font-size: 16px;
  color: var(--accent);
}

.inspector-head h3 {
  font-size: 13px;
  font-weight: 600;
}

.metadata-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
}

.meta-field {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.meta-label {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 2px;
}

.meta-value {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tactics-list {
  display: flex;
  flex-direction: column;
}

.tactics-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  font-size: 12.5px;
  color: var(--text-2);
}

.tactics-item + .tactics-item {
  border-top: 1px solid var(--line);
}

.tactics-item .ph {
  flex: 0 0 auto;
  margin-top: 2px;
  font-size: 14px;
  color: var(--ok);
}

/* ---------- loader ---------- */

.loader-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 6, 7, 0.72);
  backdrop-filter: blur(6px);
}

.loader-modal {
  width: min(380px, 100%);
  padding: 26px;
  text-align: center;
  background: var(--ink-900);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-pop);
}

.loader-modal h3 {
  margin-top: 14px;
  font-size: 14px;
  font-weight: 600;
}

.loader-modal p {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-3);
  min-height: 32px;
  line-height: 1.45;
}

.scan-track {
  height: 2px;
  border-radius: 2px;
  background: var(--ink-800);
  overflow: hidden;
}

.scan-fill {
  width: 40%;
  height: 100%;
  background: var(--accent);
  animation: scan 1.1s var(--ease) infinite;
}

@keyframes scan {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

/* ---------- toasts ---------- */

.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}

.toast {
  padding: 11px 14px;
  background: var(--ink-850);
  border: 1px solid var(--line-strong);
  border-left: 2px solid var(--text-3);
  border-radius: var(--r-control);
  font-size: 12.5px;
  color: var(--text);
  box-shadow: var(--shadow-pop);
  animation: toast-in 240ms var(--ease);
}

.toast-info { border-left-color: var(--text-2); }
.toast-success { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--err); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- reduced motion / transparency ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .app-header {
    background: var(--ink-950);
    backdrop-filter: none;
  }

  .loader-backdrop {
    background: var(--ink-950);
    backdrop-filter: none;
  }

  .tag-label {
    background: var(--ink-950);
    backdrop-filter: none;
  }
}

/* ---------- small screens ---------- */

@media (max-width: 720px) {
  .app-container {
    padding: 16px;
    gap: 14px;
  }

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

  .brand-sub {
    display: none;
  }

  .metadata-grid {
    grid-template-columns: 1fr;
  }

  .side-container {
    grid-template-columns: 1fr;
  }

  .stage-head {
    align-items: flex-start;
  }
}


/* ---------- Gemini Web Studio Integration ---------- */
.status-chip[data-state="gemini-pro"] {
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  background: rgba(14, 165, 233, 0.08);
}

.status-chip[data-state="gemini-pro"] .dot {
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
  animation: breathe 2.4s var(--ease) infinite;
}

.btn-gemini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  height: 40px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  color: #ffffff !important;
  border: 1px solid rgba(56, 189, 248, 0.5);
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.25);
  transition: all 0.2s var(--ease);
}

.btn-gemini:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.45);
  filter: brightness(1.08);
}

.btn-gemini:active {
  transform: translateY(0);
}

.btn-gemini i {
  font-size: 16px;
}

.chip-gemini-pro {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.gemini-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: rgba(56, 189, 248, 0.06);
  border: 1px solid rgba(56, 189, 248, 0.18);
  font-size: 11.5px;
  line-height: 1.5;
  color: #94a3b8;
}

.batch-geminipro-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  margin-left: 6px;
}

.gemini-prompt-box {
  margin-top: 12px;
  padding: 12px;
  background: var(--ink-800);
  border-radius: var(--r-md);
  border: 1px solid rgba(56, 189, 248, 0.25);
  font-size: 12px;
  line-height: 1.6;
}

.gemini-prompt-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #38bdf8;
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 6px;
}
