/* Shader Lab playground.
 *
 * One stylesheet for every playground on the wiki. It used to be copied into a
 * sidecar beside each page, which is how five copies of the same rules ended up
 * drifting apart - the Run button had colours on one page and none on the others.
 */

.playground_container {
  display: flex;
  min-height: 400px;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
}

.playground_left {
  width: 50%;
  padding: 10px;
  background: #111;
  color: #eee;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.playground_left h3 {
  margin: 0 0 8px;
  color: #eee;
  font-size: 1rem;
}

.playground_right {
  width: 50%;
  position: relative;
  background: #000;
}

#glCanvas,
.playground_right canvas {
  width: 100%;
  height: 100%;
  display: block;
}

#shaderCode,
.playground_left textarea {
  width: 100%;
  flex: 1;
  min-height: 260px;
  background: #000;
  color: #0f0;
  border: none;
  resize: none;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  padding: 8px;
  box-sizing: border-box;
}

/* The wiki theme sets `button { color: inherit }`, and the panel above sets
 * color:#eee, so without explicit colours the button renders near-white text on
 * the browser's default light-grey button and cannot be read. */
#shaderCompileButton,
.playground_left button {
  width: 100%;
  margin-top: 10px;
  background: #3f6fff;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 8px 12px;
  font-weight: 500;
  cursor: pointer;
}

#shaderCompileButton:hover,
.playground_left button:hover {
  background: #315bde;
}

/* Compile errors used to go to the console only, which is no help to a reader
 * editing the shader in the box next to it: the picture simply stopped changing. */
.playground_error {
  margin-top: 8px;
  padding: 8px;
  max-height: 8.5em;
  overflow: auto;
  background: #2a0d0d;
  border-left: 3px solid #ff6b6b;
  color: #ffc9c9;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 11px;
  white-space: pre-wrap;
}

.playground_error:empty {
  display: none;
}

@media (max-width: 760px) {
  .playground_container {
    flex-direction: column;
    min-height: 0;
  }

  .playground_left,
  .playground_right {
    width: 100%;
  }

  .playground_right {
    aspect-ratio: 16 / 10;
  }
}
