.dentist3d-card {
  overflow: hidden;
  border-color: rgb(21 186 178 / 35%);
  background:
    radial-gradient(circle at 85% 18%, rgb(104 239 225 / 35%), transparent 30%),
    var(--app-surface);
}

.game-card-flag {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.32rem 0.52rem;
  border-radius: 999px;
  color: #064e4b;
  font-size: 0.62rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  background: #6ee7dc;
  box-shadow: 0 0.35rem 0.8rem rgb(13 148 136 / 20%);
}

.dentist3d-screen {
  width: min(100%, 76rem);
  margin: 0 auto;
}

.dentist3d-shell {
  overflow: hidden;
  border: 1px solid rgb(78 90 212 / 16%);
  border-radius: clamp(1.25rem, 3vw, 2.25rem);
  background: #f7fcff;
  box-shadow: 0 1.5rem 4rem rgb(48 63 134 / 15%);
}

.dentist3d-intro {
  display: grid;
  min-height: min(43rem, calc(100dvh - 8.5rem));
  grid-template-columns: minmax(0, 1.05fr) minmax(18rem, 0.95fr);
}

.dentist3d-intro-copy {
  display: flex;
  padding: clamp(2rem, 6vw, 5rem);
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  background:
    radial-gradient(circle at 8% 5%, rgb(255 255 255 / 20%), transparent 25%),
    linear-gradient(145deg, #5556df 0%, #7854dc 55%, #944dcc 100%);
}

.dentist3d-kicker {
  display: inline-flex;
  padding: 0.42rem 0.72rem;
  border-radius: 999px;
  color: #eaffff;
  font-size: 0.7rem;
  font-weight: 950;
  letter-spacing: 0.09em;
  background: rgb(17 24 39 / 20%);
}

.dentist3d-intro h2 {
  max-width: 10ch;
  margin: 1rem 0 0.8rem;
  color: white;
  font-size: clamp(2.5rem, 6vw, 5.4rem);
  line-height: 0.9;
  letter-spacing: -0.065em;
}

.dentist3d-intro-copy > p {
  max-width: 37rem;
  margin: 0;
  color: rgb(255 255 255 / 82%);
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  line-height: 1.6;
}

.dentist3d-feature-list {
  display: grid;
  margin: 1.5rem 0;
  padding: 0;
  gap: 0.65rem;
  color: white;
  font-weight: 800;
  list-style: none;
}

.dentist3d-feature-list li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.dentist3d-feature-list span {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 0.7rem;
  background: rgb(255 255 255 / 16%);
}

.dentist3d-start {
  color: #193a49;
  background: #6ee7dc;
}

.dentist3d-intro .intro-back-button {
  margin-top: 0.7rem;
  color: rgb(255 255 255 / 76%);
}

.dentist3d-intro-art {
  position: relative;
  overflow: hidden;
  display: grid;
  min-height: 31rem;
  place-items: center;
  background:
    linear-gradient(90deg, transparent 49%, rgb(30 113 130 / 7%) 50% 51%, transparent 52%),
    linear-gradient(transparent 49%, rgb(30 113 130 / 7%) 50% 51%, transparent 52%),
    #bdf4f3;
  background-size: 4rem 4rem;
}

.dentist3d-sign {
  position: absolute;
  top: 2.2rem;
  padding: 0.55rem 1.1rem;
  border: 0.35rem solid white;
  border-radius: 0.8rem;
  color: white;
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.16em;
  background: #ef5f9a;
  box-shadow: 0 0.6rem 0 #bd3e74;
}

.dentist3d-preview-patient {
  position: relative;
  display: grid;
  width: min(78%, 23rem);
  aspect-ratio: 1.12;
  place-items: end center;
  border-radius: 48% 48% 42% 42%;
  background: #9c7ee8;
  box-shadow: inset 0 -1.5rem 0 rgb(69 42 124 / 15%), 0 2rem 3rem rgb(45 97 109 / 20%);
}

.dentist3d-preview-patient::before {
  position: absolute;
  bottom: 13%;
  width: 76%;
  height: 43%;
  border-radius: 48%;
  background: #5a254e;
  content: "";
}

.dentist3d-preview-patient > span {
  position: relative;
  z-index: 1;
  margin-bottom: 22%;
  color: white;
  font-size: clamp(1rem, 2.7vw, 1.65rem);
  letter-spacing: 0.05em;
}

.dentist3d-preview-ear {
  position: absolute;
  top: -4%;
  width: 23%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #8262d2;
}

.dentist3d-preview-ear.left {
  left: 7%;
}

.dentist3d-preview-ear.right {
  right: 7%;
}

.dentist3d-preview-eye {
  position: absolute;
  z-index: 2;
  top: 21%;
  width: 14%;
  aspect-ratio: 1;
  border: 0.4rem solid white;
  border-radius: 50%;
  background: #17162f;
}

.dentist3d-preview-eye.left {
  left: 24%;
}

.dentist3d-preview-eye.right {
  right: 24%;
}

.dentist3d-preview-tools {
  position: absolute;
  right: 1.5rem;
  bottom: 1.5rem;
  padding: 0.8rem 1rem;
  border: 0.25rem solid white;
  border-radius: 1rem;
  font-size: 1.35rem;
  background: #fff8d9;
  box-shadow: 0 0.8rem 1.8rem rgb(30 88 101 / 20%);
  transform: rotate(-4deg);
}

.dentist3d-game {
  padding: clamp(0.8rem, 2.4vw, 1.5rem);
}

.dentist3d-game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.dentist3d-game-header .dentist3d-kicker {
  gap: 0.25rem;
  color: #4c3db8;
  background: #e9e7ff;
}

.dentist3d-game-header h2 {
  margin: 0.45rem 0 0;
  color: #252553;
  font-size: clamp(1.25rem, 3vw, 2rem);
  letter-spacing: -0.035em;
}

.dentist3d-health {
  display: grid;
  min-width: 7.5rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid #c6eee9;
  border-radius: 1rem;
  text-align: center;
  background: #e9fffb;
}

.dentist3d-health > span {
  color: #357673;
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0.09em;
}

.dentist3d-health strong {
  color: #167c74;
  font-size: 1.45rem;
  line-height: 1;
}

.dentist3d-stage {
  position: relative;
  overflow: hidden;
  height: clamp(20rem, 54dvh, 36rem);
  border: 1px solid rgb(68 129 161 / 18%);
  border-radius: clamp(1rem, 3vw, 1.8rem);
  background: #bceef3;
  box-shadow: inset 0 0 0 0.35rem rgb(255 255 255 / 42%);
  touch-action: manipulation;
}

.dentist3d-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

.dentist3d-loading {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.6rem;
  color: #414595;
  font-weight: 900;
  text-align: center;
  background: #dffbff;
}

.dentist3d-loading span {
  font-size: 3rem;
  animation: dentist3d-bob 800ms ease-in-out infinite alternate;
}

.dentist3d-targets {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
}

.dentist3d-tooth-target {
  position: absolute;
  width: clamp(2.65rem, 9vw, 3.8rem);
  height: clamp(2.65rem, 9vw, 3.8rem);
  padding: 0;
  border: 0.18rem solid white;
  border-radius: 50%;
  color: white;
  background: rgb(239 86 133 / 24%);
  box-shadow:
    0 0 0 0.28rem rgb(239 86 133 / 45%),
    0 0 1.2rem rgb(239 86 133 / 55%);
  cursor: pointer;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  animation: dentist3d-pulse 1s ease-in-out infinite alternate;
}

.dentist3d-tooth-target::after {
  font-size: 1.15rem;
  content: "+";
}

.dentist3d-tooth-target:hover,
.dentist3d-tooth-target:focus-visible {
  outline: 0.22rem solid #fbbf24;
  outline-offset: 0.2rem;
  background: rgb(239 86 133 / 42%);
}

.dentist3d-patient-bubble {
  position: absolute;
  z-index: 2;
  top: 0.9rem;
  left: 0.9rem;
  max-width: min(14rem, 52%);
  padding: 0.6rem 0.8rem;
  border: 0.2rem solid #5146b9;
  border-radius: 1rem 1rem 1rem 0.25rem;
  color: #312b7b;
  font-size: clamp(0.72rem, 2vw, 0.9rem);
  font-weight: 850;
  background: white;
  box-shadow: 0 0.55rem 1.2rem rgb(43 63 104 / 18%);
}

.dentist3d-complete {
  position: absolute;
  z-index: 7;
  inset: 0;
  display: grid;
  padding: 2rem;
  place-content: center;
  justify-items: center;
  color: #29245f;
  text-align: center;
  background: rgb(224 255 249 / 91%);
  backdrop-filter: blur(0.45rem);
}

.dentist3d-complete[hidden],
.dentist3d-loading[hidden] {
  display: none;
}

.dentist3d-complete-icon {
  font-size: clamp(3.5rem, 10vw, 6rem);
  filter: drop-shadow(0 0.7rem 0.5rem rgb(72 70 140 / 22%));
  animation: dentist3d-bob 700ms ease-in-out infinite alternate;
}

.dentist3d-complete h3 {
  margin: 0.5rem 0 0;
  font-size: clamp(2rem, 6vw, 3.5rem);
  letter-spacing: -0.05em;
}

.dentist3d-complete p {
  max-width: 28rem;
  margin: 0.35rem 0 1rem;
  line-height: 1.5;
}

.dentist3d-message {
  min-height: 1.5rem;
  margin: 0.8rem 0;
  color: #4b4b74;
  font-weight: 800;
  text-align: center;
}

.dentist3d-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.45rem, 1.5vw, 0.8rem);
}

