:root {
  --bg: #0b1220;
  --bg-soft: #111c2f;
  --card: #152238;
  --line: #24344f;
  --text: #e8eefb;
  --muted: #8fa3c4;
  --accent: #6ee7d8;
  --accent-2: #8fb7ff;
  --new: #7ef0b0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 10% -10%, #1a2b4a 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  min-height: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  background: rgba(11, 18, 32, 0.82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-weight: 800;
  font-size: 22px;
  color: #06202a;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px rgba(110, 231, 216, 0.25);
}
.brand h1 { margin: 0; font-size: 19px; letter-spacing: 0.2px; }
.brand p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }

.live { display: flex; align-items: center; gap: 16px; }
.live-clock {
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
}
.live-meta { font-size: 12px; color: var(--muted); min-width: 210px; text-align: right; }

button.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
}
button.ghost:hover { border-color: var(--accent); color: var(--accent); }

.tabs {
  position: sticky;
  top: 81px;
  z-index: 19;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 28px;
  background: rgba(11, 18, 32, 0.78);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.tab {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--muted);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13px;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: #06202a;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 700;
}

main { padding: 20px 28px 60px; max-width: 1680px; margin: 0 auto; }

.legend { font-size: 12px; color: var(--muted); margin-bottom: 18px; line-height: 1.8; }
.chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  vertical-align: 1px;
}
.chip.new { color: #062a18; background: var(--new); }
.muted { color: var(--muted); }

.pack {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(21, 34, 56, 0.95), rgba(14, 24, 41, 0.95));
  border-radius: 20px;
  padding: 18px 20px 20px;
  margin-bottom: 20px;
}
.pack-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.pack-head h2 { margin: 0; font-size: 17px; }
.pack-head .meta { font-size: 12px; color: var(--muted); }
.pack-head .tag {
  font-size: 11px;
  color: var(--accent);
  border: 1px solid rgba(110, 231, 216, 0.35);
  border-radius: 999px;
  padding: 2px 9px;
}

.template { margin-top: 14px; }
.template-title {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
}
.sizes { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-start; }

.phone {
  border-radius: 18px;
  padding: 10px;
  background: #05080f;
  border: 1px solid #2b3d59;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  width: fit-content;
}
.phone canvas {
  display: block;
  border-radius: 12px;
  background: #0b1220;
}
.phone .caption {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  gap: 14px;
}
.phone .size { color: var(--text); font-weight: 700; }
.placeholder {
  width: 200px;
  height: 120px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
}

.status { margin-top: 26px; font-size: 12px; color: var(--muted); }
.error {
  border: 1px solid #6b2b3a;
  background: rgba(107, 43, 58, 0.25);
  color: #ffb4c4;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13px;
}

/* Same renderer, scoped to one saved admin draft with all configured sizes. */
html:has(body.admin-embed), body.admin-embed { min-height: 0; background: #141824; }
.admin-embed .topbar, .admin-embed .tabs, .admin-embed .legend, .admin-embed #status, .admin-embed .pack-head { display: none; }
.admin-embed main { padding: 0; max-width: none; margin: 0; }
.admin-embed .pack { padding: 0; margin: 0; border: 0; background: none; }
.admin-embed .template-title { font-size: 11px; overflow-wrap: anywhere; margin-bottom: 8px; }
.admin-embed #gallery, .admin-embed .template { display: flow-root; }
.admin-embed .template { margin: 0 0 12px; }
.admin-embed .sizes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: start; }
.admin-embed .phone { padding: 6px; min-width: 0; box-shadow: none; border-radius: 8px; }
.admin-embed .phone canvas { display: block; width: 100% !important; height: auto !important; border-radius: 5px; }
.admin-embed .caption { gap: 3px; flex-wrap: wrap; }
.admin-embed .caption span:last-child { font-size: 10px; }
.admin-embed .missing-size { min-height: 100px; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
