:root {
  --bg: #0b0d12;
  --bg-soft: #12151d;
  --card: #161a24;
  --border: #262c3a;
  --text: #e8ebf2;
  --muted: #9aa3b5;
  --accent: #7c5cff;
  --accent-2: #4bd0ff;
  --danger: #ff6b6b;
  --radius: 14px;
  font-size: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  min-height: 100vh;
}

.view { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 13, 18, 0.85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }
.ghost-link { color: var(--muted); text-decoration: none; margin-left: auto; }
.ghost-link:hover { color: var(--text); }
.site-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.live-link { color: var(--accent-2); text-decoration: none; font-size: 0.88rem; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-link:hover { text-decoration: underline; }

/* ---------- google-style home ---------- */
.topbar.minimal { border-bottom: none; background: transparent; justify-content: flex-end; }
.google-hero {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 0 22px 40px; width: 100%;
  margin-top: clamp(40px, 18vh, 180px);
}
.logo {
  font-size: clamp(2.6rem, 8vw, 4.4rem);
  font-weight: 800; letter-spacing: -0.03em; line-height: 1;
  text-align: center;
}
.logo .l1 { color: #ffb703; } /* yolk */
.logo .l2 { color: #fb5607; } /* salsa */
.logo .l3 { color: #ff006e; } /* pico */
.logo .l4 { color: #8ac926; } /* avocado */
.logo .l5 { color: #ffb703; }
.logo em {
  font-style: italic; font-weight: 600; color: var(--text);
  font-size: 0.55em; letter-spacing: 0;
}
.tagline { color: var(--muted); margin: 14px 0 34px; font-size: 1.08rem; text-align: center; }

.searchbox {
  display: flex; align-items: center; gap: 10px;
  width: min(600px, 94vw);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 18px 6px 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.searchbox:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.15), 0 8px 30px rgba(0, 0, 0, 0.35);
}
.searchbox .search-icon { font-size: 1.1rem; }
.searchbox input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font: inherit; font-size: 1.02rem; padding: 12px 0;
  min-width: 0;
}
.searchbox .attach { cursor: pointer; font-size: 1.15rem; padding: 6px; border-radius: 50%; }
.searchbox .attach:hover { background: var(--card); }

.thumbs.centered { justify-content: center; }

.hero-buttons { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; justify-content: center; }
.btn.google {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  font-weight: 500; padding: 11px 20px;
}
.btn.google:hover:not(:disabled) { border-color: var(--accent); }

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

.composer textarea, .chat-composer textarea, .modal input[type="text"] {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  padding: 12px 14px;
  resize: vertical;
}
.composer textarea:focus, .chat-composer textarea:focus, .modal input:focus {
  outline: none; border-color: var(--accent);
}

.composer-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  border: none; border-radius: 10px; cursor: pointer;
  font: inherit; font-weight: 600;
  padding: 10px 18px;
  transition: filter 0.15s, transform 0.05s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn.primary { background: linear-gradient(90deg, var(--accent), #9a7bff); color: #fff; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.12); }
.btn.secondary { background: var(--bg-soft); border: 1px solid var(--border); color: var(--text); }
.btn.secondary:hover { border-color: var(--accent); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); }
.icon-btn { cursor: pointer; font-size: 1.1rem; padding: 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--bg-soft); }

/* ---------- thumbnails ---------- */
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumbs:empty { margin: 0; }
.thumb { position: relative; width: 64px; height: 64px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--bg-soft); }
.thumbs.small .thumb { width: 44px; height: 44px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.uploading img { opacity: 0.35; }
.thumb .rm {
  position: absolute; top: 2px; right: 2px;
  background: rgba(0,0,0,0.65); color: #fff; border: none; border-radius: 50%;
  width: 18px; height: 18px; font-size: 11px; line-height: 1; cursor: pointer;
}

/* ---------- my sites ---------- */
.my-sites { margin-top: 64px; width: min(860px, 94vw); }
.my-sites h2 { font-size: 1.15rem; margin-bottom: 14px; }
.sites-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.site-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; cursor: pointer; transition: border-color 0.15s;
  display: flex; flex-direction: column; gap: 6px;
}
.site-card:hover { border-color: var(--accent); }
.site-card .name { font-weight: 700; }
.site-card .meta { color: var(--muted); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; width: fit-content; }
.badge.live { background: rgba(76, 217, 100, 0.12); color: #4cd964; }
.badge.draft { background: rgba(154, 163, 181, 0.12); color: var(--muted); }
.badge.pro { background: rgba(124, 92, 255, 0.15); color: #b3a1ff; }

.muted { color: var(--muted); }
.footer { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 24px; }

/* ---------- builder ---------- */
.builder { flex: 1; display: grid; grid-template-columns: 380px 1fr; min-height: 0; }
.chat-panel { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; height: calc(100vh - 61px); }
.chat-log { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.msg { border-radius: 12px; padding: 10px 14px; font-size: 0.93rem; max-width: 95%; white-space: pre-wrap; }
.msg.user { background: var(--accent); background: linear-gradient(135deg, #5a41d6, #7c5cff); align-self: flex-end; }
.msg.bot { background: var(--bg-soft); border: 1px solid var(--border); align-self: flex-start; }
.msg.bot.thinking { color: var(--muted); font-style: italic; }
.chat-composer { border-top: 1px solid var(--border); padding: 12px; }
.chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-input-row textarea { flex: 1; }

.preview-panel { display: flex; flex-direction: column; min-height: 0; background: #1a1e28; }
.preview-chrome { display: flex; align-items: center; gap: 6px; padding: 10px 14px; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot.red { background: #ff5f57; } .dot.yellow { background: #febc2e; } .dot.green { background: #28c840; }
.preview-url { color: var(--muted); font-size: 0.8rem; margin-left: 10px; font-family: ui-monospace, monospace; }
#preview { flex: 1; border: none; background: #fff; width: 100%; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  padding: 20px;
}
.modal { width: 100%; max-width: 460px; padding: 26px; }
.modal h3 { margin-bottom: 10px; font-size: 1.25rem; }
.modal p { margin-bottom: 14px; }
.modal input[type="text"] { margin-bottom: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.error-text { color: var(--danger); font-size: 0.88rem; }
code { background: var(--bg-soft); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; font-size: 0.88em; }

.dns-record { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.dns-record > div { display: flex; align-items: center; gap: 10px; }
.dns-label { color: var(--muted); font-size: 0.8rem; width: 52px; }

.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite; margin-bottom: 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 18px; z-index: 100; max-width: 90vw;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.toast.error { border-color: var(--danger); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .builder { grid-template-columns: 1fr; grid-template-rows: 1fr 45vh; }
  .chat-panel { order: 2; height: auto; border-right: none; border-top: 1px solid var(--border); }
  .preview-panel { order: 1; }
  .topbar-actions .live-link { display: none; }
}
