:root {
  --bg: #f3f3f0;
  --surface: #ffffff;
  --surface-2: #f7f7f4;
  --ink: #0c0d10;
  --ink-soft: #54565f;
  --ink-faint: #8a8c94;
  --line: rgba(12, 13, 16, 0.12);
  --line-2: rgba(12, 13, 16, 0.07);
  --dark: #0d0d10;
  --on-dark: #ffffff;
  --on-dark-soft: #b3b4ba;
  --lime: #c8f24d;
  --lime-ink: #14180a;
  --ok: #138a5e;
  --ok-bg: #e4f6ec;
  --bad: #c2185b;
  --bad-bg: #fde7f0;
  --warn-bg: #fff6d6;
  --radius: 6px;
  --shadow: 0 18px 44px -24px rgba(12, 13, 16, 0.32);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d10;
    --surface: #161619;
    --surface-2: #1f1f24;
    --ink: #f2f2f4;
    --ink-soft: #b3b4ba;
    --ink-faint: #85868e;
    --line: rgba(255, 255, 255, 0.14);
    --line-2: rgba(255, 255, 255, 0.08);
    --ok: #4fd69c;
    --ok-bg: rgba(79, 214, 156, 0.12);
    --bad: #ff6fae;
    --bad-bg: rgba(255, 77, 157, 0.14);
    --warn-bg: rgba(255, 210, 63, 0.12);
    --shadow: 0 18px 44px -24px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

.topbar {
  background: var(--dark);
  color: var(--on-dark);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; }
.brand-logo { height: 40px; width: auto; display: block; }
.brand-logo-lg { height: 60px; }
.brand-tag { color: var(--on-dark-soft); font-weight: 600; font-size: 12px; }
.login-mark { width: 48px; height: 48px; border-radius: 10px; display: block; }
.user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--on-dark-soft); }
.user img { width: 28px; height: 28px; border-radius: 50%; }
.user-email { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-switch { display: inline-flex; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: var(--radius); overflow: hidden; }
.lang-switch button { border: none; background: transparent; color: var(--on-dark-soft); font: inherit; font-size: 12px; font-weight: 700; padding: 5px 9px; cursor: pointer; }
.lang-switch button.on { background: var(--lime); color: var(--lime-ink); }
.lang-row { display: flex; justify-content: flex-end; }
.lang-switch-light { border-color: var(--line); }
.lang-switch-light button { color: var(--ink-soft); }
.topbar .btn-ghost { color: var(--on-dark); border-color: rgba(255, 255, 255, 0.2); }

.page { max-width: 1180px; margin: 0 auto; padding: 32px 16px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { color: var(--ink-soft); margin-top: 6px; }
.crumbs { font-size: 13px; color: var(--ink-faint); margin-bottom: 8px; }
.crumbs a { text-decoration: none; color: var(--ink-soft); }
.crumbs a:hover { color: var(--ink); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.card + .card { margin-top: 16px; }
.section-head { margin: 32px 0 16px; }
.section-head p { color: var(--ink-soft); font-size: 14px; margin-top: 4px; }
.designer .card + .card { margin-top: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.card-head p { color: var(--ink-soft); font-size: 14px; margin-top: 4px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); font-size: 13px; }
.spacer { height: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 9px 16px;
  font: inherit;
  font-weight: 650;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.12s ease, background 0.12s ease, opacity 0.12s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--lime); color: var(--lime-ink); }
.btn-primary:hover:not(:disabled) { background: #d6fa5f; }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn-danger:hover:not(:disabled) { background: var(--bad-bg); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 650; color: var(--ink-soft); }
.hint { font-size: 12.5px; color: var(--ink-faint); }
input[type="text"], input[type="password"], input[type="email"], input:not([type]), textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  outline: none;
}
textarea { resize: vertical; min-height: 84px; }
input:focus, textarea:focus, select:focus { border-color: var(--ink-soft); box-shadow: 0 0 0 3px var(--line-2); }
input[type="color"] { width: 38px; height: 36px; border: 1px solid var(--line); border-radius: var(--radius); padding: 2px; background: var(--surface); cursor: pointer; flex: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--ink); }
.input-row { display: flex; gap: 8px; }
.input-row > input { flex: 1; min-width: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

.site-card { display: flex; flex-direction: column; gap: 14px; text-decoration: none; transition: box-shadow 0.15s ease, transform 0.15s ease; }
.site-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.site-card .meta { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; color: var(--ink-soft); }
.site-card .stats { display: flex; gap: 18px; font-size: 13px; color: var(--ink-faint); border-top: 1px solid var(--line-2); padding-top: 12px; }
.site-card .stats b { color: var(--ink); font-size: 15px; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line-2); }
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge-off { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.empty { text-align: center; padding: 56px 24px; }
.empty h2 { margin-bottom: 8px; }
.empty p { color: var(--ink-soft); margin-bottom: 22px; }

.channels { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.channel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.channel:hover:not(:disabled) { border-color: var(--ink); box-shadow: var(--shadow); }
.channel:disabled { cursor: default; opacity: 0.55; }
.channel-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 800; }
.channel-name { font-weight: 700; }
.channel-soon { position: absolute; top: 14px; right: 14px; }

.steps { display: flex; gap: 6px; margin-bottom: 22px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-faint); padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); }
.step-n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--ink-soft); }
.step.active { color: var(--ink); border-color: var(--ink); }
.step.active .step-n { background: var(--ink); color: var(--bg); }
.step.done .step-n { background: var(--lime); color: var(--lime-ink); }

