/* YOU STILL DOWN BROS. — few colors, pixel shapes, no scroll. */

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

:root {
  --sky: #3c44c8;
  --ink: #141038;
  --sign: #b83c00;
  --sign-dark: #7a2400;
  --sign-light: #e45c10;
  --cream: #f8e0a0;
  --white: #f8f8f8;
  --lamp: #f8d878;
  --ad: rgba(20, 16, 56, 0.35);
  --px: 4px;
  --font: "Press Start 2P", "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--sky);
  color: var(--white);
  font-family: var(--font);
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  -webkit-text-size-adjust: 100%;
}

#scene {
  position: fixed;
  left: 0;
  top: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  z-index: 0;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---- layout: ad rail | stage | ad rail ---- */

.layout {
  position: relative;
  z-index: 1;
  height: 100%;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 720px) minmax(0, 1fr);
  grid-template-rows: 100%;
  gap: 0 8px;
  padding: 0 8px;
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  min-height: 0;
  padding: max(8px, env(safe-area-inset-top)) 0 max(8px, env(safe-area-inset-bottom));
}

/* ---- ad slots: reserved, honest, unobtrusive ---- */

.ad {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
  padding-top: 56px;
}
.ad-box {
  width: 160px;
  height: 600px;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgba(248, 248, 248, 0.25);
  background: var(--ad);
  color: rgba(248, 248, 248, 0.4);
  font-size: 10px;
  letter-spacing: 2px;
}

/* ---- HUD ---- */

.hud {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 2px 4px;
  font-size: 12px;
  line-height: 1;
  text-shadow: 2px 2px 0 var(--ink);
  white-space: nowrap;
}
.hud-label { color: var(--cream); }
.hud-right time { font-variant-numeric: tabular-nums; }

/* ---- the sign ---- */

.sign {
  width: min(100%, 560px);
  margin: clamp(10px, 4vh, 40px) auto 0;
  padding: 14px 16px 16px;
  background: var(--sign);
  border: var(--px) solid var(--ink);
  box-shadow:
    inset 0 0 0 var(--px) var(--sign-light),
    inset 0 0 0 calc(var(--px) * 2) var(--sign-dark),
    var(--px) var(--px) 0 var(--ink);
}

.title {
  margin: 0 0 12px;
  line-height: 1;
  color: var(--cream);
  text-shadow: 3px 3px 0 var(--ink);
}
.title span { display: block; }
.t-small {
  font-size: clamp(10px, 2.2vw, 16px);
  margin: 0 0 8px 2px;
  letter-spacing: 1px;
}
.t-big {
  font-size: clamp(22px, 6.4vw, 44px);
  color: var(--white);
  white-space: nowrap;
  letter-spacing: 0;
}
.t-big .t-down,
.t-big .t-bros { display: inline; letter-spacing: 0; }

/* ---- input + menu ---- */

.check { display: block; }

.field {
  display: flex;
  align-items: center;
  background: var(--ink);
  border: var(--px) solid var(--white);
  padding: 0 6px;
}
.field-prefix {
  color: var(--cream);
  font-size: 14px;
  padding-right: 6px;
}
#url {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--white);
  font: inherit;
  font-size: 14px;
  padding: 11px 0;
  caret-color: var(--cream);
}
#url::placeholder { color: rgba(248, 248, 248, 0.35); }
.field:focus-within { border-color: var(--cream); }

.menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}
.menu-item {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 6px 4px;
  color: var(--white);
  font: inherit;
  font-size: 12px;
  line-height: 1;
  text-align: left;
  text-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.menu-item .cursor { visibility: hidden; color: var(--cream); font-size: 10px; width: 12px; }
.menu-item:hover .cursor,
.menu-item:focus-visible .cursor,
.menu-item.is-active .cursor { visibility: visible; }
.menu-item:focus-visible { outline: 0; }
.menu-item:disabled { cursor: progress; opacity: 0.8; }

/* ---- result ---- */

.result {
  margin: 14px 0 0;
  min-height: 1em;
  font-size: 13px;
  line-height: 1.5;
  color: var(--cream);
  text-shadow: 2px 2px 0 var(--ink);
}
.result:empty { margin-top: 0; min-height: 0; }
body[data-status="up"] .result { color: var(--lamp); }
body[data-status="down"] .result { color: var(--white); }
body[data-status="busy"] .result::after {
  content: "";
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  margin-left: 6px;
  background: var(--cream);
  animation: blink 0.6s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.detail {
  margin: 6px 0 0;
  font-size: 9px;
  line-height: 1.6;
  color: var(--cream);
  opacity: 0.9;
  text-shadow: 1px 1px 0 var(--ink);
  overflow-wrap: anywhere;
}
.detail:empty { margin: 0; }

/* ---- footer ---- */

.foot {
  margin-top: auto;
  font-size: 8px;
  line-height: 1.4;
  text-align: center;
  color: var(--cream);
  text-shadow: 1px 1px 0 var(--ink);
  opacity: 0.9;
  padding: 4px 8px;
}
.foot-sep { padding: 0 6px; }

/* ---- narrow screens: rails collapse, one banner at the bottom ---- */

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 100%;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 0;
    padding: 0 12px;
  }
  .ad-a { display: none; }
  .ad-b { align-items: center; padding: 4px 0 max(4px, env(safe-area-inset-bottom)); }
  .ad-b .ad-box { width: 320px; max-width: 100%; height: 50px; }
  .foot { display: none; }
}

@media (max-width: 600px) {
  .sign { padding: 12px 12px 12px; margin-top: clamp(6px, 3vh, 24px); }
  .t-small { font-size: 10px; margin-bottom: 7px; }
  .t-big { font-size: clamp(22px, 8.6vw, 34px); }
  .hud { font-size: 10px; }
  #url { font-size: 12px; padding: 10px 0; }
  .menu-item { font-size: 9px; }
  .result { font-size: 11px; }
}

@media (max-height: 560px) {
  .sign { margin-top: 6px; padding-top: 10px; padding-bottom: 10px; }
  .title { margin-bottom: 8px; }
  .menu { margin-top: 8px; gap: 2px; }
  .result { margin-top: 8px; }
  .detail { margin-top: 4px; font-size: 8px; line-height: 1.4; }
}

@media (prefers-reduced-motion: reduce) {
  body[data-status="busy"] .result::after { animation: none; }
}
