* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: #1f2f3f;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background: #edf2f6;
}

.demo-shell {
  min-height: 100vh;
  padding: 20px;
  background:
    linear-gradient(90deg, rgba(42, 100, 150, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(42, 100, 150, 0.05) 1px, transparent 1px),
    linear-gradient(135deg, #f8fbfd, #e8eff4 60%, #f7f1ed);
  background-size: 28px 28px, 28px 28px, auto;
}

.embed-mode .demo-shell {
  min-height: 430px;
  padding: 12px;
}

.demo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1120px;
  margin: 0 auto 12px;
}

.kicker {
  display: block;
  color: #2a6496;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 2px 0 0;
  color: #20354d;
  font-size: 25px;
  line-height: 1.25;
}

.embed-mode h1 {
  font-size: 19px;
}

.status-badge {
  min-width: 152px;
  padding: 8px 12px;
  border: 1px solid rgba(42, 100, 150, 0.28);
  border-radius: 8px;
  color: #1e517a;
  background: rgba(239, 247, 252, 0.94);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.status-badge.is-alert {
  border-color: rgba(220, 72, 48, 0.36);
  color: #b93b2d;
  background: rgba(255, 239, 234, 0.96);
}

.stage-wrap {
  max-width: 1120px;
  height: clamp(342px, 52vw, 500px);
  min-height: 342px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(42, 100, 150, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 30px rgba(31, 47, 63, 0.12);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.embed-mode .stage-wrap {
  height: 330px;
  min-height: 330px;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  max-width: 1120px;
  margin: 10px auto 0;
}

.metric-strip div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(42, 100, 150, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 6px 18px rgba(31, 47, 63, 0.06);
}

.metric-strip span {
  display: block;
  color: #667482;
  font-size: 12px;
  font-weight: 700;
}

.metric-strip strong {
  display: block;
  overflow: hidden;
  color: #20354d;
  font-size: 20px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.embed-mode .metric-strip {
  gap: 6px;
  margin-top: 8px;
}

.embed-mode .metric-strip div {
  padding: 7px 9px;
}

.embed-mode .metric-strip strong {
  font-size: 17px;
}

@media (max-width: 760px) {
  .demo-shell {
    padding: 14px;
  }

  .embed-mode .demo-shell {
    min-height: 620px;
    padding: 10px;
  }

  .demo-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
  }

  h1 {
    font-size: 21px;
  }

  .embed-mode h1 {
    font-size: 17px;
  }

  .status-badge {
    min-width: 0;
    padding: 7px 10px;
    font-size: 12px;
  }

  .stage-wrap,
  .embed-mode .stage-wrap {
    height: 360px;
    min-height: 360px;
  }

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

  .metric-strip div:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 420px) {
  .stage-wrap,
  .embed-mode .stage-wrap {
    height: 350px;
    min-height: 350px;
  }

  .metric-strip span {
    font-size: 11px;
  }

  .metric-strip strong,
  .embed-mode .metric-strip strong {
    font-size: 15px;
  }
}
