/* =============================================================
   QuickMeta — Стили
   ============================================================= */

*{margin:0;padding:0;box-sizing:border-box}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;background:#f0f2f5;color:#1a1a2e;line-height:1.6;min-height:100vh}

.loading-screen{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:100vh;gap:20px}
.loading{text-align:center;padding:60px 20px;color:#888}
.spinner{width:36px;height:36px;border:4px solid #e1e5eb;border-top-color:#6366f1;border-radius:50%;animation:spin .7s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

.logo{font-size:2.2em;font-weight:800;color:#6366f1;cursor:pointer;text-align:center}
.logo span{color:#8b5cf6}
.logo.sm{font-size:1.3em}

/* Topbar */
.topbar{background:#fff;box-shadow:0 2px 12px rgba(0,0,0,.08);position:sticky;top:0;z-index:100}
.topbar-in{max-width:1400px;margin:0 auto;padding:0 20px;display:flex;align-items:center;justify-content:space-between;height:56px}
.topbar-r{display:flex;gap:8px}

.hero-mini{background:linear-gradient(135deg,#6366f1,#8b5cf6);color:#fff;text-align:center;padding:28px 20px 24px}
.hero-mini h1{font-size:1.6em;font-weight:700;margin-bottom:4px}
.hero-mini p{opacity:.9;max-width:600px;margin:0 auto}

/* Nav */
.nav{background:#fff;box-shadow:0 2px 12px rgba(0,0,0,.08);position:sticky;top:0;z-index:100}
.nav-in{max-width:1200px;margin:0 auto;padding:0 20px;display:flex;align-items:center;height:56px;gap:16px}
.nav-links{display:flex;gap:4px;margin-left:auto;}
.nl{padding:7px 14px;border:none;background:0;border-radius:10px;font-weight:500;font-size:.88em;cursor:pointer;font-family:inherit;color:#666;white-space:nowrap;transition:.2s}
.nl:hover{background:#f0f2f5}
.nl.on{background:#6366f1;color:#fff}
.nav-user{display:flex;align-items:center;gap:10px;white-space:nowrap}
.uname{font-weight:500;color:#555;font-size:.88em}

.main{max-width:1200px;margin:28px auto;padding:0 20px}
.ph{display:flex;align-items:center;justify-content:space-between;margin-bottom:24px;flex-wrap:wrap;gap:14px}
.ph h1{font-size:1.5em;font-weight:700}
.badge-count{background:#6366f1;color:#fff;padding:4px 12px;border-radius:20px;font-size:.85em;font-weight:600}

/* Card */
.card{background:#fff;border-radius:16px;padding:24px;box-shadow:0 2px 10px rgba(0,0,0,.06);margin-bottom:18px}
.card h2{font-size:1.1em;margin-bottom:16px;color:#333}

/* Forms */
.fg{display:flex;flex-direction:column;margin-bottom:14px}
.fg label{font-size:.84em;font-weight:600;color:#555;margin-bottom:4px;display:flex;align-items:center;gap:6px}
.fg input,.fg textarea,.fg select{padding:9px 13px;border:2px solid #e1e5eb;border-radius:10px;font-size:.94em;font-family:inherit;outline:none;transition:border .2s}
.fg input:focus,.fg textarea:focus,.fg select:focus{border-color:#6366f1}
.fg textarea{resize:vertical;min-height:60px;width:100%}
.fg2{display:grid;grid-template-columns:1fr 1fr;gap:14px}

.counter{font-size:.82em;font-weight:400;margin-left:auto}
.toggle{display:flex;align-items:center;gap:8px;font-weight:600;font-size:.92em;cursor:pointer;margin-bottom:14px;color:#555}
.toggle input{accent-color:#6366f1}

/* Buttons */
.btn{padding:10px 20px;border:none;border-radius:10px;font-size:.94em;font-weight:600;cursor:pointer;transition:all .2s;font-family:inherit;display:inline-flex;align-items:center;justify-content:center;gap:6px}
.btn.pri{background:linear-gradient(135deg,#6366f1,#8b5cf6);color:#fff}
.btn.pri:hover{transform:translateY(-1px);box-shadow:0 6px 18px rgba(99,102,241,.35)}
.btn.sec{background:#f0f2f5;color:#333}
.btn.out{background:#fff;border:2px solid #e1e5eb;color:#555}
.btn.out:hover{border-color:#6366f1;color:#6366f1}
.btn.sm{padding:5px 11px;font-size:.8em}
.btn.full{width:100%}
.btn.danger{background:#fee;color:#e74c3c;border:none}
.btn.danger:hover{background:#e74c3c;color:#fff}

/* =================== ГЕНЕРАТОР GRID =================== */

.gen-grid{display:grid;grid-template-columns:1fr 1fr;gap:24px;align-items:start}
.gen-form{min-width:0}
.gen-preview{min-width:0}
.sticky-card{position:sticky;top:72px}

/* =================== GOOGLE PREVIEW =================== */

.preview-google{background:#fff;border:1px solid #e8eaed;border-radius:12px;padding:16px;margin-bottom:4px}
.gp-url{font-size:.82em;color:#202124;margin-bottom:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.gp-title{font-size:1.15em;color:#1a0dab;font-weight:400;line-height:1.3;margin-bottom:4px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.gp-desc{font-size:.88em;color:#4d5156;line-height:1.5;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}

/* =================== SOCIAL PREVIEW =================== */

.preview-social{margin-bottom:4px}
.sp-card{border:1px solid #e1e5eb;border-radius:12px;overflow:hidden}
.sp-image{width:100%;height:180px;background:#f0f2f5;background-size:cover;background-position:center;display:flex;align-items:center;justify-content:center}
.sp-placeholder{color:#999;font-size:1.5em}
.sp-body{padding:12px 16px}
.sp-site{font-size:.78em;color:#999;text-transform:uppercase;margin-bottom:2px}
.sp-title{font-size:1em;font-weight:700;color:#1a1a2e;margin-bottom:4px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.sp-desc{font-size:.88em;color:#666;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}

/* =================== CODE BLOCK =================== */

.code-block{position:relative;background:#1a1a2e;border-radius:12px;padding:18px;overflow:hidden}
.code-block pre{margin:0;overflow-x:auto;max-height:400px;overflow-y:auto}
.code-block code{color:#e2e8f0;font-family:'SF Mono',SFMono-Regular,Menlo,Consolas,monospace;font-size:.82em;line-height:1.7;white-space:pre}
.code-copy{position:absolute;top:10px;right:10px;z-index:1}

/* =================== SAVED LIST =================== */

.saved-list{display:flex;flex-direction:column;gap:10px}
.saved-card{background:#fff;border:2px solid #f0f2f5;border-radius:12px;padding:16px;display:flex;align-items:center;justify-content:space-between;transition:.2s;gap:12px}
.saved-card:hover{border-color:#6366f1}
.saved-info{flex:1;min-width:0}
.saved-label{font-weight:700;font-size:1.05em;color:#1a1a2e}
.saved-date{font-size:.82em;color:#999;margin-top:2px}
.saved-acts{display:flex;gap:6px;flex-shrink:0}

/* =================== MODAL =================== */

.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.5);display:flex;align-items:center;justify-content:center;z-index:500;padding:20px;backdrop-filter:blur(4px)}
.modal-overlay.hidden{display:none}
.modal-card{background:#fff;border-radius:20px;padding:36px;width:100%;max-width:400px;box-shadow:0 20px 60px rgba(0,0,0,.3);position:relative;animation:modalIn .25s ease}
@keyframes modalIn{from{opacity:0;transform:translateY(30px)}to{opacity:1;transform:none}}
.modal-close{position:absolute;top:14px;right:14px;background:none;border:none;font-size:1.4em;cursor:pointer;color:#999;width:36px;height:36px;border-radius:50%;display:flex;align-items:center;justify-content:center;transition:.2s}
.modal-close:hover{background:#f0f2f5;color:#333}
.auth-sub{text-align:center;color:#888;margin:4px 0 24px;font-size:.92em}
.tabs{display:flex;background:#f0f2f5;border-radius:12px;padding:4px;margin-bottom:24px}
.tab{flex:1;padding:10px;border:none;background:0;border-radius:10px;font-weight:600;font-size:.95em;cursor:pointer;font-family:inherit;color:#666;transition:.2s}
.tab.on{background:#fff;color:#6366f1;box-shadow:0 2px 8px rgba(0,0,0,.1)}

/* Promo */
.promo-block{background:linear-gradient(135deg,#eef2ff,#e0e7ff);border:2px solid #c7d2fe;border-radius:16px;padding:28px;text-align:center;margin:24px 0}
.promo-icon{font-size:2.5em;margin-bottom:8px}
.promo-block h3{font-size:1.15em;color:#6366f1;margin-bottom:14px}
.promo-block ul{list-style:none;text-align:left;max-width:420px;margin:0 auto 20px;display:flex;flex-direction:column;gap:6px}
.promo-block li{font-size:.95em;color:#444}

.empty{text-align:center;padding:40px 20px;color:#888}
.ei{font-size:3em;margin-bottom:8px}

/* Toast */
#toasts{position:fixed;top:70px;right:20px;z-index:1000;display:flex;flex-direction:column;gap:8px}
.toast{display:flex;align-items:center;gap:10px;padding:13px 18px;border-radius:12px;font-size:.93em;font-weight:500;box-shadow:0 8px 28px rgba(0,0,0,.14);transform:translateX(120%);transition:transform .3s;max-width:380px}
.toast.show{transform:translateX(0)}
.t-ok{background:#e0e7ff;color:#3730a3;border:1px solid #c7d2fe}
.t-err{background:#f8d7da;color:#721c24;border:1px solid #f5c6cb}

/* SEO */
.seo-content{margin:40px 0;color:#333}
.seo-content h2{font-size:1.35em;font-weight:700;color:#1a1a2e;margin:32px 0 14px}
.seo-content p{font-size:1.02em;line-height:1.75;margin-bottom:12px;color:#444}
.seo-features{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin:20px 0}
.seo-feature{background:#fff;border:2px solid #f0f2f5;border-radius:14px;padding:22px;transition:border-color .2s}
.seo-feature:hover{border-color:#6366f1}
.seo-feature h3{font-size:1.05em;font-weight:700;color:#6366f1;margin-bottom:8px}
.seo-feature p{font-size:.93em;color:#555;margin-bottom:0}
.seo-content details{background:#fff;border:2px solid #f0f2f5;border-radius:12px;margin-bottom:10px;transition:border-color .2s}
.seo-content details:hover,.seo-content details[open]{border-color:#6366f1}
.seo-content summary{padding:16px 20px;font-weight:600;cursor:pointer;color:#1a1a2e;list-style:none;display:flex;align-items:center;gap:10px}
.seo-content summary::before{content:'▸';font-size:1.1em;color:#6366f1;transition:transform .2s}
.seo-content details[open] summary::before{transform:rotate(90deg)}
.seo-content summary::-webkit-details-marker{display:none}
.seo-content details p{padding:0 20px 16px;font-size:.95em;margin-bottom:0}

@media print{.topbar,.nav,.promo-block,.no-print,#toasts,.seo-content{display:none!important}}

/* =================== MOBILE =================== */

@media(max-width:1024px){
  .gen-grid{grid-template-columns:1fr}
  .sticky-card{position:static}
}
@media(max-width:768px){
  .nav-in{flex-wrap:wrap;height:auto;padding:8px 14px}
  .nav-links{order:3;width:100%;justify-content:center}
  .nl{padding:5px 10px;font-size:.78em}
  .uname{display:none}
  .fg2{grid-template-columns:1fr}
  .seo-features{grid-template-columns:1fr}
  .saved-card{flex-direction:column;align-items:flex-start}
  .saved-acts{width:100%}
}
@media(max-width:400px){
  .topbar-in{flex-wrap:wrap;height:auto;padding:8px 14px;gap:8px}
}
/* =============================================================
   ТАБЫ ПРЕВЬЮ
   ============================================================= */

.prev-tabs {
  display: flex;
  gap: 4px;
  background: #f0f2f5;
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 14px;
}

.ptab {
  flex: 1;
  padding: 7px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-weight: 600;
  font-size: .82em;
  cursor: pointer;
  font-family: inherit;
  color: #888;
  transition: .2s;
}

.ptab:hover {
  color: #555;
}

.ptab.on {
  background: #fff;
  color: #6366f1;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

/* =============================================================
   TELEGRAM PREVIEW
   ============================================================= */

.tg-chat {
  background: #0e1621;
  border-radius: 12px;
  padding: 16px;
}

.tg-bubble {
  background: #2b5278;
  border-radius: 12px 12px 4px 12px;
  padding: 8px 10px;
  max-width: 100%;
}

.tg-link-preview {
  display: flex;
  gap: 0;
  margin-bottom: 6px;
}

.tg-accent {
  width: 3px;
  background: #68b5ef;
  border-radius: 2px;
  flex-shrink: 0;
  margin-right: 8px;
}

.tg-content {
  flex: 1;
  min-width: 0;
}

.tg-sitename {
  font-size: .78em;
  color: #68b5ef;
  font-weight: 600;
  margin-bottom: 2px;
}

.tg-title {
  font-size: .92em;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tg-desc {
  font-size: .82em;
  color: #a8c0d4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}

.tg-image {
  width: 100%;
  height: 140px;
  background-size: cover;
  background-position: center;
  border-radius: 8px;
  margin-top: 6px;
}

.tg-url {
  font-size: .82em;
  color: #68b5ef;
  word-break: break-all;
  margin-top: 4px;
}

.tg-time {
  font-size: .72em;
  color: #6b8fad;
  text-align: right;
  margin-top: 4px;
}

/* =============================================================
   МАКС PREVIEW
   ============================================================= */

.max-chat {
  background: #edf2f7;
  border-radius: 12px;
  padding: 16px;
}

.max-bubble {
  background: #d2e4fd;
  border-radius: 16px 16px 4px 16px;
  padding: 10px 12px;
  max-width: 100%;
}

.max-sender {
  font-size: .78em;
  font-weight: 700;
  color: #2563eb;
  margin-bottom: 6px;
}

.max-link-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  margin-bottom: 6px;
}

.max-image {
  width: 100%;
  height: 150px;
  background-size: cover;
  background-position: center;
  background-color: #f1f5f9;
}

.max-image.max-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2em;
  color: #94a3b8;
  height: 80px;
}

.max-card-body {
  padding: 10px 12px;
}

.max-card-title {
  font-size: .95em;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}

.max-card-desc {
  font-size: .82em;
  color: #64748b;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.max-card-url {
  font-size: .75em;
  color: #94a3b8;
}

.max-url {
  font-size: .82em;
  color: #2563eb;
  word-break: break-all;
  margin-bottom: 4px;
}

.max-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.max-time {
  font-size: .72em;
  color: #64748b;
}

.max-read {
  font-size: .72em;
  color: #2563eb;
}

/* =============================================================
   MOBILE для превью
   ============================================================= */

@media (max-width: 768px) {
  .prev-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  .ptab {
    white-space: nowrap;
  }
  .tg-image,
  .max-image {
    height: 120px;
  }
}
/* =============================================================
   ЯНДЕКС PREVIEW
   ============================================================= */

.ya-result {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #e8e8e8;
  display: flex;
  gap: 12px;
  font-family: 'Arial', sans-serif;
  position: relative;
}

.ya-favicon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  margin-top: 2px;
}

.ya-favicon img {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: block;
}

.ya-fav-placeholder {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7em;
  font-weight: 700;
  color: #999;
}

.ya-content {
  flex: 1;
  min-width: 0;
}

.ya-breadcrumbs {
  font-size: .8em;
  color: #777;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ya-title {
  font-size: 1.12em;
  color: #0044cc;
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}

.ya-title:hover {
  color: #d00;
  text-decoration: underline;
}

.ya-desc {
  font-size: .88em;
  color: #333;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ya-thumb {
  margin-top: 8px;
}

.ya-thumb img {
  max-width: 120px;
  max-height: 80px;
  border-radius: 6px;
  border: 1px solid #eee;
  display: block;
}

/* Альтернативный вид — с картинкой справа */
@media (min-width: 500px) {
  .ya-result {
    position: relative;
  }
  .ya-thumb {
    position: absolute;
    right: 16px;
    top: 16px;
    margin-top: 0;
  }
  .ya-content {
    padding-right: 140px;
  }
}

/* Мобилка */
@media (max-width: 499px) {
  .ya-content {
    padding-right: 0;
  }
  .ya-thumb img {
    max-width: 100%;
    max-height: 120px;
  }
}
/* Яндекс (поисковый сниппет) */
.preview-yandex { margin-top: 10px; }

.ya-result{
  display:flex;
  gap:12px;
  align-items:flex-start;
  background:#fff;
  border:1px solid #e8e8e8;
  border-radius:12px;
  padding:16px;
}

.ya-left{ flex:1; min-width:0; }
.ya-right{ width:44px; display:flex; justify-content:center; }

.ya-breadcrumbs{
font-size: 14px;
  color: #006000;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: bold;
  text-transform: lowercase;
}

.ya-title{
  display:block;
  font-size:1.12em;
  color:#1a0dab;
  text-decoration:none;
  font-weight:500;
  line-height:1.25;
  margin-bottom:6px;
}

.ya-title:hover{ text-decoration:underline; color:#d10000; }

.ya-desc{
  font-size:.9em;
  color:#333;
  line-height:1.45;
  display:-webkit-box;
  -webkit-line-clamp:3;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

.ya-favicon{
  width:24px; height:24px;
  border-radius:6px;
  object-fit:cover;
}

.ya-favicon-placeholder{
  width:24px; height:24px;
  border-radius:6px;
  background:#f0f0f0;
  border:1px solid #e8e8e8;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:.78em;
  color:#999;
  font-weight:700;
}