/* Functional upgrade: publishing kit and project decision ledger. */
#studio .poster-preview {
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  justify-items: center;
  gap: 18px;
}

#studio .poster-preview #poster-canvas {
  max-height: 548px !important;
}

.visual-kit {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.45fr 1fr 0.7fr;
  width: min(100%, 650px);
  gap: 10px;
  padding: 11px;
  border-top: 1px solid rgba(67, 57, 44, 0.2);
}

.visual-kit-item {
  min-width: 0;
}

.visual-kit-label {
  display: flex;
  justify-content: space-between;
  margin: 0 0 6px;
  color: #56645f;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.visual-kit canvas {
  display: block;
  width: 100%;
  height: 70px;
  border: 1px solid rgba(61, 53, 41, 0.24);
  background: #e9e4d8;
  box-shadow: 0 8px 17px rgba(49, 40, 28, 0.14);
  object-fit: contain;
}

.kit-intro {
  margin: 18px 0 0;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  color: #d7ded3;
}

.kit-intro b,
.kit-intro span {
  display: block;
}

.kit-intro b {
  color: #f7f1e6;
  font: 500 17px/1.25 Georgia, "Noto Serif SC", serif;
}

.kit-intro span {
  margin-top: 5px;
  color: #bfcac0;
  font-size: 10px;
  line-height: 1.55;
}

.poster-actions .kit-action {
  border-color: rgba(232, 215, 185, 0.58);
  background: rgba(229, 194, 144, 0.1);
}

.poster-actions .kit-action.main-kit {
  background: #e0a07f;
  border-color: #e0a07f;
  color: #233536;
}

.poster-editor .kit-status {
  margin: 10px 0 0;
  color: #c7d0c4;
  font-size: 10px;
  line-height: 1.5;
}

.brief-editor .brief-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 9px;
}

.brief-action-row button {
  height: 40px;
  border: 1px solid rgba(43, 55, 51, 0.42);
  background: transparent;
  color: #2c3c3c;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.brief-action-row button:hover,
.brief-action-row button:focus-visible {
  border-color: #c87257;
  color: #a65941;
}

.brief-synthesis {
  margin: 18px 0 2px;
  padding: 15px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.24);
}

.brief-synthesis-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
}

.brief-synthesis-head b {
  color: #f5efe5;
  font: 500 18px/1.2 Georgia, "Noto Serif SC", serif;
}

.brief-synthesis-head span {
  padding-top: 5px;
  color: #db9274;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.brief-synthesis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}

.brief-synthesis-grid > div {
  display: block !important;
  padding: 10px 0 !important;
}

.brief-synthesis-grid > div span {
  padding: 0 !important;
  font-size: 8px !important;
}

.brief-synthesis-grid > div p {
  margin-top: 4px !important;
  font-size: 12px !important;
  line-height: 1.55 !important;
}

.brief-audit {
  margin-top: 17px;
  padding: 15px 16px;
  border: 1px solid rgba(225, 160, 127, 0.44);
  background: rgba(245, 232, 210, 0.07);
}

.brief-audit[hidden] {
  display: none;
}

.brief-audit p {
  margin: 0 !important;
  color: #ecddc8 !important;
  font-size: 12px !important;
  line-height: 1.65 !important;
}

.brief-audit ul {
  display: grid;
  gap: 6px;
  margin: 10px 0;
  padding: 0;
  list-style: none;
}

.brief-audit li {
  position: relative;
  padding-left: 12px;
  color: #d7ded3;
  font-size: 11px;
  line-height: 1.5;
}

.brief-audit li::before {
  position: absolute;
  left: 0;
  content: "—";
  color: #df987b;
}

.brief-audit small {
  display: block;
  color: #d69276;
  font-size: 9px;
  line-height: 1.55;
}

.brief-privacy {
  margin: 12px 0 0;
  color: #687878;
  font-size: 11px;
  line-height: 1.7;
}

.brief-audit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}

.brief-audit-grid p {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(52, 74, 71, .17);
  color: #39504f;
  font-size: 12px;
  line-height: 1.65;
}

.brief-audit-grid span {
  display: block;
  margin-bottom: 4px;
  color: #c67355;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
}

