html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #9fd3f0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
}

#stage,
#stage canvas {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
}

.hud {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  pointer-events: none;
}

.stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 17px;
  font-weight: 600;
  text-shadow: 0 1px 3px rgb(0 0 0 / 0.6);
}

#level {
  font-size: 19px;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

#view,
#mode {
  background: #3d5a73;
}

button {
  pointer-events: auto;
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  background: #e8873a;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.25);
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.controls {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  font-size: 16px;
  font-weight: 600;
  text-shadow: 0 1px 3px rgb(0 0 0 / 0.6);
}

/* Der Text darf Tipps aufs Spielfeld nicht abfangen, nur der Regler ist bedienbar */
.controls {
  pointer-events: none;
}

.controls label,
.controls input {
  pointer-events: auto;
}

.team {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

/* Dino-Köpfe als runde Symbole */
.team button {
  pointer-events: auto;
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #e8f0e0, #9fb88a);
  border: 3px solid rgb(255 255 255 / 0.85);
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.35);
  transition: transform 0.15s;
}

.team button img {
  width: 100%;
  height: 100%;
  display: block;
}

.team button[aria-pressed="true"] {
  border-color: #e8873a;
  transform: scale(1.18);
}

.team button:disabled {
  opacity: 0.5;
  cursor: default;
}

@media (prefers-reduced-motion: reduce) {
  .team button {
    transition: none;
  }
}

/* Dezentes Info-Symbol oben, öffnet die Anleitung */
.buttons .info {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.22);
  border: 1.5px solid rgb(255 255 255 / 0.6);
  box-shadow: none;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 19px;
  line-height: 1;
}

.buttons .info:hover {
  background: rgb(255 255 255 / 0.35);
}

/* Hinweis während der Kamerafahrt */
.skip {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgb(20 26 36 / 0.45);
  font-size: 14px;
  font-weight: 500;
  pointer-events: none;
}

/* Spielanleitung als Fenster */
.guide {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(15 20 30 / 0.55);
  z-index: 10;
}

.guide-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 22px 24px;
  border-radius: 14px;
  background: #f6f3ea;
  color: #24303a;
  text-shadow: none;
  font-size: 15px;
  line-height: 1.5;
  box-shadow: 0 10px 40px rgb(0 0 0 / 0.4);
}

.guide-card h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.guide-card h3 {
  margin: 14px 0 4px;
  font-size: 16px;
  color: #8a4a1f;
}

.guide-card p {
  margin: 0;
}

.guide-lead {
  color: #4a5560;
}

.guide-team {
  list-style: none;
  margin: 6px 0 8px;
  padding: 0;
  display: grid;
  gap: 6px;
}

.guide-team li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.guide-team img {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #e8f0e0, #9fb88a);
  border: 2px solid #fff;
}

#guide-close {
  display: block;
  margin: 18px auto 0;
  padding: 10px 26px;
}

#angle {
  width: min(260px, 60vw);
  accent-color: #e8873a;
}

.panel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(360px, calc(100vw - 32px));
  box-sizing: border-box;
  padding: 24px;
  border-radius: 14px;
  background: rgb(32 40 56 / 0.92);
  text-align: center;
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.35);
}

.panel h2 {
  margin: 0 0 8px;
  font-size: 26px;
}

.panel p {
  margin: 0 0 18px;
  font-size: 18px;
}

.panel-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

button.secondary {
  background: #3d5a73;
}

/* Levelauswahl */
.level-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin: 14px 0 18px;
}

.level-list button {
  display: grid;
  gap: 2px;
  padding: 12px;
  text-align: left;
  background: #fff;
  color: #24303a;
  border: 2px solid #e2dccb;
  box-shadow: none;
}

.level-list button.current {
  border-color: #e8873a;
}

.level-list button:disabled {
  opacity: 0.45;
  cursor: default;
}

.level-list .num {
  font-size: 13px;
  color: #6b7480;
}

.level-list .name {
  font-size: 16px;
}

.level-list .stars {
  font-size: 18px;
  color: #e8a41a;
  letter-spacing: 2px;
}

.loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #9fd3f0;
  font-size: 22px;
  font-weight: 600;
  color: #24405a;
}

[hidden] {
  display: none !important;
}
