:root {
  color-scheme: light;
  font-family: "Space Grotesk", sans-serif;
  --ink: #121417;
  --paper: #f4f6f1;
  --signal: #e8ff47;
  --line: rgba(18, 20, 23, 0.16);
  --shadow: 0 18px 48px rgba(18, 20, 23, 0.16);
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
}

button,
input { font: inherit; }

button { letter-spacing: 0; }

[hidden] { display: none !important; }

.scene-shell {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: #f4f6f1;
  background-image: linear-gradient(rgba(18, 20, 23, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(18, 20, 23, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
}

.scene-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.top-bar {
  position: absolute;
  top: 20px;
  right: 22px;
  left: 22px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.brand,
.get-sdk-button { pointer-events: auto; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  background: var(--ink);
  color: white;
  font: 600 12px/1 "IBM Plex Mono", monospace;
}

.get-sdk-button,
.primary-button {
  min-height: 44px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.get-sdk-button { padding: 0 18px; }

.get-sdk-button:hover,
.primary-button:hover { background: #34383d; }

.avatar-control {
  position: absolute;
  top: 76px;
  left: 22px;
  z-index: 20;
  width: min(300px, calc(100vw - 44px));
}

.avatar-menu-button {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 76px;
  padding: 9px 12px 9px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  backdrop-filter: blur(14px);
}

.avatar-menu-button img {
  width: 56px;
  height: 56px;
  border-radius: 4px;
  background: #dde2d7;
  object-fit: cover;
}

.avatar-menu-copy { display: grid; gap: 3px; min-width: 0; }
.avatar-menu-copy strong,
.avatar-menu-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-menu-copy strong { font-size: 14px; }
.avatar-menu-copy span { color: #676d70; font-size: 12px; }
.chevron { font-size: 22px; transform: translateY(-2px); }

.avatar-menu {
  display: grid;
  gap: 1px;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
  box-shadow: var(--shadow);
}

.avatar-menu button {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 10px 14px;
  border: 0;
  background: white;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.avatar-menu button:hover { background: var(--signal); }
.avatar-menu button span:last-child { display: grid; gap: 2px; }
.avatar-menu small { color: #6c7173; font-size: 11px; }
.menu-icon { font: 600 24px/1 "IBM Plex Mono", monospace; text-align: center; }

.notice {
  position: absolute;
  bottom: 24px;
  left: 50%;
  z-index: 40;
  max-width: calc(100vw - 32px);
  margin: 0;
  padding: 11px 15px;
  border-radius: 4px;
  background: var(--ink);
  color: white;
  font-size: 13px;
  transform: translateX(-50%);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(18, 20, 23, 0.36);
  backdrop-filter: blur(10px);
}

.creator-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr);
  background: #111317;
}

.creator-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 8px 18px;
  background: #111317;
  color: white;
  font: 500 12px/1 "IBM Plex Mono", monospace;
}

.creator-toolbar .icon-button {
  border-color: rgba(255, 255, 255, 0.22);
  background: transparent;
  color: white;
}

.creator-modal iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #111317;
}

.modal-panel {
  position: relative;
  width: min(480px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 30px 90px rgba(18, 20, 23, 0.28);
}

.modal-panel h1 { margin: 7px 0 10px; font-size: 27px; line-height: 1.08; }
.eyebrow { margin: 0; color: #646a6e; font: 600 11px/1.3 "IBM Plex Mono", monospace; text-transform: uppercase; }
.modal-copy { margin: 0 0 24px; color: #646a6e; font-size: 14px; line-height: 1.55; }
.modal-panel form { display: grid; gap: 10px; }
.modal-panel label { font-size: 12px; font-weight: 700; }
.modal-panel input {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8f9f6;
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}
.modal-panel input:focus { border-color: var(--ink); outline: 2px solid var(--signal); }
.primary-button { width: 100%; margin-top: 8px; padding: 0 18px; }
.primary-button:disabled { cursor: wait; opacity: 0.58; }
.form-error { margin: 0; color: #b4232f; font-size: 12px; }

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font: 600 20px/1 "IBM Plex Mono", monospace;
}

#sdk-close-icon { position: absolute; top: 14px; right: 14px; }
.key-output { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; }
.key-output code {
  min-width: 0;
  padding: 13px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f2f4ee;
  font: 500 12px/1.5 "IBM Plex Mono", monospace;
  white-space: nowrap;
}
.key-copy { width: 44px; height: 44px; }
.key-meta { display: grid; gap: 8px; margin: 18px 0; }
.key-meta div { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; }
.key-meta dt { color: #73787b; font-size: 12px; }
.key-meta dd { margin: 0; overflow-wrap: anywhere; font: 500 12px/1.4 "IBM Plex Mono", monospace; }

@media (max-width: 640px) {
  .top-bar { top: 14px; right: 14px; left: 14px; }
  .brand > span:last-child { display: none; }
  .avatar-control { top: 66px; left: 14px; width: min(280px, calc(100vw - 28px)); }
  .avatar-menu-button { grid-template-columns: 48px minmax(0, 1fr) 18px; min-height: 66px; }
  .avatar-menu-button img { width: 48px; height: 48px; }
  .modal { padding: 12px; }
  .modal-panel { padding: 28px 20px 22px; }
  .modal-panel h1 { font-size: 23px; }
}