* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #0d1117; color: #e8ecf3; overflow: hidden;
}
#map { position: absolute; inset: 0; width: 100%; height: 100%; background: #1a1f27; }

/* ---- HUD overlay on library pages ---- */
#hud {
  position: absolute; top: 12px; left: 12px; z-index: 10;
  width: 340px; max-width: calc(100vw - 24px);
  background: rgba(16,20,28,.92); border: 1px solid #222b36; border-radius: 12px;
  padding: 14px 16px; backdrop-filter: blur(8px);
  box-shadow: 0 10px 40px rgba(0,0,0,.45);
}
#hud.good { border-color: #1f6e42; } #hud.ok { border-color: #7a5a1c; } #hud.bad { border-color: #7a2530; }
.hud-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.hud-lib { font-size: 18px; font-weight: 800; }
.hud-strategy { font-size: 12px; color: #8a94a6; }
.bar { height: 6px; background: #222b36; border-radius: 4px; margin: 10px 0; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: linear-gradient(90deg,#3aa0ff,#37d67a); transition: width .1s linear; }
.hud-status { font-size: 12px; color: #b7c0d0; min-height: 16px; }
.hud-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-top: 12px; }
.stat { background: #12171f; border: 1px solid #1e2732; border-radius: 8px; padding: 8px 6px; text-align: center; }
.stat-val { font-size: 20px; font-weight: 800; }
.stat-lab { font-size: 10px; color: #8a94a6; text-transform: uppercase; letter-spacing: .04em; }
.hud-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 8px 12px; border-radius: 8px; text-decoration: none;
  background: #1c2634; color: #e8ecf3; font-size: 13px; font-weight: 600; border: 1px solid #2a3644;
}
.btn:hover { background: #243040; }
.countdown { color: #8a94a6; font-weight: 400; }
.warn { position: absolute; top: 12px; right: 12px; z-index: 10; max-width: 320px;
  background: rgba(122,37,48,.9); border: 1px solid #a33; border-radius: 10px; padding: 12px 14px; font-size: 13px; }

/* ---- index / landing ---- */
.wrap { position: absolute; inset: 0; overflow: auto; padding: 32px; }
.container { max-width: 860px; margin: 0 auto; }
h1 { font-size: 28px; margin: 0 0 4px; }
.sub { color: #8a94a6; margin: 0 0 24px; }
.device-card { background: #161b22; border: 1px solid #222b36; border-radius: 12px; padding: 16px 18px; margin-bottom: 24px; font-size: 13px; }
.device-card b { color: #b7c0d0; }
.device-line { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid #1a212b; }
.device-line:last-child { border-bottom: 0; }
.profile-sel { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.profile-label { font-size: 12px; color: #8a94a6; text-transform: uppercase; letter-spacing: .04em; margin-right: 4px; }
.pbtn { padding: 8px 14px; border-radius: 999px; border: 1px solid #2a3644; background: #12171f; color: #b7c0d0;
  font-size: 13px; font-weight: 600; cursor: pointer; }
.pbtn:hover { background: #1a212b; }
.pbtn.active { background: linear-gradient(90deg,#3aa0ff,#37d67a); color: #06121f; border-color: transparent; }
.profile-hint { font-size: 12px; color: #8a94a6; line-height: 1.5; margin-bottom: 16px; min-height: 32px; }
.lib.disabled { opacity: .45; pointer-events: none; }
.lib .tag.no3d { background: #3a1f24; color: #ff9aa6; margin-left: 6px; }
.suite-btn { display: block; width: 100%; text-align: center; padding: 14px; font-size: 16px; font-weight: 700;
  background: linear-gradient(90deg,#3aa0ff,#37d67a); color: #06121f; border: 0; border-radius: 12px; cursor: pointer; margin-bottom: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(240px,1fr)); gap: 12px; }
.lib { display: block; background: #161b22; border: 1px solid #222b36; border-radius: 12px; padding: 16px; text-decoration: none; color: inherit; }
.lib:hover { border-color: #3a4656; background: #1a212b; }
.lib h3 { margin: 0 0 4px; font-size: 16px; }
.lib .st { font-size: 12px; color: #8a94a6; }
.lib .tag { display: inline-block; margin-top: 8px; font-size: 11px; padding: 2px 8px; border-radius: 20px; background: #12304a; color: #7fc0ff; }
.lib .tag.raster { background: #17351f; color: #7fe0a0; }
.lib .tag.control { background: #3a2a12; color: #f0c070; }
.foot { margin-top: 24px; font-size: 12px; color: #5b6472; line-height: 1.6; }
.foot code { background: #12171f; padding: 1px 5px; border-radius: 4px; }
