/* Component stylesheet for game.compute-placement-game. */
html.iot-component-frame body {
  margin: 0;
  padding: 0;
  background: transparent;
}

html.iot-component-frame main,
html.iot-component-frame .page-columns,
html.iot-component-frame .content,
html.iot-component-frame #quarto-content,
html.iot-component-frame #quarto-document-content {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

html.iot-component-frame h1.title,
html.iot-component-frame #interactive-game > h1,
html.iot-component-frame #interactive-game > h2,
html.iot-component-frame #reference-material > h2,
html.iot-component-frame #related-resources,
html.iot-component-frame header,
html.iot-component-frame .quarto-title-block,
html.iot-component-frame nav,
html.iot-component-frame .sidebar,
html.iot-component-frame .toc-active,
html.iot-component-frame #quarto-header {
  display: none !important;
}

html.iot-component-frame #cpgGame,
html.iot-component-frame .cpg-reference-material {
  max-width: 100%;
  margin-right: 0;
  margin-left: 0;
  box-shadow: none;
}

html.iot-resource-frame-standalone #cpgGame {
  margin-bottom: 22px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

html.iot-resource-frame-standalone #cpgGame .cpg-hero {
  display: none;
}

#cpgGame,
#cpgGame * {
  box-sizing: border-box;
}

#cpgGame {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto 28px;
  padding: 18px;
  color: #20343d;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f8fb;
  border: 1px solid #d8e4ea;
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(24, 54, 68, 0.1);
}

#cpgGame h2,
#cpgGame h3,
#cpgGame p {
  margin: 0;
}

.cpg-hero {
  padding: 22px;
  margin-bottom: 16px;
  color: #ffffff;
  background: linear-gradient(135deg, #20343d 0%, #0f7d85 58%, #9a6420 100%);
  border-radius: 8px;
}

.cpg-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.cpg-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cpg-hero h2 {
  margin-bottom: 10px;
  color: #ffffff;
  font-size: 2rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.cpg-hero p {
  max-width: 820px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.5;
}

.cpg-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 620px;
  margin-top: 18px;
}

.cpg-metric {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.13);
}

.cpg-metric strong {
  display: block;
  font-size: 1.05rem;
  line-height: 1;
}

.cpg-metric span {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.72rem;
}

.cpg-status {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, minmax(96px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.cpg-progress-card,
.cpg-stat,
.cpg-scenario,
.cpg-feedback,
.cpg-results,
.cpg-empty {
  background: #ffffff;
  border: 1px solid #d8e4ea;
  border-radius: 8px;
}

.cpg-progress-card,
.cpg-stat {
  min-height: 78px;
  padding: 12px;
}

.cpg-progress-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
}

.cpg-progress-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #60747d;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cpg-progress-track {
  height: 10px;
  overflow: hidden;
  background: #e8f0f4;
  border-radius: 999px;
}

.cpg-progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #0f7d85 0%, #249461 100%);
  border-radius: inherit;
  transition: width 0.25s ease;
}

.cpg-stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.cpg-stat strong {
  display: block;
  color: #20343d;
  font-size: 1.55rem;
  line-height: 1;
}

.cpg-stat span {
  display: block;
  margin-top: 7px;
  color: #657982;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cpg-scenario {
  padding: 18px;
  margin-bottom: 14px;
  border-left: 5px solid #9a6420;
}