/* Counter-case desk: leave the right column quiet until there is a real result. */
@media (min-width: 921px) {
  .stage.project-open,
  .stage.project-open #brief {
    min-height: 790px !important;
  }

  .stage.project-open .brief-workbench,
  .brief-workbench {
    inset: 106px 7% 38px !important;
    grid-template-columns: minmax(0, 1.04fr) minmax(480px, .96fr) !important;
    gap: 30px !important;
  }

  .brief-editor,
  .brief-card,
  .brief-card.has-synthesis {
    min-height: 0 !important;
    height: auto !important;
  }

  .brief-editor {
    padding: 34px 36px !important;
  }

  .brief-editor textarea {
    flex: 0 0 300px !important;
    min-height: 300px !important;
  }

  .brief-card {
    overflow: hidden !important;
    padding: 30px 34px 28px !important;
  }

  .brief-number {
    margin-bottom: 12px !important;
  }

  .brief-card h3 {
    max-width: none !important;
    margin-bottom: 17px !important;
    font-size: 30px !important;
    line-height: 1.1 !important;
  }

  .brief-card > div {
    grid-template-columns: 100px 1fr !important;
    gap: 16px !important;
    padding: 8px 0 !important;
  }

  .brief-card > div p {
    font-size: 13px !important;
    line-height: 1.55 !important;
  }

  .brief-card > strong {
    margin-top: 12px !important;
  }

  .brief-service-state {
    margin-top: 7px !important;
  }

  .brief-service-link {
    margin-top: 13px !important;
  }
}

.brief-synthesis {
  display: none;
}

.brief-card.has-synthesis .brief-synthesis {
  display: block;
  margin-top: 14px;
}

.brief-card.has-synthesis .brief-synthesis-grid {
  gap: 8px;
}

.brief-card.has-synthesis .brief-synthesis-grid > div {
  padding: 9px 10px;
}

.brief-card.has-synthesis .brief-audit {
  margin-top: 12px;
}

.brief-card.has-synthesis {
  min-height: 860px !important;
  height: auto !important;
}

.stage.project-open,
.stage.project-open #brief {
  min-height: 1080px !important;
}

@media (max-width: 920px) {
  #studio .poster-preview #poster-canvas {
    max-height: 500px !important;
  }
  .visual-kit {
    width: 100%;
  }
  .brief-synthesis-grid {
    grid-template-columns: 1fr;
  }
  .brief-card.has-synthesis {
    min-height: 0 !important;
  }
  .stage.project-open:has(.has-synthesis),
  .stage.project-open:has(.has-synthesis) #brief {
    min-height: 1710px !important;
  }
}

/* The defense prototype is deliberately parked until a stronger game direction exists. */
#studio .poster-workbench {
  display: grid !important;
}

#studio .poster-meta {
  display: block !important;
}

.defense-workbench {
  display: none !important;
}

