/* FranticBytes BBS — 80s CRT / ANSI board */

@font-face {
  font-family: "VT323";
  src: url("../fonts/vt323/VT323-Regular.woff2") format("woff2"),
       url("../fonts/vt323/VT323-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #020805;
  --screen: #03140a;
  --green: #3dff6a;
  --green-dim: #1c8a3c;
  --green-deep: #0a3a16;
  --amber: #ffbf3c;
  --cyan: #5cf0ff;
  --magenta: #ff5ad5;
  --red: #ff5a6a;
  --white: #e9ffe9;
  --dim: #7fb88a;
  --bezel: #1a1c1a;
  --bezel-edge: #3a3d3a;
  --glow: 0 0 8px rgba(61, 255, 106, 0.45);
  --font: "VT323", "Courier New", Courier, ui-monospace, monospace;
  --line: 1.15;
  --pad: clamp(0.75rem, 3vw, 1.5rem);
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: #000;
  color: var(--green);
  font-family: var(--font);
  font-size: clamp(18px, 2.4vw, 26px);
  line-height: var(--line);
  letter-spacing: 0.02em;
}

body {
  min-height: 100dvh;
  min-height: 100vh;
}

a { color: var(--cyan); text-underline-offset: 0.15em; }
a:hover, a:focus-visible { color: var(--amber); }

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  z-index: 100;
  padding: 0.4rem 0.8rem;
  background: var(--amber);
  color: #1a1000;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform 0.15s ease;
}
.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
}

.crt {
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background:
    radial-gradient(ellipse at center, #121412 0%, #050605 55%, #000 100%);
  padding: max(0.5rem, env(safe-area-inset-top))
           max(0.5rem, env(safe-area-inset-right))
           max(0.5rem, env(safe-area-inset-bottom))
           max(0.5rem, env(safe-area-inset-left));
}

.bezel {
  width: min(920px, 100%);
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, #2a2c2a 0%, #151715 40%, #0c0d0c 100%);
  border-radius: 18px;
  padding: clamp(0.6rem, 2.2vw, 1.4rem);
  box-shadow:
    0 0 0 2px #111,
    0 0 0 4px var(--bezel-edge),
    0 24px 60px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.screen-wrap {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 2rem);
  min-height: calc(100vh - 2rem);
  background: var(--screen);
  border-radius: 8px;
  overflow: hidden;
  box-shadow:
    inset 0 0 80px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(61, 255, 106, 0.15);
  color: var(--green);
  text-shadow: var(--glow);
}

.scanlines,
.vignette {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 5;
}

.scanlines {
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.18) 0px,
    rgba(0, 0, 0, 0.18) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.55;
}

.vignette {
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.45) 100%);
}

.status-bar {
  position: relative;
  z-index: 6;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.45rem var(--pad);
  background: rgba(0, 0, 0, 0.45);
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(92, 240, 255, 0.4);
  font-size: 0.85em;
  letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(92, 240, 255, 0.25);
}

.footer-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.75rem;
  border-bottom: 0;
  border-top: 1px solid rgba(92, 240, 255, 0.25);
  color: var(--dim);
  text-shadow: none;
}
#footer-left { min-width: 0; }
#footer-right { white-space: nowrap; }

.screen {
  position: relative;
  z-index: 3;
  flex: 1;
  padding: var(--pad);
  outline: none;
  overflow: auto;
}

.panel[hidden] { display: none !important; }

