* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --panel: rgba(8, 14, 24, 0.9);
  --border: rgba(162, 220, 255, 0.3);
  --accent: #7fe8ff;
  --accent-2: #9fffb4;
  --text: #edf6ff;
  --muted: #a2c9da;
}

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(51, 126, 161, 0.45), transparent 38%),
    radial-gradient(circle at 20% 20%, rgba(72, 189, 142, 0.18), transparent 30%),
    #02060b;
  font-family: "Courier New", monospace;
  color: var(--text);
}

#hypercraft-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#mode-select {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(3, 10, 18, 0.42), rgba(3, 10, 18, 0.75));
  z-index: 1000;
}

#mode-panel {
  width: min(860px, calc(100vw - 48px));
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
  border-radius: 18px;
  padding: 34px;
}

#mode-logo {
  font-size: clamp(32px, 5vw, 46px);
  font-weight: 700;
  letter-spacing: 5px;
}

#mode-tagline {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
}

#seed-controls {
  margin-top: 24px;
  display: grid;
  gap: 10px;
}

#seed-controls label {
  color: var(--accent);
  font-size: 14px;
}

.seed-row {
  display: flex;
  gap: 12px;
}

#seed-input,
#regen-seed {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(11, 21, 34, 0.9);
  color: var(--text);
  font: inherit;
}

#seed-input {
  flex: 1;
  padding: 12px 14px;
}

#regen-seed {
  padding: 12px 14px;
  cursor: pointer;
  min-width: 120px;
}

#mode-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.mode-btn {
  text-align: left;
  background:
    linear-gradient(180deg, rgba(18, 32, 51, 0.92), rgba(10, 18, 30, 0.92));
  border: 1px solid rgba(110, 187, 255, 0.22);
  border-radius: 16px;
  padding: 22px 18px;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
  transition: transform 0.15s ease-out, border-color 0.15s ease-out, background 0.15s ease-out;
}

.mode-btn:focus-visible,
#regen-seed:focus-visible,
#seed-input:focus-visible,
.hotbar-slot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (hover: hover) {
  .mode-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(127, 232, 255, 0.76);
    background: linear-gradient(180deg, rgba(26, 47, 73, 0.96), rgba(11, 24, 39, 0.96));
  }
}

.mode-icon {
  font-size: 38px;
}

.mode-title {
  margin-top: 14px;
  font-size: 20px;
  color: var(--accent-2);
}

.mode-desc {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

#mode-help {
  margin-top: 18px;
  color: #86aab9;
  font-size: 13px;
}

#hud {
  position: fixed;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 14px;
  z-index: 200;
  pointer-events: none;
}

#hud span {
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(8, 15, 25, 0.72);
  border: 1px solid rgba(143, 206, 255, 0.16);
}

.hud-hidden {
  display: none !important;
}

#hud-hp { color: #ff7f9a; }
#hud-mode { color: var(--accent-2); }
#hud-coords { color: #a7cbe0; }
#hud-spirits { color: #ffe194; }
#hud-seed { color: var(--accent); }
#hud-ammo { color: #ffdb8a; }
#hud-tool { color: #d8b5ff; }

#mission-panel {
  position: fixed;
  left: 14px;
  bottom: 86px;
  z-index: 205;
  width: min(420px, calc(100vw - 28px));
  padding: 14px 16px;
  border: 1px solid rgba(143, 206, 255, 0.2);
  border-radius: 14px;
  background: rgba(8, 15, 25, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

#mission-title {
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.18em;
}

#mission-copy {
  margin-top: 6px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

#hotbar {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 210;
  display: grid;
  grid-template-columns: repeat(8, minmax(58px, 1fr));
  gap: 8px;
  width: min(720px, calc(100vw - 24px));
}

.hotbar-slot {
  min-height: 54px;
  border: 1px solid rgba(143, 206, 255, 0.2);
  border-radius: 10px;
  background:
    linear-gradient(rgba(8, 15, 25, 0.78), rgba(8, 15, 25, 0.78)),
    url("/assets/third-party/cubyz/ui/inventory/hotbar_slot.png") center / 100% 100%;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  display: grid;
  grid-template-columns: 15px 28px 1fr;
  gap: 2px 6px;
  align-items: center;
  padding: 7px;
  text-align: left;
  min-width: 0;
}

.hotbar-slot span {
  color: var(--accent);
  font-size: 11px;
}

.hotbar-slot i {
  width: 26px;
  height: 26px;
  grid-row: 1 / 3;
  grid-column: 2;
  border-radius: 4px;
  background-size: cover;
  background-position: center;
  image-rendering: pixelated;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.hotbar-slot strong {
  grid-column: 3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  text-transform: uppercase;
}

.hotbar-slot em {
  grid-column: 3;
  color: var(--accent-2);
  font-style: normal;
  font-size: 12px;
}

.hotbar-slot.selected {
  border-color: rgba(159, 255, 180, 0.8);
  box-shadow: 0 0 22px rgba(127, 232, 255, 0.2);
}

#crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 180;
  background: url("/assets/third-party/cubyz/ui/hud/crosshair.png") center / contain no-repeat;
  image-rendering: pixelated;
}

#crosshair::before,
#crosshair::after {
  content: none;
  position: absolute;
  background: rgba(240, 248, 255, 0.85);
  box-shadow: 0 0 10px rgba(127, 232, 255, 0.4);
}

#crosshair::before {
  left: 8px;
  top: 1px;
  width: 2px;
  height: 16px;
}

#crosshair::after {
  top: 8px;
  left: 1px;
  width: 16px;
  height: 2px;
}

@media (max-width: 780px) {
  #mode-panel {
    padding: 22px;
  }

  #mode-grid {
    grid-template-columns: 1fr;
  }

  .seed-row {
    flex-direction: column;
  }

  #regen-seed {
    width: 100%;
  }

  #hotbar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #mission-panel {
    bottom: 142px;
  }
}

@media (max-width: 1120px) and (min-width: 781px) {
  #mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .mode-btn,
  .hotbar-slot {
    transition: none;
  }
}
