/* ============================================================
   Design Library — light, minimalist, content-first
   ============================================================ */

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --border: #e6e6e8;
  --border-strong: #d9d9de;
  --text: #18181b;
  --text-2: #55555e;
  --text-3: #9a9aa3;
  --accent: #18181b;
  --accent-soft: #f0f0f2;
  --ring: rgba(24, 24, 27, 0.08);
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.04);
  --shadow-md: 0 6px 20px rgba(24, 24, 27, 0.07);
  --shadow-lg: 0 16px 48px rgba(24, 24, 27, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, "Courier New", monospace;
  --header-h: 60px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: #dbeafe; }

a { color: inherit; }

button {
  font-family: inherit;
  cursor: pointer;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ============ Icons ============ */
.icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
  vertical-align: -3px;
}
.icon-lg { width: 20px; height: 20px; }

/* ============ Header ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 650;
  font-size: 15.5px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  flex: none;
}
.brand-mark svg { width: 13px; height: 13px; stroke: #fff; }

.brand-count {
  font-weight: 500;
  color: var(--text-3);
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 9px;
  background: var(--surface);
}

.header-spacer { flex: 1; }

.search-box {
  position: relative;
  width: 280px;
  max-width: 38vw;
}
.search-box .icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.search-box input {
  width: 100%;
  height: 36px;
  padding: 0 34px 0 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box input::placeholder { color: var(--text-3); }
.search-box input:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px var(--ring);
}
.search-box kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0 5px;
  background: var(--surface-2);
  pointer-events: none;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, box-shadow 0.15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #2e2e33; border-color: #2e2e33; }

.btn-sm { height: 31px; padding: 0 11px; font-size: 12.5px; }
.btn-lg { height: 40px; padding: 0 18px; font-size: 14px; }

/* ============ Gallery ============ */
.gallery-hero {
  padding: 44px 0 8px;
}
.gallery-hero h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.gallery-hero p {
  margin: 0;
  color: var(--text-2);
  font-size: 14.5px;
  max-width: 640px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 26px 0 6px;
}

.chip {
  height: 30px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 550;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.chip .chip-n {
  font-size: 10.5px;
  opacity: 0.55;
  font-weight: 600;
}

.toolbar-meta {
  margin-left: auto;
  color: var(--text-3);
  font-size: 12.5px;
}

/* ============ Cards grid ============ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 22px;
  padding: 18px 0 40px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
  box-shadow: var(--shadow-sm);
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.card-preview {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.card-preview-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 1200px;
  height: 900px;
  border: 0;
  transform-origin: 0 0;
  background: #fff;
  pointer-events: none;
}
.card-preview-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-3);
  background:
    radial-gradient(circle at 20% 10%, rgba(24,24,27,0.025) 0, transparent 45%),
    radial-gradient(circle at 85% 90%, rgba(24,24,27,0.03) 0, transparent 40%);
}
.card-preview-placeholder .ph-big {
  font-size: 40px;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: var(--text);
  opacity: 0.16;
}
.card-preview-placeholder .ph-domain {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-preview-type {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  backdrop-filter: blur(4px);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
}
.card-preview-type .icon { width: 12px; height: 12px; }

.card-preview .loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 11px;
  z-index: 1;
}
.loading-big { text-align: center; color: var(--text-3); font-size: 13.5px; padding: 70px 0; }

.brand-count, .toolbar-meta, .chip-n, .tab-n, .fi-size { font-variant-numeric: tabular-nums; }
.pn-mid { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.userchip svg { width: 14px; height: 14px; opacity: 0.7; }

.card { position: relative; }
.fav-star {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-sm);
  color: #c6c6cd;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s, color 0.15s;
}
.fav-star:hover { transform: scale(1.15); color: #f5a623; }
.fav-star.on { color: #f5a623; }

#authArea { display: flex; align-items: center; gap: 8px; }
.userchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 31px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  max-width: 210px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.pn-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--border);
  margin-top: 30px;
  padding-top: 16px;
}
.pn {
  text-decoration: none;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 13px;
  border-radius: 9px;
  max-width: 38%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.pn:hover { background: var(--accent-soft); color: var(--text); }
.pn:last-child { text-align: right; }
.pn-mid { color: var(--text-3); font-size: 12px; flex: none; }

.sortsel {
  margin-left: auto;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  padding: 0 10px;
  outline: none;
  cursor: pointer;
}
.sortsel:focus { border-color: var(--border-strong); }

.rel-head {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 34px 0 12px;
}
.rel-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.rel-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.rel-card b { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.rel-card span { font-size: 11px; color: var(--text-3); }
.rel-card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
@media (max-width: 700px) { .rel-cards { grid-template-columns: 1fr; } }

.card-body {
  padding: 14px 16px 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title .icon { color: var(--text-3); width: 14px; height: 14px; }
.card-desc {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}
.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 2px;
}
.mini-tag {
  font-size: 11px;
  font-weight: 550;
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: 6px;
  padding: 2px 8px;
}
.card-meta {
  color: var(--text-3);
  font-size: 11.5px;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 90px 20px;
  color: var(--text-3);
}
.empty .icon { width: 34px; height: 34px; margin-bottom: 12px; }
.empty h3 { margin: 0 0 6px; color: var(--text-2); font-size: 16px; }
.empty p { margin: 0; font-size: 13.5px; }

/* ============ Detail page ============ */
.detail {
  padding: 28px 0 60px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 550;
  padding: 5px 10px 5px 6px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.back-link:hover { background: var(--accent-soft); color: var(--text); }

.detail-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin: 18px 0 4px;
}
.detail-head-text { flex: 1; min-width: 260px; }
.detail-title {
  margin: 0 0 8px;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.detail-sub {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
  max-width: 720px;
}
.detail-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-top: 22px;
}
.tab {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 570;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab .tab-n {
  font-size: 10.5px;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 0 7px;
  color: var(--text-3);
  font-weight: 650;
}

.panel { padding-top: 20px; }

/* Preview panel */
.preview-stage {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.preview-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.preview-toolbar .pt-label {
  font-size: 12px;
  color: var(--text-3);
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
}
.seg {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.seg button {
  appearance: none;
  border: none;
  background: transparent;
  height: 26px;
  padding: 0 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 550;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.seg button:hover { color: var(--text); }
.seg button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.preview-frame-wrap {
  height: calc(100vh - 300px);
  min-height: 480px;
  display: flex;
  justify-content: center;
  overflow: auto;
  background: #e9e9ec;
  padding: 0;
}
.preview-frame {
  border: 0;
  background: #fff;
  width: 100%;
  height: 100%;
  transition: width 0.25s ease;
  box-shadow: 0 0 0 1px var(--border);
}
.preview-frame.w-tablet { width: 768px; }
.preview-frame.w-phone { width: 390px; }

/* Code panel */
.code-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.file-list {
  width: 230px;
  flex: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.file-list-title {
  padding: 10px 14px 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
}
.file-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  appearance: none;
  background: none;
  border: none;
  padding: 8px 14px;
  font-size: 12.5px;
  font-family: var(--mono);
  color: var(--text-2);
  border-left: 2px solid transparent;
  transition: background 0.12s, color 0.12s;
}
.file-item:hover { background: var(--surface-2); color: var(--text); }
.file-item.active {
  background: var(--accent-soft);
  color: var(--text);
  border-left-color: var(--accent);
  font-weight: 600;
}
.file-item .fi-size {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-3);
  font-family: var(--font);
}

.code-pane {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.code-pane-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.code-pane-head .cp-file {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.code-pane-head .cp-actions { margin-left: auto; display: flex; gap: 6px; }

.code-scroll {
  max-height: calc(100vh - 320px);
  min-height: 420px;
  overflow: auto;
}
.code-scroll pre {
  margin: 0;
  padding: 16px 18px;
  font-family: var(--mono);
  font-size: 12.8px;
  line-height: 1.65;
  tab-size: 2;
}
.code-scroll code {
  font-family: inherit;
  background: none;
  padding: 0;
}
/* highlight.js overrides for a softer look */
.hljs { background: transparent !important; padding: 0 !important; }

/* Docs panel */
.docs-pane {
  max-width: 780px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 44px 44px;
}
.docs-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 16px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--border);
}
.docs-head .dh-file {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.docs-head .cp-actions { margin-left: auto; display: flex; gap: 6px; }

/* Markdown rendering */
.md { font-size: 14.5px; line-height: 1.75; color: var(--text); }
.md > :first-child { margin-top: 0; }
.md h1, .md h2, .md h3, .md h4 {
  letter-spacing: -0.015em;
  line-height: 1.3;
  margin: 1.6em 0 0.6em;
  font-weight: 680;
}
.md h1 { font-size: 24px; margin-top: 0; }
.md h2 { font-size: 19px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.md h3 { font-size: 16px; }
.md h4 { font-size: 14.5px; }
.md p { margin: 0.7em 0; }
.md a { color: #2563eb; text-decoration: none; }
.md a:hover { text-decoration: underline; }
.md ul, .md ol { padding-left: 1.4em; margin: 0.7em 0; }
.md li { margin: 0.25em 0; }
.md blockquote {
  margin: 1em 0;
  padding: 2px 16px;
  border-left: 3px solid var(--border-strong);
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: 0 8px 8px 0;
}
.md code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
}
.md pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  overflow: auto;
  line-height: 1.6;
}
.md pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 12.5px;
}
.md table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 13.5px; }
.md th, .md td { border: 1px solid var(--border); padding: 7px 12px; text-align: left; }
.md th { background: var(--surface-2); font-weight: 620; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }
.md img { max-width: 100%; border-radius: var(--radius-sm); }

/* Link detail cover */
.link-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 44px 36px;
  text-align: center;
}
.link-hero .lh-domain {
  font-family: var(--mono);
  font-size: 17px;
  color: var(--text-2);
  margin-bottom: 18px;
  word-break: break-all;
}
.link-hero .lh-domain .icon { width: 18px; height: 18px; margin-right: 8px; }
.link-hero h2 {
  margin: 0 0 10px;
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -0.025em;
}
.link-hero p {
  margin: 0 auto 24px;
  color: var(--text-2);
  max-width: 560px;
  font-size: 14.5px;
}

/* ============ Modal ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(24, 24, 27, 0.32);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 7vh 20px 40px;
  overflow-y: auto;
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 680px;
  animation: popIn 0.18s ease;
}
.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 16.5px; font-weight: 680; letter-spacing: -0.01em; }
.modal-close {
  margin-left: auto;
  appearance: none;
  border: none;
  background: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-3);
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 22px; }
.modal-body h4 { margin: 20px 0 6px; font-size: 13.5px; }
.modal-body h4:first-child { margin-top: 0; }
.modal-body p { margin: 0 0 10px; color: var(--text-2); font-size: 13.5px; }
.modal-body ol, .modal-body ul { color: var(--text-2); font-size: 13.5px; padding-left: 1.4em; margin: 0 0 10px; }
.modal-body li { margin: 4px 0; }
.modal-body code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
}
.modal-body pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  font-size: 12px;
  font-family: var(--mono);
  overflow: auto;
  line-height: 1.6;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(0.985); } to { opacity: 1; transform: none; } }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 550;
  padding: 9px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ Footer ============ */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 22px 0;
  margin-top: 20px;
}
.footer-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--text-3);
  font-size: 12.5px;
}
.footer-inner .fi-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }
.footer-inner a { color: var(--text-2); text-decoration: none; font-weight: 550; }
.footer-inner a:hover { color: var(--text); text-decoration: underline; }

