:root {
  --bar-h: 56px;
  --side-w: 56px;
  --border: #e5e7eb;
  --text: #374151;
  --muted: #6b7280;
  --bg: #ffffff;
  --bg-2: #f9fafb;

     --black: #1b2b34;
  --blue: #0078d4;

  /* derivations */
  --hoops-background: #fafafa; /* dom background */
  --hoops-foreground: #303030; /* panel foreground */

  --hoops-neutral-foreground: var(--hoops-foreground); /* text color */
  --hoops-neutral-foreground-20: color-mix(
    in srgb,
    var(--hoops-neutral-foreground),
    #000000 20%
  ); /* separator color */
  --hoops-neutral-foreground-hover: color-mix(
    in srgb,
    var(--hoops-neutral-background),
    #000000 90%
  );

  --hoops-neutral-background: var(--hoops-background); /* buton, context-menu background */
  --hoops-neutral-background-20: #fafafa;
  --hoops-neutral-background-50: #f0f0f0;
  --hoops-neutral-background-hover: #dddddddd; /* button hovering */

  --hoops-accent-foreground: var(--blue);
  --hoops-accent-foreground-hover: var(--blue); /* model-tree selected */
  --hoops-accent-foreground-active: var(--blue); /* model-tree arrows */

  --hoops-dropdown-background-color: var(--hoops-neutral-background-50);

  --hoops-separator-color: var(--hoops-neutral-foreground-20);
  --hoops-svg-stroke-color: #303030;
  --hoops-svg-fill-color: #f0f0f0;
  --hoops-svg-accent-color: #1181d7;

  --hoops-accent-foreground-disabled: #888888; /* context-menu */

  --hoops-demo-layout-panel-background: #ffffff88;
  --hoops-demo-layout-panel-border: #e0e0e0;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

.treeprops-header {
  margin: 6px 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: #666;
  padding-left: 6px;
  border-bottom: 1px solid #ddd;
}

body {
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
    Helvetica, Arial;
  color: var(--text);
  background: var(--bg);
}

/* Layout regions */
.app {
  height: 100%;
  display: grid;
  grid-template-rows: var(--bar-h) 1fr;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  height: var(--bar-h);
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

hoops-web-viewer {
  width: 100%;
  height: 100%;
  display: block;
  /* Important in grids: allow shrinking so it doesn’t overflow */
  min-width: 0;
}

hoops-web-viewer-context-manager {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  height: 100%;
}

.panel {
  position: absolute;
  top: 76px;
  left: 68px;
  width: 380px;
  max-height: 70vh;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  overflow: auto;
  display: none;
  z-index: 5;
}

/* css for my right side panel */
.card {
  position: relative;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  /* margin-right: 8px; */
}

.row {
  margin: 12px 0;
}

#page {
  display: grid;
  grid-template-columns: 1fr 360px;
  height: 100%;
}

#side {
  padding: 16px;
  border-left: 1px solid #e5e7eb;
  overflow: auto;
}

button {
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  background: #111827;
  color: #fff;
}

button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

progress {
  width: 100%;
  height: 12px;
}

.muted {
  color: #6b7280;
  font-size: 12px;
}

.out {
  margin-top: 8px;
  padding: 8px;
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  word-break: break-all;
}

.demos {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.demo-item {
  display: flex;
  align-items: flex-start;
  text-decoration: none;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.2s;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.demo-item:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.demo-item img {
  width: 150px; /* scaled down from 750px for layout */
  height: auto;
  margin-right: 5px;
  object-fit: cover;
  flex-shrink: 0;
}

.demo-text {
  margin-top: 6px;
  flex: 1;
}

.demo-text h4 {
  margin-bottom: 0;
  font-size: 1.1rem;
  color: #333;
}

.demo-text p {
  margin-bottom: 50;
  margin-top: 5;
  font-size: 0.9rem;
  color: #666;
}

/* Center the switcher in the topbar's middle column */
.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  height: var(--bar-h);
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

/* Keep the switcher centered */
.model-switcher {
  display: flex;
  justify-self: center; /* centers within the middle grid column */
  position: relative;
}

.model-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-2);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}

.model-btn:focus {
  outline: 2px solid #cde4ff;
  outline-offset: 2px;
}

.model-btn .chevron {
  transition: transform 0.15s ease;
}

.model-btn[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

/* Dropdown menu */
.model-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 280px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.1);
  padding: 8px;
  z-index: 20; /* above panels */
}

/* Each item: image left, title right */
.model-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
}

.model-item:hover {
  background: var(--bg-2);
}

.model-item img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.model-item .title {
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 600;
}

.model-item .subtitle {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Small screens: keep it tidy */
@media (max-width: 580px) {
  .model-menu { min-width: 220px; }
  .model-item { grid-template-columns: 48px 1fr; }
  .model-item img { width: 48px; height: 48px; }
}