/**
 * Front-end + editor: borders for embed roots (tutorial-embed.js adds inner structure).
 */
.rgc-basic-tutorial-block-root {
  margin: 1.25em 0;
}

.rgc-basic-tutorial-block-editor .rgc-tutorial-embed {
  margin-top: 1em;
}

/* GFX canvas embed (gfx-embed-mount.js) */
.rgc-basic-gfx-block-root {
  margin: 1.25em 0;
}

.rgc-basic-gfx-embed {
  position: relative;
  max-width: 100%;
}

.rgc-basic-gfx-poster {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  background: #1a1a1a;
  border-radius: 8px;
  overflow: hidden;
}

.rgc-basic-gfx-poster-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 480px;
  object-fit: contain;
}

.rgc-basic-gfx-run-poster {
  position: absolute;
  left: 50%;
  top: 50%;
  /*
   * Use the `translate` property (not inside `transform`) for centering so
   * that a theme's `button:hover { transform: translateY(-1px) }` etc. can't
   * clobber our centering and shift the button off-centre. Modern browsers
   * compose `translate` + `transform` together instead of overriding.
   */
  translate: -50% -50%;
  transform: none;
  padding: 0.65em 1.75em;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: 999px;
  background: #2d7d46;
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.rgc-basic-gfx-run-poster:hover,
.rgc-basic-gfx-run-poster:focus,
.rgc-basic-gfx-run-poster:active {
  background: #256a3a;
  /* Neutralise any theme hover/active transform that would shift the button. */
  transform: none;
  translate: -50% -50%;
}

.rgc-basic-gfx-app {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rgc-basic-gfx-program {
  width: 100%;
  min-height: 120px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  box-sizing: border-box;
}

/* --- Shared syntax-highlighted editor (twin-overlay technique).
 *     Emitted by assets/js/basic-highlight.js for both tutorial and gfx
 *     embeds. --- */
.rgc-basic-editor {
  position: relative;
  width: 100%;
  min-height: 120px;
}

/* Shared typography so the textarea caret lines up with the highlight. */
.rgc-basic-editor .rgc-basic-editor-highlight,
.rgc-basic-editor .rgc-basic-editor-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
  letter-spacing: 0;
  tab-size: 2;
  -moz-tab-size: 2;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  padding: 8px 10px;
  margin: 0;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  box-sizing: border-box;
}

.rgc-basic-editor .rgc-basic-editor-highlight {
  position: absolute;
  inset: 0;
  overflow: auto;
  pointer-events: none;
  background: #f7f8fa;
  color: #24292f;
  z-index: 0;
}
.rgc-basic-editor .rgc-basic-editor-highlight code {
  display: block;
  white-space: pre-wrap;
  font: inherit;
  color: inherit;
  background: transparent;
  padding: 0;
}

.rgc-basic-editor .rgc-basic-editor-input {
  position: relative;
  width: 100%;
  min-height: 120px;
  background: transparent;
  color: transparent;
  caret-color: #24292f;
  resize: vertical;
  z-index: 1;
  overflow: auto;
}
.rgc-basic-editor .rgc-basic-editor-input::selection {
  background: rgba(56, 139, 253, 0.28);
  color: transparent;
}

/* Tokens — light theme tuned to sit nicely on a white WP page. */
.rgc-basic-editor-highlight .tok-keyword   { color: #cf222e; font-weight: 600; }
.rgc-basic-editor-highlight .tok-function  { color: #8250df; }
.rgc-basic-editor-highlight .tok-operator  { color: #cf222e; }
.rgc-basic-editor-highlight .tok-string    { color: #0a3069; }
.rgc-basic-editor-highlight .tok-escape    { color: #116329; font-weight: 600; }
.rgc-basic-editor-highlight .tok-number    { color: #0550ae; }
.rgc-basic-editor-highlight .tok-comment   { color: #6e7781; font-style: italic; }
.rgc-basic-editor-highlight .tok-directive { color: #953800; font-weight: 600; }
.rgc-basic-editor-highlight .tok-lineno    { color: #6e7781; }
.rgc-basic-editor-highlight .tok-punct     { color: #24292f; }
.rgc-basic-editor-highlight .tok-ident     { color: #24292f; }

/* Dark-mode theme — respects prefers-color-scheme. */
@media (prefers-color-scheme: dark) {
  .rgc-basic-editor .rgc-basic-editor-highlight {
    background: #0d1117;
    color: #c9d1d9;
    border-color: #30363d;
  }
  .rgc-basic-editor .rgc-basic-editor-input {
    caret-color: #c9d1d9;
    border-color: #30363d;
  }
  .rgc-basic-editor-highlight .tok-keyword   { color: #ff7b72; }
  .rgc-basic-editor-highlight .tok-function  { color: #d2a8ff; }
  .rgc-basic-editor-highlight .tok-operator  { color: #ff7b72; }
  .rgc-basic-editor-highlight .tok-string    { color: #a5d6ff; }
  .rgc-basic-editor-highlight .tok-escape    { color: #7ee787; }
  .rgc-basic-editor-highlight .tok-number    { color: #79c0ff; }
  .rgc-basic-editor-highlight .tok-comment   { color: #8b949e; }
  .rgc-basic-editor-highlight .tok-directive { color: #ffa657; }
  .rgc-basic-editor-highlight .tok-lineno    { color: #8b949e; }
  .rgc-basic-editor-highlight .tok-punct     { color: #c9d1d9; }
  .rgc-basic-editor-highlight .tok-ident     { color: #c9d1d9; }
}

.rgc-basic-gfx-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.rgc-basic-gfx-toolbar--minimal {
  gap: 0.25rem;
}

.rgc-basic-gfx-toolbar button {
  cursor: pointer;
}

.rgc-basic-gfx-zoom {
  margin-left: 0.25rem;
}

.rgc-basic-gfx-canvas-wrap {
  display: inline-block;
  line-height: 0;
  border: 1px solid #444;
  border-radius: 4px;
  background: #000;
}

.rgc-basic-gfx-screen {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.rgc-basic-gfx-input-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: ui-monospace, monospace;
}

.rgc-basic-gfx-input-line {
  flex: 1;
  min-width: 0;
}

.rgc-basic-gfx-log {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  color: #c00;
  max-height: 120px;
  overflow: auto;
}

.rgc-basic-gfx-vfs {
  font-size: 13px;
}

.rgc-basic-gfx-block-editor .rgc-basic-gfx-mount {
  margin-top: 1em;
}