.cpg-scenario-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.cpg-tag,
.cpg-difficulty {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cpg-tag {
  color: #8a4f12;
  background: #fff5e8;
  border: 1px solid #d4bf9f;
}

.cpg-difficulty-easy {
  color: #176346;
  background: #e8f7ef;
  border: 1px solid #a9d9bd;
}

.cpg-difficulty-medium {
  color: #806213;
  background: #fff8e3;
  border: 1px solid #e5cc78;
}

.cpg-difficulty-hard {
  color: #91403a;
  background: #fff0ef;
  border: 1px solid #e7b2ae;
}

.cpg-scenario h3 {
  margin-bottom: 9px;
  color: #20343d;
  font-size: 1.35rem;
  line-height: 1.2;
}

.cpg-scenario p {
  color: #455d66;
  line-height: 1.58;
}

.cpg-requirements {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
}

.cpg-requirement {
  min-width: 0;
  padding: 10px;
  background: #f7fbfc;
  border: 1px solid #d5e1e6;
  border-radius: 8px;
}

.cpg-requirement span,
.cpg-requirement strong {
  display: block;
}

.cpg-requirement span {
  margin-bottom: 4px;
  color: #657982;
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cpg-requirement strong {
  color: #20343d;
  font-size: 0.9rem;
  line-height: 1.25;
}

.cpg-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.cpg-choice {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 9px 11px;
  align-items: center;
  min-height: 128px;
  padding: 13px;
  color: #20343d;
  text-align: left;
  background: #f7fbfc;
  border: 1px solid #d5e1e6;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.cpg-choice:hover:not(:disabled) {
  border-color: #0f7d85;
  transform: translateY(-1px);
}

.cpg-choice:disabled {
  cursor: default;
}

.cpg-choice-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  color: #ffffff;
  background: #0f7d85;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 900;
}

.cpg-choice strong {
  display: block;
  color: #20343d;
  font-size: 1rem;
}

.cpg-choice > span:last-child {
  grid-column: 1 / -1;
  color: #516872;
  font-size: 0.84rem;
  line-height: 1.42;
}

.cpg-choice.is-selected {
  border-color: #0f7d85;
  background: #eef8f8;
}

.cpg-choice.is-correct {
  border-color: #249461;
  background: #effaf4;
}

.cpg-choice.is-wrong {
  border-color: #c65b52;
  background: #fff6f5;
}

.cpg-feedback {
  display: none;
  padding: 16px;
  margin-top: 14px;
}

.cpg-feedback.show {
  display: block;
}

.cpg-feedback.correct {
  background: #effaf4;
  border-color: #94d2ae;
}

.cpg-feedback.partial {
  background: #fff8ec;
  border-color: #e4bf84;
}

.cpg-feedback.wrong {
  background: #fff6f5;
  border-color: #e7b2ae;
}

.cpg-feedback-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 10px;
  color: #20343d;
  font-size: 1rem;
  font-weight: 900;
}

.cpg-feedback-title span {
  color: #0f7d85;
}

.cpg-feedback-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.cpg-feedback-grid div {
  padding: 10px;
  border: 1px solid rgba(32, 52, 61, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.cpg-feedback-grid span,
.cpg-feedback-grid strong {
  display: block;
}

.cpg-feedback-grid span {
  margin-bottom: 4px;
  color: #52666f;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cpg-feedback-grid strong,
.cpg-feedback p {
  color: #405862;
  line-height: 1.5;
}

.cpg-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.cpg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #ffffff;
  background: #0f7d85;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 850;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.cpg-btn:hover:not(:disabled) {
  background: #0b676d;
  transform: translateY(-1px);
}

.cpg-btn.secondary {
  color: #20343d;
  background: #ffffff;
  border-color: #c9d8df;
}

.cpg-btn.secondary:hover:not(:disabled) {
  background: #f4f8fb;
}

.cpg-results {
  display: none;
  padding: 24px;
  text-align: center;
}

.cpg-results-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 10px;
  margin-bottom: 10px;
  border-radius: 999px;
  color: #0f7d85;
  background: #e8f4f4;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cpg-final-score {
  display: block;
  color: #0f7d85;
  font-size: 2.8rem;
  line-height: 1;
  font-weight: 900;
}

.cpg-results h3 {
  margin: 10px 0 8px;
  color: #20343d;
  font-size: 1.35rem;
}

.cpg-results p {
  margin-bottom: 16px;
  color: #52666f;
  line-height: 1.45;
}

.cpg-review {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  text-align: left;
}

.cpg-review-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px 12px;
  background: #f7fbfc;
  border: 1px solid #dbe7ec;
  border-left: 4px solid #c9d8df;
  border-radius: 8px;
}

.cpg-review-item.correct {
  border-left-color: #249461;
}

.cpg-review-item.wrong {
  border-left-color: #c65b52;
}

.cpg-review-item span {
  color: #20343d;
  font-weight: 750;
}

.cpg-review-item strong {
  color: #516872;
}

