:root {
  --cream: #fff6e5;
  --paper: #fffdf8;
  --ink: #1d1a2f;
  --tomato: #ff5a36;
  --sun: #ffd23f;
  --border: 3px solid var(--ink);
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --radius: 16px;
  --font-display: 'Baloo 2', 'Be Vietnam Pro', system-ui, sans-serif;
  --font-body: 'Be Vietnam Pro', system-ui, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  display: flex; flex-direction: column;
  background-color: var(--cream);
  background-image: radial-gradient(rgba(29, 26, 47, 0.08) 1.2px, transparent 1.2px);
  background-size: 18px 18px;
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

.top {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.brand em { font-style: normal; color: var(--tomato); }
.brand-mark {
  width: 30px; height: 30px; border: var(--border); border-radius: 9px;
  background: linear-gradient(var(--sun) 0 55%, var(--tomato) 55% 100%);
  box-shadow: var(--shadow-sm);
}
.brand:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; border-radius: 8px; }

.online {
  margin-left: auto;
  padding: 4px 12px; border: 2px solid var(--ink); border-radius: 999px;
  background: #d8f3dc; font-weight: 800; font-size: 0.9rem; white-space: nowrap;
}
.github {
  padding: 4px 12px; border: 2px solid var(--ink); border-radius: 999px;
  background: var(--paper); color: var(--ink); font-weight: 800; font-size: 0.9rem; text-decoration: none; white-space: nowrap;
  box-shadow: 2px 2px 0 var(--ink); transition: translate 120ms var(--ease), box-shadow 120ms var(--ease);
}
.online[hidden] + .music { margin-left: auto; }
.music {
  padding: 4px 12px; border: 2px solid var(--ink); border-radius: 999px; cursor: pointer;
  background: var(--paper); color: var(--ink); font: 800 0.9rem var(--font-body); white-space: nowrap;
  box-shadow: 2px 2px 0 var(--ink); transition: translate 120ms var(--ease), box-shadow 120ms var(--ease);
}
.music[aria-pressed="true"] { background: var(--sun); }
.music:hover { translate: -1px -1px; box-shadow: 3px 3px 0 var(--ink); }
.music:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.github:hover { translate: -1px -1px; box-shadow: 3px 3px 0 var(--ink); }
.github:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
/* The ward loudspeaker: a red tag and a line of text scrolling right to left, top-left of the map. */
.loa {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  display: flex; align-items: stretch; max-width: min(620px, calc(100% - 24px));
  border: 2px solid var(--ink); border-radius: 12px; overflow: hidden;
  background: var(--paper); box-shadow: var(--shadow-sm); pointer-events: none;
}
.loa-tag {
  flex: none; display: flex; align-items: center; padding: 6px 10px;
  background: #c1121f; color: #fff6e5; font: 800 0.85rem var(--font-display); white-space: nowrap;
  border-right: 2px solid var(--ink);
}
.loa-window { flex: 1; min-width: 0; overflow: hidden; display: flex; align-items: center; }
.loa-text {
  display: inline-block; padding-left: 100%; white-space: nowrap;
  font-weight: 800; font-size: 0.95rem; color: var(--ink);
  animation: loa-scroll 16s linear infinite;
}
@keyframes loa-scroll { from { transform: translateX(0); } to { transform: translateX(-100%); } }
.clock {
  padding: 4px 14px; border: var(--border); border-radius: 999px;
  background: var(--paper); box-shadow: var(--shadow-sm);
  font-family: var(--font-display); font-weight: 800; font-size: 1.15rem;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

.stage {
  position: relative; flex: 1; min-height: 0;
  margin: 0 16px 16px; border: var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; background: #9fbf6a;
}

#street {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  cursor: grab; touch-action: none;
}
#street.dragging { cursor: grabbing; }
#street:focus-visible { outline: 4px solid var(--sun); outline-offset: -4px; }

.hint {
  position: absolute; left: 50%; bottom: 14px; translate: -50% 0; margin: 0;
  padding: 6px 14px; border: 2px solid var(--ink); border-radius: 999px;
  background: rgba(255, 253, 248, 0.92); font-weight: 700; font-size: 0.9rem;
  white-space: nowrap; pointer-events: none;
  transition: opacity 600ms var(--ease);
}
.hint.gone { opacity: 0; }

@media (max-width: 560px) {
  .top { padding: 8px 12px; }
  .brand { font-size: 1.25rem; }
  .brand-mark { width: 24px; height: 24px; }
  .clock { font-size: 1rem; padding: 2px 10px; }
  .top { flex-wrap: wrap; }
  .online, .github, .music { font-size: 0.78rem; padding: 2px 8px; }
  .loa { top: 8px; left: 8px; max-width: calc(100% - 16px); }
  .loa-tag { font-size: 0.75rem; padding: 4px 8px; }
  .loa-text { font-size: 0.85rem; }
  .stage { margin: 0 12px 12px; }
  .hint { font-size: 0.78rem; bottom: 10px; white-space: normal; width: max-content; max-width: calc(100% - 24px); text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .hint { transition: none; }
  .loa-text { animation: none; padding-left: 8px; white-space: normal; }
}