/* A shared desktop stage keeps every experiment within one calm viewport. */
@media (min-width: 921px) {
  .frame {
    min-height: calc(100vh - 36px) !important;
    margin: 18px !important;
  }

  #lab-shell main,
  .frame main {
    width: min(1540px, calc(100% - 96px)) !important;
    padding-top: 18px !important;
    padding-bottom: 18px !important;
  }

  .intro {
    margin: 0 0 12px !important;
  }

  .intro h1 {
    font-size: 37px !important;
    line-height: 1 !important;
  }

  .kicker {
    margin-bottom: 5px !important;
    font-size: 9px !important;
  }

  .switcher {
    margin-top: 0 !important;
  }

  .switcher button,
  .switcher button + button {
    height: 70px !important;
    padding: 13px 17px !important;
  }

  .switcher button + button {
    padding-left: 17px !important;
  }

  .switcher button.on:after,
  .switcher button + button.on:after {
    left: 0 !important;
  }

  .switcher b {
    font-size: 18px !important;
  }

  .stage,
  .stage.studio-open,
  .stage.project-open,
  .stage.game-open,
  .stage.studio-open #studio,
  .stage.project-open #brief,
  .stage.game-open .piece {
    height: clamp(380px, calc(100vh - 310px), 760px) !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .piece {
    min-height: 0 !important;
  }

  .piece-head {
    top: 23px !important;
    left: 34px !important;
    right: 34px !important;
  }

  .piece-head h2 {
    font-size: 32px !important;
  }

  .piece-head p {
    margin-bottom: 5px !important;
  }

  .game-workbench {
    inset: 72px 7% 24px !important;
    gap: 24px !important;
  }

  .game-ledger {
    gap: 10px !important;
    padding: 21px !important;
  }

  .game-ledger h3 {
    font-size: 27px !important;
  }

  .game-ledger .stat-grid div {
    padding: 10px !important;
  }

  .game-ledger button,
  .game-ledger select {
    min-height: 39px !important;
  }

  .game-ledger .game-note {
    font-size: 11px !important;
    line-height: 1.5 !important;
  }

  .suika-shell {
    width: min(100%, 480px) !important;
    height: min(100%, 500px) !important;
  }

  .mine-shell {
    width: min(100%, 620px) !important;
    padding: 15px !important;
  }

  .controls {
    bottom: 28px !important;
    left: 34px !important;
  }

  .stage.studio-open .poster-workbench,
  .poster-workbench {
    inset: 70px 5% 22px !important;
    gap: 20px !important;
  }

  .stage.studio-open .poster-preview,
  .poster-preview {
    min-height: 0 !important;
    padding: 20px 32px !important;
  }

  #studio .poster-preview #poster-canvas {
    width: auto !important;
    max-width: min(100%, 430px) !important;
    max-height: calc(clamp(380px, 100vh - 310px, 760px) - 150px) !important;
  }

  .stage.studio-open .poster-editor,
  .poster-editor {
    min-height: 0 !important;
    padding: 19px !important;
    overflow: auto;
  }

  .stage.project-open .brief-workbench,
  .brief-workbench {
    inset: 72px 7% 24px !important;
    gap: 22px !important;
  }

  .brief-editor,
  .brief-card,
  .brief-card.has-synthesis {
    min-height: 0 !important;
    height: auto !important;
    padding: 25px !important;
    overflow: auto;
  }

  .brief-editor textarea {
    min-height: 220px !important;
  }

  .brief-editor .brief-action-row {
    margin-top: 7px;
  }

  .brief-card h3 {
    margin-bottom: 18px !important;
    font-size: 31px !important;
  }

  .brief-card div {
    padding: 8px 0 !important;
  }

  .brief-synthesis {
    margin-top: 11px !important;
    padding-top: 10px !important;
  }

  .brief-synthesis-grid > div {
    padding: 6px 0 !important;
  }
}

/* Keep the full page, including the compliance footer, inside compact desktops. */
@media (min-width: 921px) and (max-height: 900px) {
  .frame {
    min-height: 0 !important;
    margin: 8px 18px 0 !important;
  }

  #lab-shell main,
  .frame main {
    padding-top: 10px !important;
    padding-bottom: 0 !important;
  }

  .intro {
    margin-bottom: 7px !important;
  }

  .intro h1 {
    font-size: 30px !important;
  }

  .switcher button,
  .switcher button + button {
    height: 51px !important;
    padding: 8px 16px !important;
  }

  .switcher b {
    font-size: 15px !important;
  }

  .switcher small {
    margin-top: 2px !important;
    font-size: 8px !important;
  }

  .stage,
  .stage.studio-open,
  .stage.project-open,
  .stage.game-open,
  .stage.studio-open #studio,
  .stage.project-open #brief,
  .stage.game-open .piece {
    height: calc(100vh - 285px) !important;
  }
}

/* Adaptive defense: a canvas strategy game that replaces the visual publishing desk. */
#studio .poster-workbench,
#studio .poster-meta {
  display: none !important;
}

#studio:before {
  background-image: url("../assets/inner-scenes/lab-editorial-room-v1.png") !important;
  background-position: center !important;
  filter: saturate(.56) brightness(.58) contrast(1.08) !important;
}

#studio:after {
  background: linear-gradient(90deg, rgba(11, 26, 28, .72), rgba(9, 24, 27, .28) 52%, rgba(9, 22, 24, .69)) !important;
}

.defense-workbench {
  position: absolute;
  z-index: 4;
  inset: 96px 6% 30px;
  display: grid;
  grid-template-columns: 250px minmax(460px, 1fr) 196px;
  gap: 18px;
  color: #edf1e8;
}

.defense-ledger,
.defense-board-shell,
.defense-log {
  min-height: 0;
  border: 1px solid rgba(235, 238, 224, .38);
  background: rgba(14, 30, 32, .66);
  box-shadow: inset 0 1px rgba(255, 255, 255, .09), 0 18px 40px rgba(1, 11, 13, .28);
  backdrop-filter: blur(15px) saturate(.9);
}

.defense-ledger {
  display: flex;
  flex-direction: column;
  padding: 21px;
}

