:root {
  --ink: #f3f7f9;
  --muted: rgba(218, 228, 233, 0.82);
  --panel: rgba(10, 15, 18, 0.56);
  --panel-strong: rgba(7, 11, 14, 0.72);
  --line: rgba(218, 230, 235, 0.28);
  --teal: #5bd3e8;
  --green: #8bd86b;
  --amber: #e8bf62;
  --red: #ef6470;
  --shadow: 0 18px 56px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  overflow: hidden;
}

body {
  background: #b8c8d1;
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.demo3d {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 620px;
  overflow: hidden;
}

.three-stage,
.three-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.three-stage {
  background:
    linear-gradient(180deg, #9fb1bb 0%, #c7d1d6 44%, #f0efea 45%, #e9e8e2 100%);
}

.hud {
  position: absolute;
  z-index: 5;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(120%);
}

.top-hud {
  top: 16px;
  left: 16px;
  right: auto;
  width: min(680px, calc(100vw - 402px));
  min-height: 62px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  border-color: rgba(255, 255, 255, 0.34);
}

.kicker {
  display: block;
  margin-bottom: 5px;
  color: rgba(220, 238, 245, 0.86);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.12;
}

h1 {
  font-size: clamp(20px, 2.3vw, 32px);
  font-weight: 900;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 16px;
  font-weight: 900;
}

.score {
  position: static;
  min-width: 148px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  display: grid;
  justify-items: end;
  gap: 4px;
  flex: 0 0 auto;
}

.score span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.score strong {
  color: #78dff0;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 0.94;
  font-variant-numeric: tabular-nums;
}

.control-hud {
  top: 92px;
  right: 16px;
  width: min(330px, calc(100vw - 32px));
  max-height: calc(100vh - 110px);
  display: grid;
  gap: 12px;
  padding: 14px;
  overflow: hidden;
  border-color: rgba(255, 255, 255, 0.28);
}

.control-hud section {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.control-hud section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.segments,
.actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.actions {
  grid-template-columns: 1fr 1fr;
}

.actions .primary {
  grid-column: 1 / -1;
}

.segments button,
.actions button,
.section-head button {
  min-height: 38px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.1);
  font-size: 12px;
  font-weight: 900;
}

.segments button:hover,
.actions button:hover,
.section-head button:hover {
  border-color: rgba(120, 223, 240, 0.88);
}

.segments .is-active,
.actions .primary {
  color: #071015;
  border-color: var(--teal);
  background: var(--teal);
}

.range-control {
  display: grid;
  grid-template-columns: 1fr 48px;
  gap: 8px 10px;
  align-items: center;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.range-control output {
  justify-self: end;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.range-control input {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--teal);
}

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.metrics div {
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metrics strong {
  display: block;
  margin-top: 9px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.display-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.display-options input {
  accent-color: var(--teal);
}

.hint-hud {
  left: 16px;
  bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  max-width: min(620px, calc(100vw - 32px));
  padding: 9px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  border-color: rgba(255, 255, 255, 0.26);
}

.embed-mode .control-hud,
.embed-mode .hint-hud {
  display: none;
}

.embed-mode .top-hud {
  right: 18px;
  width: auto;
  min-height: 74px;
}

.embed-mode .score strong {
  font-size: 42px;
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .demo3d {
    min-height: 940px;
    height: 100svh;
    overflow: hidden;
  }

  .top-hud {
    align-items: flex-start;
    flex-direction: column;
    width: auto;
    right: 12px;
  }

  .score {
    position: static;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    justify-items: start;
  }

  .control-hud {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 66px;
    width: auto;
    max-height: 42vh;
    overflow: auto;
  }

  .hint-hud {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
}

@media (max-width: 520px) {
  .demo3d {
    min-height: 880px;
  }

  .top-hud {
    top: 8px;
    left: 8px;
    right: 8px;
    padding: 12px;
  }

  .control-hud {
    left: 8px;
    right: 8px;
    bottom: 70px;
    padding: 12px;
  }

  .segments,
  .actions,
  .metrics {
    grid-template-columns: 1fr;
  }

  .actions .primary {
    grid-column: auto;
  }
}