.dentist3d-tool {
  display: grid;
  min-height: 5.4rem;
  padding: 0.6rem;
  border: 0.15rem solid #d9dced;
  border-radius: 1.15rem;
  place-items: center;
  color: #4d4e77;
  font: inherit;
  background: white;
  box-shadow: 0 0.4rem 0.9rem rgb(54 59 101 / 8%);
  cursor: pointer;
}

.dentist3d-tool > span {
  font-size: clamp(1.45rem, 4vw, 2rem);
}

.dentist3d-tool strong {
  font-size: clamp(0.78rem, 2vw, 1rem);
}

.dentist3d-tool small {
  color: #8585a0;
  font-size: 0.68rem;
  font-weight: 800;
}

.dentist3d-tool.is-selected {
  border-color: #655ce4;
  color: #3f38a4;
  background: #eeedff;
  box-shadow: 0 0 0 0.2rem rgb(101 92 228 / 15%);
  transform: translateY(-0.12rem);
}

.dentist3d-tool:focus-visible {
  outline: 0.22rem solid #fbbf24;
  outline-offset: 0.15rem;
}

.dentist3d-actions {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 0.8rem;
}

.dentist3d-actions .action-button {
  min-width: 0;
}

.dentist3d-stage.is-wrong {
  animation: dentist3d-shake 260ms ease;
}

