*, *::before, *::after {
  box-sizing: border-box;
}

body {
  background: #1f1f1f;
  font-family: 'DM Mono', monospace;
  margin: 0;
  padding: 0 16px 40px;
  overflow-x: hidden;
}

h1 {
  align-items: center;
  text-align: center;
  color: #ccc;
  margin: 8px 0;
  font-weight: bold;
}

/* --- Text and Button Field --- */
.puzzle-submit-btn {
  background: #1a1a1a;
  color: #ccc;
  border: 1px solid #444;
  width: 120px;
  height: 40px;
  font-size: large;
  padding: 4px 14px;
  cursor: pointer;
  font-family: 'DM Mono', monospace;
}

.puzzle-submit-btn:hover {
  background: #2a2a2a;
  color: #fff;
}

.puzzle-submit-btn--ready {
  border-color: #29d316;
  color: #29d316;
}

.puzzle-submit-btn--ready:hover {
  color: #87ff41;
  border-color: #87ff41;
}

.puzzle-submit-btn--waiting {
  border-color: #888;
  color: #888;
  cursor: not-allowed;
}

.puzzle-submit-btn--waiting:hover {
  background: #1a1a1a;
  color: #888;
}

input[type="text"] {
  background: #111;
  color: #ccc;
  border: 1px solid #444;
  padding: 4px 8px;
  font-family: 'DM Mono', monospace;
  max-width: calc(100vw - 160px);
  display: block;
  margin: 0 auto;
  text-align: center;
}

/* --- Terminal Style --- */
.terminal {
  margin: 20px auto 0;
  padding: 16px;
  border: 5px solid #46ee13;
  font-size: 16px;
  background: #000000;
  width: min(500px, calc(100vw - 32px));
  min-height: 250px;
  color: #888;
}

.terminal-user {
  color: #cf550a;
  font-weight: bold;
  margin-bottom: 8px;
}

.terminal-blinking-cursor {
  display: inline-block;
  width: 10px;
  height: 20px;
  background: #5bff55;
  animation: blink 1s step-start infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* --- Puzzle Input Style --- */
.row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.column-locks {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.messageStyle {
  font-size: 18px;
  font-style: italic;
  font-weight: bold;
  color: #29d316;
  margin-bottom: 4px;
  text-align: center;
}

#puzzle-result {
  margin: 4px 0 12px;
  padding: 0 16px;
}

/* --- Up-Down separation nodes --- */
.input-display {
  width: 84px;
  height: 160px;
  background: #111;
  border: 1px solid #3a3a3a;
  display: flex;
  flex-direction: column;
  position: relative;
  user-select: none;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.8);
}

.input-zone-up,
.input-zone-down {
  flex: 1;
  display: flex;
  justify-content: center;
  cursor: pointer;
  color: #ccc;
  font-size: 16px;
}

.input-zone-up {
  align-items: flex-start;
  padding-top: 4px;
}
.input-zone-up:hover {
  background: rgba(255,255,255,0.06);
  color: #87ff41;
}

.input-zone-down {
  align-items: flex-end;
  padding-bottom: 4px;
}
.input-zone-down:hover {
  background: rgba(255,255,255,0.06);
  color: #87ff41;
}

.input-letter {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 62px;
  font-weight: bold;
  color: #fff;
  pointer-events: none;
  z-index: 1;
  letter-spacing: -2px;
}

/* --- Responsive for the size of the screen device --- */
@media (max-width: 520px) {
  .input-display {
    width: 60px;
    height: 120px;
  }
  .input-letter {
    font-size: 52px;
  }
  .input-zone-up,
  .input-zone-down {
    font-size: 11px;
  }
  .row {
    gap: 4px;
  }
  h1 {
    font-size: 20px;
  }
  .terminal {
    font-size: 16px;
  }
}