:root {
  --brown: #7f4f24;
  --navy: #0d1b2a;
  --burgundy: #540b0e;
  --charcoal: #212529;
  --paper: #f4f1ea;
  --white: #f8f7f4;
  --muted: #8d9aa7;
  --terminal-green: #b6cbb4;
  --ring-size: 180px;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--paper);
  color: var(--white);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 2px solid #c99a6b;
  outline-offset: 5px;
}

.loading-screen {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
  background: var(--navy);
  opacity: 1;
  visibility: visible;
  transition:
    opacity 650ms ease,
    visibility 650ms ease;
}

.loading-screen.is-finished {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-content {
  width: min(100%, 390px);
  margin: auto;
}

.welcome-ring {
  position: relative;
  display: grid;
  width: var(--ring-size);
  aspect-ratio: 1;
  margin: 0 auto 26px;
  place-items: center;
}

.progress-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: rotate(-90deg);
}

.ring-track,
.ring-progress {
  fill: none;
  stroke-width: 1.5;
}

.ring-track {
  stroke: #2b3a49;
}

.ring-progress {
  stroke: var(--paper);
  stroke-linecap: round;
  stroke-dasharray: 515.22;
  stroke-dashoffset: 515.22;
}

.loading-screen.is-running .ring-progress {
  animation: ring-fill 8s linear forwards;
}

@keyframes ring-fill {
  to {
    stroke-dashoffset: 0;
  }
}

.welcome-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  color: var(--white);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 25px;
  letter-spacing: -0.045em;
}

#welcome-word {
  width: 7ch;
  text-align: center;
}

.cursor {
  display: inline-block;
  width: 2px;
  height: 23px;
  margin-left: 4px;
  background: var(--brown);
  vertical-align: -4px;
  animation: cursor-blink 700ms steps(2, start) infinite;
}

@keyframes cursor-blink {
  to {
    visibility: hidden;
  }
}

.terminal {
  overflow: hidden;
  border: 1px solid #2b3a49;
  border-radius: 5px;
  background: #101820;
  box-shadow: 0 18px 60px rgb(0 0 0 / 12%);
}

.terminal-header {
  display: flex;
  min-height: 39px;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border-bottom: 1px solid #293746;
}

.terminal-dots {
  display: flex;
  gap: 5px;
}

.terminal-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #586574;
}

.terminal-title,
.terminal-status {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.07em;
}

.terminal-status {
  margin-left: auto;
  color: #c79b6b;
}

.terminal-output {
  height: 170px;
  min-height: 170px;
  padding: 13px;
  overflow-y: auto;
  overflow-x: hidden;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  line-height: 1.95;
}

.terminal-line {
  overflow: hidden;
  color: var(--terminal-green);
  white-space: nowrap;
  animation: line-appear 160ms ease both;
}

.terminal-prompt {
  color: #c18c56;
}

.terminal-cursor {
  display: inline-block;
  width: 6px;
  height: 11px;
  margin-left: 3px;
  background: #b6cbb4;
  vertical-align: -2px;
  animation: cursor-blink 700ms steps(2, start) infinite;
}

@keyframes line-appear {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.loading-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 13px;
  color: #778695;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
}

#loading-percent {
  color: #c79b6b;
  font-variant-numeric: tabular-nums;
}

.next-screen {
  min-height: 100vh;
  background: var(--paper);
}

@media (max-width: 420px) {
  :root {
    --ring-size: 160px;
  }

  .loading-screen {
    padding: 18px;
  }

  .terminal-output {
    font-size: 10px;
  }

  .terminal-title {
    font-size: 8px;
  }
}

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