:root {
  --bg: #0b0e14;
  --surface: #131823;
  --surface-2: #1a2130;
  --border: #263147;
  --text: #eef2f9;
  --muted: #93a1bc;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --good: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 14px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

[data-theme="light"] {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #edf1f8;
  --border: #d8e0ee;
  --text: #111827;
  --muted: #5b677e;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --shadow: 0 10px 26px rgba(17, 24, 39, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 62px;
  flex-wrap: wrap;
  padding: 8px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }

.brand-logo {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff2e55, #3b82f6);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.brand-name {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
  display: block;
  line-height: 1.1;
}

.brand-badge {
  font-size: 11px;
  color: var(--good);
  font-weight: 600;
}

.nav-links {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 11px;
  border: 1px solid var(--border);
}

.nav-link {
  color: var(--muted);
  font-weight: 600;
  font-size: 12.5px;
  padding: 6px 11px;
  border-radius: 8px;
  transition: all 0.15s ease;
  text-decoration: none;
}
.nav-link:hover { color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--accent); color: #fff; }

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

.lang-switch {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 2px;
}

.lang-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: 7px;
  cursor: pointer;
}
.lang-btn.active { background: var(--surface); color: var(--text); }

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 15px;
}

/* Main & Hero */
.main-content { padding: 28px 0 56px; }

.hero {
  text-align: center;
  max-width: 780px;
  margin: 14px auto 32px;
}
.hero-pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(34, 197, 94, 0.14);
  color: var(--good);
  margin-bottom: 12px;
}
.hero h1 {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: -0.03em;
}
.hero p {
  margin: 0;
  font-size: 15.5px;
  color: var(--muted);
}

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

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, border-color 0.16s ease;
}
.tool-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  text-decoration: none;
}
.tool-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.tool-card h2 {
  margin: 2px 0 0;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.tool-card p {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
  flex: 1;
}
.tool-card-cta {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

.panel-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.panel-header h1 {
  margin: 0 0 6px;
  font-size: 25px;
  letter-spacing: -0.02em;
}
.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 720px;
}
.header-pills { display: flex; gap: 8px; flex-wrap: wrap; }

/* Cards & Grids */
.workspace-grid { display: grid; gap: 20px; align-items: start; }
.thumb-grid { grid-template-columns: 360px 1fr; }
.safezone-grid { grid-template-columns: 390px 1fr; }
.rpm-grid { grid-template-columns: 420px 1fr; }
.two-col-grid { grid-template-columns: 1fr 1fr; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-secondary:hover { border-color: var(--accent); }

/* Forms & Dropzones */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  background: var(--surface-2);
  transition: border-color 0.16s ease, background 0.16s ease;
  margin-bottom: 14px;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-2));
}
.dropzone-sm { padding: 12px 10px; margin-bottom: 10px; }
.dropzone-icon { font-size: 24px; margin-bottom: 4px; }
.dropzone-title { font-weight: 700; font-size: 13.5px; }
.dropzone-hint { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.thumb-meta-pill {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(34, 197, 94, 0.16);
  color: var(--good);
}

.form-group { margin-bottom: 13px; }
.form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.input, textarea.input {
  width: 100%;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.input:focus { border-color: var(--accent); }
textarea.code-area {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  min-height: 220px;
  resize: vertical;
  line-height: 1.5;
}

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
  flex-wrap: wrap;
}
.seg-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 7px;
  cursor: pointer;
}
.seg-btn.active { background: var(--accent); color: #fff; }

.char-status {
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
}
.char-ok { background: rgba(34, 197, 94, 0.16); color: var(--good); }
.char-warn { background: rgba(245, 158, 11, 0.18); color: var(--warn); }
.char-bad { background: rgba(239, 68, 68, 0.18); color: var(--danger); }

.title-warnings { font-size: 11.5px; margin-top: 5px; color: var(--muted); }

.toggle-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  cursor: pointer;
}
.slider { width: 100%; accent-color: var(--accent); }

