:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: #10233d;
  --panel-2: #183452;
  --text: #f3f8ff;
  --muted: #9fb2c8;
  --accent: #44c2ff;
  --accent-2: #8b5cf6;
  --success: #2dd4bf;
  --danger: #f87171;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, var(--bg), #0e1b2b);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overscroll-behavior: none;
}

body.standalone-app {
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.hero {
  padding: 1.25rem 1.25rem 3rem;
  background: radial-gradient(circle at top, rgba(68, 194, 255, 0.24), transparent 44%), linear-gradient(135deg, rgba(7, 17, 31, 0.98), rgba(14, 27, 43, 0.94));
}

.topbar {
  max-width: 1100px;
  margin: 0 auto 1.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.95rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(14px);
}

.brand-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-badge {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.topbar-btn {
  text-decoration: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.8rem 1rem;
  border-radius: 999px;
  font-weight: 700;
}

.hero-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 2.25rem 1rem 1rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0 0 0.75rem;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3.1rem);
}

.hero p {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 680px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.app-btn {
  background: rgba(68, 194, 255, 0.16);
  border: 1px solid rgba(68, 194, 255, 0.2);
}

.primary-btn,
.secondary-btn,
.option-btn {
  border: none;
  border-radius: 999px;
  padding: 0.8rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  display: inline-block;
}

.primary-btn {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #02121d;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.install-btn {
  background: rgba(68, 194, 255, 0.14);
  border: 1px solid rgba(68, 194, 255, 0.28);
  color: var(--text);
}

.primary-btn:hover,
.secondary-btn:hover,
.option-btn:hover {
  transform: translateY(-2px);
}

.section {
  max-width: 1100px;
  margin: 0 auto 3rem;
  padding: 1.25rem;
}

.launch-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.35rem;
  border-radius: 1.2rem;
  background: linear-gradient(135deg, rgba(16, 35, 61, 0.95), rgba(24, 52, 82, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
}

.launch-card p {
  color: var(--muted);
  margin: 0;
}

.section-heading {
  margin-bottom: 1rem;
}

.systems-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.system-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  padding: 1rem;
  cursor: pointer;
}

.system-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.system-card h3 {
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.system-card p {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
}

.detail-card {
  background: rgba(16, 35, 61, 0.8);
  border-radius: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1.2rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.system-image-wrap {
  margin: 1rem 0 1.2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 1rem;
  padding: 0.8rem;
}

.system-image-container {
  position: relative;
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  border-radius: 0.9rem;
}

.system-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0.9rem;
  object-fit: contain;
  background: #ffffff;
  padding: 0.25rem;
  transform-origin: center center;
}

.zoom-controls {
  margin-top: 0.8rem;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.zoom-controls button {
  min-width: 44px;
  min-height: 38px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
}

.zoom-controls input[type="range"] {
  width: 160px;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.modal.open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.modal-content {
  position: relative;
  width: min(92vw, 720px);
  padding: 1rem;
  border-radius: 1rem;
  background: rgba(10, 18, 32, 0.98);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  z-index: 1;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
}

.modal-image-box {
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 1rem;
  padding: 0.8rem;
  overflow: hidden;
  max-height: 65vh;
}

.modal-zoom-controls {
  margin-top: 1rem;
  position: relative;
  z-index: 2;
}

.system-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 0.9rem;
  object-fit: contain;
  background: #ffffff;
  padding: 0.25rem;
  transform-origin: center center;
  cursor: pointer;
  position: relative;
  z-index: 1;
}
.modal-image-box img {
  pointer-events: none;
}

.system-image.clickable:hover {
  filter: brightness(1.05);
}

.system-image-wrap { position: relative; }

.overlay-highlights {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.overlay {
  position: absolute;
  background: rgba(139,92,246,0.22);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
  display: none;
  pointer-events: none;
}

.highlight-cranio { top: 8%; left: 32%; width: 36%; height: 18%; display: none; }
.highlight-torax { top: 24%; left: 26%; width: 48%; height: 26%; display: none; }
.highlight-coluna { top: 28%; left: 42%; width: 16%; height: 54%; display: none; }
.highlight-ombro { top: 20%; left: 18%; width: 14%; height: 16%; display: none; }
.highlight-braco { top: 34%; left: 12%; width: 14%; height: 36%; display: none; }
.highlight-antebraco { top: 42%; left: 8%; width: 12%; height: 30%; display: none; }
.highlight-mao { top: 66%; left: 6%; width: 12%; height: 18%; display: none; }
.highlight-pelve { top: 58%; left: 34%; width: 32%; height: 16%; display: none; }
.highlight-coxa { top: 70%; left: 28%; width: 16%; height: 18%; display: none; }
.highlight-perna { top: 78%; left: 28%; width: 12%; height: 20%; display: none; }
.highlight-pe { top: 90%; left: 26%; width: 44%; height: 10%; display: none; }

.bones-sidebar {
  position: fixed;
  right: 18px;
  top: 80px;
  width: 360px;
  max-height: 72vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 1rem;
  border-radius: 12px;
  z-index: 1200;
}

.bones-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

#boneSearch {
  width: 100%;
  padding: 0.6rem;
  margin: 0.6rem 0 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  color: var(--text);
}

.bones-list {
  display: grid;
  gap: 0.5rem;
}

.bone-item {
  padding: 0.6rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: background 0.12s ease;
}
.bone-item:hover { background: rgba(255,255,255,0.04); }
.bone-item h5 { margin: 0 0 0.2rem; font-size: 0.95rem; }
.bone-item p { margin: 0; color: var(--muted); font-size: 0.86rem; }

.detail-card ul {
  margin: 0.6rem 0 0;
  padding-left: 1.15rem;
  color: var(--muted);
}

.detail-card li + li {
  margin-top: 0.35rem;
}

.detail-card li strong {
  color: var(--text);
}

.map-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1rem;
  align-items: center;
}

.body-svg {
  width: 100%;
  max-width: 360px;
  justify-self: center;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
  border-radius: 1.2rem;
}

.body-part {
  cursor: pointer;
  transition: transform 0.15s ease;
}

.body-part:hover {
  transform: scale(1.02);
}

.body-part circle,
.body-part rect {
  fill: rgba(68, 194, 255, 0.18);
  stroke: var(--accent);
  stroke-width: 2;
}

.body-part.active circle,
.body-part.active rect {
  fill: rgba(139, 92, 246, 0.3);
  stroke: var(--accent-2);
}

.body-part text {
  fill: var(--text);
  font-size: 11px;
  font-weight: 600;
}

.quiz-card {
  background: var(--panel);
  border-radius: 1.2rem;
  padding: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.quiz-topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.quiz-label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.quiz-select {
  min-width: min(100%, 280px);
  padding: 0.7rem 0.9rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.quiz-meta {
  margin: 0.5rem 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.quiz-progress {
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.7rem;
}

.options-grid {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.option-btn {
  text-align: left;
  background: var(--panel-2);
  color: var(--text);
}

.option-btn.correct {
  background: rgba(45, 212, 191, 0.18);
  border: 1px solid rgba(45, 212, 191, 0.45);
}

.option-btn.incorrect {
  background: rgba(248, 113, 113, 0.16);
  border: 1px solid rgba(248, 113, 113, 0.42);
}

.feedback {
  min-height: 1.5rem;
  margin-top: 0.8rem;
  color: var(--muted);
}

.quiz-hint {
  min-height: 1.5rem;
  margin: 0.75rem 0 0;
  color: #c9f5ff;
  font-size: 0.95rem;
}

#quizResult {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 1rem;
  background: rgba(68, 194, 255, 0.12);
}

@media (max-width: 760px) {
  .map-layout {
    grid-template-columns: 1fr;
  }
}
