/* ===== AutomaticCensor — modern dark UI ===== */

:root {
  --bg: #0b0e17;
  --bg-soft: #111527;
  --card: #161b2e;
  --card-border: #232a45;
  --text: #e8eaf2;
  --text-dim: #9aa3c0;
  --accent: #6366f1;
  --accent-2: #06b6d4;
  --accent-grad: linear-gradient(135deg, #6366f1, #06b6d4);
  --danger: #f43f5e;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

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

html { color-scheme: dark; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1000px 500px at 80% -10%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(800px 400px at 10% 10%, rgba(6, 182, 212, 0.12), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 24px; }

.hidden { display: none !important; }

/* ===== Header ===== */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo { width: 46px; height: 46px; filter: drop-shadow(0 4px 14px rgba(99, 102, 241, 0.5)); }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.brand-accent {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-tagline { font-size: 0.78rem; color: var(--text-dim); }

.lang-toggle {
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}
.lang-toggle:hover { border-color: var(--accent); transform: translateY(-1px); }

/* ===== Upload / hero ===== */
.upload-section {
  text-align: center;
  padding: 48px 0 64px;
  max-width: 720px;
  margin: 0 auto;
}

.hero-title {
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  background: linear-gradient(135deg, #fff 30%, #a5b4fc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle {
  margin: 16px auto 24px;
  color: var(--text-dim);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 560px;
}

.privacy-badge {
  display: inline-block;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: #67e8f9;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 999px;
  margin-bottom: 36px;
}

.drop-zone {
  border: 2px dashed #313a5e;
  border-radius: 20px;
  padding: 56px 32px;
  cursor: pointer;
  background: rgba(22, 27, 46, 0.55);
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.drop-zone:hover, .drop-zone:focus-visible, .drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
  transform: translateY(-2px);
  outline: none;
}

.drop-icon { width: 52px; height: 52px; color: var(--accent); margin-bottom: 14px; }
.drop-main { font-size: 1.15rem; font-weight: 600; }
.drop-sub { color: var(--text-dim); margin-top: 6px; }
.drop-formats { color: #565f82; font-size: 0.8rem; margin-top: 14px; letter-spacing: 0.12em; }

/* ===== Workspace ===== */
.workspace {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  padding: 24px 0 48px;
  align-items: start;
}

.canvas-panel {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.canvas-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.toolbar-right { display: flex; gap: 10px; }

.canvas-wrap {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background:
    repeating-conic-gradient(#1a2038 0% 25%, #141930 0% 50%) 0 0 / 24px 24px;
  display: flex;
  justify-content: center;
}
.canvas-stack { position: relative; max-width: 100%; font-size: 0; }
#canvas { max-width: 100%; height: auto; display: block; touch-action: none; }
#canvas.drawing { cursor: crosshair; }
#overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.status-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 14, 23, 0.78);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-weight: 600;
  z-index: 5;
  text-align: center;
  padding: 20px;
}

.spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 4px solid rgba(99, 102, 241, 0.25);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.manual-hint {
  margin-top: 12px;
  color: #67e8f9;
  font-size: 0.88rem;
  text-align: center;
}

.edit-hint {
  margin-top: 12px;
  color: var(--text-dim);
  font-size: 0.82rem;
  text-align: center;
}

/* ===== Zone edit card ===== */
.zone-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.num-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 600;
}
.num-field input {
  background: var(--bg-soft);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text);
  padding: 7px 10px;
  font-size: 0.92rem;
  font-family: inherit;
  width: 100%;
}
.num-field input:focus { outline: none; border-color: var(--accent); }

.btn-danger {
  background: rgba(244, 63, 94, 0.12);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.4);
  width: 100%;
}
.btn-danger:hover { background: rgba(244, 63, 94, 0.22); color: #fff; }

/* ===== Buttons ===== */
.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
  font-family: inherit;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover { box-shadow: 0 8px 26px rgba(99, 102, 241, 0.5); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--card-border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.btn-ghost.active { color: #67e8f9; border-color: var(--accent-2); background: rgba(6, 182, 212, 0.1); }

.link-btn {
  background: none;
  border: none;
  color: var(--accent-2);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  padding: 2px 4px;
}
.link-btn:hover { text-decoration: underline; }

/* ===== Sidebar cards ===== */
.sidebar { display: flex; flex-direction: column; gap: 18px; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 1rem; font-weight: 700; margin-bottom: 12px; }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.card-header h2 { margin-bottom: 12px; }
.sep { color: #3a4265; }

.info-card { border-color: rgba(6, 182, 212, 0.3); }
.info-card p { color: var(--text-dim); font-size: 0.85rem; line-height: 1.55; }

/* ===== Detection list ===== */
.detection-list {
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detection-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-soft);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.detection-item:hover { border-color: var(--accent); }
.detection-item.active {
  border-color: var(--accent-2);
  background: rgba(6, 182, 212, 0.1);
}
.detection-item input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.detection-item .det-label { flex: 1; font-size: 0.9rem; font-weight: 600; }
.detection-item .det-score {
  font-size: 0.75rem;
  color: var(--text-dim);
  background: rgba(99, 102, 241, 0.15);
  padding: 2px 8px;
  border-radius: 999px;
}
.detection-item .det-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 2px;
}
.detection-item .det-remove:hover { color: var(--danger); }

.empty-note { color: var(--text-dim); font-size: 0.85rem; }

/* ===== Style tabs ===== */
.style-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.style-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--bg-soft);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--text-dim);
  padding: 10px 4px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.style-tab .tab-icon { font-size: 1.25rem; }
.style-tab:hover { border-color: var(--accent); color: var(--text); }
.style-tab.active {
  border-color: var(--accent);
  color: #fff;
  background: rgba(99, 102, 241, 0.15);
}

.style-options { display: flex; flex-direction: column; gap: 10px; }

.field-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 600;
}
.slider-gap { margin-top: 16px; }

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-dim);
  cursor: pointer;
}
.checkbox-row input { accent-color: var(--accent); }

/* Emoji grid */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.emoji-btn {
  font-size: 1.4rem;
  background: var(--bg-soft);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 6px 0;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.emoji-btn:hover { transform: scale(1.12); border-color: var(--accent); }
.emoji-btn.active { border-color: var(--accent-2); background: rgba(6, 182, 212, 0.15); }

.text-input {
  background: var(--bg-soft);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 1.1rem;
  width: 90px;
  font-family: inherit;
}
.text-input:focus { outline: none; border-color: var(--accent); }

/* Shape / color */
.color-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

input[type="color"] {
  width: 46px;
  height: 36px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: var(--bg-soft);
  cursor: pointer;
  padding: 3px;
}

.color-presets { display: flex; gap: 6px; }
.preset-swatch {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s;
}
.preset-swatch:hover { transform: scale(1.15); }
.preset-swatch.active { border-color: #fff; }

.shape-picker { display: flex; gap: 8px; }
.shape-btn {
  background: var(--bg-soft);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s;
}
.shape-btn:hover { border-color: var(--accent); }
.shape-btn.active { border-color: var(--accent-2); background: rgba(6, 182, 212, 0.15); }

.shape-demo { width: 30px; height: 20px; background: var(--accent-grad); display: block; }
.demo-rect { border-radius: 1px; }
.demo-rounded { border-radius: 7px; }
.demo-ellipse { border-radius: 50%; }

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  padding: 22px;
  color: #565f82;
  font-size: 0.82rem;
}
.site-footer a { color: var(--text-dim); text-decoration: none; }
.site-footer a:hover { color: var(--accent-2); }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .sidebar { order: 2; }
}

@media (max-width: 520px) {
  .site-header { padding: 14px 16px; }
  main { padding: 0 14px; }
  .upload-section { padding: 28px 0 40px; }
  .drop-zone { padding: 40px 18px; }
  .canvas-toolbar { justify-content: center; }
}
