.tsq-page body {
  background: #f5f7f9;
}

.tsq-page main.content {
  max-width: 1180px;
}

.tsq-page h2,
.tsq-page h3,
.tsq-page h4,
.tsq-page h5,
.tsq-page p {
  letter-spacing: 0;
}

.tsq-page .page-columns {
  display: block;
}

.tsq-page .quarto-title-block {
  display: none;
}

.iot-component-frame body {
  background: transparent;
}

.iot-component-frame .tsq-page main.content,
.iot-component-frame main.content {
  margin: 0;
  max-width: none;
  padding: 0;
}

.iot-component-frame #title-block-header,
.iot-component-frame .quarto-title-block,
.iot-component-frame nav,
.iot-component-frame .toc-actions,
.iot-component-frame .sidebar,
.iot-component-frame .page-navigation {
  display: none !important;
}

.iot-component-frame .tsq-hero {
  display: none;
}

.tsq-game,
.tsq-reference-material {
  color: #25313b;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 0 auto;
  max-width: 1120px;
}

.tsq-game *,
.tsq-reference-material * {
  box-sizing: border-box;
}

.tsq-hero {
  background:
    radial-gradient(circle at 14% 18%, rgba(47, 128, 197, 0.16), transparent 28%),
    linear-gradient(135deg, #183047 0%, #17716b 56%, #755b21 100%);
  border-radius: 8px;
  color: #fff;
  margin: 16px 0;
  padding: 28px;
}

.tsq-kicker,
.tsq-metrics,
.tsq-status,
.tsq-scenario-top,
.tsq-action-row,
.tsq-feedback-top {
  align-items: center;
  display: flex;
}

.tsq-kicker {
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.tsq-pill {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  color: #f7fbff;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 5px 10px;
  text-transform: uppercase;
}

.tsq-hero h2 {
  color: #fff;
  font-size: 2.1rem;
  line-height: 1.1;
  margin: 0 0 10px;
}

.tsq-hero p {
  color: rgba(255, 255, 255, 0.88);
  font-size: 1rem;
  line-height: 1.55;
  margin: 0;
  max-width: 800px;
}

.tsq-metrics {
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.tsq-metric {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  min-width: 140px;
  padding: 10px 12px;
}

.tsq-metric strong {
  display: block;
  font-size: 1.35rem;
}

.tsq-metric span {
  color: rgba(255, 255, 255, 0.82);
  display: block;
  font-size: 0.78rem;
}

.tsq-status {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(260px, 1fr) repeat(3, minmax(105px, 0.2fr));
  margin: 16px 0;
}

.tsq-progress-card,
.tsq-stat,
.tsq-scenario-card,
.tsq-panel,
.tsq-feedback,
.tsq-final-card,
.tsq-reference-intro,
.tsq-reference-section {
  background: #fff;
  border: 1px solid #dde6ec;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(22, 39, 52, 0.07);
}

.tsq-progress-card,
.tsq-stat {
  padding: 14px;
}

.tsq-progress-label {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.tsq-progress-label span,
.tsq-stat span,
.tsq-scenario-tag,
.tsq-field span {
  color: #667987;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.tsq-progress-label strong {
  color: #22313d;
  font-size: 0.9rem;
}

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

.tsq-progress-track > div {
  background: linear-gradient(90deg, #2f80c5, #1f8f70);
  border-radius: inherit;
  height: 100%;
  transition: width 0.2s ease;
  width: 0;
}

.tsq-stat {
  text-align: center;
}

.tsq-stat strong {
  color: #143247;
  display: block;
  font-size: 1.55rem;
  line-height: 1.1;
}

.tsq-scenario-card {
  border-left: 5px solid #2f80c5;
  padding: 20px;
}

.tsq-scenario-top {
  gap: 16px;
  justify-content: space-between;
}

.tsq-scenario-card h3 {
  color: #162b3a;
  font-size: 1.35rem;
  line-height: 1.25;
  margin: 4px 0 0;
}

.tsq-scenario-score {
  background: #eef6fd;
  border: 1px solid #c8dfef;
  border-radius: 999px;
  color: #246798;
  flex: 0 0 auto;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 7px 10px;
}

.tsq-scenario-copy {
  color: #43515c;
  line-height: 1.58;
  margin: 14px 0;
}

.tsq-reqs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tsq-reqs span {
  background: #f1f5f7;
  border: 1px solid #dbe5ea;
  border-radius: 999px;
  color: #354a59;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 9px;
}

.tsq-workspace {
  align-items: start;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  margin-top: 14px;
}

.tsq-panel {
  min-width: 0;
  padding: 18px;
}

.tsq-step-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.tsq-step-head > span {
  align-items: center;
  background: #163247;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.82rem;
  font-weight: 800;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.tsq-step-head h4 {
  color: #172a38;
  font-size: 1rem;
  margin: 0 0 3px;
}

.tsq-step-head p {
  color: #5c6d79;
  font-size: 0.86rem;
  line-height: 1.4;
  margin: 0;
}

.tsq-control-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tsq-field {
  display: grid;
  gap: 5px;
}

.tsq-field select {
  background: #fff;
  border: 1px solid #cdd9e2;
  border-radius: 7px;
  color: #24333d;
  font: inherit;
  min-width: 0;
  padding: 10px;
  width: 100%;
}

.tsq-preview-card {
  background: #f8fafb;
  border: 1px solid #dfe8ed;
  border-radius: 8px;
  margin-top: 12px;
  padding: 12px;
}

.tsq-preview-card h5 {
  color: #172a38;
  font-size: 0.86rem;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.tsq-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tsq-result-meta span {
  background: #eaf2f8;
  border-radius: 999px;
  color: #235f8d;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 4px 8px;
}

.tsq-chart {
  align-items: end;
  background: #142231;
  border-radius: 8px;
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  height: 160px;
  padding: 14px 12px 28px;
}

.tsq-bar-wrap {
  align-items: center;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
  position: relative;
}

.tsq-bar {
  background: linear-gradient(180deg, #5cc7b0, #2f80c5);
  border-radius: 5px 5px 0 0;
  min-height: 12px;
  width: 100%;
}

.tsq-bar-wrap span {
  bottom: -18px;
  color: #b8cbd8;
  font-size: 0.68rem;
  position: absolute;
}

.tsq-syntax-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.tsq-tab {
  background: #e9eef2;
  border: 0;
  border-radius: 999px;
  color: #263845;
  cursor: pointer;
  font-weight: 800;
  padding: 8px 12px;
}

.tsq-tab.is-active {
  background: #1f8f70;
  color: #fff;
}

.tsq-query {
  background: #142231;
  border-radius: 8px;
  color: #d7f2e4;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
  line-height: 1.5;
  margin: 0;
  min-height: 188px;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
}

.tsq-feedback {
  margin-top: 12px;
  padding: 14px;
}

.tsq-feedback.is-correct {
  border-color: #9ed8bb;
}

.tsq-feedback.is-partial {
  border-color: #d8c28e;
}

.tsq-feedback.is-wrong {
  border-color: #e5b0a5;
}

.tsq-feedback-top {
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tsq-feedback-top strong {
  color: #172a38;
}

.tsq-feedback-top span {
  background: #edf6f2;
  border-radius: 999px;
  color: #1f8f70;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 5px 9px;
}

.tsq-check-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 10px 0;
}

.tsq-check-grid div {
  background: #f8fafb;
  border: 1px solid #dfe8ed;
  border-radius: 8px;
  padding: 9px;
}

.tsq-check-grid div.is-ok {
  background: #edf9f3;
  border-color: #b7dfca;
}

.tsq-check-grid div.is-miss {
  background: #fff6ed;
  border-color: #e2c59b;
}

.tsq-check-grid span {
  color: #667987;
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.tsq-check-grid strong {
  color: #172a38;
  display: block;
  margin-top: 3px;
}

.tsq-check-grid em {
  color: #60717c;
  display: block;
  font-size: 0.78rem;
  font-style: normal;
  margin-top: 2px;
}

.tsq-feedback p {
  color: #465762;
  line-height: 1.5;
  margin: 7px 0 0;
}

.tsq-action-row {
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

.tsq-secondary,
.tsq-submit {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  line-height: 1;
  padding: 12px 16px;
}

.tsq-secondary {
  background: #e9eef2;
  color: #263845;
}

.tsq-submit {
  background: #1f8f70;
  color: #fff;
}

.tsq-final {
  margin-top: 14px;
}

.tsq-final-card {
  padding: 24px;
  text-align: center;
}

.tsq-final-card > span {
  color: #7a5b24;
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.tsq-final-card h3 {
  color: #143247;
  font-size: 2rem;
  margin: 5px 0 8px;
}

.tsq-final-card p {
  color: #4b5d68;
  margin: 0 auto 16px;
  max-width: 620px;
}

.tsq-result-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 16px auto;
  max-width: 520px;
}

.tsq-result-grid div {
  background: #f5f8fa;
  border: 1px solid #dfe8ed;
  border-radius: 8px;
  padding: 12px;
}

.tsq-result-grid strong {
  color: #1f8f70;
  display: block;
  font-size: 1.35rem;
}

.tsq-result-grid span {
  color: #657886;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.tsq-loading,
.tsq-error,
.tsq-reference-loading {
  background: #fff;
  border: 1px solid #dde6ec;
  border-radius: 8px;
  color: #596a76;
  padding: 18px;
}

.tsq-error {
  color: #a33a2a;
}

.tsq-reference-material {
  margin-top: 22px;
}

.tsq-reference-intro,
.tsq-reference-section {
  margin-bottom: 12px;
}

.tsq-reference-intro {
  padding: 16px 18px;
}

.tsq-reference-intro h3 {
  color: #172a38;
  font-size: 1.1rem;
  margin: 0 0 6px;
}

.tsq-reference-intro p {
  color: #526471;
  line-height: 1.5;
  margin: 0;
}

.tsq-reference-section {
  overflow: hidden;
}

.tsq-reference-section summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  list-style: none;
  padding: 14px 16px;
}

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

.tsq-reference-section summary span {
  color: #172a38;
  font-weight: 800;
}

.tsq-reference-section summary em {
  background: #eef3f6;
  border-radius: 999px;
  color: #526471;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
  padding: 4px 8px;
  text-transform: uppercase;
}

.tsq-reference-body {
  border-top: 1px solid #e5edf2;
  padding: 16px;
}

.tsq-table-wrap {
  overflow-x: auto;
}

.tsq-reference-table {
  border-collapse: collapse;
  width: 100%;
}

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

.tsq-reference-table th {
  color: #172a38;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.tsq-reference-table td {
  color: #475a66;
  font-size: 0.9rem;
  line-height: 1.42;
}

.tsq-card-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tsq-card-grid article,
.tsq-mini-card-grid article {
  background: #f8fafb;
  border: 1px solid #e2e9ee;
  border-radius: 8px;
  padding: 12px;
}

.tsq-card-grid h4,
.tsq-mini-card-grid h4 {
  color: #172a38;
  font-size: 0.95rem;
  margin: 0 0 6px;
}

.tsq-card-grid p,
.tsq-mini-card-grid p {
  color: #526471;
  font-size: 0.86rem;
  line-height: 1.45;
  margin: 0;
}

.tsq-mini-card-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tsq-mini-card-grid article {
  display: flex;
  gap: 12px;
}

.tsq-mini-card-grid span {
  align-items: center;
  background: #eaf2f8;
  border-radius: 8px;
  color: #235f8d;
  display: inline-flex;
  flex: 0 0 92px;
  font-size: 0.76rem;
  font-weight: 800;
  justify-content: center;
  padding: 8px;
  text-align: center;
  text-transform: uppercase;
}

html.iot-resource-frame-standalone #tsqGame .tsq-hero {
  display: none;
}

@media (max-width: 980px) {
  .tsq-status,
  .tsq-workspace,
  .tsq-card-grid,
  .tsq-mini-card-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .tsq-game,
  .tsq-reference-material {
    max-width: none;
  }

  .tsq-hero {
    border-radius: 0;
    margin: 0 0 14px;
    padding: 20px;
  }

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

  .tsq-scenario-card,
  .tsq-panel,
  .tsq-feedback,
  .tsq-final-card,
  .tsq-reference-intro,
  .tsq-reference-section {
    border-radius: 8px;
  }

  .tsq-scenario-top,
  .tsq-feedback-top,
  .tsq-action-row,
  .tsq-mini-card-grid article {
    align-items: stretch;
    flex-direction: column;
  }

  .tsq-control-grid,
  .tsq-check-grid,
  .tsq-result-grid {
    grid-template-columns: 1fr;
  }

  .tsq-chart {
    gap: 4px;
    height: 132px;
  }

  .tsq-reference-table,
  .tsq-reference-table thead,
  .tsq-reference-table tbody,
  .tsq-reference-table tr,
  .tsq-reference-table th,
  .tsq-reference-table td {
    display: block;
    width: 100%;
  }

  .tsq-reference-table thead {
    display: none;
  }

  .tsq-reference-table tr {
    background: #f8fafb;
    border: 1px solid #e2e9ee;
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 8px;
  }

  .tsq-reference-table td {
    border-bottom: 0;
    padding: 6px 4px;
  }

  .tsq-reference-table td::before {
    color: #697b87;
    content: attr(data-label);
    display: block;
    font-size: 0.7rem;
    font-weight: 800;
    margin-bottom: 2px;
    text-transform: uppercase;
  }
}
