/* Shared look for the CSS layout demos (Flexbox, Grid, Responsive Design, Container Queries,
   and Logical Properties): a quiet stage, segmented buttons, readout chips, and a code panel. */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 12px;
  background-color: transparent;
  color: var(--exerciseText, #1e2933);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#stage {
  display: grid;
  gap: 14px;
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  border-radius: var(--demoRadius, 14px);
  background-color: #f5f8fb;
  color: #1e2933;
}

.area {
  min-width: 0;
  padding: 6px;
  border: 2px dashed #a9b3bd;
  border-radius: var(--demoRadiusSmall, 10px);
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px 14px;
}

.control {
  display: grid;
  gap: 6px;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
}

.control input[type="range"] {
  width: 100%;
  accent-color: #0798ff;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

button {
  flex: 1;
  padding: 7px 10px;
  border: 2px solid #1e2933;
  border-radius: var(--demoRadiusControl, 8px);
  background-color: #ffffff;
  color: #1e2933;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

button:hover {
  background-color: #eaf7ff;
}

button[aria-pressed="true"] {
  background-color: #0798ff;
  color: #ffffff;
}

select {
  width: 100%;
  padding: 6px 8px;
  border: 2px solid #1e2933;
  border-radius: var(--demoRadiusControl, 8px);
  background-color: #ffffff;
  color: #1e2933;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #0798ff;
  outline-offset: 2px;
}

.readout {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.readout .chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 7%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 18%, transparent);
}

.readout .chip > span {
  color: #5b6773;
}

.readout .chip b {
  font-weight: 800;
}

.readout .chip.off {
  opacity: 0.45;
}

pre {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--demoRadiusSmall, 10px);
  background-color: #1e2933;
  color: #eaf7ff;
  font: 600 14px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  white-space: pre;
  overflow-x: auto;
}

pre .changed {
  color: #ffe561;
}

.tile {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 8px 12px;
  border: 2px solid #3d9be0;
  border-radius: 6px;
  background-color: #7cc4ff;
  font-size: 18px;
  font-weight: 800;
}

.tile:nth-child(4n + 2) {
  border-color: #c9a43c;
  background-color: #efcb68;
}

.tile:nth-child(4n + 3) {
  border-color: #5fae55;
  background-color: #a6dba0;
}

.tile:nth-child(4n + 4) {
  border-color: #d0699a;
  background-color: #f5a3c7;
}

@media (max-width: 560px) {
  #stage {
    padding: 12px;
  }

  pre {
    padding: 10px 12px;
    font-size: 12px;
  }
}