/* Stage & YouTube Preview */
.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.stage-hint { font-size: 12px; color: var(--muted); }

.yt-stage {
  border-radius: 12px;
  padding: 18px;
  border: 1px solid var(--border);
}
.yt-stage.yt-dark { background: #0f0f0f; color: #f1f1f1; }
.yt-stage.yt-light { background: #ffffff; color: #0f0f0f; }
.yt-stage.squint-on .yt-thumb-box img { filter: blur(2.6px) contrast(0.95); }

.yt-desktop-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 14px; }
.yt-ab-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.yt-card { display: flex; flex-direction: column; gap: 10px; }
.yt-card.is-yours .yt-thumb-box { outline: 2px solid #3b82f6; outline-offset: 2px; }
.yt-card.is-b .yt-thumb-box { outline: 2px solid #f59e0b; outline-offset: 2px; }

.yt-thumb-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #202020;
}
.yt-thumb-box img { width: 100%; height: 100%; object-fit: cover; display: block; }

.yt-duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, 0.84);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
}
.yt-duration.danger-outline {
  outline: 2px solid #ef4444;
  outline-offset: 2px;
  box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.25);
}

.yours-tag {
  position: absolute;
  left: 8px;
  top: 8px;
  background: #3b82f6;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
}
.yours-tag.tag-b { background: #f59e0b; color: #111827; }

.yt-meta { display: flex; gap: 10px; align-items: flex-start; }
.yt-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
}
.yt-text { min-width: 0; flex: 1; }
.yt-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.yt-sub { font-size: 12px; opacity: 0.68; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.yt-mobile-wrap {
  max-width: 375px;
  margin: 0 auto;
  border: 6px solid #2b3240;
  border-radius: 28px;
  overflow: hidden;
}
.yt-mobile-wrap .yt-card { padding-bottom: 18px; }
.yt-mobile-wrap .yt-thumb-box { border-radius: 0; }
.yt-mobile-wrap .yt-meta { padding: 0 12px; }

.yt-sidebar-wrap { max-width: 410px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.yt-sidebar-card { display: flex; gap: 10px; align-items: flex-start; }
.yt-sidebar-card .yt-thumb-box { width: 168px; flex-shrink: 0; border-radius: 8px; }
.yt-sidebar-card .yt-title { font-size: 13px; }

/* Safe Zone */
.platform-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.plat-btn {
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.plat-btn span { font-size: 11px; color: var(--muted); }
.plat-btn.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--surface-2)); }

