.gn-palette {
  position: relative;
  flex: 0 0 auto;
  z-index: 1010;
  --palette-paper: var(--creation-card, #fff);
  --palette-ink: var(--creation-ink, #182238);
  --palette-muted: var(--creation-muted, #68758b);
  --palette-line: var(--creation-line, #d9dfeb);
  --palette-accent: var(--creation-focus, #ad8b45);
}
html[data-theme="dark"] .gn-palette {
  --palette-paper: var(--creation-card, #202a3e);
  --palette-ink: var(--creation-ink, #f3f5fa);
  --palette-muted: var(--creation-muted, #bdc6d6);
  --palette-line: var(--creation-line, #4c596f);
  --palette-accent: var(--creation-focus, #e3c478);
}
.gn-palette .product-palette { position: relative; }
.gn-palette .product-palette > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--palette-line);
  border-radius: 8px;
  background: var(--palette-paper);
  color: var(--palette-ink);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
}
.gn-palette .product-palette > summary::-webkit-details-marker { display: none; }
.gn-palette .product-palette > summary:hover,
.gn-palette .product-palette[open] > summary { border-color: var(--palette-accent); }
.gn-palette .product-palette-panel {
  box-sizing: border-box;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(340px, calc(100vw - 20px));
  max-height: min(720px, calc(100dvh - 84px));
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--palette-line);
  border-radius: 14px;
  background: var(--palette-paper);
  color: var(--palette-ink);
  box-shadow: 0 18px 48px rgba(11, 20, 40, .22);
  font: 13px/1.4 system-ui, sans-serif;
  z-index: 1;
}
.gn-palette .product-palette-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.gn-palette .product-palette-header h2 { margin: 0; color: var(--palette-ink); font-size: 16px; }
.gn-palette .product-palette-header p,
.gn-palette .product-palette-status { margin: 4px 0 0; color: var(--palette-muted); font-size: 12px; }
.gn-palette .product-palette-panel button {
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid var(--palette-line);
  border-radius: 7px;
  background: var(--palette-paper);
  color: var(--palette-ink);
  cursor: pointer;
}
.gn-palette .product-palette-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 12px 0; }
.gn-palette .product-palette-presets button { display: flex; align-items: center; justify-content: center; gap: 5px; }
.gn-palette .product-palette-presets button[aria-pressed="true"] { border-color: var(--palette-accent); }
.gn-palette .product-palette-presets button span { width: 15px; height: 15px; border: 1px solid var(--palette-line); border-radius: 50%; background: linear-gradient(135deg, var(--palette-chip-light) 50%, var(--palette-chip-dark) 50%); }
.product-palette .product-palette-presets.product-palette-modes {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-block-end: 8px;
}
.product-palette .product-palette-modes + .product-palette-presets { margin-block-start: 0; }
.product-palette .product-palette-modes button { min-height: 36px; font-weight: 650; }
.product-palette .product-palette-modes button:hover { border-color: var(--creation-focus); }
.product-palette .product-palette-modes button[aria-pressed="true"] { background: var(--creation-accent-tint); }
.product-palette .product-palette-modes button:focus-visible { outline: 2px solid var(--creation-focus); outline-offset: 2px; }
html[data-creation-palette] .product-home .product-palette-panel { background: var(--creation-card); }
.gn-palette .product-palette-fields { border-block: 1px solid var(--palette-line); }
.gn-palette .product-palette-row { display: grid; grid-template-columns: 1fr 35px 80px; align-items: center; gap: 8px; min-height: 36px; }
.gn-palette .product-palette-row + .product-palette-row { border-top: 1px solid var(--palette-line); }
.gn-palette .product-palette-row input { box-sizing: border-box; min-width: 0; width: 100%; height: 27px; border: 1px solid var(--palette-line); border-radius: 5px; background: var(--palette-paper); color: var(--palette-ink); }
.gn-palette .product-palette-row input[type="text"] { padding: 0 5px; }
.gn-palette .product-palette-row input[type="color"] { cursor: pointer; padding: 2px; }
.gn-palette .product-palette-status { margin-top: 10px; }
.gn-palette summary:focus-visible,
.gn-palette input:focus-visible,
.gn-palette button:focus-visible { outline: 2px solid var(--palette-accent); outline-offset: 2px; }
@media (max-width: 768px) {
  .gn-palette .product-palette > summary { min-height: 34px; padding-inline: 7px; font-size: 12px; }
  .gn-palette .product-palette-panel { position: fixed; top: 60px; right: 8px; }
  html[data-creation-studio]:has(.creation-top-palette .product-palette[open]) #project-director-handle { z-index: 24; }
  /* Keep the palette beside the account while the project picker and the
     full-screen action occupy the following row on small editor screens. */
  html[data-creation-studio] .v2-shell > .topbar > .creation-top-palette { margin-left: auto; }
  html[data-creation-studio] .v2-shell > .topbar > .workspace-account-host { margin-left: 0; }
}
@media (max-width: 360px) {
  /* The summary's text remains the accessible name; its icon saves enough
     space for the avatar, balance and recharge to stay on the same row. */
  html[data-creation-studio] .creation-top-palette .product-palette > summary {
    box-sizing: border-box;
    width: 34px;
    padding: 0;
    font-size: 0;
  }
  html[data-creation-studio] .v2-shell > .topbar .workspace-account-host .wallet-balance {
    max-width: 48px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
