.workshop-game {
  --workshop-line: #bed3c7;
  font-family: "Noto Sans", sans-serif;
}
.workshop-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.workshop-heading small {
  display: block;
  font-size: 9px;
  letter-spacing: 1.3px;
  color: var(--game-accent);
}
.workshop-heading strong {
  display: block;
  font-size: 19px;
}
.workshop-emblem {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: #f7e7bf;
  color: #7f652b;
}
.workshop-game svg {
  width: 38px;
  height: 38px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.workshop-game .learning-rounds {
  margin: 0 0 14px;
}
.workshop-game header h2 {
  font-size: clamp(19px, 2.1vw, 28px);
  line-height: 1.3;
}
.workshop-game header p {
  font-size: 12px;
  line-height: 1.6;
  margin: 10px 0 18px;
}
.workshop-game button {
  min-height: 44px;
  font-family: inherit;
  white-space: normal;
}
.workshop-hardware {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 18px;
}
.workshop-parts {
  display: grid;
  gap: 10px;
  align-content: start;
}
.workshop-game .workshop-token {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--workshop-line);
  border-radius: 14px;
  background: #fffdf5;
  color: #234a44;
  touch-action: none;
  user-select: none;
  cursor: grab;
  box-shadow: 0 3px 0 #bdcdbb;
}
.workshop-token[aria-pressed="true"] {
  outline: 3px solid #e3aa43;
  outline-offset: 1px;
}
.workshop-token strong,
.workshop-token small {
  overflow-wrap: anywhere;
}
.workshop-token small {
  font-size: 11px;
  line-height: 1.4;
}
.workshop-chip,
.workshop-app-icon {
  color: var(--chip, #137e82);
}
.workshop-chip svg {
  width: 44px;
  height: 44px;
}
.workshop-state {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #56786f;
}
.workshop-board {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 15px;
  border: 2px solid #6b927c;
  border-radius: 22px;
  background: repeating-linear-gradient(
    90deg,
    #244d43 0,
    #244d43 23px,
    #28594b 24px,
    #244d43 25px
  );
  box-shadow: inset 0 0 0 5px #d7d7a133;
}
.workshop-game .workshop-socket {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  padding: 15px 10px;
  border: 2px dashed #c1cfa5;
  border-radius: 12px;
  background: #e4eddb;
  color: #234a44;
}
.workshop-socket strong {
  font-size: 24px;
}
.workshop-socket small {
  font-weight: 700;
}
.workshop-socket > span:last-child {
  font-size: 10px;
}
.workshop-socket.is-filled {
  border-style: solid;
  background: #fff6d8;
}
.workshop-ram-summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  font-size: 12px;
}
.workshop-ram-summary strong {
  font-size: 20px;
  margin-left: 7px;
}
.workshop-ram {
  display: grid;
  grid-template-columns: repeat(var(--ram-cols, 4), minmax(0, 1fr));
  gap: 7px;
  padding: 13px;
  background: #21483e;
  border: 3px solid #90ac89;
  border-radius: 18px;
  min-height: 110px;
}
.workshop-ram-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  background: #416053;
  color: #dfead2;
  border-radius: 8px;
  padding: 14px 3px 5px;
  text-align: center;
  overflow-wrap: anywhere;
}
.workshop-ram-cell.is-used {
  background: var(--chip);
  color: white;
  box-shadow: inset 0 0 0 2px #ffffff30;
  animation: workshop-load 0.22s ease-out;
}
.workshop-ram-cell small {
  position: absolute;
  top: 4px;
  left: 5px;
  opacity: 0.7;
  font-size: 9px;
}
.workshop-ram-cell strong {
  font-size: 10px;
  line-height: 1.3;
}
.workshop-apps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 13px;
  padding: 4px;
}
.workshop-game .workshop-app {
  flex-direction: row;
  gap: 9px;
  text-align: left;
  justify-content: start;
}
.workshop-app > span:nth-child(2) {
  display: grid;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.workshop-app b {
  font-size: 10px;
}
.workshop-app.is-loaded {
  background: #e4efd5;
}
.workshop-app-icon svg {
  width: 28px;
  height: 28px;
}
.workshop-notice {
  border-left: 4px solid #ba7723;
  padding: 10px;
  background: #fff0cb;
  color: #634716;
  font-size: 12px;
}
.workshop-file-manager {
  display: grid;
  grid-template-columns: minmax(105px, 0.65fr) minmax(0, 2fr);
  border: 1px solid var(--workshop-line);
  border-radius: 16px;
  background: #fffdf5;
  overflow: hidden;
  color: #234a44;
}
.workshop-folders {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  background: #e7efdf;
  border-right: 1px solid var(--workshop-line);
}
.workshop-folders button {
  padding: 9px 8px;
  text-align: left;
  font-size: 11px;
  overflow-wrap: anywhere;
}
.workshop-folders [aria-current="location"] {
  background: #234a44;
  color: white;
}
.workshop-files-pane {
  padding: 12px;
  min-width: 0;
}
.workshop-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  margin-bottom: 10px;
}
.workshop-breadcrumbs button {
  padding: 4px;
  font-size: 10px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #315e52;
}
.workshop-files {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: 10px;
  min-height: 145px;
  padding: 6px;
  align-content: start;
}
.workshop-file-icon {
  font-size: 32px;
  color: #ad793b;
}
.workshop-copy {
  display: grid;
  gap: 5px;
  padding: 14px 9px;
  border: 2px dashed #719e71;
  border-radius: 12px;
  background: #e9f5dd;
  overflow-wrap: anywhere;
  font-size: 11px;
}
.workshop-copy span {
  font-size: 10px;
}
.workshop-copy-button {
  width: 100%;
  margin-top: 12px;
  font-size: 11px;
}
.workshop-empty {
  font-size: 12px;
  opacity: 0.7;
}
.workshop-game footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin-top: 20px;
}
.workshop-game footer button {
  font-size: 11px;
}
.workshop-game button:focus-visible {
  outline: 3px solid #e3aa43;
  outline-offset: 2px;
}
.workshop-game .puzzle-drop-target {
  outline: 4px solid #edb445;
  outline-offset: 2px;
}
.workshop-game .learning-feedback {
  margin: 15px 0 0;
}
.workshop-game button,
.workshop-game .workshop-socket {
  transition:
    background 0.15s,
    outline-color 0.15s;
}
@keyframes workshop-load {
  from {
    transform: scale(0.8);
    opacity: 0.5;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
@media (max-width: 600px) {
  .workshop-hardware {
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  }
  .workshop-game .workshop-token {
    padding: 10px 6px;
  }
  .workshop-board {
    padding: 9px;
    gap: 9px;
  }
  .workshop-game .workshop-socket {
    padding: 13px 5px;
    min-height: 116px;
  }
  .workshop-chip svg {
    width: 32px;
    height: 32px;
  }
  .workshop-token strong {
    font-size: 12px;
  }
  .workshop-token small {
    font-size: 10px;
  }
  .workshop-apps {
    grid-template-columns: 1fr;
  }
  .workshop-ram {
    gap: 4px;
    padding: 8px;
  }
  .workshop-ram-cell {
    min-height: 52px;
  }
  .workshop-file-manager {
    grid-template-columns: 1fr;
  }
  .workshop-folders {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: 0;
    border-bottom: 1px solid var(--workshop-line);
    gap: 5px;
  }
  .workshop-folders button {
    flex: 1 1 80px;
  }
  .workshop-files-pane {
    padding: 9px;
  }
  .workshop-game footer > div {
    width: 100%;
  }
  .workshop-game footer > div button {
    width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  .workshop-game * {
    animation: none !important;
    transition: none !important;
  }
}

/* Gameplay stays inside the allocated viewport. Extra authored cards use pages. */
#reader
  .game-session:is(
    [data-kind="hardwarelab"],
    [data-kind="ramlab"],
    [data-kind="filequest"]
  )
  .play-stage {
  overflow: hidden;
}
#reader
  .game-session:is(
    [data-kind="hardwarelab"],
    [data-kind="ramlab"],
    [data-kind="filequest"]
  )
  #puzzle-widget {
  height: 100%;
  min-height: 0;
  padding: 3px;
  overflow: hidden;
  box-sizing: border-box;
}
#reader
  .game-session:is(
    [data-kind="hardwarelab"],
    [data-kind="ramlab"],
    [data-kind="filequest"]
  )
  .solve-flow {
  height: 100%;
  min-height: 0;
  margin: 0;
}
#reader .game-session[data-kind] .workshop-game {
  position: relative;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 12px;
  margin: 0 auto;
}
#reader .workshop-modebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  flex: none;
  font-size: 10px;
}
#reader .workshop-modebar > div {
  display: flex;
  gap: 4px;
}
#reader .workshop-modebar button {
  min-height: 38px;
  padding: 5px 9px;
  font:
    600 11px "Noto Sans",
    sans-serif;
}
#reader .workshop-modebar [aria-pressed="true"] {
  background: #267b71;
  color: white;
}
#reader .workshop-game header {
  flex: none;
  position: relative;
}
#reader .game-session[data-kind] .workshop-game header h2 {
  margin: 0;
  font:
    600 clamp(13px, 1.5vw, 19px)/1.35 "Noto Sans",
    sans-serif;
}
#reader .workshop-help {
  font-size: 10px;
  margin-top: 4px;
}
#reader .workshop-help summary {
  cursor: pointer;
}
#reader .workshop-help[open] p {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 6;
  padding: 12px;
  background: #fffdf5;
  border: 1px solid #bbd0be;
  border-radius: 10px;
  box-shadow: 0 5px 15px #244d4322;
}
#reader .workshop-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
#reader .workshop-hardware {
  flex: 1;
  min-height: 0;
  gap: 10px;
}
#reader .workshop-parts,
#reader .workshop-board {
  min-height: 0;
  gap: 6px;
  align-content: stretch;
  grid-auto-rows: minmax(0, 1fr);
}
#reader .workshop-board {
  padding: 7px;
  border-radius: 14px;
}
#reader .workshop-game .workshop-token {
  min-height: 44px;
  padding: 6px;
  gap: 3px;
  justify-content: center;
}
#reader .workshop-game .workshop-token strong {
  font-size: 12px;
  line-height: 1.25;
}
#reader .workshop-game .workshop-chip svg {
  width: 22px;
  height: 22px;
}
#reader .workshop-state {
  display: none;
}
#reader .workshop-game .workshop-socket {
  min-height: 44px;
  padding: 6px;
  gap: 4px;
}
#reader .workshop-game .workshop-socket strong {
  font-size: 16px;
  line-height: 1.1;
}
#reader .workshop-game .workshop-socket > span:last-child {
  display: none;
}
#reader .workshop-game .workshop-socket small {
  font-size: 11px;
  line-height: 1.3;
}
#reader .workshop-game .workshop-token small {
  font-size: 10px;
  line-height: 1.3;
}
#reader .workshop-ram-summary {
  flex: none;
  padding: 0;
  font-size: 10px;
}
#reader .workshop-ram-summary strong {
  font-size: 15px;
}
#reader .workshop-ram {
  flex: 1;
  min-height: 0;
  padding: 7px;
  gap: 4px;
  grid-auto-rows: minmax(0, 1fr);
}
#reader .workshop-ram-cell {
  min-height: 18px;
  padding: 11px 2px 2px;
  border-radius: 5px;
}
#reader .workshop-ram-cell strong {
  font-size: 9px;
}
#reader .workshop-apps {
  flex: none;
  margin: 0;
  padding: 1px;
  gap: 5px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
