:root {
  color-scheme: dark;
  font-family: "VT323", "Courier New", monospace;
  --c64-shell: #4f60d8;
  --c64-screen: #2f38b0;
  --c64-text: #d6dcff;
  --c64-text-muted: #9fb0ff;
  --c64-text-output: #c6d6ff;
  --c64-shadow: rgba(15, 23, 42, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: #5166d9;
  background-image: radial-gradient(
    circle at 50% 40%,
    rgba(255, 255, 255, 0.08),
    transparent 55%
  );
}

.shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  position: relative;
}

.badge {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 1;
  color: var(--c64-text);
  background: rgba(15, 23, 42, 0.8);
  padding: 6px 16px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.footer {
  position: absolute;
  right: 16px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--c64-text);
  letter-spacing: 0.04em;
  z-index: 1;
}

.footer-button {
  font: inherit;
  letter-spacing: 0.08em;
  padding: 4px 14px;
  border-radius: 999px;
  border: 2px solid rgba(214, 220, 255, 0.6);
  background: rgba(15, 23, 42, 0.3);
  color: var(--c64-text);
  cursor: pointer;
}

.footer-button:hover {
  background: rgba(15, 23, 42, 0.6);
}

.console {
  width: min(960px, 100%);
}

.frame {
  --frame-pad: 20px;
  --frame-footer: 36px;
  background-color: var(--c64-shell);
  min-height: 75vh;
  max-height: 85vh;
  width: 100%;
  padding: var(--frame-pad);
  padding-bottom: calc(var(--frame-pad) + var(--frame-footer));
  box-shadow: 0 24px 60px var(--c64-shadow);
  position: relative;
}

.viewport {
  background-color: var(--c64-screen);
  min-height: calc(75vh - (var(--frame-pad) * 2 + var(--frame-footer)));
  max-height: calc(85vh - (var(--frame-pad) * 2 + var(--frame-footer)));
  padding: 18px;
  overflow-y: auto;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.line {
  font-size: 1.35rem;
  letter-spacing: 0.05em;
  white-space: pre-wrap;
  color: var(--c64-text);
}

.line--system {
  color: var(--c64-text-muted);
}

.line--output {
  color: var(--c64-text-output);
}

.command-form {
  margin-top: 4px;
}

.input-row {
  display: flex;
  align-items: center;
  font-size: 1.35rem;
  letter-spacing: 0.05em;
  color: var(--c64-text);
}

.input-row::before {
  content: "\00a0";
}

#command-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font: inherit;
  color: inherit;
  padding: 0;
  caret-color: var(--c64-text);
}

/* ── MORSE+ inline mode ───────────────────────────────────────────────────── */

.morse-key-wrap {
  display: flex;
  justify-content: center;
  padding: 20px 0 10px;
}

.morse-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 260px;
  height: 66px;
  font: inherit;
  font-size: 1.25rem;
  letter-spacing: 0.12em;
  color: #10186a;
  cursor: default;
  border: none;
  border-radius: 4px;
  background: linear-gradient(155deg,
    #c8d0ff 0%,
    #dce4ff 28%,
    #9098d8 62%,
    #6878c0 100%);
  box-shadow:
    inset 1px  1px 3px rgba(255,255,255,0.65),
    inset -1px -1px 2px rgba(0,0,0,0.18),
    5px 5px 0 #0d1440,
    7px 7px 0 #070b28,
    8px 8px 12px rgba(0,0,0,0.5);
  transform: translate(0, 0);
  transition: box-shadow 55ms ease, transform 55ms ease, background 55ms ease;
  user-select: none;
}

.morse-key.pressed {
  background: linear-gradient(155deg,
    #6878c0 0%,
    #8090d0 28%,
    #a0a8e0 62%,
    #c8d0ff 100%);
  box-shadow:
    inset 2px  2px 5px rgba(0,0,0,0.32),
    inset -1px -1px 2px rgba(255,255,255,0.1),
    2px 2px 0 #0d1440,
    3px 3px 0 #070b28,
    4px 4px 6px rgba(0,0,0,0.3);
  transform: translate(4px, 4px);
}

.morse-bar-wrap {
  width: 260px;
  height: 4px;
  background: rgba(0,0,0,0.35);
  margin: 8px auto 20px;
  border-radius: 2px;
  overflow: hidden;
}

.morse-bar {
  height: 100%;
  width: 0%;
  background: var(--c64-text);
  border-radius: 2px;
  transition: none;
}

.morse-bar.dash-zone {
  background: #ffaa44;
}

.morse-label {
  color: var(--c64-text-muted);
}

.morse-decoded {
  color: #88ffaa;
  text-shadow: 0 0 6px rgba(136,255,170,0.5);
}

.morse-hints {
  margin-top: 12px;
  letter-spacing: 0.08em;
}

/* ── end MORSE+ ───────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .frame {
    --frame-pad: 16px;
    --frame-footer: 32px;
    padding: var(--frame-pad);
    padding-bottom: calc(var(--frame-pad) + var(--frame-footer));
  }

  .viewport {
    padding: 12px;
  }

  .line,
  .input-row {
    font-size: 1.1rem;
  }
}
