@font-face {
  font-family: "Press Start 2P";
  src: url("/assets/fonts/press-start-2p.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --sand: #d9b88f;
  --sand-dark: #b8916a;
  --ink: #241a12;
  --cream: #f0e6d2;
  --water: #3e6fa8;
  --water-deep: #2c5486;
  --foam: #e8eff5;
  --amber: #d9a441;
  --red: #c23b2e;
  --bar-h: 52px;
  --bar-h-mobile: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--ink);
  overflow: hidden;
  font-family: "Press Start 2P", monospace;
}

button, a { font-family: inherit; }

/* --- top HUD bar --- */
.hud-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--bar-h);
  background: var(--ink);
  border-bottom: 4px solid var(--sand-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 20;
}

.hud-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1;
}

.hud-name {
  color: var(--cream);
  font-size: 15px;
  letter-spacing: 1px;
}

.hud-sub {
  color: var(--amber);
  font-size: 8px;
  letter-spacing: 1px;
}

.hud-links {
  display: flex;
  gap: 10px;
}

.hud-links a {
  color: var(--cream);
  text-decoration: none;
  font-size: 9px;
  padding: 6px 4px;
  white-space: nowrap;
}

.hud-links a:hover,
.hud-links a:focus-visible {
  color: var(--amber);
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* --- map area --- */
.map-wrap {
  position: fixed;
  top: var(--bar-h);
  bottom: var(--bar-h);
  left: 0;
  right: 0;
  overflow: hidden;
  background: var(--water-deep);
}

#map {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background-image: url("/assets/avatar.png");
  background-size: cover;
  background-position: center;
}

.shore-label {
  position: absolute;
  top: 16%;
  color: var(--ink);
  font-size: 9px;
  letter-spacing: 3px;
  writing-mode: vertical-rl;
  text-orientation: upright;
  opacity: 0.8;
  pointer-events: none;
  z-index: 5;
}

.shore-west { left: 10px; }
.shore-east { right: 10px; }

.compass {
  position: absolute;
  left: 14px;
  bottom: 18px;
  width: 30px;
  height: 30px;
  z-index: 5;
  pointer-events: none;
}

.compass-n {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--cream);
  font-size: 8px;
}

.compass-mark {
  position: absolute;
  left: 50%;
  top: 0;
  width: 4px;
  height: 30px;
  background: var(--cream);
  transform: translateX(-50%);
}

.compass-mark::before {
  content: "";
  position: absolute;
  left: -13px;
  top: 13px;
  width: 30px;
  height: 4px;
  background: var(--cream);
}

.compass-mark::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 13px;
  background: var(--amber);
}

.scale-bar {
  position: absolute;
  left: 58px;
  bottom: 22px;
  z-index: 5;
  pointer-events: none;
  color: var(--cream);
}

.scale-label {
  display: block;
  font-size: 7px;
  margin-bottom: 5px;
}

.scale-ticks {
  position: relative;
  width: 44px;
  height: 2px;
  background: var(--cream);
}

.scale-ticks::before,
.scale-ticks::after {
  content: "";
  position: absolute;
  top: -3px;
  width: 2px;
  height: 8px;
  background: var(--cream);
}

.scale-ticks::before { left: 0; }
.scale-ticks::after { right: 0; }

.hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  max-width: 88vw;
  text-align: center;
  color: var(--cream);
  background: rgba(36, 26, 18, 0.65);
  border: 2px solid var(--sand-dark);
  padding: 6px 10px;
  font-size: 9px;
  letter-spacing: 1px;
  pointer-events: none;
  animation: hint-fade 8s ease forwards;
}

@keyframes hint-fade {
  0% { opacity: 1; }
  75% { opacity: 1; }
  100% { opacity: 0; }
}

/* --- bottom HUD bar --- */
.hud-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bar-h);
  background: var(--ink);
  border-top: 4px solid var(--sand-dark);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px;
  z-index: 20;
  overflow-x: auto;
  white-space: nowrap;
}

.hb-ticker {
  color: var(--amber);
  font-size: 11px;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.hb-ca {
  background: transparent;
  border: 2px solid var(--sand-dark);
  color: var(--cream);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Courier New", monospace;
  font-size: 12px;
  padding: 6px 8px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

.hb-ca:hover,
.hb-ca:focus-visible {
  border-color: var(--amber);
  outline: none;
}

.hb-copied {
  position: absolute;
  top: -22px;
  left: 0;
  background: var(--amber);
  color: var(--ink);
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  padding: 3px 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.hb-copied.show {
  opacity: 1;
}

.hb-lane {
  color: var(--sand);
  font-size: 9px;
  letter-spacing: 1px;
  flex-shrink: 0;
  margin-left: auto;
}

.hb-snd {
  background: transparent;
  border: 2px solid var(--sand-dark);
  color: var(--cream);
  font-size: 9px;
  padding: 6px 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.hb-snd:hover,
.hb-snd:focus-visible {
  border-color: var(--amber);
  outline: none;
}

.hb-snd.on {
  color: var(--ink);
  background: var(--amber);
  border-color: var(--amber);
}

@media (max-width: 640px) {
  :root { --bar-h: var(--bar-h-mobile); }
  .hud-name { font-size: 12px; }
  .hud-sub { font-size: 6px; }
  .hud-links a { font-size: 8px; }
  .hb-ticker { font-size: 9px; }
  .hb-ca { font-size: 10px; }
  .hb-lane { font-size: 7px; margin-left: 0; }
  .hint { font-size: 8px; bottom: 8px; }
  .shore-label { font-size: 7px; letter-spacing: 2px; top: 10%; }
  .compass { left: 8px; bottom: 12px; width: 22px; height: 22px; }
  .compass-mark { height: 22px; }
  .compass-mark::before { width: 22px; left: -9px; top: 9px; }
  .compass-mark::after { height: 9px; }
  .compass-n { font-size: 6px; top: -13px; }
  .scale-bar { left: 40px; bottom: 15px; }
  .scale-label { font-size: 6px; }
  .scale-ticks { width: 30px; }
}

@media (max-width: 400px) {
  .hud-sub { display: none; }
  .hud-top { padding: 0 8px; }
  .hud-links { gap: 6px; }
  .hud-links a { font-size: 7px; padding: 6px 2px; }
  .hud-bottom { gap: 8px; padding: 0 8px; }
  .hb-ticker { font-size: 8px; }
  .hb-ca { font-size: 9px; padding: 5px 6px; }
  .hb-lane { font-size: 6px; }
  .hb-snd { font-size: 8px; padding: 5px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .hint { animation: none; opacity: 1; }
  .hb-copied { transition: none; }
}