.howto { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--ink-soft); font-size: 14px; }
.howto b { color: var(--ink); }

.result { font-size: 14px; padding: 10px 12px; border-radius: var(--radius); }
.result-ok { background: var(--ok-bg); color: var(--ok); }
.result-bad { background: var(--bad-bg); color: var(--bad); }
.result-warn { background: var(--warn-bg); color: var(--ink); }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.checklist li { display: flex; gap: 8px; }
.checklist .yes { color: var(--ok); font-weight: 700; }
.checklist .no { color: var(--bad); font-weight: 700; }

.chat-list { display: flex; flex-direction: column; gap: 6px; }
.chat-option { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.chat-option:hover { border-color: var(--ink); }
.chat-option.selected { border-color: var(--ink); background: var(--surface-2); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 14px 9px; font-size: 14px; font-weight: 650; color: var(--ink-soft); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }

.designer { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 24px; align-items: start; }
.preview-wrap { position: sticky; top: 16px; }
.preview-frame { width: 100%; height: 640px; border: 1px solid var(--line); border-radius: var(--radius); background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 12px, var(--surface) 12px, var(--surface) 24px); display: block; }
.segmented { align-self: flex-start; display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.segmented button { border: none; background: var(--surface); color: var(--ink-soft); padding: 7px 12px; font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button.on { background: var(--ink); color: var(--bg); }
.colors { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type="text"] { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
details { border-top: 1px solid var(--line-2); padding-top: 12px; }
summary { cursor: pointer; font-weight: 650; font-size: 14px; }
details[open] summary { margin-bottom: 14px; }
.savebar { position: sticky; bottom: 0; margin-top: 16px; padding: 12px 0; background: linear-gradient(to top, var(--bg) 70%, transparent); display: flex; gap: 10px; align-items: center; }

.code { position: relative; background: var(--dark); color: #e9eaee; border-radius: var(--radius); padding: 16px 18px; padding-right: 92px; overflow-x: auto; white-space: pre; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.6; }
.code .copy { position: absolute; top: 10px; right: 10px; background: rgba(255, 255, 255, 0.1); color: #fff; border-color: rgba(255, 255, 255, 0.15); }
.key { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line-2); font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.platforms { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.platform { padding: 14px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface-2); font-size: 13.5px; color: var(--ink-soft); }
.platform b { display: block; color: var(--ink); margin-bottom: 4px; }

.form-rows { display: flex; flex-direction: column; gap: 8px; }
.form-row { display: grid; grid-template-columns: 180px 1fr auto; gap: 8px; }

.danger { border-color: var(--bad); }
.danger h2 { color: var(--bad); }
.danger-item { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line-2); }
.danger-item:first-of-type { border-top: none; padding-top: 0; }
.danger-item p { font-size: 14px; color: var(--ink-soft); }

.toast-host { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--radius); font-size: 14px; font-weight: 600; box-shadow: var(--shadow); animation: toast-in 0.18s ease; }
.toast.bad { background: var(--bad); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.loading { padding: 80px 0; text-align: center; color: var(--ink-faint); }

.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--dark); color: var(--on-dark); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.login-art h1 { font-size: 40px; max-width: 460px; }
.login-art h1 .accent { color: var(--lime); }
.login-art p { color: var(--on-dark-soft); max-width: 420px; margin-top: 16px; font-size: 16px; }
.login-points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; color: var(--on-dark-soft); font-size: 14.5px; }
.login-points li::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--lime); margin-right: 12px; }
.login-form { display: grid; place-items: center; padding: 40px 16px; }
.login-box { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 18px; }
.login-box h2 { font-size: 24px; }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font-weight: 650; text-decoration: none; font-size: 15px; }
.google-btn:hover { box-shadow: var(--shadow); }
.google-btn svg { width: 20px; height: 20px; }
.login-error { display: none; }
.login-error.show { display: block; }

@media (pointer: coarse) {
  input[type="text"], input[type="password"], input[type="email"], input:not([type]), textarea, select { font-size: 16px; }
}

@media (max-width: 960px) {
  .designer { grid-template-columns: 1fr; }
  .preview-wrap { position: static; }
  .preview-frame { height: 560px; }
}

@media (max-width: 760px) {
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 32px 20px; }
  .login-art h1 { font-size: 30px; }
  .grid-2, .colors { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .user-email { display: none; }
  .page { padding-top: 22px; }
  .danger-item { flex-direction: column; align-items: flex-start; }
}