.cpg-empty {
  padding: 28px;
  margin-bottom: 14px;
  text-align: center;
}

.cpg-empty h3 {
  margin-bottom: 8px;
  color: #20343d;
  font-size: 1.2rem;
}

.cpg-empty p {
  max-width: 640px;
  margin: 0 auto;
  color: #52666f;
  line-height: 1.55;
}

.cpg-error {
  border-color: #e7b2ae;
  background: #fff7f6;
}

.reference-intro {
  margin: 0 0 12px;
  color: #52666f;
  line-height: 1.5;
}

.cpg-reference-material {
  display: block;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto 28px;
  color: #20343d;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.reference-loading {
  padding: 16px;
  color: #60747d;
  background: #ffffff;
  border: 1px solid #d8e4ea;
  border-radius: 8px;
}

.reference-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.reference-map-item {
  padding: 12px;
  background: #ffffff;
  border: 1px solid #d8e4ea;
  border-radius: 8px;
}

.reference-map-item strong,
.reference-map-item span {
  display: block;
}

.reference-map-item strong {
  margin-bottom: 5px;
  color: #20343d;
  font-size: 0.9rem;
}

.reference-map-item span {
  color: #60747d;
  font-size: 0.82rem;
  line-height: 1.4;
}

.reference-section {
  margin-bottom: 10px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #d8e4ea;
  border-radius: 8px;
}

.reference-section[open] .reference-section-chevron {
  transform: rotate(90deg);
}

.reference-section-summary {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 18px;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
}

.reference-section-summary::-webkit-details-marker {
  display: none;
}

.reference-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  color: #ffffff;
  background: #0f7d85;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
}

.reference-section-tip .reference-section-icon {
  background: #9a6420;
}

.reference-section-summary span:nth-child(2) {
  color: #20343d;
  font-weight: 850;
}

.reference-section-chevron {
  color: #60747d;
  font-size: 1.2rem;
  line-height: 1;
  transition: transform 0.15s ease;
}

.reference-section-body {
  padding: 0 14px 14px;
}

.reference-mini-grid,
.reference-card-grid {
  display: grid;
  gap: 10px;
}

.reference-mini-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.reference-mini,
.reference-card {
  padding: 12px;
  background: #f7fbfc;
  border: 1px solid #dbe7ec;
  border-radius: 8px;
}

.reference-mini strong,
.reference-mini span {
  display: block;
}

.reference-mini strong,
.reference-card h4 {
  margin: 0 0 5px;
  color: #20343d;
  font-size: 0.94rem;
}

.reference-mini span,
.reference-card li {
  color: #52666f;
  font-size: 0.84rem;
  line-height: 1.45;
}

.reference-scan {
  overflow-x: auto;
  border: 1px solid #dbe7ec;
  border-radius: 8px;
}

.reference-scan-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.reference-scan-table th,
.reference-scan-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #dbe7ec;
}

.reference-scan-table th {
  color: #20343d;
  background: #edf4f7;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.reference-scan-table tr:last-child td {
  border-bottom: 0;
}

.reference-card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.reference-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.reference-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  color: #0f7d85;
  background: #e8f4f4;
  border: 1px solid #cce1eb;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 850;
}

.reference-card ul,
.reference-card ol {
  margin: 0;
  padding-left: 18px;
}

.reference-card li + li {
  margin-top: 5px;
}

@media (max-width: 900px) {
  .cpg-status,
  .cpg-requirements,
  .cpg-choices,
  .reference-map,
  .reference-card-grid {
    grid-template-columns: 1fr;
  }

  .cpg-progress-card,
  .cpg-stat {
    min-height: auto;
  }
}

@media (max-width: 620px) {
  #cpgGame {
    padding: 14px;
  }

  .cpg-hero {
    padding: 18px;
  }

  .cpg-hero h2 {
    font-size: 1.55rem;
  }

  .cpg-metrics,
  .cpg-feedback-grid,
  .reference-mini-grid {
    grid-template-columns: 1fr;
  }

  .cpg-review-item {
    grid-template-columns: 1fr;
  }

  .cpg-actions,
  .cpg-btn {
    width: 100%;
  }

  .reference-scan-table {
    min-width: 520px;
  }
}
