:root {
  --bg: #0b1220;
  --card: #101a2e;
  --text: #e6edf3;
  --muted: #9fb0c7;
  --brand: #ef4444;
  --brand-2: #f97316;
  --border: #1e2a44;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --card: #f6f8fb;
  --text: #0a1020;
  --muted: #4b5563;
  --brand: #ef4444;
  --brand-2: #fb923c;
  --border: #d1d5db;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
}

a {
  color: var(--brand-2);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px;
}

/* NAVBAR */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: relative;
  padding: 4px 0 10px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-main {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

.brand-main:hover {
  text-decoration: none;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
}

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

.menu a {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--text);
  opacity: 0.9;
  font-weight: 600;
  white-space: nowrap;
}

.menu a:hover {
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
}

#navToggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--card);
  padding: 8px 10px;
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
}

/* theme button */

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.theme-icon::before {
  content: "🌙";
}

:root[data-theme="light"] .theme-icon::before {
  content: "☀️";
}

/* BADGES */

.badge {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-soft {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--brand);
}

/* HERO */

.hero {
  padding: 28px 0 18px;
  display: grid;
  grid-template-columns: 1.6fr 1.1fr;
  gap: 26px;
  align-items: flex-start;
}

.hero-main h1 {
  margin: 10px 0 8px;
  font-size: 34px;
  max-width: 560px;
}

.hero-main p {
  color: var(--muted);
  max-width: 560px;
}

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 14px 0 8px;
}

.hero-meta {
  margin: 0;
}

.hero-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* hero side panels */

.hero-panel {
  padding: 12px 12px 10px;
}

.hero-panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.hero-panel-body {
  background: rgba(15, 23, 42, 0.4);
  border-radius: 10px;
  padding: 8px 10px;
}

:root[data-theme="light"] .hero-panel-body {
  background: #e5edf9;
}

.hero-panel-label {
  margin-bottom: 4px;
}

.hero-list {
  margin: 0;
  padding-left: 18px;
}

.hero-list li + li {
  margin-top: 4px;
}

.hero-panel-ad .hero-panel-body {
  min-height: 90px;
}

/* PANELS & CARDS */

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  margin: 10px 0;
}

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.panel-header h2 {
  margin: 0;
  font-size: 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.card p {
  margin: 0 0 10px;
  color: var(--muted);
}

/* BUTTONS */

.btn {
  display: inline-block;
  padding: 10px 14px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  color: #fff;
  border-radius: 10px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

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

/* EXTRA ELEMENTS */

.small {
  color: var(--muted);
  font-size: 12px;
}

.notice {
  background: #0f1a31;
  border-left: 4px solid var(--brand-2);
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  margin-top: 10px;
}

:root[data-theme="light"] .notice {
  background: #ffefe7;
}

/* shared utility for tool pages (keep for other routes) */

.input {
  background: #0c1527;
  border: 1px dashed var(--border);
  padding: 14px;
  border-radius: 12px;
}

:root[data-theme="light"] .input {
  background: #f1f5f9;
}

.preview-canvas {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.canvas-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  overflow: auto;
  max-height: 70vh;
}

.work-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: optimizeQuality;
  border-radius: 12px;
}

/* segmented control / range (used on tools pages) */

.toolbar .seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.toolbar .seg button {
  background: transparent;
  border: none;
  padding: 8px 10px;
  color: var(--text);
  cursor: pointer;
}

.toolbar .seg button.active {
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  color: #fff;
}

.range {
  appearance: none;
  width: 180px;
  height: 6px;
  border-radius: 999px;
  background: var(--card);
  outline: none;
  border: 1px solid var(--border);
}

.range::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--brand-2);
  border: 2px solid #fff;
}

.range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--brand-2);
  border: none;
}

/* ADS */

.ads-guard {
  width: 100%;
}

.ads-panel {
  margin-top: 16px;
}

/* FOOTER */

footer {
  margin-top: 28px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}

footer .links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* RESPONSIVE NAV + HERO */

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

  .hero-side {
    order: -1;
  }
}

@media (max-width: 720px) {
  #navToggle {
    display: inline-flex;
  }

  .menu {
    display: none;
    flex-direction: column;
    position: absolute;
    right: 0;
    top: 52px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px;
    z-index: 10;
    min-width: 220px;
  }

  .menu.open {
    display: flex;
  }

  .menu a {
    width: 100%;
  }

  .hero-main h1 {
    font-size: 28px;
  }
}