.panel {
  max-width: 42rem;
  animation: fade-in 0.25s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.wordmark {
  margin: 0.2rem 0 0;
  font-size: clamp(2.2rem, 9vw, 4.4rem);
  line-height: 0.9;
  font-weight: 400;
  letter-spacing: 0.06em;
}
.wordmark .w1 { color: var(--cyan); text-shadow: 0 0 12px rgba(92, 240, 255, 0.5); }
.wordmark .w2 { color: var(--green); }

.banner-sub {
  margin: 0.35rem 0 0;
  color: var(--amber);
  text-shadow: 0 0 8px rgba(255, 191, 60, 0.4);
  letter-spacing: 0.16em;
  font-size: 0.85em;
}

.rule {
  margin: 0.45rem 0 0.9rem;
  height: 0;
  padding: 0;
  overflow: hidden;
  color: transparent;
  font-size: 0;
  border: 0;
  border-bottom: 2px solid var(--green-dim);
  box-shadow: 0 3px 0 var(--green-deep);
  max-width: 36rem;
}

.dim { color: var(--dim); text-shadow: none; }

.log {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 1em;
  min-height: 8rem;
}

.log .ok { color: var(--green); }
.log .info { color: var(--cyan); }
.log .warn { color: var(--amber); }
.log .err { color: var(--red); }
.log .magenta { color: var(--magenta); }

.block-cursor {
  display: inline-block;
  width: 0.65ch;
  height: 1em;
  background: var(--green);
  box-shadow: var(--glow);
  vertical-align: -0.1em;
  animation: blink 1.05s steps(1) infinite;
  margin-left: 0.1ch;
}

@keyframes blink {
  50% { opacity: 0; }
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.25rem;
  position: sticky;
  bottom: 0.25rem;
  z-index: 6;
}

.btn,
.menu-item,
.dl-link {
  font: inherit;
  color: var(--green);
  background: transparent;
  border: 1px solid var(--green-dim);
  padding: 0.55rem 0.9rem;
  min-height: 44px;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: 0.04em;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.btn:hover,
.btn:focus-visible,
.menu-item:hover,
.menu-item:focus-visible,
.dl-link:hover,
.dl-link:focus-visible {
  background: var(--green);
  color: var(--screen);
  text-shadow: none;
  border-color: var(--green);
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.btn-amber {
  border-color: var(--amber);
  color: var(--amber);
}
.btn-amber:hover,
.btn-amber:focus-visible {
  background: var(--amber);
  color: #1a1000;
  border-color: var(--amber);
}

.prompt-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.4rem 0 0.8rem;
  border-bottom: 2px solid var(--green-dim);
  max-width: 24rem;
  padding: 0.15rem 0;
}

.prompt { color: var(--amber); }

#handle-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  color: var(--white);
  font: inherit;
  caret-color: var(--green);
  padding: 0.35rem 0;
  outline: none;
  text-transform: uppercase;
}

#login-form label { display: block; margin-top: 0.8rem; }

.menu {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 1rem 0 0;
}

.menu-item,
.dl-link {
  width: 100%;
  text-align: left;
  justify-content: flex-start;
  align-items: flex-start;
}
.dl-link kbd { margin-top: 0.15rem; }
.menu-item kbd { margin-top: 0.05rem; }

kbd {
  font: inherit;
  color: var(--amber);
  border: 1px solid var(--amber);
  padding: 0 0.35rem;
  min-width: 1.4rem;
  text-align: center;
  text-shadow: 0 0 6px rgba(255, 191, 60, 0.35);
}

.menu-item:hover kbd,
.menu-item:focus-visible kbd,
.dl-link:hover kbd,
.dl-link:focus-visible kbd {
  color: #1a1000;
  border-color: #1a1000;
  text-shadow: none;
}

.download-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.dl-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.dl-title { color: inherit; }
.dl-notes {
  font-size: 0.85em;
  color: var(--dim);
  text-shadow: none;
  line-height: 1.25;
}
.dl-link:hover .dl-notes,
.dl-link:focus-visible .dl-notes {
  color: var(--green-deep);
}

h2 {
  margin: 0.2rem 0 0;
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  font-weight: 400;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(92, 240, 255, 0.45);
  letter-spacing: 0.08em;
}

h3 { font-weight: 400; color: var(--amber); letter-spacing: 0.08em; }

.ver {
  color: var(--amber);
  letter-spacing: 0.08em;
  font-size: 0.85em;
}

.bbs-dialog {
  width: min(28rem, calc(100vw - 2rem));
  background: var(--screen);
  color: var(--green);
  border: 2px solid var(--amber);
  box-shadow: 0 0 24px rgba(255, 191, 60, 0.25), inset 0 0 30px rgba(0, 0, 0, 0.4);
  font-family: var(--font);
  font-size: 1.15rem;
  padding: 1.1rem 1.2rem 1.2rem;
  text-shadow: var(--glow);
}
.bbs-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}
.bbs-dialog h2 {
  color: var(--amber);
  text-align: center;
  letter-spacing: 0.14em;
}
.bbs-dialog form { margin-top: 1rem; }
.bbs-dialog .btn { width: 100%; justify-content: center; }

.help-list {
  list-style: none;
  padding: 0;
  margin: 0.8rem 0 0;
}
.help-list li { margin: 0.25rem 0; }

/* Reduced motion: no flicker, no type delays (handled in JS too) */
@media (prefers-reduced-motion: reduce) {
  .block-cursor { animation: none; }
  .panel { animation: none; }
  .scanlines { opacity: 0.25; }
}

/* Tight phones: drop heavy bezel, keep the screen */
@media (max-width: 600px) {
  body { font-size: 18px; }
  .crt { padding: 0; background: var(--screen); }
  .bezel {
    width: 100%;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    background: var(--screen);
  }
  .screen-wrap {
    min-height: 100dvh;
    min-height: 100vh;
    border-radius: 0;
  }
  .status-bar { font-size: 0.75em; }
  #status-left, #footer-right { word-break: break-word; }
}

@media (min-width: 601px) {
  .screen-wrap { min-height: min(820px, calc(100dvh - 3.5rem)); }
}

h1 {
  margin: 0.2rem 0 0;
  font-size: clamp(1.6rem, 6vw, 2.6rem);
  font-weight: 400;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(92, 240, 255, 0.45);
  letter-spacing: 0.08em;
}

#login .block-cursor { display: none; }

code {
  font-family: inherit;
  color: var(--amber);
}
