@font-face {
  font-family: "DepartureMono";
  src:
    url("/fonts/DepartureMono-Regular.woff2") format("woff2"),
    url("/fonts/DepartureMono-Regular.woff") format("woff");
}

html,
body {
  height: 100vh;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  color: aliceblue;
  background: #111111;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  font-family: "DepartureMono", monospace;
}

.title-block,
.error-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

h1 {
  font-size: clamp(28px, 9vw, 55px);
  color: #80eaff;
  margin: 0;
  line-height: 1;
}

p {
  margin: 11px 0 0 0;
  font-size: clamp(14px, 4.5vw, 22px);
}

.bg-canvas {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: -2;
  touch-action: none;
}

.bg-glow {
  pointer-events: none;
  z-index: -1;
}

.title-links {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 11px;
  justify-content: center;
}

.title-link {
  font-size: 11px;
  color: #80eaff;
  text-decoration: none;
  background: rgba(17, 17, 17, 0.5);
  padding: 2px 4px;
  transition: all 0.15s;
  white-space: nowrap;
}

.title-link:hover {
  background: aliceblue;
  color: #111111;
}

.tl-bracket {
  color: aliceblue;
}

.title-link:hover,
.title-link:hover .tl-bracket {
  color: #111111;
}

.sys-stats {
  position: fixed;
  bottom: 11px;
  left: 11px;
  font-size: 11px;
  color: rgba(240, 248, 255, 0.25);
  z-index: 10;
  pointer-events: none;
  user-select: none;
}

.title-link.title-link-main {
  color: crimson;
}

.home-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
}

.sys-stats .num {
  color: rgba(128, 234, 255, 0.7);
}

::selection,
::-moz-selection {
  background-color: #80eaff;
  color: #111111;
  text-shadow: 0 0 4px #80eaff;
}

/* ── Terminal ──────────────────────────────────── */

.terminal {
  position: relative;
  width: min(880px, 90vw);
  height: min(520px, 65vh);
  background: #111111;
  border: 1px solid rgba(128, 234, 255, 0.15);
  display: flex;
  flex-direction: column;
  font-size: 11px;
  overflow: hidden;
}

.terminal-history {
  flex: 1;
  overflow-y: auto;
  padding: 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(128, 234, 255, 0.2) transparent;
  user-select: text;
  -webkit-user-select: text;
}

.terminal-input-row {
  display: flex;
  align-items: center;
  padding: 6px 11px;
  border-top: 1px solid rgba(128, 234, 255, 0.08);
  gap: 6px;
}

.terminal-prompt {
  color: #80eaff;
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
}

.terminal-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: aliceblue;
  font-family: "DepartureMono", monospace;
  font-size: 11px;
  caret-color: #80eaff;
}

/* ── Terminal history entries ──────────────────── */

.th-in {
  background-color: #80eaff;
  color: #0d0d0d;
  padding: 0 4px;
}

.th-prompt {
  user-select: none;
  opacity: 0.6;
}

.th-out {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
  color: aliceblue;
  font-family: "DepartureMono", monospace;
  font-size: 11px;
}

.th-err {
  color: rgba(240, 100, 100, 0.85);
}

.th-timer {
  text-align: right;
  opacity: 0.5;
}

.th-ls {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
}

.th-file {
  color: #80eaff;
}

.th-dir {
  color: rgba(240, 248, 255, 0.6);
}

/* ── Syntax highlight classes (regex highlighter) ── */

.th-code .kw      { color: #80eaff; }
.th-code .str     { color: #a8d8ea; }
.th-code .num     { color: #a8d8ea; }
.th-code .cmt     { color: rgba(240, 248, 255, 0.3); }
.th-code .attr    { color: rgba(240, 248, 255, 0.5); }
.th-code .mac     { color: #80eaff; }
.th-code .life    { color: #80eaff; }

/* ── Mobile / touch ──────────────────────────────── */

@media (max-width: 600px), (pointer: coarse) {
  .terminal {
    width: 100vw;
    height: 100dvh;
    border: none;
    border-radius: 0;
  }

  .terminal-input {
    font-size: 16px; /* prevent iOS auto-zoom on focus */
  }

  .terminal-history {
    font-size: 13px;
  }

  .th-out {
    font-size: 13px;
  }

  .title-link {
    padding: 10px 14px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .sys-stats {
    bottom: max(11px, env(safe-area-inset-bottom));
  }
}

/* ── Focus indicators ────────────────────────────── */

.terminal-input:focus-visible {
  outline: 1px solid rgba(128, 234, 255, 0.4);
  outline-offset: 2px;
}

a:focus-visible {
  outline: 1px solid rgba(128, 234, 255, 0.4);
  outline-offset: 2px;
}

/* ── Reduced motion ──────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