#reader .workshop-game .workshop-app {
  flex-direction: row;
  text-align: left;
  padding: 5px;
  gap: 5px;
}
#reader .workshop-app-icon svg {
  width: 20px;
  height: 20px;
}
#reader .workshop-app b {
  font-size: 9px;
}
#reader .workshop-game .workshop-app strong {
  font-size: 11px;
}
#reader .workshop-file-manager {
  flex: 1;
  min-height: 0;
}
#reader .workshop-folders {
  padding: 5px;
  gap: 3px;
}
#reader .workshop-folders button {
  padding: 4px;
  min-height: 38px;
}
#reader .workshop-files-pane {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
}
#reader .workshop-breadcrumbs {
  margin: 0;
  flex: none;
}
#reader .workshop-breadcrumbs button {
  min-height: 28px;
}
#reader .workshop-files {
  flex: 1;
  min-height: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  align-content: stretch;
  gap: 5px;
  padding: 3px;
}
#reader .workshop-game .workshop-file-icon {
  font-size: 20px;
  line-height: 1;
}
#reader .workshop-copy {
  padding: 5px;
  font-size: 10px;
  gap: 3px;
}
#reader .workshop-copy-button {
  margin: 0;
  min-height: 40px;
  padding: 5px;
}
#reader .workshop-empty {
  font-size: 11px;
  margin: 4px;
  grid-column: 1/-1;
}
#reader .workshop-folder-select {
  display: none;
}
#reader .workshop-folders[data-many="true"] {
  display: none;
}
#reader .workshop-file-manager:has(.workshop-folders[data-many="true"]) {
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr);
}
#reader
  .workshop-file-manager:has(.workshop-folders[data-many="true"])
  .workshop-folder-select {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 5px;
  font-size: 11px;
}
#reader .workshop-folder-select select {
  min-width: 0;
  width: 100%;
  padding: 5px;
  min-height: 38px;
}
#reader .game-session[data-kind] .workshop-game > footer {
  flex: none;
  margin: 0;
  gap: 5px;
  display: flex;
  flex-wrap: nowrap;
}
#reader .workshop-game > footer button {
  flex: 1;
  min-height: 40px;
  padding: 5px;
  font-size: 11px;
}
#reader .workshop-game .learning-feedback {
  flex: none;
  padding: 5px 8px;
  margin: 0;
  font-size: 11px;
}
#reader .workshop-game .learning-feedback[open] p {
  position: absolute;
  bottom: 52px;
  left: 6px;
  right: 6px;
  padding: 10px;
  background: #fff8df;
  border: 1px solid #cdb887;
  border-radius: 8px;
  z-index: 6;
  font-size: 11px;
}
#reader .workshop-notice {
  margin: 0;
  padding: 5px;
  font-size: 10px;
}
#reader .workshop-pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  flex: none;
  font-size: 11px;
}
#reader .workshop-pager button {
  min-height: 36px;
  min-width: 38px;
  padding: 3px;
}
#reader .workshop-score {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  flex: none;
  font-size: 10px;
}
#reader .workshop-clock {
  white-space: nowrap;
  font-size: 18px;
  color: #267b71;
}
#reader .workshop-modebar select {
  width: auto;
  min-width: 0;
  min-height: 36px;
  padding: 4px;
  font-size: 11px;
}
@media (max-height: 480px) {
  #reader[data-mode="solve"]:has(.workshop-game)
    > .reader-header
    > .reader-top {
    display: none !important;
  }
  #reader
    .game-session:is(
      [data-kind="hardwarelab"],
      [data-kind="ramlab"],
      [data-kind="filequest"]
    ) {
    grid-template-rows: minmax(0, 1fr) auto;
  }
  #reader
    .game-session:is(
      [data-kind="hardwarelab"],
      [data-kind="ramlab"],
      [data-kind="filequest"]
    )
    > .world-topbar {
    display: none;
  }
  #reader
    .game-session:is(
      [data-kind="hardwarelab"],
      [data-kind="ramlab"],
      [data-kind="filequest"]
    )
    > .play-stage {
    grid-row: 1;
  }
  #reader
    .game-session:is(
      [data-kind="hardwarelab"],
      [data-kind="ramlab"],
      [data-kind="filequest"]
    )
    > .play-toolbar {
    grid-row: 2;
  }
}
@media (max-width: 600px) {
  #reader .game-session[data-kind] .workshop-game {
    padding: 7px;
    gap: 5px;
  }
  #reader .workshop-modebar > span {
    display: none;
  }
  #reader .workshop-hardware {
    gap: 5px;
  }
  #reader .workshop-game .workshop-token {
    padding: 4px;
  }
  #reader .workshop-game .workshop-chip {
    display: none;
  }
  #reader .workshop-file-manager {
    grid-template-rows: auto minmax(0, 1fr);
  }
  #reader .workshop-folders {
    flex-wrap: nowrap;
    padding: 4px;
  }
  #reader .workshop-folders button {
    flex: 1;
    min-width: 0;
    font-size: 10px;
    min-height: 36px;
  }
  #reader .workshop-breadcrumbs {
    display: none;
  }
}
@media (max-width: 600px) and (max-height: 700px) {
  #reader
    .game-session:is(
      [data-kind="hardwarelab"],
      [data-kind="ramlab"],
      [data-kind="filequest"]
    ) {
    grid-template-rows: minmax(0, 1fr) auto;
  }
  #reader
    .game-session:is(
      [data-kind="hardwarelab"],
      [data-kind="ramlab"],
      [data-kind="filequest"]
    )
    > .world-topbar {
    display: none;
  }
  #reader
    .game-session:is(
      [data-kind="hardwarelab"],
      [data-kind="ramlab"],
      [data-kind="filequest"]
    )
    > .play-stage {
    grid-row: 1;
  }
  #reader
    .game-session:is(
      [data-kind="hardwarelab"],
      [data-kind="ramlab"],
      [data-kind="filequest"]
    )
    > .play-toolbar {
    grid-row: 2;
  }
}
@media (max-height: 480px) and (min-width: 601px) {
  #reader .game-session[data-kind] .workshop-game {
    padding: 6px;
    gap: 4px;
  }
  #reader
    .game-session[data-kind]
    .workshop-game[data-challenge="false"]
    > footer {
    display: none;
  }
  #reader .game-session:has(.workshop-game[data-challenge="true"]) {
    grid-template-rows: minmax(0, 1fr);
  }
  #reader
    .game-session:has(.workshop-game[data-challenge="true"])
    > .play-toolbar {
    display: none;
  }
  #reader .workshop-hardware {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }
  #reader .workshop-parts,
  #reader .workshop-board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
    padding: 3px;
    gap: 4px;
  }
  #reader .workshop-game .workshop-socket {
    gap: 2px;
    min-height: 44px;
    padding: 4px;
  }
  #reader .workshop-game .workshop-socket strong {
    font-size: 13px;
  }
  #reader .workshop-content:has(.workshop-ram) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  #reader .workshop-ram-summary {
    grid-column: 1/-1;
  }
  #reader .workshop-game .workshop-chip {
    display: none;
  }
  #reader .workshop-game .workshop-token small {
    display: none;
  }
  #reader .game-session[data-kind] .workshop-game header h2 {
    font-size: 12px;
  }
  #reader .workshop-help {
    display: none;
  }
}
