:root {
  color-scheme: dark light;
  --accent-primary: #6366f1;
  --accent-secondary: #818cf8;
  --accent-light: #c7d2fe;
  --accent-ink: #4f46e5;
  --text-primary: #e0e0f0;
  --text-secondary: #8888a0;
  --text-muted: #6a6a90;
  --card-bg: #fff;
  --card-shadow: 0 8px 32px rgba(0,0,0,.12);
  --card-radius: 18px;
  --card-dark-bg: rgba(99,102,241,.08);
  --card-dark-border: rgba(99,102,241,.15);
  --card-dark-bg-hover: rgba(99,102,241,.16);
  --html-bg: #0f0f1a;
  --bg-gradient: linear-gradient(165deg,#0f0f1a 0%,#1a1a2e 40%,#16213e 100%);
  --topbar-bg: rgba(15,15,26,.85);
  --topbar-border: rgba(99,102,241,.12);
  --input-bg: rgba(255,255,255,.04);
  --input-border: rgba(255,255,255,.08);
  --title-gradient: linear-gradient(135deg,#c7d2fe 0%,#818cf8 50%,#6366f1 100%);
}
[data-theme="light"] {
  color-scheme: light;
  --accent-primary: #4f46e5;
  --accent-secondary: #4f46e5;
  --accent-light: #4338ca;
  --text-primary: #1a1a2e;
  --text-secondary: #5a5a72;
  --text-muted: #8a8aa0;
  --card-bg: #fff;
  --card-shadow: 0 6px 22px rgba(31,35,80,.08);
  --card-dark-bg: rgba(99,102,241,.06);
  --card-dark-border: rgba(99,102,241,.22);
  --card-dark-bg-hover: rgba(99,102,241,.12);
  --html-bg: #f5f7fb;
  --bg-gradient: linear-gradient(165deg,#f5f7fb 0%,#eef0f8 40%,#e8edf6 100%);
  --topbar-bg: rgba(245,247,251,.85);
  --topbar-border: rgba(99,102,241,.22);
  --input-bg: rgba(31,35,80,.04);
  --input-border: rgba(99,102,241,.22);
  --title-gradient: linear-gradient(135deg,#4f46e5 0%,#4338ca 50%,#312e81 100%);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--topbar-border);
}
.topbar-inner {
  max-width: 1100px; margin: 0 auto;
  padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { font-weight: 700; font-size: 16px; color: var(--text-primary); text-decoration: none; }
.theme-toggle {
  width: 36px; height: 36px;
  border: 1px solid var(--card-dark-border);
  background: var(--card-dark-bg);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-primary);
}
.theme-toggle svg { width: 16px; height: 16px; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: none; }

.container { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }
.micro-label {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.2em; color: var(--accent-secondary);
  text-transform: uppercase; margin-bottom: 18px;
  display: block;
}
.gradient-title {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 800; line-height: 1.1;
  letter-spacing: -0.025em;
  background: var(--title-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 14px;
}
.lead {
  font-size: 15px; color: var(--text-secondary);
  line-height: 1.55; margin-bottom: 28px;
  max-width: 760px;
}

.editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 800px) {
  .editor { grid-template-columns: 1fr; }
}

.panel {
  background: var(--card-dark-bg);
  border: 1px solid var(--card-dark-border);
  border-radius: 14px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--card-dark-border);
  background: var(--card-dark-bg);
}
.panel-title {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-secondary);
}
.char-count {
  font-size: 11px; font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
}
.char-count.over { color: #ef4444; }

.ta {
  width: 100%; min-height: 280px;
  padding: 16px;
  background: var(--input-bg);
  border: none; outline: none;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 14px; line-height: 1.55;
  resize: vertical;
}
.ta-mono { font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.ta::placeholder { color: var(--text-muted); }

.actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.btn-primary {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: #fff; font-weight: 600; font-size: 14px;
  padding: 12px 22px;
  border: none; border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 6px 24px rgba(99,102,241,.35);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 28px rgba(99,102,241,.45); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px; padding: 12px 16px;
  border: 1px solid var(--card-dark-border);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
}
.btn-ghost:hover { color: var(--accent-light); border-color: var(--accent-primary); }

.preview-panel { margin-bottom: 24px; }
.preview {
  padding: 18px 20px;
  background: var(--input-bg);
  font-family: 'Inter', sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  min-height: 80px;
  color: var(--text-primary);
}
.preview b, .preview strong { font-weight: 700; }
.preview i, .preview em { font-style: italic; }
.preview u { text-decoration: underline; }
.preview s { text-decoration: line-through; opacity: 0.7; }
.preview code {
  background: var(--card-dark-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--accent-light);
}
.preview pre {
  background: var(--card-dark-bg);
  border: 1px solid var(--card-dark-border);
  padding: 12px 14px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.5;
  overflow-x: auto;
  margin: 8px 0;
}
.preview pre code { background: transparent; padding: 0; color: var(--text-primary); }
.preview a { color: var(--accent-primary); text-decoration: underline; }
.preview blockquote {
  border-left: 3px solid var(--accent-primary);
  padding: 4px 12px;
  margin: 8px 0;
  color: var(--text-secondary);
  font-style: normal;
}
.preview tg-spoiler {
  background: var(--text-muted);
  color: var(--text-muted);
  border-radius: 3px;
  padding: 0 4px;
  cursor: pointer;
  transition: color 200ms ease;
}
.preview tg-spoiler:hover { color: var(--text-primary); }

.cheatsheet {
  background: var(--card-dark-bg);
  border: 1px solid var(--card-dark-border);
  border-radius: 14px;
  overflow: hidden;
}
.cheatsheet summary {
  padding: 14px 18px;
  font-weight: 600;
  font-size: 14px;
  color: var(--accent-light);
  cursor: pointer;
  list-style: none;
}
.cheatsheet summary::-webkit-details-marker { display: none; }
.cheatsheet summary::before { content: '+ '; color: var(--accent-primary); font-weight: 700; }
.cheatsheet[open] summary::before { content: '− '; }
.cheatsheet-body { padding: 0 18px 18px; font-size: 13.5px; color: var(--text-secondary); }
.cheatsheet table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.cheatsheet th, .cheatsheet td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--card-dark-border);
  vertical-align: top;
}
.cheatsheet th { color: var(--accent-secondary); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.cheatsheet code {
  font-family: 'JetBrains Mono', monospace;
  background: var(--input-bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}
.cheatsheet-note { margin-top: 12px; color: var(--text-muted); font-size: 12px; }

.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  background: #22c55e;
  color: #fff;
  border-radius: 10px;
  font-weight: 600; font-size: 14px;
  z-index: 100;
  animation: slideUp 0.2s;
}
@keyframes slideUp {
  from { transform: translate(-50%, 16px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.split-info { margin: 12px 0; padding: 10px 14px; background: rgba(245, 158, 11, 0.08); border-left: 3px solid #f59e0b; border-radius: 6px; font-size: 13px; color: var(--text-secondary); }
.dropzone { position: fixed; inset: 0; background: rgba(99, 102, 241, 0.85); display: none; align-items: center; justify-content: center; z-index: 1000; pointer-events: none; }
.dropzone.show { display: flex; }
.dropzone-inner { color: white; text-align: center; padding: 40px; border: 3px dashed white; border-radius: 24px; }
.dropzone-inner p { font-size: 24px; font-weight: 700; margin: 16px 0 0; }
[hidden] { display: none !important; }

.url-input { width: 100%; padding: 16px 18px; background: var(--card-bg); color: var(--text-primary); border: 1px solid var(--panel-border); border-radius: 14px; font-family: var(--font-mono); font-size: 15px; line-height: 1.5; transition: border-color 0.15s; }
.url-input:focus { outline: none; border-color: var(--accent-primary); }

.result-empty { padding: 40px 20px; text-align: center; color: var(--text-muted); font-size: 14px; }
.result-error { padding: 20px; background: rgba(236, 72, 153, 0.08); border-left: 3px solid #ec4899; border-radius: 8px; color: var(--text-secondary); font-size: 14px; }

.verdict { display: flex; align-items: center; gap: 20px; padding: 24px; border-radius: 18px; margin: 24px 0 16px; }
.verdict-ok { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); }
.verdict-warn { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.3); }
.verdict-high { background: rgba(236, 72, 153, 0.12); border: 1px solid rgba(236, 72, 153, 0.4); }
.verdict-critical { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.5); }
.verdict-score { font-family: var(--font-mono); font-size: 48px; font-weight: 800; line-height: 1; min-width: 80px; text-align: center; }
.verdict-ok .verdict-score { color: #10b981; }
.verdict-warn .verdict-score { color: #f59e0b; }
.verdict-high .verdict-score { color: #ec4899; }
.verdict-critical .verdict-score { color: #ef4444; }
.verdict-body { flex: 1; min-width: 0; }
.verdict-label { font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.verdict-host { font-family: var(--font-mono); font-size: 13px; color: var(--text-secondary); word-break: break-all; }

.checks { display: flex; flex-direction: column; gap: 10px; }
.check { display: flex; gap: 14px; padding: 14px 16px; background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 12px; }
.check-icon { font-size: 18px; line-height: 1.2; flex-shrink: 0; min-width: 24px; }
.check-body { flex: 1; min-width: 0; }
.check-title { font-weight: 600; color: var(--text-primary); margin-bottom: 4px; font-size: 14px; }
.check-detail { font-size: 13px; color: var(--text-secondary); line-height: 1.55; }
.check-high { border-color: rgba(236, 72, 153, 0.4); }
.check-warn { border-color: rgba(245, 158, 11, 0.4); }
.check-ok { border-color: rgba(16, 185, 129, 0.4); }

.dropzone { position: fixed; inset: 0; background: rgba(99, 102, 241, 0.85); display: none; align-items: center; justify-content: center; z-index: 1000; pointer-events: none; }
.dropzone.show { display: flex; }
.dropzone-inner { color: white; text-align: center; padding: 40px; border: 3px dashed white; border-radius: 24px; }
.dropzone-inner p { font-size: 24px; font-weight: 700; margin: 16px 0 0; }
[hidden] { display: none !important; }

.explain-badge { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin-left: 8px; background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 50%; color: var(--text-muted); font-size: 12px; font-weight: 700; cursor: pointer; vertical-align: middle; transition: all 0.15s; }
.explain-badge:hover { color: white; background: var(--accent-primary); border-color: var(--accent-primary); }

.explain-modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center; z-index: 250; padding: 20px; }
.explain-modal[hidden] { display: none; }
.explain-inner { background: var(--card-bg); border: 1px solid var(--panel-border); border-radius: 16px; padding: 28px 32px; max-width: 580px; width: 100%; box-shadow: 0 16px 60px rgba(0,0,0,0.6); position: relative; }
.explain-inner h3 { margin: 0 0 14px; font-size: 18px; font-weight: 700; color: var(--text-primary); padding-right: 30px; }
.explain-inner p { margin: 0; font-size: 14px; line-height: 1.7; color: var(--text-secondary); }
.explain-close { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; background: transparent; border: none; color: var(--text-muted); font-size: 26px; line-height: 1; cursor: pointer; }
.explain-close:hover { color: var(--text-primary); }


.faq-section { max-width: 760px; margin: 60px auto 40px; }
.faq-section h2 { font-size: 24px; font-weight: 700; margin: 0 0 24px; color: var(--text-primary); }
.faq-item { background: var(--card-bg); border: 1px solid var(--panel-border); border-radius: 12px; padding: 0; margin-bottom: 12px; overflow: hidden; transition: border-color 0.15s; }
.faq-item:hover { border-color: var(--accent-primary); }
.faq-item summary { cursor: pointer; padding: 16px 20px; font-weight: 600; color: var(--text-primary); list-style: none; position: relative; padding-right: 50px; user-select: none; font-size: 15px; line-height: 1.5; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 22px; color: var(--text-muted); font-weight: 300; }
.faq-item[open] summary::after { content: "−"; }
.faq-item[open] summary { color: var(--accent-primary); }
.faq-answer { padding: 0 20px 18px; color: var(--text-secondary); font-size: 14px; line-height: 1.7; }
.faq-answer code { font-family: var(--font-mono); font-size: 13px; padding: 1px 6px; background: var(--panel-bg); border-radius: 4px; color: var(--text-primary); }
