:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #17191c;
  --muted: #667085;
  --line: #d8dde6;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #d9f4ef;
  --shadow: 0 18px 45px rgba(22, 29, 37, 0.09);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(180, 83, 9, 0.08), transparent 30%),
    var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

body.modal-open {
  overflow: hidden;
}

.site-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 0.95;
  letter-spacing: 0;
}

.summary {
  min-width: 132px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  text-align: right;
}

.summary span {
  display: block;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.summary small {
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 22px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

.sidebar,
.content {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.sidebar {
  align-self: start;
  position: sticky;
  top: 18px;
  padding: 16px;
}

.search {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.group-nav,
#groupButtons {
  display: grid;
  gap: 8px;
}

.group-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.group-button:hover,
.group-button.is-active {
  border-color: rgba(15, 118, 110, 0.2);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.group-button strong {
  min-width: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: inherit;
  font-size: 12px;
  line-height: 22px;
  text-align: center;
}

.content {
  min-height: 420px;
  padding: 18px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.toolbar h2 {
  margin: 0;
  font-size: 20px;
}

.toolbar span {
  color: var(--muted);
  font-size: 13px;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.demo-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  width: 100%;
  min-height: 172px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: #fff;
  color: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.demo-card:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 14px 30px rgba(22, 29, 37, 0.11);
}

.demo-card h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.path {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.badge {
  justify-self: start;
  border-radius: 999px;
  padding: 5px 9px;
  background: #eef2f7;
  color: #475467;
  font-size: 12px;
  font-weight: 700;
}

.empty-state {
  margin: 64px 0;
  color: var(--muted);
  text-align: center;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.68);
}

.modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr) auto;
  width: min(1120px, 100%);
  height: min(780px, calc(100vh - 48px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 8px 0 6px;
  font-size: 20px;
  line-height: 1.25;
}

.modal-header .path {
  margin: 0;
}

.icon-button {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.icon-button:hover {
  border-color: rgba(15, 118, 110, 0.35);
  color: var(--accent-strong);
}

.preview-frame-wrap {
  min-height: 0;
  background: #101418;
}

.preview-frame-wrap iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.secondary-button:hover {
  border-color: rgba(15, 118, 110, 0.35);
  color: var(--accent-strong);
}

@media (max-width: 760px) {
  .site-header {
    align-items: stretch;
    flex-direction: column;
    padding-top: 28px;
  }

  .summary {
    text-align: left;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .modal {
    padding: 12px;
  }

  .modal-panel {
    height: calc(100vh - 24px);
  }

  .modal-header {
    padding: 14px;
  }

  .modal-actions {
    padding: 12px 14px;
  }
}
