:root {
  color-scheme: dark;
  --ink: #69f7ff;
  --violet: #f16bff;
  --shell: #171821;
  --shell-edge: #2d3040;
  --screen: #02090b;
  --app-height: 100dvh;
}

* {
  box-sizing: border-box;
}

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

body {
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 20px;
  color: #d8faff;
  background:
    radial-gradient(circle at 50% 0%, #25283a 0, transparent 45%),
    #08090d;
  font-family: "Courier New", "Liberation Mono", monospace;
}

button {
  font: inherit;
}

.machine {
  width: min(1100px, 100%);
  height: min(760px, calc(100vh - 40px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 18px;
  border: 1px solid #393c4b;
  border-radius: 20px;
  background: linear-gradient(145deg, #20222c, #111219);
  box-shadow:
    0 30px 80px #000a,
    inset 0 1px #ffffff18,
    inset 0 -2px #000;
}

.machine__header,
.machine__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 42px;
  padding: 0 8px;
  color: #9297a8;
  font-size: 12px;
  letter-spacing: 0.12em;
}

.machine__footer {
  justify-content: flex-start;
}

.machine__footer span + span::before {
  content: "·";
  margin-right: 20px;
  color: #4c5060;
}

.machine__footer button {
  margin-left: auto;
  border: 0;
  color: #9297a8;
  background: none;
  cursor: pointer;
}

.led {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: #58262a;
  box-shadow: 0 0 0 transparent;
}

.led.is-online {
  background: #47f38d;
  box-shadow: 0 0 12px #47f38d;
}

.screen {
  min-height: 0;
  padding: 12px;
  border: 2px solid #08090d;
  border-radius: 18px;
  background: #090a0f;
  box-shadow:
    inset 0 0 0 2px #353844,
    0 1px #ffffff12;
}

.screen__glass {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 9px;
  background:
    radial-gradient(ellipse at center, #082027 0, var(--screen) 75%);
  box-shadow:
    inset 0 0 80px #000,
    0 0 20px #45eaff16;
}

.terminal-frame {
  width: 100%;
  height: 100%;
  padding: 20px 20px 30px;
}

#terminal {
  width: 100%;
  height: 100%;
}

.xterm {
  height: 100%;
}

.xterm .xterm-viewport {
  scrollbar-color: #27616a #02090b;
  scrollbar-width: thin;
}

.scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.25;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    #000 3px,
    #000 4px
  );
  mix-blend-mode: multiply;
}

.dialer {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #050609e8;
  backdrop-filter: blur(14px);
  transition: opacity 350ms ease, visibility 350ms;
}

.dialer.is-hidden {
  visibility: hidden;
  opacity: 0;
}

.dialer__panel {
  width: min(540px, 100%);
  padding: 48px;
  border: 1px solid #47e7f04d;
  text-align: center;
  background: #080d12;
  box-shadow:
    0 0 80px #26e3ff12,
    inset 0 0 60px #000;
}

.dialer__eyebrow {
  color: #6b8790;
  font-size: 11px;
  letter-spacing: 0.24em;
}

.dialer h1 {
  margin: 20px 0 8px;
  color: var(--ink);
  font-size: clamp(40px, 10vw, 72px);
  line-height: 1;
  letter-spacing: -0.07em;
  text-shadow: 0 0 22px #69f7ff66;
}

.dialer p {
  margin: 18px auto 32px;
  color: #9bb0b5;
  line-height: 1.6;
}

.dialer button {
  width: 100%;
  padding: 18px;
  border: 1px solid var(--ink);
  color: #021013;
  background: var(--ink);
  cursor: pointer;
  box-shadow: 0 0 28px #69f7ff33;
}

.dialer button:hover {
  color: white;
  border-color: var(--violet);
  background: var(--violet);
}

.dialer button span,
.dialer button small {
  display: block;
}

.dialer button span {
  font-weight: bold;
  letter-spacing: 0.08em;
}

.dialer button small {
  margin-top: 5px;
  font-size: 10px;
  opacity: 0.7;
}

.dialer__options {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 20px;
}

.dialer label {
  display: inline-flex;
  gap: 8px;
  color: #75858b;
  font-size: 12px;
  cursor: pointer;
}

.dialer .dialer__language {
  width: auto;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: none;
  box-shadow: none;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dialer .dialer__language:hover {
  color: var(--violet);
  border: 0;
  background: none;
}

@media (max-width: 640px) {
  html,
  body {
    width: 100%;
    height: var(--app-height);
    min-height: 0;
  }

  body {
    padding: 0;
    place-items: stretch;
  }

  .machine {
    width: 100%;
    height: var(--app-height);
    min-height: 0;
    border: 0;
    border-radius: 0;
    padding:
      max(4px, env(safe-area-inset-top))
      max(4px, env(safe-area-inset-right))
      max(4px, env(safe-area-inset-bottom))
      max(4px, env(safe-area-inset-left));
  }

  .machine__header,
  .machine__footer {
    min-height: 32px;
    padding: 0 4px;
    gap: 10px;
    font-size: 10px;
    letter-spacing: 0.08em;
  }

  .machine__footer {
    min-height: 28px;
  }

  .screen {
    padding: 4px;
    border-width: 1px;
    border-radius: 11px;
  }

  .screen__glass {
    border-radius: 7px;
  }

  .address,
  .machine__footer span:nth-child(n + 3) {
    display: none;
  }

  .terminal-frame {
    padding: 7px 5px 10px;
  }

  .scanlines {
    opacity: 0.18;
  }

  body.is-keyboard-open .machine__footer {
    display: none;
  }

  body.is-keyboard-open .machine__header {
    min-height: 26px;
  }

  .dialer__panel {
    padding: 34px 22px;
  }
}

@media (max-width: 380px) {
  .machine__footer span:nth-child(n + 2) {
    display: none;
  }

  .terminal-frame {
    padding-inline: 3px;
  }
}