.defense-eyebrow,
.defense-log > p {
  margin: 0;
  color: #d9987b;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .16em;
}

.defense-ledger h3 {
  margin: 9px 0 18px;
  color: #f0f1e8;
  font: 500 26px/1.05 Georgia, "Noto Serif SC", serif;
}

.defense-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 14px;
  border-top: 1px solid rgba(235, 238, 224, .26);
  border-left: 1px solid rgba(235, 238, 224, .26);
}

.defense-stats div {
  min-height: 66px;
  padding: 10px;
  border-right: 1px solid rgba(235, 238, 224, .26);
  border-bottom: 1px solid rgba(235, 238, 224, .26);
}

.defense-stats span,
.defense-tools > span {
  display: block;
  color: rgba(228, 237, 230, .65);
  font-size: 9px;
  letter-spacing: .1em;
}

.defense-stats b {
  display: block;
  margin-top: 4px;
  color: #f4efe3;
  font: 500 25px Georgia, "Noto Serif SC", serif;
}

.defense-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 2px;
}

.defense-tools > span {
  grid-column: 1 / -1;
  margin-bottom: 1px;
}

.defense-tools button,
.defense-actions button {
  min-height: 35px;
  padding: 0 9px;
  border: 1px solid rgba(239, 239, 224, .45);
  border-radius: 0;
  background: rgba(13, 30, 31, .36);
  color: #edf1e9;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
}

.defense-tools button.on {
  border-color: #d78366;
  background: rgba(204, 112, 82, .82);
}

.defense-actions {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.defense-actions .main {
  border-color: #d78366;
  background: #c86e50;
}

.defense-status {
  min-height: 31px;
  margin: 13px 0 0;
  color: #d4ded6;
  font-size: 11px;
  line-height: 1.55;
}

.defense-board-shell {
  position: relative;
  overflow: hidden;
  min-width: 0;
}

#defense-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.defense-log {
  display: flex;
  flex-direction: column;
  padding: 19px 17px;
}

.defense-log h4 {
  margin: 10px 0 12px;
  color: #f2eee5;
  font: 500 21px/1.05 Georgia, "Noto Serif SC", serif;
}

.defense-log ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.defense-log li {
  position: relative;
  padding: 0 0 9px 12px;
  border-bottom: 1px solid rgba(237, 239, 228, .16);
  color: rgba(227, 235, 227, .8);
  font-size: 10px;
  line-height: 1.55;
}

.defense-log li::before {
  position: absolute;
  top: 5px;
  left: 0;
  width: 4px;
  height: 4px;
  content: "";
  background: #d47a58;
}

.defense-hint {
  margin: auto 0 0;
  color: rgba(227, 235, 227, .58);
  font-size: 10px;
  line-height: 1.6;
}

@media (min-width: 921px) {
  .stage.studio-open .defense-workbench {
    inset: 76px 6% 22px;
  }
}

@media (min-width: 921px) and (max-height: 900px) {
  .stage.studio-open .defense-workbench {
    inset: 58px 6% 16px;
    grid-template-columns: 205px minmax(420px, 1fr) 165px;
    gap: 13px;
  }

  .defense-ledger,
  .defense-log {
    padding: 14px;
  }

  .defense-ledger h3 {
    margin: 6px 0 10px;
    font-size: 21px;
  }

  .defense-stats div {
    min-height: 52px;
    padding: 7px;
  }

  .defense-stats b {
    font-size: 20px;
  }

  .defense-tools {
    gap: 5px;
  }

  .defense-tools button,
  .defense-actions button {
    min-height: 29px;
    font-size: 9px;
  }

  .defense-status {
    min-height: 20px;
    margin-top: 8px;
    font-size: 9px;
  }

  .defense-log h4 {
    margin: 6px 0 8px;
    font-size: 17px;
  }

  .defense-log ul {
    gap: 5px;
  }

  .defense-log li {
    padding-bottom: 5px;
    font-size: 9px;
    line-height: 1.35;
  }
}

@media (max-width: 920px) {
  #studio .piece-head .context {
    display: none;
  }

  .defense-workbench {
    inset: 92px 18px 26px;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(420px, 1fr) auto;
    gap: 12px;
    overflow: auto;
  }

  .defense-ledger,
  .defense-log {
    padding: 17px;
  }

  .defense-ledger h3 {
    font-size: 25px;
  }

  .defense-board-shell {
    min-height: 420px;
  }
}