/* ============ Add/Edit design form ============ */
.modal-wide { max-width: 920px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; }
.form-col { display: grid; gap: 13px; align-content: start; }
.field-row label {
  display: flex; align-items: baseline; gap: 7px;
  font-size: 12px; font-weight: 650; color: var(--text-2); margin-bottom: 5px;
}
.field-row .ft-hint { font-weight: 500; color: var(--text-3); font-size: 11px; }
.field-row input[type="text"], .field-row input[type="url"],
.form-body textarea {
  width: 100%;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 11px; font: inherit; font-size: 13.5px; color: var(--text);
  background: var(--surface); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-body textarea {
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
  resize: vertical; min-height: 60px;
}
.field-row input:focus, .form-body textarea:focus {
  border-color: var(--border-strong); box-shadow: 0 0 0 3px var(--ring);
}
.pv-box {
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: var(--surface-2); display: flex; flex-direction: column;
  position: sticky; top: 0;
}
.pv-label {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 11px; font-size: 11px; font-weight: 650; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-3);
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.pv-stage { position: relative; height: 420px; background: var(--surface-2); }
.pv-stage .pv-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.pv-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 0 20px; text-align: center; color: var(--text-3); font-size: 12.5px; line-height: 1.55;
}
.pv-empty b { color: var(--text-2); }
.form-actions { display: flex; align-items: center; gap: 9px; margin-top: 20px; flex-wrap: wrap; }
.form-note { color: var(--text-3); font-size: 12px; margin-left: auto; text-align: right; }
.form-note b { color: var(--text-2); font-weight: 600; }
.drop-hint {
  position: fixed; inset: 14px; z-index: 300;
  border: 2px dashed var(--border-strong); border-radius: 16px;
  background: rgba(255, 255, 255, 0.93); backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center; gap: 10px;
  font-size: 16px; font-weight: 650; color: var(--text-2); pointer-events: none;
}
.drop-hint.show { display: flex; }

/* ============ Responsive ============ */
@media (max-width: 760px) {
  .search-box { width: 170px; }
  .search-box kbd { display: none; }
  .brand-count { display: none; }
  .gallery-hero { padding-top: 30px; }
  .code-layout { flex-direction: column; }
  .file-list { width: 100%; display: flex; flex-wrap: wrap; }
  .file-list-title { width: 100%; }
  .file-item { width: auto; border-left: none; border-radius: 7px; }
  .file-item.active { border-left: none; }
  .docs-pane { padding: 26px 22px 30px; }
  .preview-frame-wrap { height: 68vh; }
  .form-grid { grid-template-columns: 1fr; }
  .pv-stage { height: 260px; }
}