.dentist3d-fallback {
  min-height: 32rem;
  padding: 2rem;
  place-content: center;
  justify-items: center;
  color: #3b376f;
  text-align: center;
  background: #eafcff;
}

.dentist3d-fallback:not([hidden]) {
  display: grid;
}

.dentist3d-fallback > span {
  font-size: 4rem;
}

.dentist3d-fallback h2 {
  max-width: 24ch;
  margin: 0.6rem 0;
}

.dentist3d-fallback p {
  max-width: 34rem;
  margin: 0 0 1rem;
}

html[data-theme="dark"] .dentist3d-shell,
html[data-theme="dark"] .dentist3d-game {
  background: #171a2e;
}

html[data-theme="dark"] .dentist3d-game-header h2,
html[data-theme="dark"] .dentist3d-message {
  color: #f1f2ff;
}

html[data-theme="dark"] .dentist3d-health {
  border-color: #286964;
  background: #173d3a;
}

html[data-theme="dark"] .dentist3d-health > span,
html[data-theme="dark"] .dentist3d-health strong {
  color: #82e9dd;
}

html[data-theme="dark"] .dentist3d-tool {
  border-color: #363b5d;
  color: #e9e9f8;
  background: #222640;
}

html[data-theme="dark"] .dentist3d-tool.is-selected {
  border-color: #8f87ff;
  color: white;
  background: #39366d;
}

@keyframes dentist3d-pulse {
  to {
    box-shadow:
      0 0 0 0.4rem rgb(239 86 133 / 30%),
      0 0 1.5rem rgb(239 86 133 / 65%);
    transform: translate(-50%, -50%) scale(1.08);
  }
}

@keyframes dentist3d-bob {
  to {
    transform: translateY(-0.4rem) rotate(3deg);
  }
}

@keyframes dentist3d-shake {
  25% {
    transform: translateX(-0.35rem);
  }

  75% {
    transform: translateX(0.35rem);
  }
}

@media (max-width: 48rem) {
  .dentist3d-intro {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .dentist3d-intro-copy {
    padding: 2rem 1.35rem;
  }

  .dentist3d-intro h2 {
    max-width: 12ch;
    font-size: clamp(2.45rem, 12vw, 4rem);
  }

  .dentist3d-intro-art {
    min-height: 20rem;
  }

  .dentist3d-preview-patient {
    width: min(68%, 18rem);
  }

  .dentist3d-game-header {
    align-items: flex-end;
  }

  .dentist3d-stage {
    height: clamp(20rem, 51dvh, 29rem);
  }

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

@media (max-width: 23rem) {
  .dentist3d-game {
    padding: 0.55rem;
  }

  .dentist3d-game-header h2 {
    font-size: 1.1rem;
  }

  .dentist3d-health {
    min-width: 6.4rem;
    padding: 0.5rem;
  }

  .dentist3d-stage {
    height: 18.5rem;
  }

  .dentist3d-tool {
    min-height: 4.8rem;
  }

  .dentist3d-tool small {
    display: none;
  }
}

@media (orientation: landscape) and (max-height: 36rem) {
  .dentist3d-stage {
    height: 68dvh;
    min-height: 17rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dentist3d-loading span,
  .dentist3d-complete-icon,
  .dentist3d-tooth-target {
    animation: none;
  }

  .dentist3d-tool.is-selected {
    transform: none;
  }
}