.info-box {
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.sz-stage-card { display: flex; justify-content: center; align-items: center; padding: 24px; }
.phone-shell {
  width: 320px;
  background: #090b10;
  border: 8px solid #262e3d;
  border-radius: 38px;
  padding: 10px;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.55);
}
.phone-notch { width: 90px; height: 16px; background: #141923; border-radius: 999px; margin: 0 auto 8px; }
.phone-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 22px;
  overflow: hidden;
  background: #141923;
}
.phone-screen img, .phone-screen video { width: 100%; height: 100%; object-fit: cover; display: block; }
.sz-overlay, .sz-mock-ui { position: absolute; inset: 0; pointer-events: none; }
.sz-danger { position: absolute; background: rgba(239, 68, 68, 0.55); }
.sz-top { top: 0; left: 0; right: 0; }
.sz-bottom { bottom: 0; left: 0; right: 0; }
.sz-right { right: 0; }
.sz-left { left: 0; }
.sz-safe-box { position: absolute; border: 2px dashed #22c55e; box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.35); }
.sz-safe-tag {
  position: absolute; top: 6px; left: 6px;
  background: rgba(34, 197, 94, 0.92); color: #052e16;
  font-size: 9.5px; font-weight: 800; padding: 2px 6px; border-radius: 4px;
}
.sz-grid-lines {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.22) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.22) 1px, transparent 1px);
  background-size: 33.333% 33.333%;
}
.sz-live-caption {
  position: absolute;
  left: 8%;
  right: 8%;
  text-align: center;
  font-weight: 900;
  font-size: 16px;
  line-height: 1.25;
  color: #fff;
  background: rgba(0, 0, 0, 0.72);
  padding: 6px 10px;
  border-radius: 8px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

.mock-top-bar {
  position: absolute; top: 12px; left: 14px; right: 14px;
  display: flex; justify-content: space-between; align-items: center;
  color: #fff; font-size: 11px; font-weight: 700; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}
.mock-right-rail {
  position: absolute; right: 10px; bottom: 92px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: #fff; font-size: 10px; font-weight: 700; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}
.mock-rail-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mock-rail-circle {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.45); display: grid; place-items: center; font-size: 14px;
}
.mock-bottom-meta {
  position: absolute; left: 12px; right: 60px; bottom: 16px;
  color: #fff; font-size: 11px; line-height: 1.35; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* RPM & Stats */
.section-title { margin: 0 0 14px; font-size: 16px; }
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.kpi-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 4px;
}
.kpi-highlight { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface-2)); }
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi-value { font-size: 22px; letter-spacing: -0.02em; }
.kpi-sub { font-size: 11.5px; color: var(--good); font-weight: 600; }

.split-bar-wrap { margin-top: 16px; }
.split-bar-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.split-bar { height: 12px; border-radius: 999px; overflow: hidden; display: flex; background: var(--surface-2); }
.split-long { background: #3b82f6; }
.split-short { background: #f43f5e; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

.ypp-results { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.ypp-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 13px; }
.ypp-box h4 { margin: 0 0 6px; font-size: 13px; }
.ypp-date { font-size: 17px; font-weight: 800; color: var(--good); }
.ypp-bar-track { height: 7px; border-radius: 999px; background: var(--border); overflow: hidden; margin: 8px 0 4px; }
.ypp-bar-fill { height: 100%; background: var(--good); }
.ypp-detail { font-size: 11.5px; color: var(--muted); }

/* Validation list & Cropper */
.check-list { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 7px; }
.check-list li {
  padding: 8px 11px;
  border-radius: 9px;
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.check-pass { border-left: 4px solid var(--good) !important; }
.check-fail { border-left: 4px solid var(--danger) !important; }
.check-warn { border-left: 4px solid var(--warn) !important; }

.crop-canvas-wrap {
  width: 100%;
  background: #090b10;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 360px;
}
.crop-canvas-wrap canvas {
  max-width: 100%;
  max-height: 460px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* Related Tools & SEO FAQ & Prose */
.ad-slot {
  margin: 22px 0;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-2) 60%, transparent);
}

.seo-faq { margin-top: 22px; }
.seo-faq h2 { margin: 0 0 14px; font-size: 17px; }
.faq-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.faq-grid h3 { margin: 0 0 6px; font-size: 13.5px; }
.faq-grid p { margin: 0; font-size: 12.5px; color: var(--muted); }

.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 13px;
}
.spec-table th, .spec-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}
.spec-table th { background: var(--surface-2); }

.prose { max-width: 780px; margin: 0 auto; }
.prose h1 { font-size: 28px; margin-bottom: 10px; }
.prose h2 { font-size: 18px; margin-top: 24px; }
.prose p, .prose li { color: var(--muted); font-size: 14.5px; }

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 22px 0;
  font-size: 12px;
  color: var(--muted);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-links { display: flex; gap: 14px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--text); }

@media (max-width: 980px) {
  .hub-grid, .thumb-grid, .safezone-grid, .rpm-grid, .two-col-grid, .faq-grid, .kpi-grid, .ypp-results, .yt-ab-grid {
    grid-template-columns: 1fr;
  }
  .yt-desktop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .yt-desktop-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 26px; }
}
